versioning and wp plugin updates
This commit is contained in:
@@ -0,0 +1,227 @@
|
||||
<?php
|
||||
/**
|
||||
* Connection Page
|
||||
*
|
||||
* @package Igny8Bridge
|
||||
*/
|
||||
|
||||
// Prevent direct access
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Include layout header
|
||||
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);
|
||||
$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');
|
||||
?>
|
||||
|
||||
<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>
|
||||
|
||||
<?php if (!$is_connected): ?>
|
||||
<!-- Not Connected - Show Connection Form -->
|
||||
<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.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"/>
|
||||
</svg>
|
||||
<?php _e('Connect to IGNY8', 'igny8-bridge'); ?>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div class="igny8-status igny8-status-disconnected" style="margin-bottom: 24px;">
|
||||
<span class="igny8-status-indicator"></span>
|
||||
<?php _e('Not Connected', 'igny8-bridge'); ?>
|
||||
</div>
|
||||
|
||||
<form method="post" action="">
|
||||
<?php wp_nonce_field('igny8_settings_nonce'); ?>
|
||||
|
||||
<div class="igny8-form-group">
|
||||
<label for="igny8_api_key">
|
||||
<?php _e('API Key', 'igny8-bridge'); ?>
|
||||
<span style="color: var(--igny8-danger);">*</span>
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="igny8_api_key"
|
||||
name="igny8_api_key"
|
||||
value=""
|
||||
placeholder="<?php _e('igny8_site_5_1764575388582_u671q2e2mv', 'igny8-bridge'); ?>"
|
||||
required
|
||||
/>
|
||||
<p class="igny8-form-help">
|
||||
<?php printf(
|
||||
__('Get your API key from the <a href="%s" target="_blank">IGNY8 app integrations page</a>. The API key format includes your site ID.', 'igny8-bridge'),
|
||||
'https://app.igny8.com'
|
||||
); ?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<button type="submit" name="igny8_connect" 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="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"/>
|
||||
</svg>
|
||||
<?php _e('Connect to IGNY8', 'igny8-bridge'); ?>
|
||||
</button>
|
||||
</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>
|
||||
</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>
|
||||
</div>
|
||||
|
||||
<?php else: ?>
|
||||
<!-- Connected - Show Connection Details -->
|
||||
<div class="igny8-alert igny8-alert-success">
|
||||
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
||||
</svg>
|
||||
<div>
|
||||
<strong><?php _e('Connected Successfully', 'igny8-bridge'); ?></strong>
|
||||
<p><?php _e('Your WordPress site is connected to IGNY8 and ready to sync content.', 'igny8-bridge'); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="igny8-grid igny8-grid-2">
|
||||
<!-- Connection Status -->
|
||||
<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 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
||||
</svg>
|
||||
<?php _e('Connection Status', 'igny8-bridge'); ?>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div class="igny8-status igny8-status-connected" style="margin-bottom: 20px;">
|
||||
<span class="igny8-status-indicator"></span>
|
||||
<?php _e('Connected & Active', 'igny8-bridge'); ?>
|
||||
</div>
|
||||
|
||||
<div class="igny8-form-group">
|
||||
<label><?php _e('Site ID', 'igny8-bridge'); ?></label>
|
||||
<code style="display: block; padding: 10px; background: var(--igny8-surface); border-radius: var(--igny8-radius-base);">
|
||||
<?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 -->
|
||||
<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="M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"/>
|
||||
</svg>
|
||||
<?php _e('API Key', 'igny8-bridge'); ?>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div class="igny8-form-group">
|
||||
<label><?php _e('Active API Key', 'igny8-bridge'); ?></label>
|
||||
<div style="padding: 10px 12px; background: var(--igny8-surface); border: 1px solid var(--igny8-stroke); border-radius: var(--igny8-radius-base); font-family: monospace;">
|
||||
<?php echo esc_html(substr($api_key, 0, 7) . '••••••••••••' . substr($api_key, -7)); ?>
|
||||
<span style="color: var(--igny8-success); font-weight: 600; margin-left: 12px;">✓ Verified</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($token_issued): ?>
|
||||
<div class="igny8-form-group">
|
||||
<label><?php _e('Token Issued', 'igny8-bridge'); ?></label>
|
||||
<p style="margin: 0; font-size: 14px;">
|
||||
<?php echo esc_html($token_age_text); ?>
|
||||
<span style="color: var(--igny8-text-dim); display: block; font-size: 13px; margin-top: 4px;">
|
||||
<?php echo esc_html($token_issued_formatted); ?>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($last_health_check): ?>
|
||||
<div class="igny8-form-group">
|
||||
<label><?php _e('Last Health Check', 'igny8-bridge'); ?></label>
|
||||
<p style="margin: 0; font-size: 14px;">
|
||||
<?php echo esc_html($last_health_check_formatted); ?>
|
||||
</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Disconnect Section -->
|
||||
<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 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
|
||||
</svg>
|
||||
<?php _e('Danger Zone', 'igny8-bridge'); ?>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<p style="margin-bottom: 16px; color: var(--igny8-text-dim);">
|
||||
<?php _e('Disconnecting will stop all syncing with IGNY8. Your content in WordPress will remain unchanged, but no new updates will be received from IGNY8.', 'igny8-bridge'); ?>
|
||||
</p>
|
||||
|
||||
<form method="post" action="">
|
||||
<?php wp_nonce_field('igny8_revoke_api_key'); ?>
|
||||
<button type="submit" name="igny8_revoke_api_key" class="igny8-btn igny8-btn-danger"
|
||||
onclick="return confirm('<?php _e('Are you sure you want to disconnect? This will stop all syncing with IGNY8.', 'igny8-bridge'); ?>');">
|
||||
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"/>
|
||||
</svg>
|
||||
<?php _e('Disconnect from IGNY8', 'igny8-bridge'); ?>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
// Include layout footer
|
||||
include IGNY8_BRIDGE_PLUGIN_DIR . 'admin/layout-footer.php';
|
||||
?>
|
||||
Reference in New Issue
Block a user