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.
137 lines
4.5 KiB
PHP
137 lines
4.5 KiB
PHP
<?php
|
|
/**
|
|
* Admin functionality for TigerStyle Heat
|
|
*/
|
|
|
|
// Prevent direct access
|
|
if (!defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
class TigerStyleSEO_Admin {
|
|
|
|
/**
|
|
* Single instance
|
|
*/
|
|
private static $instance = null;
|
|
|
|
/**
|
|
* Get instance
|
|
*/
|
|
public static function instance() {
|
|
if (is_null(self::$instance)) {
|
|
self::$instance = new self();
|
|
}
|
|
return self::$instance;
|
|
}
|
|
|
|
/**
|
|
* Constructor
|
|
*/
|
|
private function __construct() {
|
|
error_log('TigerStyle Heat: Admin class constructor called');
|
|
error_log('TigerStyle Heat: is_admin() = ' . (is_admin() ? 'true' : 'false'));
|
|
error_log('TigerStyle Heat: current_user_can(manage_options) = ' . (current_user_can('manage_options') ? 'true' : 'false'));
|
|
$this->init();
|
|
}
|
|
|
|
/**
|
|
* Initialize admin functionality
|
|
*/
|
|
private function init() {
|
|
error_log('TigerStyle Heat: Admin init() method called');
|
|
add_action('admin_menu', array($this, 'add_admin_menu'));
|
|
add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
|
|
error_log('TigerStyle Heat: Admin hooks registered');
|
|
|
|
// Initialize admin pages
|
|
TigerStyleSEO_Admin_Pages::instance();
|
|
error_log('TigerStyle Heat: Admin pages initialized');
|
|
}
|
|
|
|
/**
|
|
* Add admin menu
|
|
*/
|
|
public function add_admin_menu() {
|
|
// Debug log to verify this function is being called
|
|
error_log('TigerStyle Heat: add_admin_menu called');
|
|
|
|
$hook = add_menu_page(
|
|
__('TigerStyle Heat Settings', 'tigerstyle-heat'),
|
|
__('TigerStyle Heat', 'tigerstyle-heat'),
|
|
'manage_options',
|
|
'tigerstyle-heat',
|
|
array($this, 'admin_page'),
|
|
'data:image/svg+xml;base64,' . base64_encode('
|
|
<svg viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
|
<!-- Tiger head -->
|
|
<ellipse cx="12" cy="13" rx="7" ry="6" fill="currentColor" opacity="0.9"/>
|
|
<!-- Tiger ears -->
|
|
<ellipse cx="8" cy="8" rx="2" ry="3" fill="currentColor"/>
|
|
<ellipse cx="16" cy="8" rx="2" ry="3" fill="currentColor"/>
|
|
<!-- Tiger eyes -->
|
|
<circle cx="9.5" cy="11" r="1" fill="currentColor"/>
|
|
<circle cx="14.5" cy="11" r="1" fill="currentColor"/>
|
|
<!-- Tiger nose -->
|
|
<ellipse cx="12" cy="13.5" rx="0.8" ry="0.5" fill="currentColor"/>
|
|
<!-- Tiger stripes -->
|
|
<path d="M7 10 L9 12 M15 10 L17 12 M6 13 L8 15 M16 13 L18 15" stroke="currentColor" stroke-width="0.8" fill="none"/>
|
|
</svg>'),
|
|
25
|
|
);
|
|
|
|
// Debug log to verify menu was added
|
|
error_log('TigerStyle Heat: add_menu_page returned: ' . ($hook ? $hook : 'false'));
|
|
}
|
|
|
|
/**
|
|
* Render admin page
|
|
*/
|
|
public function admin_page() {
|
|
TigerStyleSEO_Admin_Pages::render_main_page();
|
|
}
|
|
|
|
/**
|
|
* Enqueue admin scripts and styles
|
|
*/
|
|
public function enqueue_admin_scripts($hook) {
|
|
// Debug log to check what hook we're getting
|
|
error_log('TigerStyle Heat: enqueue_admin_scripts called with hook: ' . $hook);
|
|
|
|
// Only load on our admin page
|
|
if ('toplevel_page_tigerstyle-heat' !== $hook) {
|
|
error_log('TigerStyle Heat: Scripts NOT enqueued - hook mismatch');
|
|
return;
|
|
}
|
|
|
|
error_log('TigerStyle Heat: Scripts being enqueued');
|
|
|
|
wp_enqueue_script(
|
|
'tigerstyle-heat-admin',
|
|
TIGERSTYLE_HEAT_PLUGIN_URL . 'assets/js/admin.js',
|
|
array('jquery'),
|
|
TIGERSTYLE_HEAT_VERSION,
|
|
true
|
|
);
|
|
|
|
wp_enqueue_style(
|
|
'tigerstyle-heat-admin',
|
|
TIGERSTYLE_HEAT_PLUGIN_URL . 'assets/css/admin.css',
|
|
array(),
|
|
TIGERSTYLE_HEAT_VERSION
|
|
);
|
|
|
|
// Localize script for AJAX
|
|
wp_localize_script('tigerstyle-heat-admin', 'tigerstyleSEO', array(
|
|
'ajaxurl' => admin_url('admin-ajax.php'),
|
|
'nonce' => wp_create_nonce('tigerstyle_heat_nonce'),
|
|
'cache_analysis_nonce' => wp_create_nonce('tigerstyle_cache_analysis'),
|
|
'ai_nonce' => wp_create_nonce('tigerstyle_ai_nonce'),
|
|
'strings' => array(
|
|
'runningAnalysis' => __('Running Analysis...', 'tigerstyle-heat'),
|
|
'analysisFailed' => __('Analysis failed. Please try again.', 'tigerstyle-heat'),
|
|
'networkError' => __('Network error. Please try again.', 'tigerstyle-heat'),
|
|
)
|
|
));
|
|
}
|
|
} |