PluginProbe
Booking Calendar / 11.8.3
Booking Calendar v11.8.3
11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 10.11.2 All 203 releases
← All changes | includes/_capacity/confirmation.php +86 -31 10.1.311.8.3 View file →
@@ -1,7 +1,7 @@
1 1 <?php
2 2
3 -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly //FixIn: 9.8.0.4
3 +if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly // FixIn: 9.8.0.4.
4 4
5 5 // ---------------------------------------------------------------------------------------------------------------------
6 6 // == Get Booking Confirmation Data
7 7 // ---------------------------------------------------------------------------------------------------------------------
@@ -93,37 +93,87 @@
93 93 // =================================================================================================================
94 94 // == Confirmation data == / TY - Thank you /
95 95 // =================================================================================================================
96 96
97 - $confirmation['ty_message'] = stripslashes( esc_js( wpbc_lang( get_bk_option( 'booking_title_after_reservation' ) ) ) ); // 'Thank you for booking!'
98 - $confirmation['ty_message_booking_id'] = sprintf( __( 'Your booking id: %s', 'booking' ), "<strong>{$params_arr['booking_id']}</strong>" );
97 + $replace_arr = wpbc__get_replace_shortcodes__email_new_visitor( $params_arr['booking_id'], $params_arr['resource_id'], $params_arr['form_data'] );
99 98
99 +
100 + $replace_arr['readable_dates'] = '<div class="wpbc_ty__section_text_dates">'. wpbc_get_redable_dates( $params_arr['dates_ymd_arr'] ) . '</div>';
101 + $replace_arr['readable_times'] = '';
102 + if (
103 + ( wpbc_transform__24_hours_his__in__seconds( $params_arr['times_his_arr'][0] ) > 0 )
104 + && ( wpbc_transform__24_hours_his__in__seconds( $params_arr['times_his_arr'][0] ) < 86400 )
105 + ) {
106 + // -- Times text --
107 + $replace_arr['readable_times'] = '<div class="wpbc_ty__section_text_times">' . wpbc_get_redable_times( $params_arr['dates_ymd_arr'], $params_arr['times_his_arr'] ) . '</div>';
108 + }
109 +
110 + $is_no_date = apply_filters( 'wpbc_maybe_no_booking_date', false, $params_arr['dates_ymd_arr'] );
111 + if ( $is_no_date ) {
112 + $replace_arr['readable_dates'] = '<div class="wpbc_ty__section_text_dates">---</div>';
113 + $replace_arr['readable_times'] = '';
114 + }
115 +
116 + // Top - Thank you
117 + $title_after_reservation = html_entity_decode( esc_js( wpbc_lang( get_bk_option( 'booking_title_after_reservation' ) ) ) );
118 + $title_after_reservation = wpbc_replace_booking_shortcodes( $title_after_reservation, $replace_arr, ' --- ' );
119 + $title_after_reservation = stripslashes( $title_after_reservation );
120 + $title_after_reservation = wp_kses_post( $title_after_reservation ); // FixIn: 10.6.4.2.
121 + $confirmation['ty_message'] = $title_after_reservation; // 'Thank you for booking!'
122 +
123 + // -----------------------------------------------------------------------------------------------------------------
124 + // Booking ID
125 + // -----------------------------------------------------------------------------------------------------------------
126 + $confirmation['ty_message_booking_id'] = '';
127 + if ( 'Off' !== get_bk_option( 'booking_confirmation_header_enabled' ) ) {
128 + $confirmation['ty_message_booking_id'] .= ( false !== get_bk_option( 'booking_confirmation_header' ) )
129 + ? html_entity_decode( esc_js( wpbc_lang( get_bk_option( 'booking_confirmation_header' ) ) ) )
130 + /* translators: 1: ... */
131 + : sprintf( __( 'Your booking id: %s', 'booking' ), '<strong>[booking_id]</strong>' );
132 + }
133 + $confirmation['ty_message_booking_id'] = wpbc_replace_booking_shortcodes( $confirmation['ty_message_booking_id'], $replace_arr, ' --- ' );
134 + $confirmation['ty_message_booking_id'] = stripslashes( $confirmation['ty_message_booking_id'] );
135 + $confirmation['ty_message_booking_id'] = wp_kses_post( $confirmation['ty_message_booking_id'] ); // FixIn: 10.6.4.2.
136 + //$confirmation['ty_message_booking_id'] = str_replace( '[booking_id]', $params_arr['booking_id'], $confirmation['ty_message_booking_id'] );
137 +
138 + // -----------------------------------------------------------------------------------------------------------------
100 139 // -- Customer details --
101 - $plain_form_data_show = wpbc_get__booking_form_data__show( $params_arr['form_data'], $params_arr['resource_id'], array( 'unknown_shortcodes_replace_by' => ' ... ' ) );
140 + // -----------------------------------------------------------------------------------------------------------------
141 + //$plain_form_data_show = wpbc_get__booking_form_data__show( $params_arr['form_data'], $params_arr['resource_id'], array( 'unknown_shortcodes_replace_by' => ' ... ' ) );
102 142
103 - $confirmation['ty_customer_details'] = '<div class="wpbc_ty__section_header">' . __( 'Personal information', 'booking' ) . '</div>';
104 - $confirmation['ty_customer_details'] .= $plain_form_data_show;
143 + $confirmation['ty_customer_details'] = '';
144 + if ( 'Off' !== get_bk_option( 'booking_confirmation__personal_info__header_enabled' ) ) {
145 + // Title
146 + $section_title = html_entity_decode( esc_js( wpbc_lang( get_bk_option( 'booking_confirmation__personal_info__title' ) ) ) );
147 + $confirmation['ty_customer_details'] .= '<div class="wpbc_ty__section_header">' . $section_title . '</div>';
105 148
149 + // Content
150 + $confirmation['ty_customer_details'] .= html_entity_decode( esc_js( wpbc_lang( get_bk_option( 'booking_confirmation__personal_info__content' ) ) ) );
151 + $confirmation['ty_customer_details'] = str_replace( array( "\\n", "\n" ), '<br>', $confirmation['ty_customer_details'] );
152 + $confirmation['ty_customer_details'] = wpbc_replace_booking_shortcodes( $confirmation['ty_customer_details'], $replace_arr, ' --- ' );
153 + }
154 + $confirmation['ty_customer_details'] = wp_kses_post( $confirmation['ty_customer_details'] ); // FixIn: 10.6.4.2.
155 +
156 + // -----------------------------------------------------------------------------------------------------------------
106 157 // -- Booking details --
107 - $confirmation['ty_booking_details'] = '<div class="wpbc_ty__section_header">' . __( 'Booking details', 'booking' ) . '</div>';
108 - $confirmation['ty_booking_details'] .= '<h4 class="wpbc_ty__section_text_resource">' . wpbc_get_resource_title( $params_arr['resource_id'] ) . '</h4>';
158 + // -----------------------------------------------------------------------------------------------------------------
159 + $confirmation['ty_booking_details'] = '';
160 + if ( 'Off' !== get_bk_option( 'booking_confirmation__booking_details__header_enabled' ) ) {
161 + // Title
162 + $section_title = html_entity_decode( esc_js( wpbc_lang( get_bk_option( 'booking_confirmation__booking_details__title' ) ) ) );
163 + $confirmation['ty_booking_details'] .= '<div class="wpbc_ty__section_header">' . $section_title . '</div>';
109 164
110 - // -- Dates text --
111 - $confirmation['ty_booking_details'] .= '<div class="wpbc_ty__section_text_dates">'
112 - . wpbc_get_redable_dates( $params_arr['dates_ymd_arr'] )
113 - . '</div>';
114 - // -- Times text --
115 - if (
116 - ( wpbc_transform__24_hours_his__in__seconds( $params_arr['times_his_arr'][0] ) > 0 )
117 - && ( wpbc_transform__24_hours_his__in__seconds( $params_arr['times_his_arr'][0] ) < 86400 )
118 - ) {
119 - $confirmation['ty_booking_details'] .= '<div class="wpbc_ty__section_text_times">'
120 - . wpbc_get_redable_times( $params_arr['dates_ymd_arr']
121 - , $params_arr['times_his_arr']
122 - )
123 - . '</div>';
165 + // Content
166 + $confirmation['ty_booking_details'] .= html_entity_decode( esc_js( wpbc_lang( get_bk_option( 'booking_confirmation__booking_details__content' ) ) ) );
167 + $confirmation['ty_booking_details'] = str_replace( array( "\\n", "\n" ), '<br>', $confirmation['ty_booking_details'] );
168 + $confirmation['ty_booking_details'] = wpbc_replace_booking_shortcodes( $confirmation['ty_booking_details'], $replace_arr, ' --- ' );
124 169 }
170 +
171 + $confirmation['ty_booking_details'] = wp_kses_post( $confirmation['ty_booking_details'] ); // FixIn: 10.6.4.2.
172 +
173 + // -----------------------------------------------------------------------------------------------------------------
125 174 // -- Costs text --
175 + // -----------------------------------------------------------------------------------------------------------------
126 176 $confirmation['ty_booking_costs'] = '';
127 177 $confirmation['payment_cost'] = '';
128 178
129 179 if ( class_exists('wpdev_bk_biz_s')) {
@@ -163,9 +213,9 @@
163 213 'resource_id' => $params_arr['resource_id'] // '2'
164 214 , 'str_dates__dd_mm_yyyy' => $params_arr['str_dates__dd_mm_yyyy'] // '14.11.2023, 15.11.2023, 16.11.2023, 17.11.2023'
165 215 , 'times_array' => $params_arr['times_array'] // [ ["10","00","00"], ["12","00","00"] ]
166 216 , 'form_data' => $params_arr['form_data'] // 'text^selected_short_timedates_hint4^06/11/2018 14:00...'
167 - , 'is_discount_calculate' => ! true // Default true
217 + , 'is_discount_calculate' => false // FixIn: 10.11.5.7. // Default true
168 218 , 'is_only_original_cost' => false // Default false
169 219 ) );
170 220 $total_cost_without_discount = floatval( $total_cost_without_discount ); // from double > float
171 221
@@ -222,9 +272,9 @@
222 272 // ---------------------------------------------------------------------------------------------------------
223 273 // "Update Note" in booking with all datails. Again ?
224 274 // ---------------------------------------------------------------------------------------------------------
225 275 $cost_booking_note = preg_replace( "@(&lt;|<)br\s*/?(&gt;|>)(\r\n)?@", "\n", $confirmation['ty_booking_costs'] );
226 - $cost_booking_note = strip_tags( $cost_booking_note );
276 + $cost_booking_note = wp_strip_all_tags( $cost_booking_note );
227 277 $cost_booking_note = str_replace( array( ' ', "\n " ), array( ' ', "\n" ), $cost_booking_note );
228 278
229 279 if ( ! empty( $params_arr['gateway_rows'] ) ) {
230 280
@@ -233,9 +283,9 @@
233 283
234 284 $booking_note .= ' ' . __( 'Payment section displayed', 'booking' );
235 285 if ( empty( $cost_booking_note ) ) {
236 286 foreach ( $params_arr['gateway_rows'] as $row_num => $gateway_row ) {
237 - $booking_note .= ' | ' . strip_tags( html_entity_decode( $gateway_row['header'] ) );
287 + $booking_note .= ' | ' . wp_strip_all_tags( html_entity_decode( $gateway_row['header'] ) );
238 288 }
239 289 }
240 290 $booking_note .= "\n";
241 291
@@ -319,17 +369,17 @@
319 369 }
320 370 }
321 371
322 372
373 + // FixIn: 10.10.3.3.
374 + // // If showing payment form, that we do not make redirection and show Message only.
375 + // if ( ! empty( $confirmation['ty_payment_gateways'] ) ) {
376 + // $confirmation['ty_is_redirect'] = 'message';
377 + // }
323 378
324 - // If showing payment form, that we do not make redirection and show Message only
325 - if ( ! empty( $confirmation['ty_payment_gateways'] ) ) {
326 - $confirmation['ty_is_redirect'] = 'message';
327 - }
328 -
329 379 if ( 'page' == $confirmation['ty_is_redirect'] ) {
330 380
331 - //FixIn: 9.9.0.3
381 + // FixIn: 9.9.0.3.
332 382 if ( ! empty( $params_arr['ty_url'] ) ) {
333 383
334 384 $confirmation['ty_url'] = $params_arr['ty_url'];
335 385
@@ -337,8 +387,13 @@
337 387
338 388 $confirmation['ty_url'] = wpbc_make_link_absolute( wpbc_lang( get_bk_option( 'booking_thank_you_page_URL' ) ) ); // '/thank-you'
339 389
340 390 $confirmation['ty_url'] .= ( ( false === strpos( $confirmation['ty_url'], '?' ) ) ? '?' : '&' ) . 'booking_hash=' . $booking_hash;
391 +
392 + // FixIn: 10.10.3.3.
393 + if ( ! empty( $confirmation['ty_payment_gateways'] ) ) {
394 + $confirmation['ty_url'] .= ( ( false === strpos( $confirmation['ty_url'], '?' ) ) ? '?' : '&' ) . 'booking_pay=1';
395 + }
341 396 }
342 397
343 398 } else {
344 399 $confirmation['ty_url'] = '';