This commit is contained in:
alorig
2025-12-01 04:55:27 +05:00
parent 34d2b3abf9
commit 90b532d13b
8 changed files with 1637 additions and 226 deletions

View File

@@ -63,10 +63,14 @@ $webhook_logs = igny8_get_webhook_logs(array('limit' => 10));
<div class="wrap">
<h1><?php echo esc_html(get_admin_page_title()); ?></h1>
<?php settings_errors('igny8_settings'); ?>
<div class="igny8-settings-container">
<div class="igny8-module-title igny8-page-header">
<h2>Igny8 Wordpress Bridge</h2>
</div>
<div class="igny8-top-grid">
<div class="igny8-settings-card">
<h2>
<svg width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" style="vertical-align: middle; margin-right: 8px; display: inline;">
@@ -230,87 +234,8 @@ $webhook_logs = igny8_get_webhook_logs(array('limit' => 10));
</p>
<?php endif; ?>
</div>
<div class="igny8-settings-card">
<h2>
<svg width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" style="vertical-align: middle; margin-right: 8px; display: inline;">
<path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
<?php _e('Diagnostics', 'igny8-bridge'); ?>
</h2>
<div class="igny8-diagnostics-grid">
<div class="igny8-diagnostic-item">
<div class="igny8-diagnostic-label"><?php _e('Access Token Age', 'igny8-bridge'); ?></div>
<div class="igny8-diagnostic-value"><?php echo esc_html($token_age_text); ?></div>
<p class="description">
<?php echo esc_html($token_issued_formatted); ?>
</p>
</div>
<div class="igny8-diagnostic-item">
<div class="igny8-diagnostic-label"><?php _e('Last API Health Check', 'igny8-bridge'); ?></div>
<div class="igny8-diagnostic-value"><?php echo esc_html($last_health_check_formatted); ?></div>
<p class="description">
<?php _e('Updated when tests succeed', 'igny8-bridge'); ?>
</p>
</div>
<div class="igny8-diagnostic-item">
<div class="igny8-diagnostic-label"><?php _e('Last Site Data Sync', 'igny8-bridge'); ?></div>
<div class="igny8-diagnostic-value"><?php echo esc_html($last_site_sync_formatted); ?></div>
<p class="description">
<?php _e('Triggered automatically after setup', 'igny8-bridge'); ?>
</p>
</div>
<div class="igny8-diagnostic-item">
<div class="igny8-diagnostic-label"><?php _e('Last Full Site Scan', 'igny8-bridge'); ?></div>
<div class="igny8-diagnostic-value"><?php echo esc_html($last_full_site_scan_formatted); ?></div>
<p class="description">
<?php _e('Runs weekly or when requested manually', 'igny8-bridge'); ?>
</p>
</div>
<div class="igny8-diagnostic-item">
<div class="igny8-diagnostic-label"><?php _e('Last Semantic Map', 'igny8-bridge'); ?></div>
<div class="igny8-diagnostic-value"><?php echo esc_html($last_semantic_map_formatted); ?></div>
<p class="description">
<?php
if (!empty($semantic_summary)) {
printf(
/* translators: %1$d: sectors count, %2$d: keywords count */
esc_html__('Sectors: %1$d · Keywords: %2$d', 'igny8-bridge'),
intval($semantic_summary['sectors'] ?? 0),
intval($semantic_summary['keywords'] ?? 0)
);
} else {
_e('Planner semantic map generated after full scan', 'igny8-bridge');
}
?>
</p>
</div>
<div class="igny8-diagnostic-item">
<div class="igny8-diagnostic-label"><?php _e('Last Taxonomy Sync', 'igny8-bridge'); ?></div>
<div class="igny8-diagnostic-value"><?php echo esc_html($last_taxonomy_sync_formatted); ?></div>
<p class="description">
<?php _e('Sectors & clusters imported from Planner', 'igny8-bridge'); ?>
</p>
</div>
<div class="igny8-diagnostic-item">
<div class="igny8-diagnostic-label"><?php _e('Last Keyword Sync', 'igny8-bridge'); ?></div>
<div class="igny8-diagnostic-value"><?php echo esc_html($last_keyword_sync_formatted); ?></div>
<p class="description">
<?php _e('Planner keywords cached to WordPress posts', 'igny8-bridge'); ?>
</p>
</div>
<div class="igny8-diagnostic-item">
<div class="igny8-diagnostic-label"><?php _e('Last Writer Sync', 'igny8-bridge'); ?></div>
<div class="igny8-diagnostic-value"><?php echo esc_html($last_writer_sync_formatted); ?></div>
<p class="description">
<?php _e('New IGNY8 tasks imported automatically', 'igny8-bridge'); ?>
</p>
</div>
<div class="igny8-diagnostic-item">
<div class="igny8-diagnostic-label"><?php _e('Next Scheduled Site Scan', 'igny8-bridge'); ?></div>
<div class="igny8-diagnostic-value"><?php echo esc_html($next_site_sync_formatted); ?></div>
</div>
</div>
</div>
<?php else : ?>
<div class="igny8-settings-card">
<h2><?php _e('Connection Status', 'igny8-bridge'); ?></h2>
@@ -336,10 +261,10 @@ $webhook_logs = igny8_get_webhook_logs(array('limit' => 10));
<form method="post" action="options.php">
<?php settings_fields('igny8_bridge_controls'); ?>
<table class="form-table">
<tr>
<th scope="row"><?php _e('Post Types to Sync', 'igny8-bridge'); ?></th>
<td>
<div class="igny8-automation-grid">
<div class="automation-column-left">
<div class="automation-block">
<h3><?php _e('Post Types to Sync', 'igny8-bridge'); ?></h3>
<?php foreach ($available_post_types as $slug => $label) : ?>
<label>
<input
@@ -355,11 +280,10 @@ $webhook_logs = igny8_get_webhook_logs(array('limit' => 10));
<p class="description">
<?php _e('Select the content types IGNY8 should manage automatically.', 'igny8-bridge'); ?>
</p>
</td>
</tr>
<tr>
<th scope="row"><?php _e('IGNY8 Modules', 'igny8-bridge'); ?></th>
<td>
</div>
<div class="automation-block">
<h3><?php _e('IGNY8 Modules', 'igny8-bridge'); ?></h3>
<?php foreach ($available_modules as $module_key => $module_label) : ?>
<label>
<input
@@ -375,11 +299,10 @@ $webhook_logs = igny8_get_webhook_logs(array('limit' => 10));
<p class="description">
<?php _e('Disable modules temporarily if a feature is not ready in the SaaS app.', 'igny8-bridge'); ?>
</p>
</td>
</tr>
<tr>
<th scope="row"><?php _e('Control Mode', 'igny8-bridge'); ?></th>
<td>
</div>
<div class="automation-block">
<h3><?php _e('Control Mode', 'igny8-bridge'); ?></h3>
<label>
<input
type="radio"
@@ -401,11 +324,12 @@ $webhook_logs = igny8_get_webhook_logs(array('limit' => 10));
<strong><?php _e('Hybrid', 'igny8-bridge'); ?></strong>
<span class="description"><?php _e('Allow editors to update content in WordPress and sync back to IGNY8.', 'igny8-bridge'); ?></span>
</label>
</td>
</tr>
<tr>
<th scope="row"><?php _e('WooCommerce Products', 'igny8-bridge'); ?></th>
<td>
</div>
</div>
<div class="automation-column-right">
<div class="automation-block">
<h3><?php _e('WooCommerce Products', 'igny8-bridge'); ?></h3>
<label>
<input
type="checkbox"
@@ -421,31 +345,33 @@ $webhook_logs = igny8_get_webhook_logs(array('limit' => 10));
<?php _e('WooCommerce is not active on this site. Enable the plugin to sync product data.', 'igny8-bridge'); ?>
</p>
<?php endif; ?>
</td>
</tr>
<tr>
<th scope="row"><?php _e('Taxonomies to Sync', 'igny8-bridge'); ?></th>
<td>
</div>
<div class="automation-block">
<h3><?php _e('Taxonomies to Sync', 'igny8-bridge'); ?></h3>
<div class="taxonomy-list">
<?php foreach ($available_taxonomies as $taxonomy_slug => $taxonomy_label) : ?>
<label>
<label class="taxonomy-item">
<input
type="checkbox"
name="igny8_enabled_taxonomies[]"
value="<?php echo esc_attr($taxonomy_slug); ?>"
<?php checked(in_array($taxonomy_slug, $enabled_taxonomies, true)); ?>
/>
<?php echo esc_html($taxonomy_label); ?> (<?php echo esc_html($taxonomy_slug); ?>)
<?php echo esc_html($taxonomy_label); ?> <span class="taxonomy-slug">(<?php echo esc_html($taxonomy_slug); ?>)</span>
</label>
<br />
<?php endforeach; ?>
</div>
<p class="description">
<?php _e('Select which taxonomies to synchronize bidirectionally with IGNY8.', 'igny8-bridge'); ?>
</p>
</td>
</tr>
</table>
<?php submit_button(__('Save Automation Settings', 'igny8-bridge')); ?>
</div>
<div class="automation-block" style="margin-top:18px;">
<?php submit_button(__('Save Automation Settings', 'igny8-bridge')); ?>
</div>
</div>
</div>
</form>
<p class="description">
@@ -453,23 +379,7 @@ $webhook_logs = igny8_get_webhook_logs(array('limit' => 10));
</p>
</div>
<div class="igny8-settings-card">
<h2>
<svg width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" style="vertical-align: middle; margin-right: 8px; display: inline;">
<path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
<?php _e('About', 'igny8-bridge'); ?>
</h2>
<p>
<?php _e('The IGNY8 WordPress Bridge plugin connects your WordPress site to the IGNY8 API, enabling two-way synchronization of posts, taxonomies, and site data.', 'igny8-bridge'); ?>
</p>
<p>
<strong><?php _e('Version:', 'igny8-bridge'); ?></strong> <?php echo esc_html(IGNY8_BRIDGE_VERSION); ?>
</p>
<p>
<strong><?php _e('Authentication:', 'igny8-bridge'); ?></strong> <?php _e('API Key Only (secure, modern authentication)', 'igny8-bridge'); ?>
</p>
</div>
<?php if ($is_connected) : ?>
<div class="igny8-settings-card">
@@ -717,6 +627,82 @@ $webhook_logs = igny8_get_webhook_logs(array('limit' => 10));
</div>
</div>
<?php endif; ?>
<!-- Diagnostics (moved to near end) -->
<div class="igny8-settings-card">
<h2>
<svg width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" style="vertical-align: middle; margin-right: 8px; display: inline;">
<path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
<?php _e('Diagnostics', 'igny8-bridge'); ?>
</h2>
<div class="igny8-diagnostics-grid">
<div class="igny8-diagnostic-item">
<div class="igny8-diagnostic-label"><?php _e('Access Token Age', 'igny8-bridge'); ?></div>
<div class="igny8-diagnostic-value"><?php echo esc_html($token_age_text); ?></div>
<p class="description"><?php echo esc_html($token_issued_formatted); ?></p>
</div>
<div class="igny8-diagnostic-item">
<div class="igny8-diagnostic-label"><?php _e('Last API Health Check', 'igny8-bridge'); ?></div>
<div class="igny8-diagnostic-value"><?php echo esc_html($last_health_check_formatted); ?></div>
<p class="description"><?php _e('Updated when tests succeed', 'igny8-bridge'); ?></p>
</div>
<div class="igny8-diagnostic-item">
<div class="igny8-diagnostic-label"><?php _e('Last Site Data Sync', 'igny8-bridge'); ?></div>
<div class="igny8-diagnostic-value"><?php echo esc_html($last_site_sync_formatted); ?></div>
<p class="description"><?php _e('Triggered automatically after setup', 'igny8-bridge'); ?></p>
</div>
<div class="igny8-diagnostic-item">
<div class="igny8-diagnostic-label"><?php _e('Last Full Site Scan', 'igny8-bridge'); ?></div>
<div class="igny8-diagnostic-value"><?php echo esc_html($last_full_site_scan_formatted); ?></div>
<p class="description"><?php _e('Runs weekly or when requested manually', 'igny8-bridge'); ?></p>
</div>
<div class="igny8-diagnostic-item">
<div class="igny8-diagnostic-label"><?php _e('Last Semantic Map', 'igny8-bridge'); ?></div>
<div class="igny8-diagnostic-value"><?php echo esc_html($last_semantic_map_formatted); ?></div>
<p class="description">
<?php
if (!empty($semantic_summary)) {
printf(
esc_html__('Sectors: %1$d · Keywords: %2$d', 'igny8-bridge'),
intval($semantic_summary['sectors'] ?? 0),
intval($semantic_summary['keywords'] ?? 0)
);
} else {
_e('Planner semantic map generated after full scan', 'igny8-bridge');
}
?>
</p>
</div>
<div class="igny8-diagnostic-item">
<div class="igny8-diagnostic-label"><?php _e('Last Taxonomy Sync', 'igny8-bridge'); ?></div>
<div class="igny8-diagnostic-value"><?php echo esc_html($last_taxonomy_sync_formatted); ?></div>
<p class="description"><?php _e('Sectors & clusters imported from Planner', 'igny8-bridge'); ?></p>
</div>
<div class="igny8-diagnostic-item">
<div class="igny8-diagnostic-label"><?php _e('Last Keyword Sync', 'igny8-bridge'); ?></div>
<div class="igny8-diagnostic-value"><?php echo esc_html($last_keyword_sync_formatted); ?></div>
<p class="description"><?php _e('Planner keywords cached to WordPress posts', 'igny8-bridge'); ?></p>
</div>
<div class="igny8-diagnostic-item">
<div class="igny8-diagnostic-label"><?php _e('Last Writer Sync', 'igny8-bridge'); ?></div>
<div class="igny8-diagnostic-value"><?php echo esc_html($last_writer_sync_formatted); ?></div>
<p class="description"><?php _e('New IGNY8 tasks imported automatically', 'igny8-bridge'); ?></p>
</div>
<div class="igny8-diagnostic-item">
<div class="igny8-diagnostic-label"><?php _e('Next Scheduled Site Scan', 'igny8-bridge'); ?></div>
<div class="igny8-diagnostic-value"><?php echo esc_html($next_site_sync_formatted); ?></div>
</div>
</div>
</div>
<!-- About (moved to the end) -->
<div class="igny8-settings-card">
<h2><?php _e('About', 'igny8-bridge'); ?></h2>
<p><?php _e('The IGNY8 WordPress Bridge plugin connects your WordPress site to the IGNY8 API, enabling two-way synchronization of posts, taxonomies, and site data.', 'igny8-bridge'); ?></p>
<p><strong><?php _e('Version:', 'igny8-bridge'); ?></strong> <?php echo esc_html(IGNY8_BRIDGE_VERSION); ?></p>
<p><strong><?php _e('Authentication:', 'igny8-bridge'); ?></strong> <?php _e('API Key Only (secure, modern authentication)', 'igny8-bridge'); ?></p>
</div>
</div>
<?php endif; ?>
</div>