tigerstyle-heat/admin/class-admin-pages.php
Ryan Malloy 0028738e33 Initial commit: TigerStyle Heat v2.0.0
Make your WordPress site irresistible. Natural SEO attraction with:
- robots.txt management
- sitemap.xml generation
- LLMs.txt support
- Google integration (Analytics, Search Console, Tag Manager)
- Schema.org structured data
- Open Graph / Twitter Card meta tags
- AMP support
- Visual elements gallery
- Built-in backup/restore module

Includes build.sh and .distignore for WordPress-installable release ZIPs.
2026-05-27 13:41:35 -06:00

502 lines
24 KiB
PHP

<?php
/**
* Admin pages for TigerStyle Heat
*/
// Prevent direct access
if (!defined('ABSPATH')) {
exit;
}
class TigerStyleSEO_Admin_Pages {
/**
* Single instance
*/
private static $instance = null;
/**
* Get instance
*/
public static function instance() {
if (is_null(self::$instance)) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Render main admin page
*/
public static function render_main_page() {
// Handle messages
self::display_admin_messages();
?>
<div class="wrap">
<h1><?php echo esc_html(get_admin_page_title()); ?></h1>
<nav class="nav-tab-wrapper">
<a href="#robots-tab" class="nav-tab nav-tab-active" onclick="switchTab(event, 'robots-tab')"><?php _e('Robots.txt', 'tigerstyle-heat'); ?></a>
<a href="#sitemap-tab" class="nav-tab" onclick="switchTab(event, 'sitemap-tab')"><?php _e('Sitemap.xml', 'tigerstyle-heat'); ?></a>
<a href="#llmstxt-tab" class="nav-tab" onclick="switchTab(event, 'llmstxt-tab')"><?php _e('LLMs.txt', 'tigerstyle-heat'); ?></a>
<a href="#google-setup-tab" class="nav-tab" onclick="switchTab(event, 'google-setup-tab')"><?php _e('Google Setup', 'tigerstyle-heat'); ?></a>
<a href="#google-appearance-tab" class="nav-tab" onclick="switchTab(event, 'google-appearance-tab')"><?php _e('Schema.org & Structured Data', 'tigerstyle-heat'); ?></a>
<a href="#meta-tags-tab" class="nav-tab" onclick="switchTab(event, 'meta-tags-tab')"><?php _e('Meta Tags', 'tigerstyle-heat'); ?></a>
<a href="#opengraph-tab" class="nav-tab" onclick="switchTab(event, 'opengraph-tab')"><?php _e('OpenGraph', 'tigerstyle-heat'); ?></a>
<a href="#facebook-tab" class="nav-tab" onclick="switchTab(event, 'facebook-tab')"><?php _e('Facebook', 'tigerstyle-heat'); ?></a>
<a href="#seo-checker-tab" class="nav-tab" onclick="switchTab(event, 'seo-checker-tab')"><?php _e('SEO Health Checker', 'tigerstyle-heat'); ?></a>
<a href="#head-footer-tab" class="nav-tab" onclick="switchTab(event, 'head-footer-tab')"><?php _e('Head/Footer Injection', 'tigerstyle-heat'); ?></a>
<a href="#visual-gallery-tab" class="nav-tab" onclick="switchTab(event, 'visual-gallery-tab')"><?php _e('Visual Gallery', 'tigerstyle-heat'); ?></a>
<a href="#amp-tab" class="nav-tab" onclick="switchTab(event, 'amp-tab')"><?php _e('AMP & SXG', 'tigerstyle-heat'); ?></a>
<a href="#ecosystem-tab" class="nav-tab" onclick="switchTab(event, 'ecosystem-tab')"><?php _e('🐅 Ecosystem Dashboard', 'tigerstyle-heat'); ?></a>
<a href="#ai-provider-tab" class="nav-tab" onclick="switchTab(event, 'ai-provider-tab')"><?php _e('AI Chat & Providers', 'tigerstyle-heat'); ?></a>
<a href="#whiskers-tab" class="nav-tab" onclick="switchTab(event, 'whiskers-tab')"><?php _e('🐱 Privacy Whiskers', 'tigerstyle-heat'); ?></a>
<a href="#about-tab" class="nav-tab" onclick="switchTab(event, 'about-tab')"><?php _e('About TigerStyle Heat', 'tigerstyle-heat'); ?></a>
</nav>
<!-- Tab Content -->
<div id="robots-tab" class="tab-content active">
<?php
$module = tigerstyle_heat()->get_module('robots_txt');
if ($module && method_exists($module, 'render_admin_page')) {
$module->render_admin_page();
} else {
echo '<p>Robots.txt module not available yet.</p>';
}
?>
</div>
<div id="sitemap-tab" class="tab-content">
<?php
$module = tigerstyle_heat()->get_module('sitemap_xml');
if ($module && method_exists($module, 'render_admin_page')) {
$module->render_admin_page();
} else {
echo '<p>Sitemap XML module not available yet.</p>';
}
?>
</div>
<div id="llmstxt-tab" class="tab-content">
<?php
$module = tigerstyle_heat()->get_module('llms_txt');
if ($module && method_exists($module, 'render_admin_page')) {
$module->render_admin_page();
} else {
echo '<p>LLMs.txt module not available yet.</p>';
}
?>
</div>
<div id="google-setup-tab" class="tab-content">
<?php
$module = tigerstyle_heat()->get_module('google_setup');
if ($module && method_exists($module, 'render_admin_page')) {
$module->render_admin_page();
} else {
echo '<p>Google Setup module not available yet.</p>';
}
?>
</div>
<div id="google-appearance-tab" class="tab-content">
<?php
$module = tigerstyle_heat()->get_module('structured_data');
if ($module && method_exists($module, 'render_admin_page')) {
$module->render_admin_page();
} else {
echo '<p>Structured Data module not available yet.</p>';
}
?>
</div>
<div id="meta-tags-tab" class="tab-content">
<?php
$module = tigerstyle_heat()->get_module('meta_tags');
if ($module && method_exists($module, 'render_admin_page')) {
$module->render_admin_page();
} else {
echo '<p>Meta Tags module not available yet.</p>';
}
?>
</div>
<div id="opengraph-tab" class="tab-content">
<?php
$module = tigerstyle_heat()->get_module('opengraph');
if ($module && method_exists($module, 'render_admin_page')) {
$module->render_admin_page();
} else {
echo '<p>OpenGraph module not available yet.</p>';
}
?>
</div>
<div id="facebook-tab" class="tab-content">
<?php
$module = tigerstyle_heat()->get_module('facebook');
if ($module && method_exists($module, 'render_admin_page')) {
$module->render_admin_page();
} else {
echo '<p>Facebook module not available yet.</p>';
}
?>
</div>
<div id="seo-checker-tab" class="tab-content">
<?php
$module = tigerstyle_heat()->get_module('seo_health');
if ($module && method_exists($module, 'render_admin_page')) {
$module->render_admin_page();
} else {
echo '<p>SEO Health module not available yet.</p>';
}
?>
</div>
<div id="ai-provider-tab" class="tab-content">
<?php
$module = tigerstyle_heat()->get_module('ai_provider');
if ($module && method_exists($module, 'render_admin_page')) {
$module->render_admin_page();
} else {
echo '<p>AI Provider module not available yet.</p>';
}
?>
</div>
<div id="head-footer-tab" class="tab-content">
<?php
$module = tigerstyle_heat()->get_module('head_footer');
if ($module && method_exists($module, 'render_admin_page')) {
$module->render_admin_page();
} else {
echo '<p>Head Footer module not available yet.</p>';
}
?>
</div>
<div id="visual-gallery-tab" class="tab-content">
<?php include TIGERSTYLE_HEAT_PLUGIN_DIR . 'admin/pages/visual-elements-gallery.php'; ?>
</div>
<div id="amp-tab" class="tab-content">
<?php include TIGERSTYLE_HEAT_PLUGIN_DIR . 'admin/pages/amp.php'; ?>
</div>
<div id="ecosystem-tab" class="tab-content">
<?php self::render_ecosystem_dashboard(); ?>
</div>
<div id="whiskers-tab" class="tab-content">
<?php
// Heat-Whiskers Integration Bridge
if (class_exists('TigerStyleWhiskers')) {
echo '<div style="background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%); color: white; padding: 20px; border-radius: 10px; margin-bottom: 20px; text-align: center;">';
echo '<h3 style="margin: 0 0 10px 0; color: white;">🐱 TigerStyle Whiskers Detected!</h3>';
echo '<p style="margin: 0; opacity: 0.9;">Privacy boundaries integrated with Heat\'s SEO optimization</p>';
echo '</div>';
echo '<div style="background: #f8f7ff; border: 2px solid #6c5ce7; border-radius: 10px; padding: 30px; text-align: center;">';
echo '<span style="font-size: 48px; display: block; margin-bottom: 15px;">🐱</span>';
echo '<h3 style="color: #6c5ce7; margin-bottom: 15px;">Whiskers Has Its Own Admin Interface</h3>';
echo '<p style="color: #666; margin-bottom: 20px;">TigerStyle Whiskers includes a comprehensive admin dashboard for privacy management. Access it through the WordPress admin menu.</p>';
// Check if Whiskers has registered its own admin menu
echo '<div style="margin: 20px 0;">';
if (function_exists('get_admin_page_title') && current_user_can('manage_options')) {
echo '<a href="' . admin_url('admin.php?page=tigerstyle-whiskers') . '" class="button button-primary" style="margin-right: 10px;">🐱 Open Whiskers Dashboard</a>';
}
echo '<a href="' . admin_url('plugins.php') . '" class="button button-secondary">View All Plugins</a>';
echo '</div>';
echo '<div style="background: #e8e6ff; padding: 15px; border-radius: 8px; margin: 20px 0; text-align: left;">';
echo '<h4 style="margin: 0 0 10px 0; color: #6c5ce7;">🤝 Heat + Whiskers Integration Status:</h4>';
echo '<ul style="margin: 0; color: #555;">';
echo '<li>✅ <strong>Plugin Detection:</strong> Whiskers is active and ready</li>';
echo '<li>🔄 <strong>Cross-Communication:</strong> APIs available for integration</li>';
echo '<li>🎯 <strong>Shared Ecosystem:</strong> Both plugins in TigerStyle family</li>';
echo '<li>🚀 <strong>Future Features:</strong> Advanced integration coming soon</li>';
echo '</ul></div>';
echo '</div>';
} else {
echo '<div style="background: #f8f7ff; border: 2px solid #6c5ce7; border-radius: 10px; padding: 30px; text-align: center;">';
echo '<span style="font-size: 48px; display: block; margin-bottom: 15px;">🐱</span>';
echo '<h3 style="color: #6c5ce7; margin-bottom: 15px;">TigerStyle Whiskers Integration</h3>';
echo '<p style="color: #666; margin-bottom: 20px;">Install TigerStyle Whiskers to unlock privacy compliance features that work seamlessly with Heat\'s SEO optimization.</p>';
if (file_exists(ABSPATH . 'wp-content/plugins/tigerstyle-whiskers/tigerstyle-whiskers.php')) {
echo '<div style="background: #fff3cd; border: 1px solid #ffeaa7; padding: 15px; border-radius: 8px; margin: 15px 0;">';
echo '<p style="margin: 0; color: #856404;"><strong>🎯 Whiskers Plugin Detected!</strong> Activate it to enable integration.</p>';
echo '</div>';
echo '<a href="' . admin_url('plugins.php') . '" class="button button-primary">Activate TigerStyle Whiskers</a>';
} else {
echo '<p style="color: #999; font-style: italic; margin-bottom: 20px;">TigerStyle Whiskers plugin not found in plugins directory.</p>';
echo '<a href="' . admin_url('plugin-install.php') . '" class="button button-secondary">Browse Plugins</a>';
}
echo '</div>';
}
?>
</div>
<div id="about-tab" class="tab-content">
<?php include TIGERSTYLE_HEAT_PLUGIN_DIR . 'admin/pages/about.php'; ?>
</div>
</div>
<style>
.tab-content { display: none; }
.tab-content.active { display: block; }
.seo-info-box {
background: #f9f9f9;
border: 1px solid #ddd;
border-radius: 5px;
padding: 20px;
margin: 20px 0;
}
.seo-setup-steps { margin-top: 15px; }
.nav-tab-wrapper { margin-bottom: 20px; }
</style>
<!-- Tab switching functionality is handled by admin.js -->
<?php
}
/**
* Display admin messages
*/
private static function display_admin_messages() {
if (!isset($_GET['message'])) {
return;
}
$messages = array(
'robots_txt_updated' => __('Robots.txt settings have been updated successfully!', 'tigerstyle-heat'),
'sitemap_xml_updated' => __('Sitemap.xml settings have been updated successfully!', 'tigerstyle-heat'),
'llmstxt_updated' => __('LLMs.txt settings have been updated successfully!', 'tigerstyle-heat'),
'google_setup_updated' => __('Google Setup settings have been updated successfully!', 'tigerstyle-heat'),
'google_appearance_updated' => __('Schema.org & Structured Data settings have been updated successfully!', 'tigerstyle-heat'),
'meta_tags_updated' => __('Meta Tags settings have been updated successfully!', 'tigerstyle-heat'),
'opengraph_updated' => __('OpenGraph settings have been updated successfully!', 'tigerstyle-heat'),
'facebook_updated' => __('Facebook settings have been updated successfully!', 'tigerstyle-heat'),
'head_footer_updated' => __('Head/Footer injection settings have been updated successfully!', 'tigerstyle-heat'),
'backup_settings_saved' => __('Backup settings have been saved successfully!', 'tigerstyle-heat'),
'backup_created' => __('Backup has been created successfully!', 'tigerstyle-heat'),
'backup_restored' => __('Backup has been restored successfully!', 'tigerstyle-heat'),
'backup_deleted' => __('Backup has been deleted successfully!', 'tigerstyle-heat'),
'theme_exported' => __('Theme has been exported successfully!', 'tigerstyle-heat'),
'theme_imported' => __('Theme has been imported successfully!', 'tigerstyle-heat'),
'amp_updated' => __('AMP & SXG settings have been updated successfully!', 'tigerstyle-heat'),
'sxg_test_success' => __('SXG infrastructure test completed successfully!', 'tigerstyle-heat'),
'error' => __('An error occurred. Please try again.', 'tigerstyle-heat'),
);
$message_key = sanitize_key($_GET['message']);
if (isset($messages[$message_key])) {
$class = ($message_key === 'error') ? 'notice-error' : 'notice-success';
echo '<div class="notice ' . $class . ' is-dismissible"><p>' . $messages[$message_key] . '</p></div>';
}
}
/**
* Render TigerStyle Ecosystem Dashboard
*/
public static function render_ecosystem_dashboard() {
$coordinator = TigerStyleSEO_EcosystemCoordinator::instance();
$plugins = $coordinator->get_registered_plugins();
$stats = $coordinator->get_ecosystem_stats();
?>
<style>
.ecosystem-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 20px;
margin: 20px 0;
}
.ecosystem-card {
background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
border: 2px solid #e9ecef;
border-radius: 12px;
padding: 20px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
transition: all 0.3s ease;
}
.ecosystem-card:hover {
transform: translateY(-2px);
box-shadow: 0 8px 16px rgba(0,0,0,0.15);
border-color: #ff6b35;
}
.ecosystem-card.coordinator {
background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
color: white;
border-color: #ff6b35;
}
.ecosystem-card.coordinator h3 {
color: white;
}
.plugin-status {
display: inline-block;
padding: 4px 8px;
border-radius: 20px;
font-size: 12px;
font-weight: bold;
text-transform: uppercase;
}
.status-active {
background: #28a745;
color: white;
}
.status-coordinator {
background: rgba(255,255,255,0.2);
color: white;
}
.capability-tag {
display: inline-block;
background: rgba(255,107,53,0.1);
color: #ff6b35;
padding: 2px 8px;
border-radius: 12px;
font-size: 11px;
margin: 2px;
}
.ecosystem-stats {
background: linear-gradient(135deg, #17a2b8 0%, #007bff 100%);
color: white;
padding: 20px;
border-radius: 12px;
margin-bottom: 20px;
}
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: 15px;
margin-top: 15px;
}
.stat-item {
text-align: center;
}
.stat-number {
font-size: 24px;
font-weight: bold;
display: block;
}
.stat-label {
font-size: 12px;
opacity: 0.9;
}
</style>
<div class="seo-info-box">
<h3>🐅 TigerStyle Ecosystem Dashboard</h3>
<p class="description">
Manage and monitor all TigerStyle plugins from this central command center.
See integration status, coordinate preferences, and optimize your tiger-powered website!
</p>
</div>
<div class="ecosystem-stats">
<h3>📊 Ecosystem Statistics</h3>
<div class="stats-grid">
<div class="stat-item">
<span class="stat-number"><?php echo count($plugins); ?></span>
<span class="stat-label">Active Plugins</span>
</div>
<div class="stat-item">
<span class="stat-number"><?php echo count($stats['capabilities']); ?></span>
<span class="stat-label">Total Capabilities</span>
</div>
<div class="stat-item">
<span class="stat-number"><?php echo $stats['coordinator_version']; ?></span>
<span class="stat-label">Coordinator Version</span>
</div>
<div class="stat-item">
<span class="stat-number"><?php echo human_time_diff($stats['last_sync']); ?> ago</span>
<span class="stat-label">Last Sync</span>
</div>
</div>
</div>
<h3>🔗 Plugin Ecosystem</h3>
<div class="ecosystem-grid">
<?php foreach ($plugins as $plugin_id => $plugin_data): ?>
<div class="ecosystem-card <?php echo ($plugin_data['role'] === 'coordinator') ? 'coordinator' : ''; ?>">
<h3><?php echo esc_html($plugin_data['name']); ?></h3>
<p>
<span class="plugin-status <?php echo ($plugin_data['role'] === 'coordinator') ? 'status-coordinator' : 'status-active'; ?>">
<?php echo esc_html(ucfirst($plugin_data['role'])); ?>
</span>
<span style="float: right; opacity: 0.7;">v<?php echo esc_html($plugin_data['version']); ?></span>
</p>
<div style="margin: 10px 0;">
<strong>Capabilities:</strong><br>
<?php foreach ($plugin_data['capabilities'] as $capability): ?>
<span class="capability-tag"><?php echo esc_html($capability); ?></span>
<?php endforeach; ?>
</div>
<small style="opacity: 0.7;">
Registered: <?php echo human_time_diff($plugin_data['registered_at']); ?> ago
</small>
<?php if ($plugin_id === 'heat'): ?>
<div style="margin-top: 15px; padding-top: 15px; border-top: 1px solid rgba(255,255,255,0.2);">
<strong>🔥 Coordination Status:</strong><br>
<small>Managing ecosystem communication, analytics consent, and cross-plugin preferences</small>
</div>
<?php endif; ?>
<?php if ($plugin_id === 'whiskers'): ?>
<div style="margin-top: 15px; padding-top: 15px; border-top: 1px solid #e9ecef;">
<strong>🐱 Privacy Integration:</strong><br>
<small>Analytics consent:
<?php
$coordinator_module = tigerstyle_heat()->get_module('google_setup');
if ($coordinator_module && method_exists($coordinator_module, 'inject_google_analytics')) {
echo '<span style="color: #28a745;">✓ Active</span>';
} else {
echo '<span style="color: #dc3545;">✗ Not configured</span>';
}
?>
</small>
</div>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<?php if (count($plugins) === 1): ?>
<div class="seo-info-box" style="background: #fff3cd; border-color: #ffeaa7;">
<h3>🚀 Expand Your TigerStyle Ecosystem!</h3>
<p>You currently have TigerStyle Heat managing your SEO. Consider adding other TigerStyle plugins for a complete website optimization suite:</p>
<ul>
<li><strong>🐱 TigerStyle Whiskers</strong> - GDPR compliance & privacy protection</li>
<li><strong>⚡ TigerStyle Dash</strong> - Performance & speed optimization</li>
<li><strong>💾 TigerStyle Life9</strong> - Backup & disaster recovery</li>
<li><strong>🔑 TigerStyle Scent</strong> - OAuth2 authorization & API access</li>
</ul>
</div>
<?php endif; ?>
<div class="seo-info-box">
<h3>🔧 Ecosystem Management</h3>
<p>Use the JavaScript console to interact with the ecosystem:</p>
<code>
// Check ecosystem status<br>
console.log(window.tigerstyleEcosystem);<br><br>
// Sync user preferences<br>
window.tigerstyleEcosystem.syncPreferences({theme: 'dark', notifications: 'enabled'});<br><br>
// Check plugin capabilities<br>
window.tigerstyleEcosystem.getPluginCapabilities('whiskers');
</code>
</div>
<?php
}
}