versioning and wp plugin updates

This commit is contained in:
IGNY8 VPS (Salman)
2026-01-10 00:26:00 +00:00
parent 0ea3a30909
commit a86524a6b1
24 changed files with 2011 additions and 101 deletions

View File

@@ -0,0 +1,227 @@
<?php
/**
* Connection Page
*
* @package Igny8Bridge
*/
// Prevent direct access
if (!defined('ABSPATH')) {
exit;
}
// Include layout header
include IGNY8_BRIDGE_PLUGIN_DIR . 'admin/layout-header.php';
// Get connection settings
$api_key = function_exists('igny8_get_secure_option') ? igny8_get_secure_option('igny8_api_key') : get_option('igny8_api_key');
$site_id = get_option('igny8_site_id', '');
$integration_id = get_option('igny8_integration_id', '');
$access_token = function_exists('igny8_get_secure_option') ? igny8_get_secure_option('igny8_access_token') : get_option('igny8_access_token');
$last_structure_sync = get_option('igny8_last_structure_sync', 0);
$is_connected = !empty($access_token) && !empty($integration_id) && !empty($last_structure_sync);
$date_format = get_option('date_format');
$time_format = get_option('time_format');
$now = current_time('timestamp');
$token_issued = intval(get_option('igny8_access_token_issued', 0));
$token_age_text = $token_issued ? sprintf(__('%s ago', 'igny8-bridge'), human_time_diff($token_issued, $now)) : __('Not generated yet', 'igny8-bridge');
$token_issued_formatted = $token_issued ? date_i18n($date_format . ' ' . $time_format, $token_issued) : __('—', 'igny8-bridge');
$last_health_check = intval(get_option('igny8_last_api_health_check', 0));
$last_health_check_formatted = $last_health_check ? date_i18n($date_format . ' ' . $time_format, $last_health_check) : __('Never', 'igny8-bridge');
?>
<div class="igny8-page-header">
<h1><?php _e('Connection', 'igny8-bridge'); ?></h1>
<p><?php _e('Manage your IGNY8 API connection and authentication', 'igny8-bridge'); ?></p>
</div>
<?php if (!$is_connected): ?>
<!-- Not Connected - Show Connection Form -->
<div class="igny8-card">
<div class="igny8-card-header">
<h2>
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"/>
</svg>
<?php _e('Connect to IGNY8', 'igny8-bridge'); ?>
</h2>
</div>
<div class="igny8-status igny8-status-disconnected" style="margin-bottom: 24px;">
<span class="igny8-status-indicator"></span>
<?php _e('Not Connected', 'igny8-bridge'); ?>
</div>
<form method="post" action="">
<?php wp_nonce_field('igny8_settings_nonce'); ?>
<div class="igny8-form-group">
<label for="igny8_api_key">
<?php _e('API Key', 'igny8-bridge'); ?>
<span style="color: var(--igny8-danger);">*</span>
</label>
<input
type="text"
id="igny8_api_key"
name="igny8_api_key"
value=""
placeholder="<?php _e('igny8_site_5_1764575388582_u671q2e2mv', 'igny8-bridge'); ?>"
required
/>
<p class="igny8-form-help">
<?php printf(
__('Get your API key from the <a href="%s" target="_blank">IGNY8 app integrations page</a>. The API key format includes your site ID.', 'igny8-bridge'),
'https://app.igny8.com'
); ?>
</p>
</div>
<button type="submit" name="igny8_connect" class="igny8-btn igny8-btn-primary">
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"/>
</svg>
<?php _e('Connect to IGNY8', 'igny8-bridge'); ?>
</button>
</form>
</div>
<!-- Connection Instructions -->
<div class="igny8-card">
<div class="igny8-card-header">
<h2>
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
<?php _e('How to Connect', 'igny8-bridge'); ?>
</h2>
</div>
<ol style="padding-left: 20px; line-height: 1.8;">
<li><?php _e('Log in to your IGNY8 account', 'igny8-bridge'); ?></li>
<li><?php _e('Navigate to Settings → Integrations', 'igny8-bridge'); ?></li>
<li><?php _e('Find WordPress in the integrations list', 'igny8-bridge'); ?></li>
<li><?php _e('Click "Add Site" to generate a new API key', 'igny8-bridge'); ?></li>
<li><?php _e('Copy the API key and paste it in the field above', 'igny8-bridge'); ?></li>
<li><?php _e('Click "Connect to IGNY8" to establish the connection', 'igny8-bridge'); ?></li>
</ol>
</div>
<?php else: ?>
<!-- Connected - Show Connection Details -->
<div class="igny8-alert igny8-alert-success">
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
<div>
<strong><?php _e('Connected Successfully', 'igny8-bridge'); ?></strong>
<p><?php _e('Your WordPress site is connected to IGNY8 and ready to sync content.', 'igny8-bridge'); ?></p>
</div>
</div>
<div class="igny8-grid igny8-grid-2">
<!-- Connection Status -->
<div class="igny8-card">
<div class="igny8-card-header">
<h2>
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
<?php _e('Connection Status', 'igny8-bridge'); ?>
</h2>
</div>
<div class="igny8-status igny8-status-connected" style="margin-bottom: 20px;">
<span class="igny8-status-indicator"></span>
<?php _e('Connected & Active', 'igny8-bridge'); ?>
</div>
<div class="igny8-form-group">
<label><?php _e('Site ID', 'igny8-bridge'); ?></label>
<code style="display: block; padding: 10px; background: var(--igny8-surface); border-radius: var(--igny8-radius-base);">
<?php echo esc_html($site_id ?: __('Not set', 'igny8-bridge')); ?>
</code>
</div>
<div class="igny8-form-group">
<label><?php _e('Integration ID', 'igny8-bridge'); ?></label>
<code style="display: block; padding: 10px; background: var(--igny8-surface); border-radius: var(--igny8-radius-base);">
<?php echo esc_html($integration_id ?: __('Not set', 'igny8-bridge')); ?>
</code>
</div>
</div>
<!-- API Key Details -->
<div class="igny8-card">
<div class="igny8-card-header">
<h2>
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"/>
</svg>
<?php _e('API Key', 'igny8-bridge'); ?>
</h2>
</div>
<div class="igny8-form-group">
<label><?php _e('Active API Key', 'igny8-bridge'); ?></label>
<div style="padding: 10px 12px; background: var(--igny8-surface); border: 1px solid var(--igny8-stroke); border-radius: var(--igny8-radius-base); font-family: monospace;">
<?php echo esc_html(substr($api_key, 0, 7) . '••••••••••••' . substr($api_key, -7)); ?>
<span style="color: var(--igny8-success); font-weight: 600; margin-left: 12px;">✓ Verified</span>
</div>
</div>
<?php if ($token_issued): ?>
<div class="igny8-form-group">
<label><?php _e('Token Issued', 'igny8-bridge'); ?></label>
<p style="margin: 0; font-size: 14px;">
<?php echo esc_html($token_age_text); ?>
<span style="color: var(--igny8-text-dim); display: block; font-size: 13px; margin-top: 4px;">
<?php echo esc_html($token_issued_formatted); ?>
</span>
</p>
</div>
<?php endif; ?>
<?php if ($last_health_check): ?>
<div class="igny8-form-group">
<label><?php _e('Last Health Check', 'igny8-bridge'); ?></label>
<p style="margin: 0; font-size: 14px;">
<?php echo esc_html($last_health_check_formatted); ?>
</p>
</div>
<?php endif; ?>
</div>
</div>
<!-- Disconnect Section -->
<div class="igny8-card">
<div class="igny8-card-header">
<h2>
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
</svg>
<?php _e('Danger Zone', 'igny8-bridge'); ?>
</h2>
</div>
<p style="margin-bottom: 16px; color: var(--igny8-text-dim);">
<?php _e('Disconnecting will stop all syncing with IGNY8. Your content in WordPress will remain unchanged, but no new updates will be received from IGNY8.', 'igny8-bridge'); ?>
</p>
<form method="post" action="">
<?php wp_nonce_field('igny8_revoke_api_key'); ?>
<button type="submit" name="igny8_revoke_api_key" class="igny8-btn igny8-btn-danger"
onclick="return confirm('<?php _e('Are you sure you want to disconnect? This will stop all syncing with IGNY8.', 'igny8-bridge'); ?>');">
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"/>
</svg>
<?php _e('Disconnect from IGNY8', 'igny8-bridge'); ?>
</button>
</form>
</div>
<?php endif; ?>
<?php
// Include layout footer
include IGNY8_BRIDGE_PLUGIN_DIR . 'admin/layout-footer.php';
?>

View File

@@ -0,0 +1,276 @@
<?php
/**
* Controls Page
*
* @package Igny8Bridge
*/
// Prevent direct access
if (!defined('ABSPATH')) {
exit;
}
// Include layout header
include IGNY8_BRIDGE_PLUGIN_DIR . 'admin/layout-header.php';
// Get settings
$available_post_types = igny8_get_supported_post_types();
$enabled_post_types = igny8_get_enabled_post_types();
$available_taxonomies = igny8_get_supported_taxonomies();
$enabled_taxonomies = igny8_get_enabled_taxonomies();
$control_mode = igny8_get_control_mode();
$woocommerce_enabled = (int) get_option('igny8_enable_woocommerce', class_exists('WooCommerce') ? 1 : 0);
$woocommerce_detected = class_exists('WooCommerce');
$available_modules = igny8_get_available_modules();
$enabled_modules = igny8_get_enabled_modules();
$default_post_status = get_option('igny8_default_post_status', 'draft');
?>
<div class="igny8-page-header">
<h1><?php _e('Controls', 'igny8-bridge'); ?></h1>
<p><?php _e('Configure which content types to sync and how IGNY8 manages your content', 'igny8-bridge'); ?></p>
</div>
<form method="post" action="options.php">
<?php settings_fields('igny8_bridge_controls'); ?>
<div class="igny8-grid igny8-grid-2">
<!-- Post Types -->
<div class="igny8-card">
<div class="igny8-card-header">
<h2>
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
</svg>
<?php _e('Post Types to Sync', 'igny8-bridge'); ?>
</h2>
</div>
<?php foreach ($available_post_types as $slug => $label) : ?>
<div class="igny8-form-group" style="margin-bottom: 12px;">
<label style="display: flex; align-items: center; cursor: pointer;">
<input
type="checkbox"
name="igny8_enabled_post_types[]"
value="<?php echo esc_attr($slug); ?>"
<?php checked(in_array($slug, $enabled_post_types, true)); ?>
style="margin-right: 8px;"
/>
<?php echo esc_html($label); ?>
</label>
</div>
<?php endforeach; ?>
<p class="igny8-form-help">
<?php _e('Select the content types IGNY8 should manage automatically.', 'igny8-bridge'); ?>
</p>
</div>
<!-- Taxonomies -->
<div class="igny8-card">
<div class="igny8-card-header">
<h2>
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z"/>
</svg>
<?php _e('Taxonomies to Sync', 'igny8-bridge'); ?>
</h2>
</div>
<?php foreach ($available_taxonomies as $slug => $label) : ?>
<div class="igny8-form-group" style="margin-bottom: 12px;">
<label style="display: flex; align-items: center; cursor: pointer;">
<input
type="checkbox"
name="igny8_enabled_taxonomies[]"
value="<?php echo esc_attr($slug); ?>"
<?php checked(in_array($slug, $enabled_taxonomies, true)); ?>
style="margin-right: 8px;"
/>
<?php echo esc_html($label); ?>
</label>
</div>
<?php endforeach; ?>
<p class="igny8-form-help">
<?php _e('Select which taxonomies to sync with IGNY8.', 'igny8-bridge'); ?>
</p>
</div>
</div>
<!-- Control Mode -->
<div class="igny8-card">
<div class="igny8-card-header">
<h2>
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4"/>
</svg>
<?php _e('Control Mode', 'igny8-bridge'); ?>
</h2>
</div>
<div style="display: grid; gap: 16px;">
<label style="display: flex; align-items: flex-start; cursor: pointer; padding: 16px; border: 2px solid var(--igny8-stroke); border-radius: var(--igny8-radius-base); transition: all 0.2s;"
class="<?php echo $control_mode === 'mirror' ? 'igny8-control-mode-selected' : ''; ?>">
<input
type="radio"
name="igny8_control_mode"
value="mirror"
<?php checked($control_mode, 'mirror'); ?>
style="margin-right: 12px; margin-top: 4px;"
/>
<div>
<strong style="font-size: 16px; display: block; margin-bottom: 4px;">
<?php _e('Mirror Mode', 'igny8-bridge'); ?>
</strong>
<span style="color: var(--igny8-text-dim); font-size: 14px;">
<?php _e('IGNY8 is the source of truth; WordPress reflects changes only. Content is read-only in WordPress.', 'igny8-bridge'); ?>
</span>
</div>
</label>
<label style="display: flex; align-items: flex-start; cursor: pointer; padding: 16px; border: 2px solid var(--igny8-stroke); border-radius: var(--igny8-radius-base); transition: all 0.2s;"
class="<?php echo $control_mode === 'hybrid' ? 'igny8-control-mode-selected' : ''; ?>">
<input
type="radio"
name="igny8_control_mode"
value="hybrid"
<?php checked($control_mode, 'hybrid'); ?>
style="margin-right: 12px; margin-top: 4px;"
/>
<div>
<strong style="font-size: 16px; display: block; margin-bottom: 4px;">
<?php _e('Hybrid Mode', 'igny8-bridge'); ?>
</strong>
<span style="color: var(--igny8-text-dim); font-size: 14px;">
<?php _e('Allow editors to update content in WordPress and sync changes back to IGNY8. Two-way synchronization.', 'igny8-bridge'); ?>
</span>
</div>
</label>
</div>
</div>
<div class="igny8-grid igny8-grid-2">
<!-- Modules -->
<div class="igny8-card">
<div class="igny8-card-header">
<h2>
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"/>
</svg>
<?php _e('IGNY8 Modules', 'igny8-bridge'); ?>
</h2>
</div>
<?php foreach ($available_modules as $module_key => $module_label) : ?>
<div class="igny8-form-group" style="margin-bottom: 12px;">
<label style="display: flex; align-items: center; cursor: pointer;">
<input
type="checkbox"
name="igny8_enabled_modules[]"
value="<?php echo esc_attr($module_key); ?>"
<?php checked(in_array($module_key, $enabled_modules, true)); ?>
style="margin-right: 8px;"
/>
<?php echo esc_html($module_label); ?>
</label>
</div>
<?php endforeach; ?>
<p class="igny8-form-help">
<?php _e('Disable modules temporarily if a feature is not ready in the SaaS app.', 'igny8-bridge'); ?>
</p>
</div>
<!-- Default Post Status -->
<div class="igny8-card">
<div class="igny8-card-header">
<h2>
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
<?php _e('Default Post Status', 'igny8-bridge'); ?>
</h2>
</div>
<div style="display: grid; gap: 12px; margin-bottom: 16px;">
<label style="display: flex; align-items: flex-start; cursor: pointer;">
<input
type="radio"
name="igny8_default_post_status"
value="draft"
<?php checked($default_post_status, 'draft'); ?>
style="margin-right: 8px; margin-top: 4px;"
/>
<div>
<strong><?php _e('Draft', 'igny8-bridge'); ?></strong>
<span style="display: block; color: var(--igny8-text-dim); font-size: 13px;">
<?php _e('Save content as draft for review before publishing.', 'igny8-bridge'); ?>
</span>
</div>
</label>
<label style="display: flex; align-items: flex-start; cursor: pointer;">
<input
type="radio"
name="igny8_default_post_status"
value="publish"
<?php checked($default_post_status, 'publish'); ?>
style="margin-right: 8px; margin-top: 4px;"
/>
<div>
<strong><?php _e('Publish', 'igny8-bridge'); ?></strong>
<span style="display: block; color: var(--igny8-text-dim); font-size: 13px;">
<?php _e('Publish content immediately when received from IGNY8.', 'igny8-bridge'); ?>
</span>
</div>
</label>
</div>
<p class="igny8-form-help">
<?php _e('Choose whether content published from IGNY8 should be saved as draft or published immediately in WordPress.', 'igny8-bridge'); ?>
</p>
<?php if ($woocommerce_detected): ?>
<div style="margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--igny8-stroke);">
<label style="display: flex; align-items: center; cursor: pointer;">
<input
type="checkbox"
name="igny8_enable_woocommerce"
value="1"
<?php checked($woocommerce_enabled, 1); ?>
style="margin-right: 8px;"
/>
<strong><?php _e('Sync WooCommerce products and categories', 'igny8-bridge'); ?></strong>
</label>
</div>
<?php else: ?>
<div class="igny8-alert igny8-alert-warning" style="margin-top: 20px;">
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
<span><?php _e('WooCommerce is not installed. Install WooCommerce to sync products.', 'igny8-bridge'); ?></span>
</div>
<?php endif; ?>
</div>
</div>
<button type="submit" class="igny8-btn igny8-btn-primary">
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
</svg>
<?php _e('Save Controls', 'igny8-bridge'); ?>
</button>
</form>
<style>
.igny8-control-mode-selected {
border-color: var(--igny8-primary) !important;
background: var(--igny8-primary-subtle) !important;
}
</style>
<?php
// Include layout footer
include IGNY8_BRIDGE_PLUGIN_DIR . 'admin/layout-footer.php';
?>

View File

@@ -0,0 +1,182 @@
<?php
/**
* Dashboard Page
*
* @package Igny8Bridge
*/
// Prevent direct access
if (!defined('ABSPATH')) {
exit;
}
// Include layout header
include IGNY8_BRIDGE_PLUGIN_DIR . 'admin/layout-header.php';
// Get connection status
$api_key = get_option('igny8_api_key');
$is_connected = !empty($api_key);
$site_id = get_option('igny8_site_id');
$last_sync = get_option('igny8_last_sync_time');
?>
<div class="igny8-page-header">
<h1><?php _e('Dashboard', 'igny8-bridge'); ?></h1>
<p><?php _e('Overview of your IGNY8 integration', 'igny8-bridge'); ?></p>
</div>
<?php if (!$is_connected): ?>
<div class="igny8-alert igny8-alert-warning">
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
</svg>
<div>
<strong><?php _e('Not Connected', 'igny8-bridge'); ?></strong>
<p><?php _e('You need to connect to IGNY8 to start syncing content.', 'igny8-bridge'); ?>
<a href="<?php echo esc_url(admin_url('admin.php?page=igny8-connection')); ?>"><?php _e('Connect now', 'igny8-bridge'); ?></a>
</p>
</div>
</div>
<?php endif; ?>
<div class="igny8-grid igny8-grid-3">
<!-- Connection Status Card -->
<div class="igny8-card">
<div class="igny8-card-header">
<h2>
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"/>
</svg>
<?php _e('Connection', 'igny8-bridge'); ?>
</h2>
</div>
<div style="padding: 16px 0;">
<?php if ($is_connected): ?>
<div class="igny8-status igny8-status-connected" style="font-size: 16px; padding: 8px 16px;">
<span class="igny8-status-indicator"></span>
<?php _e('Connected', 'igny8-bridge'); ?>
</div>
<?php if ($site_id): ?>
<p style="margin-top: 12px; font-size: 13px; color: var(--igny8-text-dim);">
<?php _e('Site ID:', 'igny8-bridge'); ?> <code><?php echo esc_html($site_id); ?></code>
</p>
<?php endif; ?>
<?php else: ?>
<div class="igny8-status igny8-status-disconnected" style="font-size: 16px; padding: 8px 16px;">
<span class="igny8-status-indicator"></span>
<?php _e('Not Connected', 'igny8-bridge'); ?>
</div>
<p style="margin-top: 12px;">
<a href="<?php echo esc_url(admin_url('admin.php?page=igny8-connection')); ?>" class="igny8-btn igny8-btn-primary">
<?php _e('Connect Now', 'igny8-bridge'); ?>
</a>
</p>
<?php endif; ?>
</div>
</div>
<!-- Sync Status Card -->
<div class="igny8-card">
<div class="igny8-card-header">
<h2>
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/>
</svg>
<?php _e('Last Sync', 'igny8-bridge'); ?>
</h2>
</div>
<div style="padding: 16px 0;">
<?php if ($last_sync): ?>
<p style="font-size: 14px; margin: 0;">
<?php echo esc_html(human_time_diff($last_sync, current_time('timestamp'))) . ' ' . __('ago', 'igny8-bridge'); ?>
</p>
<p style="font-size: 13px; color: var(--igny8-text-dim); margin: 8px 0 0 0;">
<?php echo esc_html(date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $last_sync)); ?>
</p>
<?php else: ?>
<p style="font-size: 14px; color: var(--igny8-text-dim); margin: 0;">
<?php _e('No sync performed yet', 'igny8-bridge'); ?>
</p>
<?php endif; ?>
</div>
</div>
<!-- Plugin Info Card -->
<div class="igny8-card">
<div class="igny8-card-header">
<h2>
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
<?php _e('Plugin Info', 'igny8-bridge'); ?>
</h2>
</div>
<div style="padding: 16px 0;">
<p style="font-size: 14px; margin: 0 0 8px 0;">
<strong><?php _e('Version:', 'igny8-bridge'); ?></strong> <?php echo esc_html(IGNY8_BRIDGE_VERSION); ?>
</p>
<p style="font-size: 14px; margin: 0;">
<strong><?php _e('PHP:', 'igny8-bridge'); ?></strong> <?php echo esc_html(PHP_VERSION); ?>
</p>
</div>
</div>
</div>
<!-- Quick Actions -->
<div class="igny8-card">
<div class="igny8-card-header">
<h2>
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"/>
</svg>
<?php _e('Quick Actions', 'igny8-bridge'); ?>
</h2>
</div>
<div class="igny8-grid igny8-grid-2" style="padding: 16px 0;">
<div>
<h3 style="font-size: 16px; margin: 0 0 12px 0;"><?php _e('Connection', 'igny8-bridge'); ?></h3>
<p style="font-size: 14px; color: var(--igny8-text-dim); margin-bottom: 16px;">
<?php _e('Manage your API connection and authentication', 'igny8-bridge'); ?>
</p>
<a href="<?php echo esc_url(admin_url('admin.php?page=igny8-connection')); ?>" class="igny8-btn igny8-btn-secondary">
<?php _e('Manage Connection', 'igny8-bridge'); ?>
</a>
</div>
<div>
<h3 style="font-size: 16px; margin: 0 0 12px 0;"><?php _e('Controls', 'igny8-bridge'); ?></h3>
<p style="font-size: 14px; color: var(--igny8-text-dim); margin-bottom: 16px;">
<?php _e('Configure which content types to sync', 'igny8-bridge'); ?>
</p>
<a href="<?php echo esc_url(admin_url('admin.php?page=igny8-controls')); ?>" class="igny8-btn igny8-btn-secondary">
<?php _e('Configure Controls', 'igny8-bridge'); ?>
</a>
</div>
<div>
<h3 style="font-size: 16px; margin: 0 0 12px 0;"><?php _e('Sync Settings', 'igny8-bridge'); ?></h3>
<p style="font-size: 14px; color: var(--igny8-text-dim); margin-bottom: 16px;">
<?php _e('Configure automatic sync and content updates', 'igny8-bridge'); ?>
</p>
<a href="<?php echo esc_url(admin_url('admin.php?page=igny8-sync')); ?>" class="igny8-btn igny8-btn-secondary">
<?php _e('Sync Settings', 'igny8-bridge'); ?>
</a>
</div>
<div>
<h3 style="font-size: 16px; margin: 0 0 12px 0;"><?php _e('View Logs', 'igny8-bridge'); ?></h3>
<p style="font-size: 14px; color: var(--igny8-text-dim); margin-bottom: 16px;">
<?php _e('Review sync history and troubleshoot issues', 'igny8-bridge'); ?>
</p>
<a href="<?php echo esc_url(admin_url('admin.php?page=igny8-logs')); ?>" class="igny8-btn igny8-btn-secondary">
<?php _e('View Logs', 'igny8-bridge'); ?>
</a>
</div>
</div>
</div>
<?php
// Include layout footer
include IGNY8_BRIDGE_PLUGIN_DIR . 'admin/layout-footer.php';
?>

View File

@@ -0,0 +1,148 @@
<?php
/**
* Data Page
*
* @package Igny8Bridge
*/
// Prevent direct access
if (!defined('ABSPATH')) {
exit;
}
// Include layout header
include IGNY8_BRIDGE_PLUGIN_DIR . 'admin/layout-header.php';
// Get data statistics
$link_queue = get_option('igny8_link_queue', array());
$pending_links = array_filter($link_queue, function($item) {
return isset($item['status']) && $item['status'] === 'pending';
});
$total_links = count($link_queue);
$pending_count = count($pending_links);
$processed_count = $total_links - $pending_count;
?>
<div class="igny8-page-header">
<h1><?php _e('Data', 'igny8-bridge'); ?></h1>
<p><?php _e('View synced data, queues, and content status', 'igny8-bridge'); ?></p>
</div>
<!-- Statistics -->
<div class="igny8-grid igny8-grid-3">
<div class="igny8-card">
<div class="igny8-card-header">
<h2>
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"/>
</svg>
<?php _e('Total Links', 'igny8-bridge'); ?>
</h2>
</div>
<div style="padding: 16px 0;">
<p style="font-size: 32px; font-weight: 700; margin: 0; color: var(--igny8-primary);">
<?php echo esc_html($total_links); ?>
</p>
</div>
</div>
<div class="igny8-card">
<div class="igny8-card-header">
<h2>
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
<?php _e('Pending', 'igny8-bridge'); ?>
</h2>
</div>
<div style="padding: 16px 0;">
<p style="font-size: 32px; font-weight: 700; margin: 0; color: var(--igny8-warning);">
<?php echo esc_html($pending_count); ?>
</p>
</div>
</div>
<div class="igny8-card">
<div class="igny8-card-header">
<h2>
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
<?php _e('Processed', 'igny8-bridge'); ?>
</h2>
</div>
<div style="padding: 16px 0;">
<p style="font-size: 32px; font-weight: 700; margin: 0; color: var(--igny8-success);">
<?php echo esc_html($processed_count); ?>
</p>
</div>
</div>
</div>
<!-- Link Queue -->
<?php if (!empty($link_queue)): ?>
<div class="igny8-card">
<div class="igny8-card-header">
<h2>
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 10h16M4 14h16M4 18h16"/>
</svg>
<?php _e('Link Queue', 'igny8-bridge'); ?>
</h2>
</div>
<table class="igny8-table">
<thead>
<tr>
<th><?php _e('Post Title', 'igny8-bridge'); ?></th>
<th><?php _e('Target URL', 'igny8-bridge'); ?></th>
<th><?php _e('Anchor', 'igny8-bridge'); ?></th>
<th><?php _e('Status', 'igny8-bridge'); ?></th>
</tr>
</thead>
<tbody>
<?php foreach (array_slice($link_queue, 0, 10) as $item): ?>
<tr>
<td>
<?php
$post = get_post($item['post_id'] ?? 0);
echo $post ? esc_html($post->post_title) : __('Unknown Post', 'igny8-bridge');
?>
</td>
<td>
<a href="<?php echo esc_url($item['target_url'] ?? '#'); ?>" target="_blank" style="color: var(--igny8-primary);">
<?php echo esc_html(isset($item['target_url']) ? parse_url($item['target_url'], PHP_URL_HOST) : '—'); ?>
</a>
</td>
<td><?php echo esc_html($item['anchor'] ?? '—'); ?></td>
<td>
<?php if (($item['status'] ?? '') === 'pending'): ?>
<span class="igny8-status igny8-status-disconnected"><?php _e('Pending', 'igny8-bridge'); ?></span>
<?php else: ?>
<span class="igny8-status igny8-status-connected"><?php _e('Processed', 'igny8-bridge'); ?></span>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php if (count($link_queue) > 10): ?>
<p style="margin-top: 16px; color: var(--igny8-text-dim); font-size: 14px;">
<?php printf(__('Showing 10 of %d total items', 'igny8-bridge'), count($link_queue)); ?>
</p>
<?php endif; ?>
</div>
<?php else: ?>
<div class="igny8-alert igny8-alert-success">
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
<span><?php _e('No items in link queue. All links have been processed.', 'igny8-bridge'); ?></span>
</div>
<?php endif; ?>
<?php
// Include layout footer
include IGNY8_BRIDGE_PLUGIN_DIR . 'admin/layout-footer.php';
?>

View File

@@ -0,0 +1,100 @@
<?php
/**
* Logs Page
*
* @package Igny8Bridge
*/
// Prevent direct access
if (!defined('ABSPATH')) {
exit;
}
// Include layout header
include IGNY8_BRIDGE_PLUGIN_DIR . 'admin/layout-header.php';
// Get logs
$webhook_logs = igny8_get_webhook_logs(array('limit' => 20));
?>
<div class="igny8-page-header">
<h1><?php _e('Logs', 'igny8-bridge'); ?></h1>
<p><?php _e('Review webhook activity and troubleshoot sync issues', 'igny8-bridge'); ?></p>
</div>
<?php if (!empty($webhook_logs)): ?>
<div class="igny8-card">
<div class="igny8-card-header">
<h2>
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
</svg>
<?php _e('Webhook Logs', 'igny8-bridge'); ?>
</h2>
</div>
<table class="igny8-table">
<thead>
<tr>
<th><?php _e('Timestamp', 'igny8-bridge'); ?></th>
<th><?php _e('Event', 'igny8-bridge'); ?></th>
<th><?php _e('Status', 'igny8-bridge'); ?></th>
<th><?php _e('Response Time', 'igny8-bridge'); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($webhook_logs as $log): ?>
<tr>
<td>
<?php
$timestamp = isset($log['timestamp']) ? $log['timestamp'] : 0;
echo esc_html(date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $timestamp));
?>
</td>
<td>
<strong><?php echo esc_html($log['event'] ?? __('Unknown', 'igny8-bridge')); ?></strong>
</td>
<td>
<?php if (($log['status'] ?? '') === 'success'): ?>
<span class="igny8-status igny8-status-connected">✓ <?php _e('Success', 'igny8-bridge'); ?></span>
<?php else: ?>
<span class="igny8-status igny8-status-disconnected">✗ <?php _e('Failed', 'igny8-bridge'); ?></span>
<?php endif; ?>
</td>
<td>
<?php
$response_time = isset($log['response_time']) ? $log['response_time'] : 0;
echo esc_html(number_format($response_time, 2)) . 'ms';
?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<div class="igny8-alert igny8-alert-success" style="margin-top: 24px;">
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
<span>
<?php _e('For detailed API request/response logs, check', 'igny8-bridge'); ?>
<code>wp-content/debug.log</code>
</span>
</div>
<?php else: ?>
<div class="igny8-alert igny8-alert-warning">
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
<div>
<strong><?php _e('No Logs Available', 'igny8-bridge'); ?></strong>
<p><?php _e('No webhook activity has been recorded yet. Logs will appear here once IGNY8 starts sending content to your site.', 'igny8-bridge'); ?></p>
</div>
</div>
<?php endif; ?>
<?php
// Include layout footer
include IGNY8_BRIDGE_PLUGIN_DIR . 'admin/layout-footer.php';
?>

View File

@@ -0,0 +1,169 @@
<?php
/**
* Sync Page
*
* @package Igny8Bridge
*/
// Prevent direct access
if (!defined('ABSPATH')) {
exit;
}
// Include layout header
include IGNY8_BRIDGE_PLUGIN_DIR . 'admin/layout-header.php';
// Get sync settings
$connection_enabled = igny8_is_connection_enabled();
$last_site_sync = intval(get_option('igny8_last_site_sync', 0));
$last_taxonomy_sync = intval(get_option('igny8_last_taxonomy_sync', 0));
$last_keyword_sync = intval(get_option('igny8_last_keyword_sync', 0));
$last_writer_sync = intval(get_option('igny8_last_writer_sync', 0));
$next_site_sync = wp_next_scheduled('igny8_sync_site_data');
$date_format = get_option('date_format');
$time_format = get_option('time_format');
$last_site_sync_formatted = $last_site_sync ? date_i18n($date_format . ' ' . $time_format, $last_site_sync) : __('Never', 'igny8-bridge');
$last_taxonomy_sync_formatted = $last_taxonomy_sync ? date_i18n($date_format . ' ' . $time_format, $last_taxonomy_sync) : __('Never', 'igny8-bridge');
$last_keyword_sync_formatted = $last_keyword_sync ? date_i18n($date_format . ' ' . $time_format, $last_keyword_sync) : __('Never', 'igny8-bridge');
$last_writer_sync_formatted = $last_writer_sync ? date_i18n($date_format . ' ' . $time_format, $last_writer_sync) : __('Never', 'igny8-bridge');
$next_site_sync_formatted = $next_site_sync ? date_i18n($date_format . ' ' . $time_format, $next_site_sync) : __('Not scheduled', 'igny8-bridge');
?>
<div class="igny8-page-header">
<h1><?php _e('Sync', 'igny8-bridge'); ?></h1>
<p><?php _e('Configure automatic sync and monitor synchronization status', 'igny8-bridge'); ?></p>
</div>
<form method="post" action="options.php">
<?php settings_fields('igny8_bridge_connection'); ?>
<!-- Connection Enable/Disable -->
<div class="igny8-card">
<div class="igny8-card-header">
<h2>
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"/>
</svg>
<?php _e('Sync Status', 'igny8-bridge'); ?>
</h2>
</div>
<label style="display: flex; align-items: center; cursor: pointer; padding: 16px; background: var(--igny8-surface); border-radius: var(--igny8-radius-base);">
<input
type="checkbox"
name="igny8_connection_enabled"
value="1"
<?php checked($connection_enabled, 1); ?>
style="margin-right: 12px;"
/>
<div>
<strong style="font-size: 16px; display: block; margin-bottom: 4px;">
<?php _e('Enable IGNY8 Sync', 'igny8-bridge'); ?>
</strong>
<span style="color: var(--igny8-text-dim); font-size: 14px;">
<?php _e('Allow IGNY8 to sync content to this WordPress site. Disable this to pause syncing temporarily.', 'igny8-bridge'); ?>
</span>
</div>
</label>
</div>
<button type="submit" class="igny8-btn igny8-btn-primary">
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
</svg>
<?php _e('Save Sync Settings', 'igny8-bridge'); ?>
</button>
</form>
<!-- Sync History -->
<div class="igny8-card">
<div class="igny8-card-header">
<h2>
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
<?php _e('Sync History', 'igny8-bridge'); ?>
</h2>
</div>
<table class="igny8-table">
<thead>
<tr>
<th><?php _e('Sync Type', 'igny8-bridge'); ?></th>
<th><?php _e('Last Sync', 'igny8-bridge'); ?></th>
<th><?php _e('Status', 'igny8-bridge'); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong><?php _e('Site Data', 'igny8-bridge'); ?></strong></td>
<td><?php echo esc_html($last_site_sync_formatted); ?></td>
<td>
<?php if ($last_site_sync): ?>
<span class="igny8-status igny8-status-connected">✓ <?php _e('Synced', 'igny8-bridge'); ?></span>
<?php else: ?>
<span class="igny8-status igny8-status-disconnected">— <?php _e('Never', 'igny8-bridge'); ?></span>
<?php endif; ?>
</td>
</tr>
<tr>
<td><strong><?php _e('Taxonomies', 'igny8-bridge'); ?></strong></td>
<td><?php echo esc_html($last_taxonomy_sync_formatted); ?></td>
<td>
<?php if ($last_taxonomy_sync): ?>
<span class="igny8-status igny8-status-connected">✓ <?php _e('Synced', 'igny8-bridge'); ?></span>
<?php else: ?>
<span class="igny8-status igny8-status-disconnected">— <?php _e('Never', 'igny8-bridge'); ?></span>
<?php endif; ?>
</td>
</tr>
<tr>
<td><strong><?php _e('Keywords', 'igny8-bridge'); ?></strong></td>
<td><?php echo esc_html($last_keyword_sync_formatted); ?></td>
<td>
<?php if ($last_keyword_sync): ?>
<span class="igny8-status igny8-status-connected">✓ <?php _e('Synced', 'igny8-bridge'); ?></span>
<?php else: ?>
<span class="igny8-status igny8-status-disconnected">— <?php _e('Never', 'igny8-bridge'); ?></span>
<?php endif; ?>
</td>
</tr>
<tr>
<td><strong><?php _e('Writers', 'igny8-bridge'); ?></strong></td>
<td><?php echo esc_html($last_writer_sync_formatted); ?></td>
<td>
<?php if ($last_writer_sync): ?>
<span class="igny8-status igny8-status-connected">✓ <?php _e('Synced', 'igny8-bridge'); ?></span>
<?php else: ?>
<span class="igny8-status igny8-status-disconnected">— <?php _e('Never', 'igny8-bridge'); ?></span>
<?php endif; ?>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Next Scheduled Sync -->
<div class="igny8-card">
<div class="igny8-card-header">
<h2>
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"/>
</svg>
<?php _e('Scheduled Syncs', 'igny8-bridge'); ?>
</h2>
</div>
<div class="igny8-form-group">
<label><?php _e('Next Site Data Sync', 'igny8-bridge'); ?></label>
<p style="margin: 0; font-size: 15px; font-weight: 600;">
<?php echo esc_html($next_site_sync_formatted); ?>
</p>
</div>
</div>
<?php
// Include layout footer
include IGNY8_BRIDGE_PLUGIN_DIR . 'admin/layout-footer.php';
?>