wp plugin and app fixes adn automation page update

This commit is contained in:
IGNY8 VPS (Salman)
2026-01-12 01:12:08 +00:00
parent 3925ddf894
commit 90b9d6aadc
19 changed files with 1918 additions and 336 deletions

View File

@@ -81,10 +81,10 @@ class Igny8Admin {
add_submenu_page(
'igny8-dashboard',
__('Controls', 'igny8-bridge'),
__('Controls', 'igny8-bridge'),
__('Settings', 'igny8-bridge'),
__('Settings', 'igny8-bridge'),
'manage_options',
'igny8-controls',
'igny8-settings',
array($this, 'render_page')
);
@@ -170,6 +170,13 @@ class Igny8Admin {
'sanitize_callback' => array($this, 'sanitize_post_status'),
'default' => 'draft'
));
// Sync enabled toggle
register_setting('igny8_bridge_controls', 'igny8_sync_enabled', array(
'type' => 'boolean',
'sanitize_callback' => 'absint',
'default' => 1
));
}
/**
@@ -290,8 +297,8 @@ class Igny8Admin {
case 'igny8-connection':
$template_file = IGNY8_BRIDGE_PLUGIN_DIR . 'admin/pages/connection.php';
break;
case 'igny8-controls':
$template_file = IGNY8_BRIDGE_PLUGIN_DIR . 'admin/pages/controls.php';
case 'igny8-settings':
$template_file = IGNY8_BRIDGE_PLUGIN_DIR . 'admin/pages/settings.php';
break;
case 'igny8-sync':
$template_file = IGNY8_BRIDGE_PLUGIN_DIR . 'admin/pages/sync.php';

View File

@@ -64,12 +64,13 @@ $is_connected = !empty($api_key);
</li>
<li>
<a href="<?php echo esc_url(admin_url('admin.php?page=igny8-controls')); ?>"
class="<?php echo ($current_page === 'igny8-controls') ? 'active' : ''; ?>">
<a href="<?php echo esc_url(admin_url('admin.php?page=igny8-settings')); ?>"
class="<?php echo ($current_page === 'igny8-settings') ? 'active' : ''; ?>">
<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"/>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"/>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/>
</svg>
<?php _e('Controls', 'igny8-bridge'); ?>
<?php _e('Settings', 'igny8-bridge'); ?>
</a>
</li>

View File

@@ -145,12 +145,12 @@ $last_sync = get_option('igny8_last_sync_time');
</div>
<div>
<h3 style="font-size: 16px; margin: 0 0 12px 0;"><?php _e('Controls', 'igny8-bridge'); ?></h3>
<h3 style="font-size: 16px; margin: 0 0 12px 0;"><?php _e('Settings', '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'); ?>
<?php _e('Configure post types and taxonomies 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 href="<?php echo esc_url(admin_url('admin.php?page=igny8-settings')); ?>" class="igny8-btn igny8-btn-secondary">
<?php _e('Configure Settings', 'igny8-bridge'); ?>
</a>
</div>

View File

@@ -0,0 +1,292 @@
<?php
/**
* Settings Page (Renamed from Controls)
* Simplified post type and taxonomy management
*
* @package Igny8Bridge
*/
// Prevent direct access
if (!defined('ABSPATH')) {
exit;
}
// Include layout header
include IGNY8_BRIDGE_PLUGIN_DIR . 'admin/layout-header.php';
// Get all registered public post types
$all_post_types = get_post_types(array('public' => true), 'objects');
$excluded_post_types = array('attachment', 'revision', 'nav_menu_item', 'wp_block', 'wp_template', 'wp_template_part', 'wp_navigation');
$enabled_post_types = igny8_get_enabled_post_types();
$default_post_status = get_option('igny8_default_post_status', 'draft');
$sync_enabled = get_option('igny8_sync_enabled', 1);
// Get enabled taxonomies
$enabled_taxonomies = igny8_get_enabled_taxonomies();
// Filter out system post types
$public_post_types = array();
foreach ($all_post_types as $pt) {
if (!in_array($pt->name, $excluded_post_types, true)) {
$public_post_types[$pt->name] = $pt;
}
}
?>
<div class="igny8-page-header">
<h1><?php _e('Settings', 'igny8-bridge'); ?></h1>
<p><?php _e('Configure post types, taxonomies, and sync settings', 'igny8-bridge'); ?></p>
</div>
<form method="post" action="options.php" id="igny8-settings-form">
<?php settings_fields('igny8_bridge_controls'); ?>
<!-- Post Types Section -->
<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 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', 'igny8-bridge'); ?>
</h2>
</div>
<p style="margin-bottom: 16px; color: var(--igny8-text-dim);">
<?php _e('Enable post types to sync with IGNY8. Only enabled post types will show their taxonomy configuration below.', 'igny8-bridge'); ?>
</p>
<div style="display: grid; gap: 12px;">
<?php foreach ($public_post_types as $slug => $pt) :
$is_posts = ($slug === 'post');
$is_enabled = in_array($slug, $enabled_post_types, true);
?>
<label class="igny8-post-type-toggle" style="display: flex; align-items: center; cursor: pointer; padding: 12px 16px; border: 1px solid var(--igny8-stroke); border-radius: var(--igny8-radius-base); background: var(--igny8-surface);">
<input
type="checkbox"
name="igny8_enabled_post_types[]"
value="<?php echo esc_attr($slug); ?>"
class="igny8-post-type-checkbox"
data-post-type="<?php echo esc_attr($slug); ?>"
<?php checked($is_enabled); ?>
style="margin-right: 12px;"
/>
<div style="flex: 1;">
<span style="font-weight: 600;">
<?php echo esc_html($pt->label); ?>
</span>
<?php if (!$is_posts) : ?>
<span class="igny8-badge igny8-badge-warning" style="margin-left: 8px;">
<?php _e('Coming Soon', 'igny8-bridge'); ?>
</span>
<?php endif; ?>
</div>
<span style="color: var(--igny8-text-dim); font-size: 13px;">
<?php echo esc_html($slug); ?>
</span>
</label>
<?php endforeach; ?>
</div>
</div>
<!-- Post Type Taxonomy Cards (dynamic, shown only for enabled post types) -->
<?php foreach ($public_post_types as $slug => $pt) :
$is_posts = ($slug === 'post');
$is_enabled = in_array($slug, $enabled_post_types, true);
$taxonomies = get_object_taxonomies($slug, 'objects');
// Filter out system taxonomies
$public_taxonomies = array();
foreach ($taxonomies as $tax) {
if ($tax->public && !in_array($tax->name, array('post_format', 'wp_theme'), true)) {
$public_taxonomies[$tax->name] = $tax;
}
}
// Skip if no public taxonomies
if (empty($public_taxonomies)) continue;
// Add IGNY8 taxonomies if they exist
if (taxonomy_exists('igny8_sectors')) {
$public_taxonomies['igny8_sectors'] = get_taxonomy('igny8_sectors');
}
if (taxonomy_exists('igny8_clusters')) {
$public_taxonomies['igny8_clusters'] = get_taxonomy('igny8_clusters');
}
?>
<div class="igny8-card igny8-taxonomy-card" data-post-type="<?php echo esc_attr($slug); ?>" style="margin-bottom: 24px; <?php echo $is_enabled ? '' : 'display: none;'; ?>">
<div class="igny8-card-header" style="display: flex; align-items: center; justify-content: space-between;">
<h2 style="display: flex; align-items: center; gap: 8px;">
<?php if ($slug === 'post') : ?>
<span style="font-size: 20px;">📝</span>
<?php elseif ($slug === 'product') : ?>
<span style="font-size: 20px;">📦</span>
<?php elseif ($slug === 'page') : ?>
<span style="font-size: 20px;">📄</span>
<?php else : ?>
<span style="font-size: 20px;">📁</span>
<?php endif; ?>
<?php echo esc_html(strtoupper($pt->label)); ?>
</h2>
<?php if (!$is_posts) : ?>
<span class="igny8-badge igny8-badge-warning">
<?php _e('Coming Soon', 'igny8-bridge'); ?>
</span>
<?php endif; ?>
</div>
<p style="margin-bottom: 16px; color: var(--igny8-text-dim); font-size: 14px;">
<?php printf(__('Taxonomies for %s:', 'igny8-bridge'), esc_html($pt->label)); ?>
</p>
<div style="display: grid; gap: 8px;">
<?php foreach ($public_taxonomies as $tax_slug => $tax) :
// Default enabled: category, post_tag, product_cat, product_tag, igny8_sectors, igny8_clusters
$default_enabled = in_array($tax_slug, array('category', 'post_tag', 'product_cat', 'product_tag', 'igny8_sectors', 'igny8_clusters'), true);
$is_tax_enabled = in_array($tax_slug, $enabled_taxonomies, true);
?>
<label style="display: flex; align-items: center; cursor: pointer; padding: 10px 14px; border: 1px solid var(--igny8-stroke); border-radius: var(--igny8-radius-sm); background: var(--igny8-bg);">
<input
type="checkbox"
name="igny8_enabled_taxonomies[]"
value="<?php echo esc_attr($tax_slug); ?>"
<?php checked($is_tax_enabled); ?>
style="margin-right: 10px;"
/>
<span style="flex: 1;"><?php echo esc_html($tax->label); ?></span>
<span style="color: var(--igny8-text-dim); font-size: 12px;"><?php echo esc_html($tax_slug); ?></span>
</label>
<?php endforeach; ?>
</div>
</div>
<?php endforeach; ?>
<!-- Default Settings -->
<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="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"/>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/>
</svg>
<?php _e('Default Settings', 'igny8-bridge'); ?>
</h2>
</div>
<div class="igny8-grid igny8-grid-2" style="gap: 24px;">
<!-- Default Post Status -->
<div>
<label style="display: block; font-weight: 600; margin-bottom: 12px;">
<?php _e('Default Post Status', 'igny8-bridge'); ?>
</label>
<div style="display: grid; gap: 8px;">
<label style="display: flex; align-items: center; cursor: pointer; padding: 12px; border: 1px solid var(--igny8-stroke); border-radius: var(--igny8-radius-sm); <?php echo $default_post_status === 'draft' ? 'background: var(--igny8-primary-subtle); border-color: var(--igny8-primary);' : ''; ?>">
<input
type="radio"
name="igny8_default_post_status"
value="draft"
<?php checked($default_post_status, 'draft'); ?>
style="margin-right: 10px;"
/>
<div>
<strong><?php _e('Draft', 'igny8-bridge'); ?></strong>
<span style="display: block; font-size: 12px; color: var(--igny8-text-dim);">
<?php _e('Review before publishing', 'igny8-bridge'); ?>
</span>
</div>
</label>
<label style="display: flex; align-items: center; cursor: pointer; padding: 12px; border: 1px solid var(--igny8-stroke); border-radius: var(--igny8-radius-sm); <?php echo $default_post_status === 'publish' ? 'background: var(--igny8-primary-subtle); border-color: var(--igny8-primary);' : ''; ?>">
<input
type="radio"
name="igny8_default_post_status"
value="publish"
<?php checked($default_post_status, 'publish'); ?>
style="margin-right: 10px;"
/>
<div>
<strong><?php _e('Publish', 'igny8-bridge'); ?></strong>
<span style="display: block; font-size: 12px; color: var(--igny8-text-dim);">
<?php _e('Publish immediately', 'igny8-bridge'); ?>
</span>
</div>
</label>
</div>
</div>
<!-- Enable Sync -->
<div>
<label style="display: block; font-weight: 600; margin-bottom: 12px;">
<?php _e('IGNY8 Sync', 'igny8-bridge'); ?>
</label>
<label style="display: flex; align-items: center; cursor: pointer; padding: 16px; border: 1px solid var(--igny8-stroke); border-radius: var(--igny8-radius-sm); background: var(--igny8-surface);">
<input
type="checkbox"
name="igny8_sync_enabled"
value="1"
<?php checked($sync_enabled, 1); ?>
style="margin-right: 12px; width: 20px; height: 20px;"
/>
<div>
<strong><?php _e('Enable IGNY8 Sync', 'igny8-bridge'); ?></strong>
<span style="display: block; font-size: 12px; color: var(--igny8-text-dim);">
<?php _e('Allow IGNY8 to publish content to this site', 'igny8-bridge'); ?>
</span>
</div>
</label>
</div>
</div>
</div>
<button type="submit" class="igny8-btn igny8-btn-primary">
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24" style="width: 16px; height: 16px;">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
</svg>
<?php _e('Save Settings', 'igny8-bridge'); ?>
</button>
</form>
<style>
.igny8-badge {
display: inline-block;
padding: 2px 8px;
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
border-radius: 4px;
}
.igny8-badge-warning {
background: #fef3c7;
color: #92400e;
}
.igny8-badge-success {
background: #d1fae5;
color: #065f46;
}
.igny8-post-type-toggle:hover {
border-color: var(--igny8-primary);
}
.igny8-taxonomy-card {
transition: opacity 0.2s ease, transform 0.2s ease;
}
</style>
<script>
jQuery(document).ready(function($) {
// Toggle taxonomy cards based on post type checkboxes
$('.igny8-post-type-checkbox').on('change', function() {
var postType = $(this).data('post-type');
var card = $('.igny8-taxonomy-card[data-post-type="' + postType + '"]');
if ($(this).is(':checked')) {
card.slideDown(200);
} else {
card.slideUp(200);
}
});
});
</script>
<?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';
?>

View File

@@ -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';

View File

@@ -3,7 +3,7 @@
* Plugin Name: IGNY8 WordPress Bridge
* Plugin URI: https://igny8.com/igny8-wp-bridge
* Description: Lightweight bridge plugin that connects WordPress to IGNY8 API for one-way content publishing.
* Version: 1.3.3
* Version: 1.3.4
* Author: IGNY8
* Author URI: https://igny8.com/
* License: GPL v2 or later
@@ -22,7 +22,7 @@ if (!defined('ABSPATH')) {
}
// Define plugin constants
define('IGNY8_BRIDGE_VERSION', '1.3.3');
define('IGNY8_BRIDGE_VERSION', '1.3.4');
define('IGNY8_BRIDGE_PLUGIN_DIR', plugin_dir_path(__FILE__));
define('IGNY8_BRIDGE_PLUGIN_URL', plugin_dir_url(__FILE__));
define('IGNY8_BRIDGE_PLUGIN_FILE', __FILE__);