post_content, 'hvac_trainer_dashboard')) { return true; } return false; } /** * Check if current page is a trainer page */ private static function is_trainer_page() { $current_url = $_SERVER['REQUEST_URI'] ?? ''; $trainer_patterns = [ '/trainer/', '/master-trainer/', '/training-login/', '/trainer-registration/' ]; foreach ($trainer_patterns as $pattern) { if (strpos($current_url, $pattern) !== false) { return true; } } return false; } /** * Check if current page is a TEC Community Events page */ private static function is_tec_community_page() { $current_url = $_SERVER['REQUEST_URI'] ?? ''; $tec_patterns = [ '/events/community/', '/events/network/', '/community/events/', 'event_id=', 'tribe-community-events' ]; foreach ($tec_patterns as $pattern) { if (strpos($current_url, $pattern) !== false) { return true; } } // Check if TEC Community Events is active on this 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 a registration page */ private static function is_registration_page() { global $post; if ($post) { // Check if page uses registration template $template = get_page_template_slug($post->ID); if (strpos($template, 'registration') !== false) { return true; } // Check page content for registration forms if (has_shortcode($post->post_content, 'hvac_registration_form')) { return true; } } return false; } /** * Get compatibility status for debugging */ public static function get_compatibility_status() { return [ 'jquery_loaded' => wp_script_is('jquery', 'done'), 'compatibility_fix_loaded' => wp_script_is('hvac-jquery-compatibility-fix', 'done'), 'should_load' => self::should_load_compatibility_scripts(), 'is_trainer_page' => self::is_trainer_page(), 'is_tec_page' => self::is_tec_community_page(), 'is_registration_page' => self::is_registration_page(), 'current_url' => $_SERVER['REQUEST_URI'] ?? '' ]; } } // Initialize the compatibility system HVAC_jQuery_Compatibility::init();