| @@ -7,8 +7,9 @@ | ||
| 7 | 7 | use Yatra\Shortcodes\MyAccountShortcode; |
| 8 | 8 | use Yatra\Shortcodes\TripShortcode; |
| 9 | 9 | use Yatra\Shortcodes\ActivityShortcode; |
| 10 | 10 | use Yatra\Shortcodes\DestinationShortcode; |
| 11 | +use Yatra\Shortcodes\TripCategoryShortcode; | |
| 11 | 12 | use Yatra\Shortcodes\DiscountAndDealsShortcode; |
| 12 | 13 | use Yatra\Shortcodes\SearchShortcode; |
| 13 | 14 | use Yatra\Shortcodes\LoginShortcode; |
| 14 | 15 | use Yatra\Ajax\TripShortcodeAjax; |
| @@ -13,8 +14,9 @@ | ||
| 13 | 14 | use Yatra\Shortcodes\LoginShortcode; |
| 14 | 15 | use Yatra\Ajax\TripShortcodeAjax; |
| 15 | 16 | use Yatra\Ajax\ActivityShortcodeAjax; |
| 16 | 17 | use Yatra\Ajax\DestinationShortcodeAjax; |
| 18 | +use Yatra\Ajax\TripCategoryShortcodeAjax; | |
| 17 | 19 | use Yatra\Ajax\DiscountShortcodeAjax; |
| 18 | 20 | use Yatra\Ajax\LoginAjax; |
| 19 | 21 | use Yatra\Ajax\GeocodingAjax; |
| 20 | 22 | |
| @@ -45,8 +47,9 @@ | ||
| 45 | 47 | $ajax_handlers = [ |
| 46 | 48 | 'TripShortcodeAjax', |
| 47 | 49 | 'ActivityShortcodeAjax', |
| 48 | 50 | 'DestinationShortcodeAjax', |
| 51 | + 'TripCategoryShortcodeAjax', | |
| 49 | 52 | 'DiscountShortcodeAjax', |
| 50 | 53 | 'LoginAjax', |
| 51 | 54 | 'GeocodingAjax', |
| 52 | 55 | 'DirectAttributeQuery', |
| @@ -58,18 +61,12 @@ | ||
| 58 | 61 | |
| 59 | 62 | if (class_exists($full_class_name)) { |
| 60 | 63 | new $full_class_name(); |
| 61 | 64 | } else { |
| 62 | - // Log error for debugging | |
| 63 | - if (defined('WP_DEBUG') && WP_DEBUG) { | |
| 64 | - error_log("Yatra ShortcodeServiceProvider: AJAX handler class {$full_class_name} not found"); | |
| 65 | - } | |
| 65 | + | |
| 66 | 66 | } |
| 67 | 67 | } catch (Exception $e) { |
| 68 | - // Log error for debugging | |
| 69 | - if (defined('WP_DEBUG') && WP_DEBUG) { | |
| 70 | - error_log("Yatra ShortcodeServiceProvider: Failed to register AJAX handler {$handler_class}: " . $e->getMessage()); | |
| 71 | - } | |
| 68 | + | |
| 72 | 69 | } |
| 73 | 70 | } |
| 74 | 71 | } |
| 75 | 72 | |
| @@ -82,8 +79,9 @@ | ||
| 82 | 79 | 'yatra_my_account' => MyAccountShortcode::class, |
| 83 | 80 | 'yatra_trip' => TripShortcode::class, |
| 84 | 81 | 'yatra_activity' => ActivityShortcode::class, |
| 85 | 82 | 'yatra_destination' => DestinationShortcode::class, |
| 83 | + 'yatra_trip_category' => TripCategoryShortcode::class, | |
| 86 | 84 | 'yatra_discount_and_deals' => DiscountAndDealsShortcode::class, |
| 87 | 85 | 'yatra_search' => SearchShortcode::class, |
| 88 | 86 | 'yatra_login' => LoginShortcode::class, |
| 89 | 87 | ]; |
| @@ -96,25 +94,16 @@ | ||
| 96 | 94 | // Validate that the shortcode class has the register method |
| 97 | 95 | if (method_exists($shortcode, 'register')) { |
| 98 | 96 | $shortcode->register(); |
| 99 | 97 | } else { |
| 100 | - // Log error for debugging | |
| 101 | - if (defined('WP_DEBUG') && WP_DEBUG) { | |
| 102 | - error_log("Yatra ShortcodeServiceProvider: Shortcode class {$class} missing register method"); | |
| 103 | - } | |
| 98 | + | |
| 104 | 99 | } |
| 105 | 100 | } else { |
| 106 | - // Log error for debugging | |
| 107 | - if (defined('WP_DEBUG') && WP_DEBUG) { | |
| 108 | - error_log("Yatra ShortcodeServiceProvider: Shortcode class {$class} not found"); | |
| 109 | - } | |
| 101 | + | |
| 110 | 102 | } |
| 111 | - } catch (Exception $e) { | |
| 103 | + } catch (\Exception $e) { | |
| 112 | 104 | // Log error for debugging |
| 113 | - if (defined('WP_DEBUG') && WP_DEBUG) { | |
| 114 | - error_log("Yatra ShortcodeServiceProvider: Failed to register shortcode {$tag}: " . $e->getMessage()); | |
| 115 | - } | |
| 116 | - | |
| 105 | + | |
| 117 | 106 | // Continue with other shortcodes even if one fails |
| 118 | 107 | continue; |
| 119 | 108 | } |
| 120 | 109 | } |