PluginProbe
Yatra – Travel Booking & Tour Operator Software / trunk
Yatra – Travel Booking & Tour Operator Software vtrunk
3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 2.0.10 2.0.11 All 82 releases
← All changes | app/Shortcodes/LoginShortcode.php +16 -2 3.0.5trunk View file →
@@ -66,8 +66,10 @@
66 66 // Localize script for AJAX with security and debugging
67 67 wp_localize_script('yatra-login-shortcode', 'yatra_ajax', [
68 68 'ajax_url' => admin_url('admin-ajax.php'),
69 69 'nonce' => wp_create_nonce('yatra_login_nonce'),
70 + 'rest_url' => esc_url_raw(rest_url('yatra/v1')),
71 + 'rest_nonce' => wp_create_nonce('wp_rest'),
70 72 'debug' => defined('WP_DEBUG') && WP_DEBUG,
71 73 'strings' => [
72 74 'login_error' => __('Login failed. Please try again.', 'yatra'),
73 75 'network_error' => __('Network error. Please check your connection.', 'yatra'),
@@ -81,12 +83,24 @@
81 83 */
82 84 protected function renderContent(array $atts): string
83 85 {
84 86 $atts = shortcode_atts($this->default_attributes, $atts, $this->tag);
85 -
87 +
86 88 // Sanitize and validate attributes
87 89 $atts = $this->sanitizeAttributes($atts);
88 -
90 +
91 + // Translate the built-in default title/subtitle at render time. The
92 + // defaults are stored as raw English in the constructor because __()
93 + // must not run that early (before init) — doing so triggers WordPress's
94 + // just-in-time textdomain notice. A custom title/subtitle set by the
95 + // operator on the shortcode passes through unchanged.
96 + if ($atts['title'] === 'Customer Login') {
97 + $atts['title'] = __('Customer Login', 'yatra');
98 + }
99 + if ($atts['subtitle'] === 'Login to access your bookings and account') {
100 + $atts['subtitle'] = __('Login to access your bookings and account', 'yatra');
101 + }
102 +
89 103 // Check if user is already logged in
90 104 if (is_user_logged_in()) {
91 105 return $this->renderLoggedInMessage($atts);
92 106 }