registerShortcodes(); // Register AJAX handlers with error handling $this->registerAjaxHandlers(); } /** * Register AJAX handlers with error handling and lazy loading */ private function registerAjaxHandlers(): void { $ajax_handlers = [ 'TripShortcodeAjax', 'ActivityShortcodeAjax', 'DestinationShortcodeAjax', 'TripCategoryShortcodeAjax', 'DiscountShortcodeAjax', 'LoginAjax', 'GeocodingAjax', 'DirectAttributeQuery', ]; foreach ($ajax_handlers as $handler_class) { try { $full_class_name = "\\Yatra\\Ajax\\{$handler_class}"; if (class_exists($full_class_name)) { new $full_class_name(); } else { } } catch (Exception $e) { } } } /** * Register all shortcodes with production optimizations */ public function registerShortcodes(): void { $shortcodes = [ 'yatra_my_account' => MyAccountShortcode::class, 'yatra_trip' => TripShortcode::class, 'yatra_activity' => ActivityShortcode::class, 'yatra_destination' => DestinationShortcode::class, 'yatra_trip_category' => TripCategoryShortcode::class, 'yatra_discount_and_deals' => DiscountAndDealsShortcode::class, 'yatra_search' => SearchShortcode::class, 'yatra_login' => LoginShortcode::class, ]; foreach ($shortcodes as $tag => $class) { try { if (class_exists($class)) { $shortcode = new $class(); // Validate that the shortcode class has the register method if (method_exists($shortcode, 'register')) { $shortcode->register(); } else { } } else { } } catch (\Exception $e) { // Log error for debugging // Continue with other shortcodes even if one fails continue; } } } }