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/_front_end/class-fe-render.php +63 -10 10.15.711.8.3 View file →
@@ -1,4 +1,4 @@
1 1 <?php
2 2 /**
3 3 * Front-End Render (Booking form, Calendar)
4 4 *
@@ -52,9 +52,12 @@
52 52 'start_month_calendar' => false,
53 53 'shortcode_param__options' => '',
54 54 'calendar_dates_start' => '',
55 55 'calendar_dates_end' => '',
56 - 'form_status' => 'published',
56 + 'booking_hash' => '',
57 + 'form_status' => 'published',
58 + 'booking_workflow' => 'classic',
59 + 'calendar_request_overrides' => array(),
57 60 );
58 61 $params_arr = wp_parse_args( $params_arr, $default_params );
59 62 $is_echo = ( ! empty( $params_arr['is_echo'] ) );
60 63
@@ -83,16 +86,60 @@
83 86 return self::echo_or_return( $resource_validation, $is_echo );
84 87 }
85 88
86 89 // ---------------------------------------------------------------------
87 - // == MU ==
88 - // ---------------------------------------------------------------------
89 - make_bk_action( 'check_multiuser_params_for_client_side', $params_arr['resource_id'] );
90 -
91 - // ---------------------------------------------------------------------
90 + // == MU ==
91 + // ---------------------------------------------------------------------
92 + make_bk_action( 'check_multiuser_params_for_client_side', $params_arr['resource_id'] );
93 +
94 + // Render a focused cancellation confirmation instead of loading the complete booking form and calendar.
95 + if ( WPBC_GET_Request::has_get( 'booking_cancel' ) && function_exists( 'wpbc_customer_access_render_cancellation_confirmation' ) ) {
96 + $booking_hash = sanitize_text_field( wp_unslash( (string) $params_arr['booking_hash'] ) );
97 + if ( '' === $booking_hash ) {
98 + $booking_hash = WPBC_GET_Request::get_sanitized( 'booking_hash' );
99 + }
100 +
101 + $cancellation_html = wpbc_customer_access_render_cancellation_confirmation( $booking_hash, $params_arr['resource_id'] );
102 +
103 + /**
104 + * Filters the complete visitor cancellation confirmation markup.
105 + *
106 + * @param string $cancellation_html Rendered confirmation markup.
107 + * @param int $resource_id Resource ID used by the front-end form container.
108 + * @param string $booking_hash Sanitized booking credential from the cancellation URL.
109 + */
110 + $cancellation_html = apply_filters(
111 + 'wpbc_customer_booking_cancellation_confirmation_html',
112 + $cancellation_html,
113 + absint( $params_arr['resource_id'] ),
114 + $booking_hash
115 + );
116 +
117 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
118 + $my_result = apply_filters( 'wpdev_booking_form', ' ' . $cancellation_html . ' ', $params_arr['resource_id'] );
119 +
120 + make_bk_action( 'finish_check_multiuser_params_for_client_side', $params_arr['resource_id'] );
121 +
122 + return self::echo_or_return( $my_result, $is_echo );
123 + }
124 +
125 + // ---------------------------------------------------------------------
92 126 // Normalize calendar_dates_start/end.
93 127 // ---------------------------------------------------------------------
94 - $calendar_dates_range = WPBC_FE_Attr_Postprocessor::normalize_calendar_dates_range( $params_arr['calendar_dates_start'], $params_arr['calendar_dates_end'] );
128 + $calendar_dates_range = WPBC_FE_Attr_Postprocessor::normalize_calendar_dates_range( $params_arr['calendar_dates_start'], $params_arr['calendar_dates_end'] );
129 + $classic_booking_context_token = '';
130 + if ( function_exists( 'wpbc_classic_booking_context_encode' ) ) {
131 + $classic_booking_context_token = wpbc_classic_booking_context_encode(
132 + array(
133 + 'booking_workflow' => $params_arr['booking_workflow'],
134 + 'resource_id' => $params_arr['resource_id'],
135 + 'calendar_dates_start' => $calendar_dates_range['start'],
136 + 'calendar_dates_end' => $calendar_dates_range['end'],
137 + 'custom_form' => $params_arr['custom_booking_form'],
138 + 'aggregate_resource_ids' => $aggregate_resource_id_arr,
139 + )
140 + );
141 + }
95 142
96 143 // ---------------------------------------------------------------------
97 144 // Calendar load params (keep identical keys).
98 145 // ---------------------------------------------------------------------
@@ -103,10 +150,12 @@
103 150 'calendar_number_of_months' => $params_arr['cal_count'],
104 151 'start_month_calendar' => $params_arr['start_month_calendar'],
105 152 'shortcode_options' => $params_arr['shortcode_param__options'],
106 153 'custom_form' => $params_arr['custom_booking_form'],
107 - 'calendar_dates_start' => $calendar_dates_range['start'],
108 - 'calendar_dates_end' => $calendar_dates_range['end'],
154 + 'calendar_dates_start' => $calendar_dates_range['start'],
155 + 'calendar_dates_end' => $calendar_dates_range['end'],
156 + 'classic_booking_context_token' => $classic_booking_context_token,
157 + 'calendar_request_overrides' => $params_arr['calendar_request_overrides'],
109 158 );
110 159
111 160 $start_script_code = wpbc__calendar__load( $calendar_load_params );
112 161
@@ -143,8 +192,9 @@
143 192 'form_status' => $params_arr['form_status'],
144 193 'selected_dates_without_calendar' => $params_arr['selected_dates_without_calendar'],
145 194 'cal_count' => $params_arr['cal_count'],
146 195 'shortcode_param__options' => $params_arr['shortcode_param__options'],
196 + 'booking_hash' => $params_arr['booking_hash'],
147 197 'legacy_instance' => $legacy,
148 198 )
149 199 );
150 200
@@ -177,8 +227,10 @@
177 227 'start_month_calendar' => false,
178 228 'shortcode_param__options' => '',
179 229 'calendar_dates_start' => '',
180 230 'calendar_dates_end' => '',
231 + 'booking_hash' => '',
232 + 'calendar_request_overrides' => array(),
181 233 );
182 234 $params_arr = wp_parse_args( $params_arr, $default_params );
183 235 $is_echo = ( ! empty( $params_arr['is_echo'] ) );
184 236
@@ -227,8 +279,9 @@
227 279 'shortcode_options' => $params_arr['shortcode_param__options'],
228 280 'custom_form' => 'standard', // Because we show only 'AVAILABILITY CALENDAR' without the form, at all.
229 281 'calendar_dates_start' => $calendar_dates_range['start'],
230 282 'calendar_dates_end' => $calendar_dates_range['end'],
283 + 'calendar_request_overrides' => $params_arr['calendar_request_overrides'],
231 284 );
232 285 $start_script_code = wpbc__calendar__load( $calendar_load_params );
233 286
234 287
@@ -337,5 +390,5 @@
337 390
338 391 /**
339 392 * This hook exists in personal.php file for the [bookingselect ..]
340 393 */
341 -add_bk_filter( 'wpdevbk_get_booking_form', 'wpbc_get_rendered_booking_form_html__noecho' );
394 +add_bk_filter( 'wpdevbk_get_booking_form', 'wpbc_get_rendered_booking_form_html__noecho' );