164 lines
8.2 KiB
PHP
164 lines
8.2 KiB
PHP
<?php
|
|
/**
|
|
* Sync Page (Simplified)
|
|
* Shows connection status and last sync info
|
|
*
|
|
* @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));
|
|
$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');
|
|
|
|
// Get published content stats
|
|
global $wpdb;
|
|
$igny8_content_count = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->postmeta} WHERE meta_key = '_igny8_content_id'");
|
|
$igny8_content_count = $igny8_content_count ?: 0;
|
|
|
|
// Get IGNY8 taxonomy term counts
|
|
$clusters_count = 0;
|
|
$sectors_count = 0;
|
|
if (taxonomy_exists('igny8_clusters')) {
|
|
$clusters_count = wp_count_terms(array('taxonomy' => 'igny8_clusters', 'hide_empty' => false));
|
|
if (is_wp_error($clusters_count)) $clusters_count = 0;
|
|
}
|
|
if (taxonomy_exists('igny8_sectors')) {
|
|
$sectors_count = wp_count_terms(array('taxonomy' => 'igny8_sectors', 'hide_empty' => false));
|
|
if (is_wp_error($sectors_count)) $sectors_count = 0;
|
|
}
|
|
?>
|
|
|
|
<div class="igny8-page-header">
|
|
<h1><?php _e('Sync Status', 'igny8-bridge'); ?></h1>
|
|
<p><?php _e('Monitor synchronization status between IGNY8 and WordPress', 'igny8-bridge'); ?></p>
|
|
</div>
|
|
|
|
<!-- Connection Status Card -->
|
|
<div class="igny8-card" style="margin-bottom: 24px;">
|
|
<div class="igny8-card-header">
|
|
<h2>
|
|
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24" style="width: 20px; height: 20px;">
|
|
<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('Connection Status', 'igny8-bridge'); ?>
|
|
</h2>
|
|
</div>
|
|
|
|
<div style="display: flex; align-items: center; gap: 16px; padding: 20px; background: var(--igny8-surface); border-radius: var(--igny8-radius-base);">
|
|
<?php if ($connection_enabled): ?>
|
|
<div style="width: 48px; height: 48px; background: var(--igny8-success-bg); border-radius: 50%; display: flex; align-items: center; justify-content: center;">
|
|
<svg fill="none" stroke="var(--igny8-success)" viewBox="0 0 24 24" style="width: 24px; height: 24px;">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
|
|
</svg>
|
|
</div>
|
|
<div>
|
|
<strong style="font-size: 18px; display: block; color: var(--igny8-success);">
|
|
<?php _e('Connected', 'igny8-bridge'); ?>
|
|
</strong>
|
|
<span style="color: var(--igny8-text-dim); font-size: 14px;">
|
|
<?php _e('IGNY8 sync is active and receiving content', 'igny8-bridge'); ?>
|
|
</span>
|
|
</div>
|
|
<?php else: ?>
|
|
<div style="width: 48px; height: 48px; background: var(--igny8-error-bg); border-radius: 50%; display: flex; align-items: center; justify-content: center;">
|
|
<svg fill="none" stroke="var(--igny8-error)" viewBox="0 0 24 24" style="width: 24px; height: 24px;">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
|
|
</svg>
|
|
</div>
|
|
<div>
|
|
<strong style="font-size: 18px; display: block; color: var(--igny8-error);">
|
|
<?php _e('Disconnected', 'igny8-bridge'); ?>
|
|
</strong>
|
|
<span style="color: var(--igny8-text-dim); font-size: 14px;">
|
|
<?php _e('IGNY8 sync is paused', 'igny8-bridge'); ?>
|
|
</span>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Content Stats -->
|
|
<div class="igny8-card" style="margin-bottom: 24px;">
|
|
<div class="igny8-card-header">
|
|
<h2>
|
|
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24" style="width: 20px; height: 20px;">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"/>
|
|
</svg>
|
|
<?php _e('IGNY8 Content Stats', 'igny8-bridge'); ?>
|
|
</h2>
|
|
</div>
|
|
|
|
<div class="igny8-grid igny8-grid-3" style="gap: 16px;">
|
|
<div style="padding: 20px; background: var(--igny8-surface); border-radius: var(--igny8-radius-base); text-align: center;">
|
|
<div style="font-size: 32px; font-weight: 700; color: var(--igny8-primary);"><?php echo esc_html($igny8_content_count); ?></div>
|
|
<div style="font-size: 14px; color: var(--igny8-text-dim);"><?php _e('Published Posts', 'igny8-bridge'); ?></div>
|
|
</div>
|
|
<div style="padding: 20px; background: var(--igny8-surface); border-radius: var(--igny8-radius-base); text-align: center;">
|
|
<div style="font-size: 32px; font-weight: 700; color: var(--igny8-primary);"><?php echo esc_html($clusters_count); ?></div>
|
|
<div style="font-size: 14px; color: var(--igny8-text-dim);"><?php _e('IGNY8 Clusters', 'igny8-bridge'); ?></div>
|
|
</div>
|
|
<div style="padding: 20px; background: var(--igny8-surface); border-radius: var(--igny8-radius-base); text-align: center;">
|
|
<div style="font-size: 32px; font-weight: 700; color: var(--igny8-primary);"><?php echo esc_html($sectors_count); ?></div>
|
|
<div style="font-size: 14px; color: var(--igny8-text-dim);"><?php _e('IGNY8 Sectors', 'igny8-bridge'); ?></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Last Sync Info -->
|
|
<div class="igny8-card">
|
|
<div class="igny8-card-header">
|
|
<h2>
|
|
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24" style="width: 20px; height: 20px;">
|
|
<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('Last Updated', 'igny8-bridge'); ?>
|
|
</h2>
|
|
</div>
|
|
|
|
<div class="igny8-grid igny8-grid-2" style="gap: 16px;">
|
|
<div style="padding: 16px; border: 1px solid var(--igny8-stroke); border-radius: var(--igny8-radius-base);">
|
|
<div style="font-weight: 600; margin-bottom: 4px;"><?php _e('Site Metadata', 'igny8-bridge'); ?></div>
|
|
<div style="font-size: 14px; color: var(--igny8-text-dim);">
|
|
<?php if ($last_site_sync): ?>
|
|
<span style="color: var(--igny8-success);">✓</span> <?php echo esc_html($last_site_sync_formatted); ?>
|
|
<?php else: ?>
|
|
<span style="color: var(--igny8-text-dim);">—</span> <?php _e('Never synced', 'igny8-bridge'); ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<div style="padding: 16px; border: 1px solid var(--igny8-stroke); border-radius: var(--igny8-radius-base);">
|
|
<div style="font-weight: 600; margin-bottom: 4px;"><?php _e('Taxonomies', 'igny8-bridge'); ?></div>
|
|
<div style="font-size: 14px; color: var(--igny8-text-dim);">
|
|
<?php if ($last_taxonomy_sync): ?>
|
|
<span style="color: var(--igny8-success);">✓</span> <?php echo esc_html($last_taxonomy_sync_formatted); ?>
|
|
<?php else: ?>
|
|
<span style="color: var(--igny8-text-dim);">—</span> <?php _e('Never synced', 'igny8-bridge'); ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<p style="margin-top: 16px; font-size: 13px; color: var(--igny8-text-dim);">
|
|
<?php _e('Sync happens automatically when content is published from IGNY8.', 'igny8-bridge'); ?>
|
|
</p>
|
|
</div>
|
|
|
|
<?php
|
|
// Include layout footer
|
|
include IGNY8_BRIDGE_PLUGIN_DIR . 'admin/layout-footer.php';
|
|
?>
|