| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly // FixIn: 9.8.0.4. |
| 4 | 4 | |
| @@ -64,9 +64,9 @@ | ||
| 64 | 64 | } |
| 65 | 65 | add_action( 'init', 'wpbc_init_shortcode__wpbc_booking_confirmation', 9999 ); // <- priority to load it last |
| 66 | 66 | |
| 67 | 67 | |
| 68 | - /** | |
| 68 | +/** | |
| 69 | 69 | * Universal shortcode worker |
| 70 | 70 | * |
| 71 | 71 | * @param array $attr |
| 72 | 72 | * @param string|null $content |
| @@ -73,9 +73,9 @@ | ||
| 73 | 73 | * @param string $tag |
| 74 | 74 | * |
| 75 | 75 | * @return string |
| 76 | 76 | */ |
| 77 | - function wpbc_shortcode__booking_confirmation( $attr = array(), $content = null, $tag = '' ) { | |
| 77 | +function wpbc_shortcode__booking_confirmation( $attr = array(), $content = null, $tag = '' ) { | |
| 78 | 78 | |
| 79 | 79 | // ob_start(); |
| 80 | 80 | |
| 81 | 81 | $atts = array_change_key_case( (array) $attr, CASE_LOWER ); // Changes the case of all keys in an array |
| @@ -90,28 +90,26 @@ | ||
| 90 | 90 | */ |
| 91 | 91 | |
| 92 | 92 | $return = ''; |
| 93 | 93 | |
| 94 | - switch ( $attr['mode'] ) { | |
| 94 | + switch ( $attr['mode'] ) { | |
| 95 | 95 | |
| 96 | - case 'booking_confirm': | |
| 96 | + case 'booking_confirm': | |
| 97 | + $return .= wpbc_do_shortcode__booking_confirm( $attr ); | |
| 98 | + break; | |
| 97 | 99 | |
| 98 | - $return .= wpbc_do_shortcode__booking_confirm( $attr ); | |
| 99 | - break; | |
| 100 | + default: | |
| 101 | + $return = '<p style="font-size:9px;">Invalid shortcode configuration: <strong>[' . esc_html( $tag ) . ' ... ]</strong>. ' . // FixIn: 10.11.2.1. | |
| 102 | + /* translators: 1: ... */ | |
| 103 | + sprintf( __( 'Find more in the %1$sFAQ%2$s', 'booking' ), '<a href="https://wpbookingcalendar.com/faq/">', '</a>.' ) . | |
| 104 | + '</p>'; | |
| 105 | + } | |
| 100 | 106 | |
| 101 | - default: | |
| 102 | - $return = '<p style="font-size:9px;">' | |
| 103 | - . 'Invalid shortcode configuration: <strong>[' . $tag . ' ... ]</strong> with the following parameters: ' . wp_json_encode( $attr ) . '. ' | |
| 104 | - /* translators: 1: ... */ | |
| 105 | - . sprintf( __( 'Find more in the %1$sFAQ%2$s', 'booking' ), '<a href="https://wpbookingcalendar.com/faq/">', '</a>.' ) | |
| 106 | - . '</p>'; | |
| 107 | - } | |
| 108 | - | |
| 109 | 107 | // $possible_output = ob_get_clean(); |
| 110 | 108 | // $return .= $possible_output; |
| 111 | 109 | |
| 112 | - return $return ; | |
| 113 | - } | |
| 110 | + return $return ; | |
| 111 | +} | |
| 114 | 112 | |
| 115 | 113 | |
| 116 | 114 | |
| 117 | 115 | function wpbc_do_shortcode__booking_confirm( $attr ){ |
| @@ -137,10 +135,10 @@ | ||
| 137 | 135 | $resource_id = intval( $booking_resource_id__arr['resource_id'] ); |
| 138 | 136 | |
| 139 | 137 | if ( empty( $booking_id ) ) { |
| 140 | 138 | |
| 141 | - return '<strong>' . esc_html__('Oops!' ,'booking') . '</strong> ' | |
| 142 | - . __('We could not find your booking. The link you used may be incorrect or has expired. If you need assistance, please contact our support team.' ,'booking'); | |
| 139 | + return '<div class="wpbc_after_booking_thank_you_section"><div class="wpbc_ty__container"><div class="wpbc_ty__header"><strong>' . esc_html__('Oops!' ,'booking') . '</strong> ' | |
| 140 | + . __('We could not find your booking. The link you used may be incorrect or has expired. If you need assistance, please contact our support team.' ,'booking') . '</div></div></div>'; | |
| 143 | 141 | } else { |
| 144 | 142 | |
| 145 | 143 | |
| 146 | 144 | // DB Booking Details |
| @@ -298,9 +296,15 @@ | ||
| 298 | 296 | $json_arr = array(); |
| 299 | 297 | $json_arr['ajx_confirmation'] = $confirmation_arr; |
| 300 | 298 | $json_arr['resource_id'] = $resource_id; |
| 301 | 299 | |
| 302 | - $return_str = '<div class="wpbc_container ">' | |
| 300 | + /* | |
| 301 | + * Keep redirected confirmation/payment output in the same styling scope | |
| 302 | + * as payment forms shown directly after an AJAX booking. Gateway buttons | |
| 303 | + * use the shared .wpbc_button_light styles scoped by | |
| 304 | + * .wpbc_container_booking_form. | |
| 305 | + */ | |
| 306 | + $return_str = '<div class="wpbc_container wpbc_container_booking_form">' | |
| 303 | 307 | . '<div id="booking_form' . $resource_id . '"></div>' |
| 304 | 308 | . '<script type="text/javascript"> ' . wpbc_jq_ready_start() // FixIn: 10.1.3.7. |
| 305 | 309 | . ' wpbc_show_thank_you_message_after_booking(' .wp_json_encode( $json_arr ) . '); ' |
| 306 | 310 | //. ' wpbc_show_thank_you_message_after_booking(' . str_replace( array( "\n", '\\n', '\n' ), ' ', wp_json_encode( $json_arr ) ) . '); ' |
| @@ -314,5 +318,5 @@ | ||
| 314 | 318 | |
| 315 | 319 | $return_str .= $possible_output; |
| 316 | 320 | |
| 317 | 321 | return $return_str; // return '<pre>' . var_export($confirmation_arr, true) . '</pre>'; |
| 318 | -} | |
| 322 | +} | |