- Add comprehensive Training Leads system for HVAC trainers * New /trainer/training-leads/ page with tabular contact submission display * HVAC_Training_Leads class with AJAX status updates and filtering * Empty state messaging and profile sharing CTA * Database integration with existing contact forms system - Restructure trainer navigation menu for better UX * Rename "Customize" to "Profile" with logical groupings * Move "Logout" under "Profile" submenu * Change "Personal Profile" to "Trainer Profile" * Add "Training Leads" under Profile section * Update help menu to show only question mark icon positioned far right - Enhance documentation system * Fix /trainer/documentation/ page styling and navigation integration * Update content to reflect current platform features * Add Training Leads documentation and navigation guide * Implement proper WordPress template structure - Update user management * Change joe@upskillhvac.com display name to "Joe Medosch" * Assign Joe as author of measureQuick headquarters venue * Assign Joe as author of measureQuick and Upskill HVAC organizers 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
		
			
				
	
	
		
			684 lines
		
	
	
		
			No EOL
		
	
	
		
			21 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			684 lines
		
	
	
		
			No EOL
		
	
	
		
			21 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| /**
 | |
|  * HVAC Scripts and Styles Manager
 | |
|  *
 | |
|  * Centralized management of all plugin scripts and styles
 | |
|  *
 | |
|  * @package HVAC_Community_Events
 | |
|  * @since 2.0.0
 | |
|  */
 | |
| 
 | |
| if (!defined('ABSPATH')) {
 | |
|     exit;
 | |
| }
 | |
| 
 | |
| /**
 | |
|  * HVAC_Scripts_Styles class
 | |
|  */
 | |
| class HVAC_Scripts_Styles {
 | |
|     
 | |
|     /**
 | |
|      * Instance
 | |
|      * 
 | |
|      * @var HVAC_Scripts_Styles
 | |
|      */
 | |
|     private static $instance = null;
 | |
|     
 | |
|     /**
 | |
|      * Script version for cache busting
 | |
|      * 
 | |
|      * @var string
 | |
|      */
 | |
|     private $version;
 | |
|     
 | |
|     /**
 | |
|      * Get instance
 | |
|      * 
 | |
|      * @return HVAC_Scripts_Styles
 | |
|      */
 | |
|     public static function instance() {
 | |
|         if (null === self::$instance) {
 | |
|             self::$instance = new self();
 | |
|         }
 | |
|         return self::$instance;
 | |
|     }
 | |
|     
 | |
|     /**
 | |
|      * Constructor
 | |
|      */
 | |
|     private function __construct() {
 | |
|         $this->version = HVAC_PLUGIN_VERSION;
 | |
|         $this->init_hooks();
 | |
|     }
 | |
|     
 | |
|     /**
 | |
|      * Initialize hooks
 | |
|      * 
 | |
|      * @return void
 | |
|      */
 | |
|     private function init_hooks() {
 | |
|         // Frontend scripts and styles
 | |
|         add_action('wp_enqueue_scripts', array($this, 'enqueue_frontend_assets'));
 | |
|         
 | |
|         // Admin scripts and styles
 | |
|         add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_assets'));
 | |
|         
 | |
|         // Login page scripts and styles
 | |
|         add_action('login_enqueue_scripts', array($this, 'enqueue_login_assets'));
 | |
|     }
 | |
|     
 | |
|     /**
 | |
|      * Enqueue frontend assets
 | |
|      * 
 | |
|      * @return void
 | |
|      */
 | |
|     public function enqueue_frontend_assets() {
 | |
|         // Only enqueue on plugin pages
 | |
|         if (!$this->is_plugin_page()) {
 | |
|             return;
 | |
|         }
 | |
|         
 | |
|         // Main plugin styles - load on ALL plugin pages
 | |
|         wp_enqueue_style(
 | |
|             'hvac-community-events',
 | |
|             HVAC_PLUGIN_URL . 'assets/css/hvac-community-events.css',
 | |
|             array(),
 | |
|             $this->version
 | |
|         );
 | |
|         
 | |
|         // Page templates styles - ensures proper layout for all HVAC pages
 | |
|         wp_enqueue_style(
 | |
|             'hvac-page-templates',
 | |
|             HVAC_PLUGIN_URL . 'assets/css/hvac-page-templates.css',
 | |
|             array(),
 | |
|             $this->version
 | |
|         );
 | |
|         
 | |
|         // Layout styles - ensure proper container width and padding
 | |
|         wp_enqueue_style(
 | |
|             'hvac-layout',
 | |
|             HVAC_PLUGIN_URL . 'assets/css/hvac-layout.css',
 | |
|             array('hvac-community-events'),
 | |
|             $this->version
 | |
|         );
 | |
|         
 | |
|         // Common styles for all trainer pages - ensures consistent styling
 | |
|         wp_enqueue_style(
 | |
|             'hvac-common',
 | |
|             HVAC_PLUGIN_URL . 'assets/css/hvac-common.css',
 | |
|             array(),
 | |
|             $this->version
 | |
|         );
 | |
|         
 | |
|         // Dashboard styles
 | |
|         if ($this->is_dashboard_page()) {
 | |
|             wp_enqueue_style(
 | |
|                 'hvac-dashboard',
 | |
|                 HVAC_PLUGIN_URL . 'assets/css/hvac-dashboard.css',
 | |
|                 array('hvac-community-events'),
 | |
|                 $this->version
 | |
|             );
 | |
|             
 | |
|             wp_enqueue_style(
 | |
|                 'hvac-dashboard-enhanced',
 | |
|                 HVAC_PLUGIN_URL . 'assets/css/hvac-dashboard-enhanced.css',
 | |
|                 array('hvac-dashboard'),
 | |
|                 $this->version
 | |
|             );
 | |
|         }
 | |
|         
 | |
|         // Registration styles
 | |
|         if ($this->is_registration_page()) {
 | |
|             wp_enqueue_style(
 | |
|                 'hvac-registration',
 | |
|                 HVAC_PLUGIN_URL . 'assets/css/hvac-registration.css',
 | |
|                 array('hvac-community-events'),
 | |
|                 $this->version
 | |
|             );
 | |
|         }
 | |
|         
 | |
|         // Communication templates styles
 | |
|         if ($this->is_communication_page()) {
 | |
|             wp_enqueue_style(
 | |
|                 'communication-templates',
 | |
|                 HVAC_PLUGIN_URL . 'assets/css/communication-templates.css',
 | |
|                 array('hvac-community-events'),
 | |
|                 $this->version
 | |
|             );
 | |
|         }
 | |
|         
 | |
|         // Certificate pages styles
 | |
|         if ($this->is_certificate_page()) {
 | |
|             wp_enqueue_style(
 | |
|                 'hvac-certificates',
 | |
|                 HVAC_PLUGIN_URL . 'assets/css/hvac-certificates.css',
 | |
|                 array('hvac-community-events'),
 | |
|                 $this->version
 | |
|             );
 | |
|             
 | |
|             wp_enqueue_style(
 | |
|                 'hvac-certificates-enhanced',
 | |
|                 HVAC_PLUGIN_URL . 'assets/css/hvac-certificates-enhanced.css',
 | |
|                 array('hvac-certificates'),
 | |
|                 $this->version
 | |
|             );
 | |
|             
 | |
|             // Load specific certificate page styles
 | |
|             if (strpos($_SERVER['REQUEST_URI'], 'certificate-reports') !== false) {
 | |
|                 wp_enqueue_style(
 | |
|                     'hvac-certificate-reports',
 | |
|                     HVAC_PLUGIN_URL . 'assets/css/hvac-certificate-reports.css',
 | |
|                     array('hvac-certificates'),
 | |
|                     $this->version
 | |
|                 );
 | |
|             }
 | |
|             
 | |
|             if (strpos($_SERVER['REQUEST_URI'], 'generate-certificates') !== false) {
 | |
|                 wp_enqueue_style(
 | |
|                     'hvac-generate-certificates',
 | |
|                     HVAC_PLUGIN_URL . 'assets/css/hvac-generate-certificates.css',
 | |
|                     array('hvac-certificates'),
 | |
|                     $this->version
 | |
|                 );
 | |
|             }
 | |
|         }
 | |
|         
 | |
|         // Organizers pages styles
 | |
|         if ($this->is_organizers_page()) {
 | |
|             wp_enqueue_style(
 | |
|                 'hvac-organizers',
 | |
|                 HVAC_PLUGIN_URL . 'assets/css/hvac-organizers.css',
 | |
|                 array('hvac-community-events'),
 | |
|                 $this->version
 | |
|             );
 | |
|         }
 | |
|         
 | |
|         // Venues pages styles
 | |
|         if ($this->is_venues_page()) {
 | |
|             wp_enqueue_style(
 | |
|                 'hvac-venues',
 | |
|                 HVAC_PLUGIN_URL . 'assets/css/hvac-venues.css',
 | |
|                 array('hvac-community-events'),
 | |
|                 $this->version
 | |
|             );
 | |
|         }
 | |
|         
 | |
|         // Trainer profile pages styles
 | |
|         if ($this->is_trainer_profile_page()) {
 | |
|             wp_enqueue_style(
 | |
|                 'hvac-trainer-profile',
 | |
|                 HVAC_PLUGIN_URL . 'assets/css/hvac-trainer-profile.css',
 | |
|                 array('hvac-community-events'),
 | |
|                 $this->version
 | |
|             );
 | |
|             
 | |
|             // Profile sharing styles - includes modal and QR code display
 | |
|             wp_enqueue_style(
 | |
|                 'hvac-profile-sharing',
 | |
|                 HVAC_PLUGIN_URL . 'assets/css/hvac-profile-sharing.css',
 | |
|                 array('hvac-trainer-profile'),
 | |
|                 $this->version
 | |
|             );
 | |
|         }
 | |
|         
 | |
|         // Event manage page styles
 | |
|         if ($this->is_event_manage_page()) {
 | |
|             // First ensure common CSS is loaded
 | |
|             wp_enqueue_style(
 | |
|                 'hvac-common',
 | |
|                 HVAC_PLUGIN_URL . 'assets/css/hvac-common.css',
 | |
|                 array(),
 | |
|                 $this->version
 | |
|             );
 | |
|             
 | |
|             // Then dashboard CSS
 | |
|             wp_enqueue_style(
 | |
|                 'hvac-dashboard',
 | |
|                 HVAC_PLUGIN_URL . 'assets/css/hvac-dashboard.css',
 | |
|                 array('hvac-community-events', 'hvac-common'),
 | |
|                 $this->version
 | |
|             );
 | |
|             
 | |
|             // Layout CSS for proper container styling
 | |
|             wp_enqueue_style(
 | |
|                 'hvac-layout',
 | |
|                 HVAC_PLUGIN_URL . 'assets/css/hvac-layout.css',
 | |
|                 array('hvac-community-events'),
 | |
|                 $this->version
 | |
|             );
 | |
|             
 | |
|             // Finally event manage CSS
 | |
|             wp_enqueue_style(
 | |
|                 'hvac-event-manage',
 | |
|                 HVAC_PLUGIN_URL . 'assets/css/hvac-event-manage.css',
 | |
|                 array('hvac-community-events', 'hvac-common', 'hvac-dashboard', 'hvac-layout'),
 | |
|                 $this->version
 | |
|             );
 | |
|         }
 | |
|         
 | |
|         // Main plugin scripts
 | |
|         wp_enqueue_script(
 | |
|             'hvac-community-events',
 | |
|             HVAC_PLUGIN_URL . 'assets/js/hvac-community-events.js',
 | |
|             array('jquery'),
 | |
|             $this->version,
 | |
|             true
 | |
|         );
 | |
|         
 | |
|         // Dashboard scripts
 | |
|         if ($this->is_dashboard_page()) {
 | |
|             wp_enqueue_script(
 | |
|                 'hvac-dashboard',
 | |
|                 HVAC_PLUGIN_URL . 'assets/js/hvac-dashboard.js',
 | |
|                 array('jquery', 'hvac-community-events'),
 | |
|                 $this->version,
 | |
|                 true
 | |
|             );
 | |
|             
 | |
|             wp_enqueue_script(
 | |
|                 'hvac-dashboard-enhanced',
 | |
|                 HVAC_PLUGIN_URL . 'assets/js/hvac-dashboard-enhanced.js',
 | |
|                 array('hvac-dashboard'),
 | |
|                 $this->version,
 | |
|                 true
 | |
|             );
 | |
|         }
 | |
|         
 | |
|         // Registration scripts
 | |
|         if ($this->is_registration_page()) {
 | |
|             wp_enqueue_script(
 | |
|                 'hvac-registration',
 | |
|                 HVAC_PLUGIN_URL . 'assets/js/hvac-registration.js',
 | |
|                 array('jquery', 'hvac-community-events'),
 | |
|                 $this->version,
 | |
|                 true
 | |
|             );
 | |
|         }
 | |
|         
 | |
|         // Trainer profile scripts
 | |
|         if ($this->is_trainer_profile_page()) {
 | |
|             wp_enqueue_script(
 | |
|                 'hvac-profile-sharing',
 | |
|                 HVAC_PLUGIN_URL . 'assets/js/hvac-profile-sharing.js',
 | |
|                 array('jquery', 'hvac-community-events'),
 | |
|                 $this->version,
 | |
|                 true
 | |
|             );
 | |
|         }
 | |
|         
 | |
|         // Help system scripts
 | |
|         wp_enqueue_script(
 | |
|             'hvac-help-system',
 | |
|             HVAC_PLUGIN_URL . 'assets/js/hvac-help-system.js',
 | |
|             array('jquery'),
 | |
|             $this->version,
 | |
|             true
 | |
|         );
 | |
|         
 | |
|         // Localize main script
 | |
|         wp_localize_script('hvac-community-events', 'hvac_ajax', array(
 | |
|             'ajax_url' => admin_url('admin-ajax.php'),
 | |
|             'nonce' => wp_create_nonce('hvac_ajax_nonce'),
 | |
|             'is_logged_in' => is_user_logged_in(),
 | |
|             'plugin_url' => HVAC_PLUGIN_URL,
 | |
|         ));
 | |
|         
 | |
|         // Localize dashboard script
 | |
|         if ($this->is_dashboard_page()) {
 | |
|             wp_localize_script('hvac-dashboard', 'hvac_dashboard', array(
 | |
|                 'ajax_url' => admin_url('admin-ajax.php'),
 | |
|                 'nonce' => wp_create_nonce('hvac_dashboard_nonce'),
 | |
|                 'strings' => array(
 | |
|                     'loading' => __('Loading...', 'hvac-community-events'),
 | |
|                     'error' => __('An error occurred. Please try again.', 'hvac-community-events'),
 | |
|                 ),
 | |
|             ));
 | |
|         }
 | |
|         
 | |
|         // Localize profile sharing script
 | |
|         if ($this->is_trainer_profile_page()) {
 | |
|             wp_localize_script('hvac-profile-sharing', 'hvac_sharing', array(
 | |
|                 'ajax_url' => admin_url('admin-ajax.php'),
 | |
|                 'nonce' => wp_create_nonce('hvac_profile_sharing'),
 | |
|                 'strings' => array(
 | |
|                     'loading' => __('Loading...', 'hvac-community-events'),
 | |
|                     'error' => __('An error occurred. Please try again.', 'hvac-community-events'),
 | |
|                     'copied' => __('Copied to clipboard!', 'hvac-community-events'),
 | |
|                     'copy_error' => __('Unable to copy. Please select and copy manually.', 'hvac-community-events'),
 | |
|                     'loading_error' => __('Unable to load profile card. Please try again.', 'hvac-community-events')
 | |
|                 ),
 | |
|             ));
 | |
|         }
 | |
|     }
 | |
|     
 | |
|     /**
 | |
|      * Enqueue admin assets
 | |
|      * 
 | |
|      * @param string $hook Current admin page hook
 | |
|      * @return void
 | |
|      */
 | |
|     public function enqueue_admin_assets($hook) {
 | |
|         // Global admin styles
 | |
|         wp_enqueue_style(
 | |
|             'hvac-admin',
 | |
|             HVAC_PLUGIN_URL . 'assets/css/hvac-admin.css',
 | |
|             array(),
 | |
|             $this->version
 | |
|         );
 | |
|         
 | |
|         // Global admin scripts
 | |
|         wp_enqueue_script(
 | |
|             'hvac-admin',
 | |
|             HVAC_PLUGIN_URL . 'assets/js/hvac-admin.js',
 | |
|             array('jquery'),
 | |
|             $this->version . '.2', // Force cache refresh for jQuery fix
 | |
|             true
 | |
|         );
 | |
|         
 | |
|         // Localize admin script
 | |
|         wp_localize_script('hvac-admin', 'hvac_admin', array(
 | |
|             'ajax_url' => admin_url('admin-ajax.php'),
 | |
|             'nonce' => wp_create_nonce('hvac_admin_nonce'),
 | |
|         ));
 | |
|         
 | |
|         // Plugin-specific admin pages
 | |
|         if (strpos($hook, 'hvac-community-events') !== false) {
 | |
|             // Add any additional plugin-specific admin assets here
 | |
|         }
 | |
|         
 | |
|         // Certificate admin scripts
 | |
|         if (strpos($hook, 'certificate') !== false) {
 | |
|             wp_enqueue_script(
 | |
|                 'hvac-certificate-admin',
 | |
|                 HVAC_PLUGIN_URL . 'assets/js/hvac-certificate-admin.js',
 | |
|                 array('jquery'),
 | |
|                 $this->version,
 | |
|                 true
 | |
|             );
 | |
|         }
 | |
|     }
 | |
|     
 | |
|     /**
 | |
|      * Enqueue login page assets
 | |
|      * 
 | |
|      * @return void
 | |
|      */
 | |
|     public function enqueue_login_assets() {
 | |
|         // Check if we're on the custom login page
 | |
|         if (!$this->is_custom_login_page()) {
 | |
|             return;
 | |
|         }
 | |
|         
 | |
|         wp_enqueue_style(
 | |
|             'hvac-login',
 | |
|             HVAC_PLUGIN_URL . 'assets/css/hvac-login.css',
 | |
|             array(),
 | |
|             $this->version
 | |
|         );
 | |
|         
 | |
|         wp_enqueue_script(
 | |
|             'hvac-login',
 | |
|             HVAC_PLUGIN_URL . 'assets/js/hvac-login.js',
 | |
|             array('jquery'),
 | |
|             $this->version,
 | |
|             true
 | |
|         );
 | |
|     }
 | |
|     
 | |
|     /**
 | |
|      * Check if current page is a plugin page
 | |
|      * 
 | |
|      * @return bool
 | |
|      */
 | |
|     private function is_plugin_page() {
 | |
|         // Check if we're in a page template context
 | |
|         if (defined('HVAC_IN_PAGE_TEMPLATE') && HVAC_IN_PAGE_TEMPLATE) {
 | |
|             return true;
 | |
|         }
 | |
|         
 | |
|         // Check using template loader if available
 | |
|         if (class_exists('HVAC_Template_Loader')) {
 | |
|             return HVAC_Template_Loader::is_plugin_template();
 | |
|         }
 | |
|         
 | |
|         // Check by page template
 | |
|         if (is_page_template()) {
 | |
|             $template = get_page_template_slug();
 | |
|             if (strpos($template, 'page-trainer') !== false || 
 | |
|                 strpos($template, 'page-master') !== false ||
 | |
|                 strpos($template, 'page-certificate') !== false ||
 | |
|                 strpos($template, 'page-generate') !== false ||
 | |
|                 strpos($template, 'page-manage-event') !== false) {
 | |
|                 return true;
 | |
|             }
 | |
|         }
 | |
|         
 | |
|         // Fallback: check URL path (more comprehensive)
 | |
|         $current_path = trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/');
 | |
|         $plugin_paths = array(
 | |
|             'trainer',
 | |
|             'master-trainer',
 | |
|             'training-login',
 | |
|             'hvac-dashboard',
 | |
|             'manage-event',
 | |
|             'event-summary',
 | |
|             'certificate-reports',
 | |
|             'generate-certificates',
 | |
|         );
 | |
|         
 | |
|         foreach ($plugin_paths as $path) {
 | |
|             if (strpos($current_path, $path) !== false) {
 | |
|                 return true;
 | |
|             }
 | |
|         }
 | |
|         
 | |
|         return false;
 | |
|     }
 | |
|     
 | |
|     /**
 | |
|      * Check if current page is a dashboard page
 | |
|      * 
 | |
|      * @return bool
 | |
|      */
 | |
|     private function is_dashboard_page() {
 | |
|         // Check by page slug
 | |
|         $dashboard_pages = array(
 | |
|             'trainer-dashboard',
 | |
|             'master-dashboard',
 | |
|             'hvac-dashboard',
 | |
|             'trainer/dashboard',
 | |
|             'master-trainer/dashboard',
 | |
|             'master-trainer/master-dashboard',
 | |
|             'trainer/event/manage',
 | |
|             'manage-event',
 | |
|             'trainer/certificate-reports',
 | |
|             'trainer/generate-certificates'
 | |
|         );
 | |
|         
 | |
|         foreach ($dashboard_pages as $page_slug) {
 | |
|             if (is_page($page_slug)) {
 | |
|                 return true;
 | |
|             }
 | |
|         }
 | |
|         
 | |
|         // Also check URL path as fallback
 | |
|         $current_path = trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/');
 | |
|         $dashboard_paths = array(
 | |
|             'trainer/dashboard',
 | |
|             'master-trainer/dashboard',
 | |
|             'master-trainer/master-dashboard',
 | |
|             'trainer/event/manage',
 | |
|             'manage-event',
 | |
|             'trainer/certificate-reports',
 | |
|             'trainer/generate-certificates'
 | |
|         );
 | |
|         
 | |
|         foreach ($dashboard_paths as $path) {
 | |
|             if (strpos($current_path, $path) !== false) {
 | |
|                 return true;
 | |
|             }
 | |
|         }
 | |
|         
 | |
|         // Check if this is a community events submission page
 | |
|         if (function_exists('tribe_is_community_edit_event_page') && tribe_is_community_edit_event_page()) {
 | |
|             return true;
 | |
|         }
 | |
|         
 | |
|         if (function_exists('tribe_is_community_my_events_page') && tribe_is_community_my_events_page()) {
 | |
|             return true;
 | |
|         }
 | |
|         
 | |
|         return false;
 | |
|     }
 | |
|     
 | |
|     /**
 | |
|      * Check if current page is registration page
 | |
|      * 
 | |
|      * @return bool
 | |
|      */
 | |
|     private function is_registration_page() {
 | |
|         return is_page('trainer-registration') ||
 | |
|                is_page('trainer/registration');
 | |
|     }
 | |
|     
 | |
|     /**
 | |
|      * Check if current page is communication page
 | |
|      * 
 | |
|      * @return bool
 | |
|      */
 | |
|     private function is_communication_page() {
 | |
|         return is_page('communication-templates') ||
 | |
|                is_page('trainer/communication-templates') ||
 | |
|                is_page('communication-schedules') ||
 | |
|                is_page('trainer/communication-schedules');
 | |
|     }
 | |
|     
 | |
|     /**
 | |
|      * Check if current page is event manage page
 | |
|      * 
 | |
|      * @return bool
 | |
|      */
 | |
|     private function is_event_manage_page() {
 | |
|         // Check by page ID (most reliable)
 | |
|         global $post;
 | |
|         if ($post && $post->ID == 5344) { // Event manage page ID
 | |
|             return true;
 | |
|         }
 | |
|         
 | |
|         // Check by page slug
 | |
|         if (is_page('manage') || is_page('trainer/event/manage') || is_page('manage-event') || is_page('trainer-event-manage')) {
 | |
|             return true;
 | |
|         }
 | |
|         
 | |
|         // Check by page template
 | |
|         if (is_page_template('page-manage-event.php')) {
 | |
|             return true;
 | |
|         }
 | |
|         
 | |
|         // Check URL path
 | |
|         $current_path = trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/');
 | |
|         if ($current_path === 'trainer/event/manage' || $current_path === 'trainer/event/manage/') {
 | |
|             return true;
 | |
|         }
 | |
|         
 | |
|         // Check if this is a community events submission page
 | |
|         if (function_exists('tribe_is_community_edit_event_page') && tribe_is_community_edit_event_page()) {
 | |
|             return true;
 | |
|         }
 | |
|         
 | |
|         return false;
 | |
|     }
 | |
|     
 | |
|     /**
 | |
|      * Check if current page is custom login page
 | |
|      * 
 | |
|      * @return bool
 | |
|      */
 | |
|     private function is_custom_login_page() {
 | |
|         return is_page('training-login') ||
 | |
|                is_page('community-login') ||
 | |
|                is_page('trainer/login');
 | |
|     }
 | |
|     
 | |
|     /**
 | |
|      * Check if current page is certificate page
 | |
|      * 
 | |
|      * @return bool
 | |
|      */
 | |
|     private function is_certificate_page() {
 | |
|         return is_page('certificate-reports') ||
 | |
|                is_page('trainer/certificate-reports') ||
 | |
|                is_page('generate-certificates') ||
 | |
|                is_page('trainer/generate-certificates') ||
 | |
|                strpos($_SERVER['REQUEST_URI'], 'certificate-reports') !== false ||
 | |
|                strpos($_SERVER['REQUEST_URI'], 'generate-certificates') !== false;
 | |
|     }
 | |
|     
 | |
|     /**
 | |
|      * Check if current page is organizers page
 | |
|      * 
 | |
|      * @return bool
 | |
|      */
 | |
|     private function is_organizers_page() {
 | |
|         return is_page('trainer-organizers-list') ||
 | |
|                is_page('trainer/organizer/list') ||
 | |
|                is_page('trainer-organizer-manage') ||
 | |
|                is_page('trainer/organizer/manage') ||
 | |
|                strpos($_SERVER['REQUEST_URI'], 'organizer') !== false;
 | |
|     }
 | |
|     
 | |
|     /**
 | |
|      * Check if current page is venues page
 | |
|      * 
 | |
|      * @return bool
 | |
|      */
 | |
|     private function is_venues_page() {
 | |
|         return is_page('trainer-venues-list') ||
 | |
|                is_page('trainer/venue/list') ||
 | |
|                is_page('trainer-venue-manage') ||
 | |
|                is_page('trainer/venue/manage') ||
 | |
|                strpos($_SERVER['REQUEST_URI'], 'venue') !== false;
 | |
|     }
 | |
|     
 | |
|     /**
 | |
|      * Check if current page is a trainer profile page
 | |
|      * 
 | |
|      * @return bool
 | |
|      */
 | |
|     private function is_trainer_profile_page() {
 | |
|         return is_page('trainer/profile') ||
 | |
|                is_page('trainer/profile/edit') ||
 | |
|                is_page('trainer/my-profile') ||
 | |
|                strpos($_SERVER['REQUEST_URI'], '/trainer/profile') !== false;
 | |
|     }
 | |
|     
 | |
|     /**
 | |
|      * Get script version with cache busting
 | |
|      * 
 | |
|      * @param string $file File path
 | |
|      * @return string
 | |
|      */
 | |
|     public function get_asset_version($file = '') {
 | |
|         // In development, use file modification time
 | |
|         if (defined('WP_DEBUG') && WP_DEBUG && $file) {
 | |
|             $file_path = HVAC_PLUGIN_DIR . $file;
 | |
|             if (file_exists($file_path)) {
 | |
|                 return filemtime($file_path);
 | |
|             }
 | |
|         }
 | |
|         
 | |
|         return $this->version;
 | |
|     }
 | |
|     
 | |
|     /**
 | |
|      * Localize sharing data for profile pages
 | |
|      * 
 | |
|      * @param array $data Sharing data to localize
 | |
|      * @return void
 | |
|      */
 | |
|     public function localize_sharing_data($data) {
 | |
|         if ($this->is_trainer_profile_page() && wp_script_is('hvac-profile-sharing', 'enqueued')) {
 | |
|             wp_localize_script('hvac-profile-sharing', 'hvac_sharing_data', $data);
 | |
|         }
 | |
|     }
 | |
| } |