wp plugin and app fixes adn automation page update
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Sync Page
|
||||
* Sync Page (Simplified)
|
||||
* Shows connection status and last sync info
|
||||
*
|
||||
* @package Igny8Bridge
|
||||
*/
|
||||
@@ -17,152 +18,145 @@ include IGNY8_BRIDGE_PLUGIN_DIR . 'admin/layout-header.php';
|
||||
$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');
|
||||
|
||||
// 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', 'igny8-bridge'); ?></h1>
|
||||
<p><?php _e('Configure automatic sync and monitor synchronization status', 'igny8-bridge'); ?></p>
|
||||
<h1><?php _e('Sync Status', 'igny8-bridge'); ?></h1>
|
||||
<p><?php _e('Monitor synchronization status between IGNY8 and WordPress', 'igny8-bridge'); ?></p>
|
||||
</div>
|
||||
|
||||
<form method="post" action="options.php">
|
||||
<?php settings_fields('igny8_bridge_connection'); ?>
|
||||
<!-- 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>
|
||||
|
||||
<!-- 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"/>
|
||||
<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>
|
||||
<?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>
|
||||
<div>
|
||||
<strong style="font-size: 16px; display: block; margin-bottom: 4px;">
|
||||
<?php _e('Enable IGNY8 Sync', 'igny8-bridge'); ?>
|
||||
<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('Allow IGNY8 to sync content to this WordPress site. Disable this to pause syncing temporarily.', 'igny8-bridge'); ?>
|
||||
<?php _e('IGNY8 sync is active and receiving content', 'igny8-bridge'); ?>
|
||||
</span>
|
||||
</div>
|
||||
</label>
|
||||
<?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>
|
||||
|
||||
<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">
|
||||
<!-- 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">
|
||||
<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 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('Scheduled Syncs', 'igny8-bridge'); ?>
|
||||
<?php _e('IGNY8 Content Stats', '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 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';
|
||||
|
||||
Reference in New Issue
Block a user