wp plugin udapted v1.5.0

This commit is contained in:
IGNY8 VPS (Salman)
2026-01-13 08:19:55 +00:00
parent 17b3811d4c
commit 3cc2e6b270
13 changed files with 1078 additions and 273 deletions

View File

@@ -16,23 +16,26 @@ 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);
$is_connected = !empty($api_key);
$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');
$last_communication = intval(get_option('igny8_last_communication', 0));
$last_communication_text = $last_communication ? sprintf(__('%s ago', 'igny8-bridge'), human_time_diff($last_communication, $now)) : __('Never', 'igny8-bridge');
$last_communication_formatted = $last_communication ? date_i18n($date_format . ' ' . $time_format, $last_communication) : __('—', '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 style="display: flex; justify-content: space-between; align-items: flex-start;">
<div>
<h1><?php _e('Connection', 'igny8-bridge'); ?></h1>
<p><?php _e('Manage your IGNY8 API connection and authentication', 'igny8-bridge'); ?></p>
</div>
<div style="text-align: right; font-size: 13px; color: rgba(255,255,255,0.85);">
<span style="display: block;">Plugin v<?php echo esc_html(IGNY8_BRIDGE_VERSION); ?></span>
<span style="display: block; opacity: 0.7;">PHP <?php echo esc_html(PHP_VERSION); ?></span>
</div>
</div>
</div>
<?php if (!$is_connected): ?>
@@ -85,25 +88,64 @@ $last_health_check_formatted = $last_health_check ? date_i18n($date_format . ' '
</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>
<!-- Quick Actions Row -->
<div class="igny8-grid igny8-grid-3">
<!-- How to Connect 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('How to Connect', 'igny8-bridge'); ?>
</h2>
</div>
<ol style="padding-left: 20px; line-height: 1.7; font-size: 14px;">
<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 above', 'igny8-bridge'); ?></li>
<li><?php _e('Click "Connect to IGNY8"', 'igny8-bridge'); ?></li>
</ol>
</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>
<!-- Settings 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="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('Settings', 'igny8-bridge'); ?>
</h2>
</div>
<p style="font-size: 14px; color: var(--igny8-text-dim); margin-bottom: 16px;">
<?php _e('Configure post types and taxonomies to sync', 'igny8-bridge'); ?>
</p>
<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 Logs 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="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('View Logs', 'igny8-bridge'); ?>
</h2>
</div>
<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>
<?php else: ?>
@@ -141,13 +183,6 @@ $last_health_check_formatted = $last_health_check ? date_i18n($date_format . ' '
<?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 -->
@@ -192,6 +227,64 @@ $last_health_check_formatted = $last_health_check ? date_i18n($date_format . ' '
</div>
</div>
<!-- Quick Actions Row -->
<div class="igny8-grid igny8-grid-3">
<!-- How to Publish 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('Publishing Content', 'igny8-bridge'); ?>
</h2>
</div>
<ol style="padding-left: 20px; line-height: 1.7; font-size: 14px;">
<li><?php _e('Create content in IGNY8 app', 'igny8-bridge'); ?></li>
<li><?php _e('Review and approve content', 'igny8-bridge'); ?></li>
<li><?php _e('Click "Publish to WordPress"', 'igny8-bridge'); ?></li>
<li><?php _e('Content appears on your site', 'igny8-bridge'); ?></li>
</ol>
</div>
<!-- Settings 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="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('Settings', 'igny8-bridge'); ?>
</h2>
</div>
<p style="font-size: 14px; color: var(--igny8-text-dim); margin-bottom: 16px;">
<?php _e('Configure post types and taxonomies to sync', 'igny8-bridge'); ?>
</p>
<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 Logs 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="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('View Logs', 'igny8-bridge'); ?>
</h2>
</div>
<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>
<!-- Disconnect Section -->
<div class="igny8-card">
<div class="igny8-card-header">