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(' '), 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'), ) )); } }