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 +60 -10 11.011.8.3 View file →
@@ -1,4 +1,4 @@
1 1 <?php
2 2 /**
3 3 * Front-End Render (Booking form, Calendar)
4 4 *
@@ -52,10 +52,12 @@
52 52 'start_month_calendar' => false,
53 53 'shortcode_param__options' => '',
54 54 'calendar_dates_start' => '',
55 55 'calendar_dates_end' => '',
56 - 'booking_hash' => '',
57 - 'form_status' => 'published',
56 + 'booking_hash' => '',
57 + 'form_status' => 'published',
58 + 'booking_workflow' => 'classic',
59 + 'calendar_request_overrides' => array(),
58 60 );
59 61 $params_arr = wp_parse_args( $params_arr, $default_params );
60 62 $is_echo = ( ! empty( $params_arr['is_echo'] ) );
61 63
@@ -84,16 +86,60 @@
84 86 return self::echo_or_return( $resource_validation, $is_echo );
85 87 }
86 88
87 89 // ---------------------------------------------------------------------
88 - // == MU ==
89 - // ---------------------------------------------------------------------
90 - make_bk_action( 'check_multiuser_params_for_client_side', $params_arr['resource_id'] );
91 -
92 - // ---------------------------------------------------------------------
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 + // ---------------------------------------------------------------------
93 126 // Normalize calendar_dates_start/end.
94 127 // ---------------------------------------------------------------------
95 - $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 + }
96 142
97 143 // ---------------------------------------------------------------------
98 144 // Calendar load params (keep identical keys).
99 145 // ---------------------------------------------------------------------
@@ -104,10 +150,12 @@
104 150 'calendar_number_of_months' => $params_arr['cal_count'],
105 151 'start_month_calendar' => $params_arr['start_month_calendar'],
106 152 'shortcode_options' => $params_arr['shortcode_param__options'],
107 153 'custom_form' => $params_arr['custom_booking_form'],
108 - 'calendar_dates_start' => $calendar_dates_range['start'],
109 - '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'],
110 158 );
111 159
112 160 $start_script_code = wpbc__calendar__load( $calendar_load_params );
113 161
@@ -180,8 +228,9 @@
180 228 'shortcode_param__options' => '',
181 229 'calendar_dates_start' => '',
182 230 'calendar_dates_end' => '',
183 231 'booking_hash' => '',
232 + 'calendar_request_overrides' => array(),
184 233 );
185 234 $params_arr = wp_parse_args( $params_arr, $default_params );
186 235 $is_echo = ( ! empty( $params_arr['is_echo'] ) );
187 236
@@ -230,8 +279,9 @@
230 279 'shortcode_options' => $params_arr['shortcode_param__options'],
231 280 'custom_form' => 'standard', // Because we show only 'AVAILABILITY CALENDAR' without the form, at all.
232 281 'calendar_dates_start' => $calendar_dates_range['start'],
233 282 'calendar_dates_end' => $calendar_dates_range['end'],
283 + 'calendar_request_overrides' => $params_arr['calendar_request_overrides'],
234 284 );
235 285 $start_script_code = wpbc__calendar__load( $calendar_load_params );
236 286
237 287