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 | core/lib/wpdev-booking-class.php +68 -879 10.1011.8.3 View file →
@@ -1,11 +1,14 @@
1 1 <?php
2 +/**
3 + * @file: wp-content/plugins/booking/core/lib/wpdev-booking-class.php
4 + */
2 5 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3 6
4 7 class wpdev_booking {
5 8
6 9 public $popover_front_end_js_is_writed; //FixIn: Flex TimeLine 1.0 -- previos this was private and not public property
7 -
10 +
8 11 // <editor-fold defaultstate="collapsed" desc=" C O N S T R U C T O R & P r o p e r t i e s ">
9 12
10 13 var $wpdev_bk_personal;
11 14
@@ -10,30 +13,15 @@
10 13 var $wpdev_bk_personal;
11 14
12 15 function __construct() {
13 16
14 - // In AJAX request it DO NOT RUNNING. Important note
17 + $this->popover_front_end_js_is_writed = false;
18 + $this->wpdev_bk_personal = false;
15 19
16 - $this->popover_front_end_js_is_writed = false;
17 -
18 20 if ( class_exists( 'wpdev_bk_personal' ) ) {
19 21 $this->wpdev_bk_personal = new wpdev_bk_personal();
20 - } else {
21 - $this->wpdev_bk_personal = false;
22 22 }
23 23
24 -
25 - // User defined - hooks
26 - add_action( 'wpdev_bk_add_calendar', array( &$this, 'add_calendar_action' ), 10, 2 );
27 - add_action( 'wpdev_bk_add_form', array( &$this, 'add_booking_form_action' ), 10, 2 );
28 - add_bk_action( 'wpdevbk_add_form', array( &$this, 'add_booking_form_action' ) );
29 - add_filter( 'wpdev_bk_get_form', array( &$this, 'get_booking_form_action' ), 10, 2 );
30 - add_bk_filter( 'wpdevbk_get_booking_form', array( &$this, 'get_booking_form_action' ) );
31 - add_filter( 'wpdev_bk_get_showing_date_format', array( &$this, 'get_showing_date_format' ), 10, 1 );
32 -
33 - // Get script for calendar activation
34 - add_bk_filter( 'pre_get_calendar_html', array( &$this, 'pre_get_calendar_html' ) );
35 -
36 24 add_action( 'init', array( $this, 'wpbc_shortcodes_init' ), 9999 ); // <- priority to load it last
37 25 }
38 26 // </editor-fold>
39 27
@@ -43,630 +31,26 @@
43 31 *
44 32 * @return void
45 33 */
46 34 function wpbc_shortcodes_init(){
47 -
48 - add_shortcode( 'booking', array( &$this, 'booking_shortcode' ) );
49 - add_shortcode( 'bookingcalendar', array( &$this, 'booking_calendar_only_shortcode' ) );
50 - add_shortcode( 'bookingform', array( &$this, 'bookingform_shortcode' ) );
51 - add_shortcode( 'bookingedit', array( &$this, 'bookingedit_shortcode' ) );
52 - add_shortcode( 'bookingsearch', array( &$this, 'bookingsearch_shortcode' ) );
53 - add_shortcode( 'bookingsearchresults', array( &$this, 'bookingsearchresults_shortcode' ) );
54 - add_shortcode( 'bookingselect', array( &$this, 'bookingselect_shortcode' ) );
55 - add_shortcode( 'bookingresource', array( &$this, 'bookingresource_shortcode' ) );
56 - add_shortcode( 'bookingtimeline', array( &$this, 'bookingtimeline_shortcode' ) );
57 - add_shortcode( 'bookingcustomerlisting', array( &$this, 'bookingcustomerlisting_shortcode' ) ); // FixIn: 8.1.3.5.
58 -
35 + add_shortcode( 'bookingedit', array( $this, 'bookingedit_shortcode' ) );
36 + add_shortcode( 'bookingsearch', array( $this, 'bookingsearch_shortcode' ) );
37 + add_shortcode( 'bookingsearchresults', array( $this, 'bookingsearchresults_shortcode' ) );
38 + add_shortcode( 'bookingselect', array( $this, 'bookingselect_shortcode' ) );
39 + add_shortcode( 'bookingresource', array( $this, 'bookingresource_shortcode' ) );
40 + add_shortcode( 'bookingtimeline', array( $this, 'bookingtimeline_shortcode' ) );
41 + add_shortcode( 'bookingcustomerlisting', array( $this, 'bookingcustomerlisting_shortcode' ) ); // FixIn: 8.1.3.5.
59 42 }
60 -
61 -
62 - // <editor-fold defaultstate="collapsed" desc=" S U P P O R T F U N C T I O N S ">
63 43
64 - function silent_deactivate_WPBC() {
65 - deactivate_plugins( WPBC_PLUGIN_DIRNAME . '/' . WPBC_PLUGIN_FILENAME, true );
66 - }
67 44
68 -
69 - // Change date format
70 - function get_showing_date_format( $mydate ) {
71 - $date_format = get_bk_option( 'booking_date_format' );
72 - if ( $date_format == '' ) {
73 - $date_format = "d.m.Y";
74 - }
75 -
76 - $time_format = get_bk_option( 'booking_time_format' );
77 - if ( $time_format !== false ) {
78 - $time_format = ' ' . $time_format;
79 - $my_time = gmdate( 'H:i:s', $mydate );
80 - if ( $my_time == '00:00:00' ) {
81 - $time_format = '';
82 - }
83 - } else {
84 - $time_format = '';
85 - }
86 -
87 - // return gmdate($date_format . $time_format , $mydate);
88 - return date_i18n( $date_format, $mydate ) . '<sup class="booking-table-time">' . date_i18n( $time_format, $mydate ) . '</sup>';
89 - }
90 -
91 - // </editor-fold>
92 -
93 -
94 - // <editor-fold defaultstate="collapsed" desc=" B O O K I N G s A D M I N F U N C T I O N s ">
95 -
96 - /**
97 - * Generate booking CAPTCHA fields for booking form
98 - *
99 - * @param $bk_tp resource ID
100 - *
101 - * @return string|true
102 - */
103 - function createCapthaContent($bk_tp) {
104 -
105 - $admin_uri = ltrim( str_replace( get_site_url( null, '', 'admin' ), '', admin_url( 'admin.php?' ) ), '/' );
106 -
107 - $server_request_uri = ( ( isset( $_SERVER['REQUEST_URI'] ) ) ? sanitize_text_field( $_SERVER['REQUEST_URI'] ) : '' ); /* phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.MissingUnslash */ /* FixIn: sanitize_unslash */
108 -
109 - if ( ( get_bk_option( 'booking_is_use_captcha' ) !== 'On' )
110 - || (
111 - ( strpos( $server_request_uri, $admin_uri ) !== false )
112 - && ( ! wpbc_is_settings_form_page() )
113 - )
114 - ) {
115 - return '';
116 - } else {
117 -
118 - $html = wpbc_captcha__simple__generate_html_content( $bk_tp );
119 -
120 - return $html;
121 - }
122 - }
123 -
124 - // Get default Booking resource
125 - function get_default_type() {
126 -
127 - if ( $this->wpdev_bk_personal !== false ) {
128 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
129 - if ( ( isset( $_GET['booking_type'] ) ) && ( $_GET['booking_type'] != '' ) ) {
130 - $bk_type = sanitize_text_field( wp_unslash( $_GET['booking_type'] ) ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */
131 - } else {
132 - $bk_type = $this->wpdev_bk_personal->get_default_booking_resource_id();
133 - }
134 - } else {
135 - $bk_type = 1;
136 - }
137 -
138 - return $bk_type;
139 - }
140 -
141 - // </editor-fold>
142 -
143 -
144 - // <editor-fold defaultstate="collapsed" desc=" C L I E N T S I D E & H O O K S ">
145 -
146 -
147 - // Get HTML for the initilizing inline calendars
148 - function pre_get_calendar_html( $resource_id=1, $cal_count=1, $bk_otions=array() ){
149 - //SHORTCODE:
150 - /*
151 - * [booking type=56 form_type='standard' nummonths=4
152 - * options='{calendar months_num_in_row=2 width=682px cell_height=48px}']
153 - */
154 -
155 - $bk_otions = wpbc_parse_calendar_options($bk_otions);
156 - /* options:
157 - [months_num_in_row] => 2
158 - [width] => 341px define: width: 100%; max-width:341px;
159 - [strong_width] => 341px define: width:341px;
160 - [cell_height] => 48px
161 - */
162 - $width = $months_num_in_row = $cell_height = '';
163 -
164 - if (!empty($bk_otions)){
165 -
166 - if ( isset( $bk_otions['months_num_in_row'] ) ) {
167 - $months_num_in_row = $bk_otions['months_num_in_row'];
168 - }
169 -
170 - if ( isset( $bk_otions['width'] ) ) {
171 - $width = 'width:100%;max-width:' . $bk_otions['width'] . ';'; // FixIn: 9.3.1.5.
172 - }
173 - if ( isset( $bk_otions['strong_width'] ) ) {
174 - $width .= 'width:' . $bk_otions['strong_width'] . ';'; // FixIn: 9.3.1.6.
175 - }
176 -
177 - if ( isset( $bk_otions['cell_height'] ) ) {
178 - $cell_height = $bk_otions['cell_height'];
179 - }
180 - if ( isset( $bk_otions['strong_cell_height'] ) ) { // FixIn: 9.7.3.3.
181 - $cell_height = $bk_otions['strong_cell_height'] . '!important;';
182 - }
183 - }
184 - /* FixIn: 9.7.3.4 */
185 -
186 - if ( ! empty( $cell_height ) ) {
187 - // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedStylesheet
188 - $style = '<style type="text/css" rel="stylesheet" >' . '.hasDatepick .datepick-inline .datepick-title-row th,' . '.hasDatepick .datepick-inline .datepick-days-cell{' . ' height: ' . $cell_height . '; ' . '}' . '</style>';
189 - } else {
190 - $style = '';
191 - }
192 -
193 - // FixIn: 8.2.1.27.
194 - $booking_timeslot_day_bg_as_available = get_bk_option( 'booking_timeslot_day_bg_as_available' );
195 -
196 - $booking_timeslot_day_bg_as_available = ( $booking_timeslot_day_bg_as_available === 'On' ) ? ' wpbc_timeslot_day_bg_as_available' : '';
197 -
198 - //FixIn: 9.8.1
199 - $is_custom_width_css = ( empty( $width ) ) ? ' wpbc_no_custom_width ' : '';
200 -
201 - $calendar = $style.
202 - '<div class="wpbc_cal_container bk_calendar_frame' . $is_custom_width_css . ' months_num_in_row_' . $months_num_in_row . ' cal_month_num_' . $cal_count . $booking_timeslot_day_bg_as_available . '" style="' . $width . '">' .
203 - '<div id="calendar_booking' . $resource_id . '">' .
204 - __('Calendar is loading...' ,'booking').
205 - '</div>'.
206 - '</div>'.
207 - '';
208 -
209 - $booking_is_show_powered_by_notice = get_bk_option( 'booking_is_show_powered_by_notice' );
210 - if ( ( ! class_exists( 'wpdev_bk_personal' ) ) && ( $booking_is_show_powered_by_notice == 'On' ) ) {
211 - $calendar .= '<div style="font-size:7px;text-align:left;margin:0 0 10px;text-shadow: none;">Powered by <a href="https://wpbookingcalendar.com" style="font-size:7px;" target="_blank" title="Booking Calendar plugin for WordPress">Booking Calendar</a></div>';
212 - }
213 -
214 - $calendar .= '<textarea id="date_booking' . $resource_id . '" name="date_booking' . $resource_id . '" autocomplete="off" style="display:none;"></textarea>'; // Calendar code
215 -
216 - $calendar .= wpbc_get_calendar_legend(); // FixIn: 9.4.3.6.
217 -
218 - $calendar_css_class_outer = 'wpbc_calendar_wraper';
219 -
220 - // FixIn: 7.0.1.24.
221 - $is_booking_change_over_days_triangles = get_bk_option( 'booking_change_over_days_triangles' );
222 - if ( $is_booking_change_over_days_triangles !== 'Off' ) {
223 - $calendar_css_class_outer .= ' wpbc_change_over_triangle';
224 - }
225 -
226 -
227 - // filenames, such as 'multidays.css'
228 - $calendar_skin_name = basename( get_bk_option( 'booking_skin' ) );
229 - if ( wpbc_is_calendar_skin_legacy( $calendar_skin_name ) ) {
230 - $calendar_css_class_outer .= ' wpbc_calendar_skin_legacy'; //. wpbc_get_slug_format( get_bk_option( 'booking_skin' ) );
231 - }
232 -
233 - $calendar = '<div class="' . esc_attr( $calendar_css_class_outer ) . '">' . $calendar . '</div>';
234 -
235 - return $calendar;
236 - }
237 -
238 -
239 -
240 - // Get booking form
241 - function get_booking_form_action( $resource_id = 1, $my_boook_count = 1, $my_booking_form = 'standard', $my_selected_dates_without_calendar = '', $start_month_calendar = false, $bk_otions = array() ) {
242 -
243 - $res = $this->add_booking_form_action($resource_id,$my_boook_count, 0, $my_booking_form , $my_selected_dates_without_calendar, $start_month_calendar, $bk_otions );
244 - return $res;
245 - }
246 -
247 - //Show booking form from action call - wpdev_bk_add_form
248 - function add_booking_form_action( $resource_id = 1, $cal_count = 1, $is_echo = 1, $my_booking_form = 'standard', $my_selected_dates_without_calendar = '', $start_month_calendar = false, $bk_otions = array() ) {
249 -
250 - $additional_bk_types = array();
251 - if ( strpos($resource_id,';') !== false ) {
252 - $additional_bk_types = explode(';',$resource_id);
253 - $resource_id = $additional_bk_types[0];
254 - }
255 -
256 - //--------------------------------------------------------------------------------------------------------------
257 - // Check if booking resource exist
258 - if ( $resource_id == '' ) {
259 - $my_result = __( 'Booking resource type is not defined. This can be, when at the URL is wrong booking hash.', 'booking' );
260 - if ( $is_echo ) {
261 - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
262 - echo $my_result;
263 - } else {
264 - return $my_result;
265 - }
266 -
267 - return;
268 - }
269 -
270 - $is_booking_resource_exist = apply_bk_filter('wpdev_is_booking_resource_exist',true, $resource_id, $is_echo );
271 - if (! $is_booking_resource_exist) {
272 - if ( $is_echo ) echo 'Booking resource does not exist.' . ' [ID=' . esc_attr( $resource_id ) . ']';
273 - return 'Booking resource does not exist.' . ' [ID=' . esc_attr( $resource_id ) . ']';
274 - }
275 -
276 - //--------------------------------------------------------------------------------------------------------------
277 - // Define $this->client_side_active_params_of_user to specific User,
278 - // depends from belonging booking resource to specific User
279 - make_bk_action('check_multiuser_params_for_client_side', $resource_id );
280 -
281 - //--------------------------------------------------------------------------------------------------------------
282 - // Get Booking ID and booking resource ID, if we EDIT booking
283 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
284 - if ( isset( $_GET['booking_hash'] ) ) {
285 -
286 - $get_booking_hash = ( ( isset( $_GET['booking_hash'] ) ) ? sanitize_text_field( wp_unslash( $_GET['booking_hash'] ) ) : '' ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */
287 -
288 - $my_booking_id_type = wpbc_hash__get_booking_id__resource_id( $get_booking_hash );
289 -
290 - $is_error = false; // FixIn: 9.1.3.2.
291 - if ( $my_booking_id_type !== false ) {
292 -
293 - list( $my_edited_bk_id, $my_boook_type ) = $my_booking_id_type;
294 -
295 - if ( $my_boook_type == '' ) {
296 - $is_error ='<strong>' . esc_html__('Oops!' ,'booking') . '</strong> ' . __('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');
297 - }
298 - } else {
299 - $is_error = '<strong>' . esc_html__('Oops!' ,'booking') . '</strong> ' . __('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');
300 - }
301 -
302 - if ( false !== $is_error ) {
303 - if ( $is_echo ) {
304 - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
305 - echo $is_error;
306 - }
307 - return $is_error;
308 - }
309 -
310 - // Check situation when we have editing "child booking resource", so need to reupdate calendar and form to have it for parent resource.
311 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
312 - if ( ( ! isset( $_GET['booking_pay'] ) ) && ( ! isset( $_GET['resource_no_update'] ) )
313 - && ( function_exists( 'wpbc_is_this_child_resource' ) )
314 - && ( wpbc_is_this_child_resource( $my_boook_type ) )
315 - ){
316 - $bk_parent_br_id = wpbc_get_parent_resource( $my_boook_type );
317 - $resource_id = $bk_parent_br_id;
318 - }
319 - }
320 -
321 - //--------------------------------------------------------------------------------------------------------------
322 - // Get JS vars for Booked dates | Rates | Availability & define function for showing calendar
323 -
324 - $start_script_code = wpbc__calendar__load( array(
325 - 'resource_id' => $resource_id,
326 - 'aggregate_resource_id_arr' => $additional_bk_types,
327 - 'selected_dates_without_calendar' => $my_selected_dates_without_calendar,
328 - 'calendar_number_of_months' => $cal_count,
329 - 'start_month_calendar' => $start_month_calendar,
330 - 'shortcode_options' => $bk_otions,
331 - 'custom_form' => ( isset( $_GET['booking_form'] ) ) ? wpbc_clean_text_value( $_GET['booking_form'] ) : $my_booking_form // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
332 - ));
333 -
334 -
335 - if ( $my_selected_dates_without_calendar !== '' ) { // FixIn: 9.3.1.1.
336 - // Disable booked time slots, for predefined selected date in the booking form (it's shortcode for booking form, without the calendar)
337 - $start_script_code .= '<script type="text/javascript"> ' . wpbc_jq_ready_start(); // FixIn: 10.1.3.7.
338 - $start_script_code .= " bkDisableBookedTimeSlots( jQuery( '#date_booking{$resource_id}' ).val(), {$resource_id} ); ";
339 - $start_script_code .= wpbc_jq_ready_end() . '</script>'; // FixIn: 10.1.3.7.
340 - }
341 -
342 -
343 - //--------------------------------------------------------------------------------------------------------------
344 - // Get booking form content
345 - $my_result = ' ' . $this->get__client_side_booking_content($resource_id, $my_booking_form, $my_selected_dates_without_calendar, $cal_count, $bk_otions ) . ' ' . $start_script_code ;
346 -
347 -
348 - $my_result = apply_filters('wpdev_booking_form', $my_result , $resource_id); // Add DIV structure, where to show payment form
349 -
350 -
351 - make_bk_action('finish_check_multiuser_params_for_client_side', $resource_id );
352 -
353 - if ( $is_echo ) {
354 - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
355 - echo $my_result;
356 - } else {
357 - return $my_result;
358 - }
359 - }
360 -
361 -
362 - /**
363 - * For [bookingcalendar ... ] shortcode Only!
364 - *
365 - * @param $resource_id
366 - * @param $cal_count
367 - * @param $is_echo
368 - * @param $start_month_calendar
369 - * @param $bk_otions
370 - *
371 - * @return string|void
372 - */
373 - function add_calendar_action( $resource_id = 1, $cal_count = 1, $is_echo = 1, $start_month_calendar = false, $bk_otions = array() ) {
374 -
375 - $additional_bk_types = array();
376 - if ( strpos($resource_id,';') !== false ) {
377 - $additional_bk_types = explode(';',$resource_id);
378 - $resource_id = $additional_bk_types[0];
379 - }
380 -
381 - make_bk_action('check_multiuser_params_for_client_side', $resource_id );
382 -
383 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
384 - if (isset($_GET['booking_hash'])) {
385 - $get_booking_hash = ( ( isset( $_GET['booking_hash'] ) ) ? sanitize_text_field( wp_unslash( $_GET['booking_hash'] ) ) : '' ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */
386 - $my_booking_id_type = wpbc_hash__get_booking_id__resource_id( $get_booking_hash );
387 - if ($my_booking_id_type != false)
388 - if ($my_booking_id_type[1]=='') {
389 - $my_result = '<strong>' . esc_html__('Oops!' ,'booking') . '</strong> ' . __('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');
390 - if ( $is_echo ) {
391 - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
392 - echo $my_result;
393 - } else {
394 - return $my_result;
395 - }
396 - return;
397 - }
398 - }
399 -
400 - $start_script_code = wpbc__calendar__load( array(
401 - 'resource_id' => $resource_id,
402 - 'aggregate_resource_id_arr' => $additional_bk_types,
403 - 'selected_dates_without_calendar' => '',
404 - 'calendar_number_of_months' => $cal_count,
405 - 'start_month_calendar' => $start_month_calendar,
406 - 'custom_form' => 'standard' // Because we show only 'AVAILABILITY CALENDAR' without the form, at all.
407 - ));
408 -
409 - $my_result = '<div style="clear:both;height:10px;"></div>' . $this->pre_get_calendar_html( $resource_id, $cal_count, $bk_otions );
410 -
411 - $my_result .= ' ' . $start_script_code ;
412 -
413 - $my_result = apply_filters('wpdev_booking_calendar', $my_result , $resource_id);
414 -
415 -
416 - $booking_form_is_using_bs_css = get_bk_option( 'booking_form_is_using_bs_css' );
417 - $my_result = '<span ' . (($booking_form_is_using_bs_css == 'On') ? 'class="wpdevelop"' : '') . '>' . $my_result . '</span>';
418 -
419 - make_bk_action('finish_check_multiuser_params_for_client_side', $resource_id );
420 -
421 - if ( $is_echo ) {
422 - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
423 - echo $my_result;
424 - } else {
425 - return $my_result;
426 - }
427 - }
428 -
429 - // Get content at client side of C A L E N D A R
430 - function get__client_side_booking_content( $resource_id = 1, $my_booking_form = 'standard', $my_selected_dates_without_calendar = '', $cal_count = 1, $bk_otions = array() ) {
431 -
432 - $nl = '<div style="clear:both;height:10px;"></div>'; // New line
433 - if ($my_selected_dates_without_calendar=='') {
434 - // Get HTML with [calendar] shortcode and Styles for calendar. Get legend html.
435 - $calendar = $this->pre_get_calendar_html( $resource_id, $cal_count, $bk_otions );
436 - } else {
437 - $calendar = '<textarea rows="3" cols="50" id="date_booking' . $resource_id . '" name="date_booking' . $resource_id . '" autocomplete="off" style="display:none;">' . $my_selected_dates_without_calendar . '</textarea>'; // Calendar code
438 - }
439 -
440 - // FixIn: 8.2.1.1.
441 - $form = '<a name="bklnk' . $resource_id . '" id="bklnk' . $resource_id . '"></a><div id="booking_form_div' . $resource_id . '" class="booking_form_div">';
442 - // FixIn: 6.0.1.5.
443 - $custom_params = array();
444 - if (! empty($bk_otions)) {
445 - $param ='\s*([name|value]+)=[\'"]{1}([^\'"]+)[\'"]{1}\s*'; // Find all possible options
446 - $pattern_to_search='%\s*{([^\s]+)' . $param . $param .'}\s*[,]?\s*%';
447 - preg_match_all($pattern_to_search, $bk_otions, $matches, PREG_SET_ORDER);
448 - //debuge($matches);
449 - foreach ( $matches as $matche_value ) {
450 - if ( $matche_value[1] == 'parameter' ) {
451 - $custom_params[ $matche_value[3] ]= $matche_value[5];
452 - }
453 - }
454 - }
455 - // FixIn: 6.0.1.5.
456 -
457 - if ( $this->wpdev_bk_personal !== false ) {
458 - $form .= $this->wpdev_bk_personal->get_booking_form( $resource_id, $my_booking_form, $custom_params );
459 - } else {
460 - $form .= wpbc_simple_form__get_booking_form__as_html( $resource_id );
461 - }
462 -
463 -
464 - // Insert calendar into form
465 - if ( strpos( $form, '[calendar]' ) !== false ) {
466 - $form = str_replace( '[calendar]', $calendar, $form );
467 - } else {
468 - $form = '<div class="booking_form_div">' . $calendar . '</div>' . $nl . $form;
469 - }
470 -
471 - // Replace additional calendars like [calendar id=9] to HTML and JS code
472 - $form = apply_bk_filter( 'wpdev_check_for_additional_calendars_in_form'
473 - , $form
474 - , $resource_id
475 - , array(
476 - 'booking_form' => $my_booking_form ,
477 - 'selected_dates' => $my_selected_dates_without_calendar ,
478 - 'cal_count' => $cal_count ,
479 - 'otions' => $bk_otions
480 - )
481 - );
482 -
483 - if ( strpos($form, '[captcha]') !== false ) {
484 - $captcha = $this->createCapthaContent($resource_id);
485 - $form =str_replace('[captcha]', $captcha ,$form);
486 - }
487 -
488 - // Set additional "Check in/out" times, if activated to use change-over days!
489 - $form = apply_filters( 'wpbc_booking_form_html__update__append_change_over_times', $form, $resource_id );
490 -
491 -
492 -
493 - // Add booking type field
494 - $form .= '<input id="bk_type' . $resource_id . '" name="bk_type' . $resource_id . '" class="" type="hidden" value="' . $resource_id . '" /></div>';
495 - $submitting = '<div id="submiting' . $resource_id . '"></div><div class="form_bk_messages" id="form_bk_messages' . $resource_id . '" ></div>';
496 -
497 - //Params: $action = -1, $name = "_wpnonce", $referer = true , $echo = true
498 -
499 - $wpbc_nonce = wp_nonce_field('CALCULATE_THE_COST', ( "wpbc_nonceCALCULATE_THE_COST" . $resource_id) , true , false );
500 -
501 -
502 - $res = $form . $submitting . $wpbc_nonce;
503 -
504 - $my_random_id = time() * wp_rand(0,1000);
505 - $my_random_id = 'form_id'. $my_random_id;
506 -
507 - $booking_form_is_using_bs_css = get_bk_option( 'booking_form_is_using_bs_css');
508 - $booking_form_format_type = get_bk_option( 'booking_form_format_type');
509 - $booking_form_theme = get_bk_option( 'booking_form_theme');
510 -
511 - $return_form = '<div id="' . $my_random_id . '" '
512 - . ' class="wpbc_container wpbc_form wpbc_container_booking_form '
513 - . ( ( wpbc_is_this_demo() == 'On' ) ? 'wpbc_demo_site ' : '' )
514 - . esc_attr( $booking_form_theme ) . ' '
515 - . ( ( $booking_form_is_using_bs_css == 'On' ) ? 'wpdevelop ' : '' )
516 - . '" >' .
517 - '<form id="booking_form' . $resource_id . '" class="booking_form ' . $booking_form_format_type . '" method="post" action="">' .
518 - '<div id="ajax_respond_insert' . $resource_id . '" class="ajax_respond_insert" style="display:none;"></div>' .
519 - $res.
520 - '</form></div>';
521 -
522 - $return_form .= '<div id="booking_form_garbage' . $resource_id . '" class="booking_form_garbage"></div>';
523 -
524 - if ($my_selected_dates_without_calendar == '' ) {
525 - // Check according already shown Booking Calendar and set do not visible of it
526 -
527 - $return_form .= '<script type="text/javascript"> ' . wpbc_jq_ready_start(); // FixIn: 10.1.3.7.
528 - $return_form .= ' jQuery(".widget_wpdev_booking .booking_form.form-horizontal").removeClass("form-horizontal");
529 - var visible_calendars_count = _wpbc.get_other_param( "calendars__on_this_page" ).length;
530 - if (visible_calendars_count !== null ) {
531 - for (var i=0;i< visible_calendars_count ;i++){
532 - if ( _wpbc.get_other_param( "calendars__on_this_page" )[i] === ' . $resource_id . ' ) {
533 - document.getElementById("'.$my_random_id.'").innerHTML = "<span style=\'color:#A00;font-size:10px;\'>'.
534 - /* translators: 1: ... */
535 - esc_js( sprintf( __( '%1$sWarning! Booking calendar for this booking resource are already at the page, please check more about this issue at %2$sthis page%3$s', 'booking' )
536 - , ''
537 - , ''
538 - , ': https://wpbookingcalendar.com/faq/why-the-booking-calendar-widget-not-show-on-page/'
539 - ) )
540 - .'</span>";
541 - jQuery("#'.$my_random_id.'").animate( {opacity: 1}, 10000 ).fadeOut(5000);
542 - return;
543 - }
544 - }
545 - _wpbc.get_other_param( "calendars__on_this_page" )[ visible_calendars_count ]=' . intval( $resource_id ) . ';
546 - } ';
547 - $return_form .= wpbc_jq_ready_end() . '</script>'; // FixIn: 10.1.3.7.
548 - } else {
549 - //FixIn:6.1.1.16 // FixIn: 8.2.1.13.
550 - $return_form .= '<script type="text/javascript"> ' . wpbc_jq_ready_start(); // FixIn: 10.1.3.7.
551 - $return_form .= ' if(typeof( showCostHintInsideBkForm ) == "function") { showCostHintInsideBkForm(' . $resource_id . '); } ';
552 - $return_form .= wpbc_jq_ready_end() . '</script>'; // FixIn: 10.1.3.7.
553 - }
554 -
555 - $is_use_auto_fill_for_logged = get_bk_option( 'booking_is_use_autofill_4_logged_user' ) ;
556 -
557 -
558 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
559 - if (! isset($_GET['booking_hash']))
560 - if ($is_use_auto_fill_for_logged == 'On') {
561 -
562 - $curr_user = wpbc_get_current_user();
563 - if ( $curr_user->ID > 0 ) {
564 - $user_nick_name = get_user_meta( $curr_user->ID, 'nickname' );
565 - $user_nick_name = ( empty( $user_nick_name ) ) ? '' : $user_nick_name[0]; // FixIn: 8.7.1.5.
566 -
567 - $return_form .= '<script type="text/javascript"> ' . wpbc_jq_ready_start(); // FixIn: 10.1.3.7.
568 - $return_form .= 'var bk_af_submit_form = document.getElementById( "booking_form' . $resource_id . '" );
569 - var bk_af_count = bk_af_submit_form.elements.length;
570 - var bk_af_element;
571 - var bk_af_reg;
572 - for (var bk_af_i=0; bk_af_i<bk_af_count; bk_af_i++) {
573 - bk_af_element = bk_af_submit_form.elements[bk_af_i];
574 - // FixIn: 9.4.3.4.
575 - if ( ( bk_af_element.type == "text" ) || ( bk_af_element.type == "email" ) )
576 - if ( bk_af_element.name !== ("date_booking' . $resource_id . '" ) )
577 - {
578 - // NickName // FixIn: 8.6.1.2.
579 - bk_af_reg = /^([A-Za-z0-9_\-\.])*(nickname){1}([A-Za-z0-9_\-\.])*$/;
580 - if(bk_af_reg.test(bk_af_element.name) != false)
581 - if (bk_af_element.value == "" )
582 - bk_af_element.value = "' . str_replace( "'", '', $user_nick_name ) . '";
583 - // Second Name
584 - bk_af_reg = /^([A-Za-z0-9_\-\.])*(last|second){1}([_\-\.])?name([A-Za-z0-9_\-\.])*$/;
585 - if(bk_af_reg.test(bk_af_element.name) != false)
586 - if (bk_af_element.value == "" )
587 - bk_af_element.value = "'.str_replace("'",'',$curr_user->last_name).'";
588 - // First Name
589 - bk_af_reg = /^name([0-9_\-\.])*$/;
590 - if(bk_af_reg.test(bk_af_element.name) != false)
591 - if (bk_af_element.value == "" )
592 - bk_af_element.value = "'.str_replace("'",'',$curr_user->first_name).'";
593 - bk_af_reg = /^([A-Za-z0-9_\-\.])*(first|my){1}([_\-\.])?name([A-Za-z0-9_\-\.])*$/;
594 - if(bk_af_reg.test(bk_af_element.name) != false)
595 - if (bk_af_element.value == "" )
596 - bk_af_element.value = "'.str_replace("'",'',$curr_user->first_name).'";
597 - // Email
598 - bk_af_reg = /^(e)?([_\-\.])?mail([0-9_\-\.])*$/;
599 - if(bk_af_reg.test(bk_af_element.name) != false)
600 - if (bk_af_element.value == "" )
601 - bk_af_element.value = "'.str_replace("'",'',$curr_user->user_email).'";
602 - // Phone
603 - bk_af_reg = /^([A-Za-z0-9_\-\.])*(phone|fone){1}([A-Za-z0-9_\-\.])*$/;
604 - if(bk_af_reg.test(bk_af_element.name) != false)
605 - if (bk_af_element.value == "" )
606 - bk_af_element.value = "'.str_replace("'",'',$curr_user->phone_number).'";
607 - // NB Enfants
608 - bk_af_reg = /^(e)?([_\-\.])?nb_enfant([0-9_\-\.])*$/;
609 - if(bk_af_reg.test(bk_af_element.name) != false)
610 - if (bk_af_element.value == "" )
611 - bk_af_element.value = "'.str_replace("'",'',$curr_user->nb_enfant).'";
612 - // URL
613 - bk_af_reg = /^([A-Za-z0-9_\-\.])*(URL|site|web|WEB){1}([A-Za-z0-9_\-\.])*$/;
614 - if(bk_af_reg.test(bk_af_element.name) != false)
615 - if (bk_af_element.value == "" )
616 - bk_af_element.value = "'.str_replace("'",'',$curr_user->user_url).'";
617 - }
618 - }';
619 - $return_form .= wpbc_jq_ready_end() . '</script>'; // FixIn: 10.1.3.7.
620 - }
621 - }
622 -
623 - return $return_form ;
624 - }
625 - // </editor-fold>
626 -
627 -
628 - // FixIn: 8.7.11.13.
629 - function wpbc_test_speed_shortcode( $attr ) {
630 -
631 - if ( wpbc_is_on_edit_page() ) {
632 - return wpbc_get_preview_for_shortcode( 'booking_test_speed', $attr ); // FixIn: 9.9.0.39.
633 - }
634 -
635 - $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1
636 -
637 - echo '<h4>Booking Calendar Test</h4>';
638 -
639 - $datesArray = Array(
640 - '2021-09-10'
641 - , '2021-09-11'
642 - , '2021-09-12'
643 - , '2021-09-13'
644 - , '2021-09-14'
645 - , '2021-09-15'
646 - , '2021-09-16'
647 - , '2021-09-17'
648 - , '2021-09-18'
649 - ) ;
650 - for( $i = 0; $i < 1 ; $i++) {
651 -$result = wpbc_api_is_dates_booked( $datesArray, $resource_id = 13 );
652 -//debuge((int) $result );
653 - }
654 -
655 - debuge_speed('(int)');
656 - echo '<hr/>';
657 - echo '<hr/>';
658 - }
659 -
660 -
661 45 // <editor-fold defaultstate="collapsed" desc=" S H O R T C O D E S ">
662 46
663 47 // FixIn: 8.1.3.5.
664 - /** Listing customners bookings in timeline view
48 + /** Render verified customer access and the customer's booking list.
665 49 *
666 - * @param $attr - The same parameters as for bookingtimeline shortcode (function)
50 + * @param array $attr Shortcode attributes.
667 51 *
668 - * @return mixed|string|void
52 + * @return string Customer verification or booking-listing HTML.
669 53 */
670 54 function bookingcustomerlisting_shortcode( $attr ){
671 55
672 56 if ( ! class_exists( 'wpdev_bk_personal' ) ) {
@@ -677,99 +61,44 @@
677 61 return wpbc_get_preview_for_shortcode( 'bookingcustomerlisting', $attr ); // FixIn: 9.9.0.39.
678 62 }
679 63
680 64 $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1
65 + $attr = is_array( $attr ) ? $attr : array();
681 66
682 - // FixIn: 8.4.5.11.
683 - if (! is_array($attr)) {
684 - $attr = array();
67 + if ( ! function_exists( 'wpbc_customer_bookings_render_shortcode' ) ) {
68 + return '<strong>' . esc_html__( 'Customer booking access is temporarily unavailable.', 'booking' ) . '</strong>';
685 69 }
686 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
687 - if ( ( isset( $_GET['booking_hash'] ) ) || ( isset( $attr['booking_hash'] ) ) ) {
688 70
689 -
690 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
691 - if ( isset( $_GET['booking_hash'] ) ) {
692 - $get_booking_hash = ( ( isset( $_GET['booking_hash'] ) ) ? sanitize_text_field( wp_unslash( $_GET['booking_hash'] ) ) : '' ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */
693 - $my_booking_id_type = wpbc_hash__get_booking_id__resource_id( $get_booking_hash );
694 -
695 - $attr['booking_hash'] = $get_booking_hash;
696 - } else {
697 - $my_booking_id_type = wpbc_hash__get_booking_id__resource_id( $attr['booking_hash'] );
698 - }
699 -
700 - if ( $my_booking_id_type !== false ) {
701 -
702 - if ( ! isset( $attr['type' ] ) ) { // 8.1.3.5.2
703 -
704 - $br_list = wpbc_get_all_booking_resources_list();
705 - $br_list = array_keys( $br_list );
706 - $br_list = implode(',',$br_list);
707 - $attr['type' ] = $br_list; //wpbc_get_default_resource();
708 - }
709 - if ( ! isset( $attr['view_days_num' ] ) ) {
710 - $attr['view_days_num' ] = 30;
711 - }
712 - if ( ! isset( $attr['scroll_start_date' ] ) ) {
713 - $attr['scroll_start_date' ] = '';
714 - }
715 - if ( ! isset( $attr['scroll_day' ] ) ) {
716 - $attr['scroll_day' ] = 0;
717 - }
718 - if ( ! isset( $attr['scroll_month' ] ) ) {
719 - $attr['scroll_month' ] = 0;
720 - }
721 - if ( ! isset( $attr['header_title' ] ) ) {
722 - $attr['header_title' ] = __( 'My bookings' , 'booking');
723 - }
724 -
725 - $timeline_results = $this->bookingtimeline_shortcode( $attr );
726 -
727 - return $timeline_results ;
728 -
729 - } else {
730 - return '<strong>' . esc_html__('Oops!' ,'booking') . '</strong> ' . esc_html__('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');
731 - }
732 -
733 - } else {
734 - return __( 'This page can only be accessed through links in emails related to your booking.', 'booking' )
735 - . ' <br/><em>'
736 - /* translators: 1: ... */
737 - . sprintf( __( 'Please check more about configuration at %1$sthis page%2$s', 'booking' ), '<a href="https://wpbookingcalendar.com/faq/configure-editing-cancel-payment-bookings-for-visitors/" target="_blank">', '</a>.' )
738 - . '</em>';
739 - }
71 + return wpbc_customer_bookings_render_shortcode( $attr );
740 72 }
741 73
742 -
743 - /**
74 + /**
744 75 * TimeLine shortcode
745 - *
746 - * @param type $attr
747 - * @return type
748 - *
749 - * Shortcodes exmaples:
750 - *
751 - *
752 -** Matrix:
753 - * 1 Month View Mode:
754 -[bookingtimeline type="3,4,1,5,6,7,8,9,2,10,11,12,14" view_days_num=30 scroll_start_date="" scroll_month=0 header_title='All Bookings']
755 - * 2 Months View Mode:
756 -[bookingtimeline type="1,5,6,7,8,9,2,10,11,12,3,4,14" view_days_num=60 scroll_start_date="" scroll_month=-1 header_title='All Bookings']
757 - * 1 Week View Mode:
758 -[bookingtimeline type="3,4" view_days_num=7 scroll_start_date="" scroll_day=-7 header_title='All Bookings']
759 - * 1 Day View Mode:
760 -[bookingtimeline type="3,4" view_days_num=1 scroll_start_date="" scroll_day=0 header_title='All Bookings']
761 -
762 -** Single:
763 - * 1 Month View Mode:
764 -[bookingtimeline type="4" view_days_num=30 scroll_start_date="" scroll_day=-15 scroll_month=0 header_title='All Bookings']
765 - * 3 Months View Mode:
766 -[bookingtimeline type="4" view_days_num=90 scroll_start_date="" scroll_day=-30]
767 - * 1 Year View Mode:
768 -[bookingtimeline type="4" view_days_num=365 scroll_start_date="" scroll_month=-3]
769 -
770 -
771 - */
76 + *
77 + * @param type $attr
78 + *
79 + * @return type
80 + *
81 + * Shortcodes exmaples:
82 + *
83 + *
84 + ** Matrix:
85 + * 1 Month View Mode:
86 + * [bookingtimeline type="3,4,1,5,6,7,8,9,2,10,11,12,14" view_days_num=30 scroll_start_date="" scroll_month=0 header_title='All Bookings']
87 + * 2 Months View Mode:
88 + * [bookingtimeline type="1,5,6,7,8,9,2,10,11,12,3,4,14" view_days_num=60 scroll_start_date="" scroll_month=-1 header_title='All Bookings']
89 + * 1 Week View Mode:
90 + * [bookingtimeline type="3,4" view_days_num=7 scroll_start_date="" scroll_day=-7 header_title='All Bookings']
91 + * 1 Day View Mode:
92 + * [bookingtimeline type="3,4" view_days_num=1 scroll_start_date="" scroll_day=0 header_title='All Bookings']
93 + ** Single:
94 + * 1 Month View Mode:
95 + * [bookingtimeline type="4" view_days_num=30 scroll_start_date="" scroll_day=-15 scroll_month=0 header_title='All Bookings']
96 + * 3 Months View Mode:
97 + * [bookingtimeline type="4" view_days_num=90 scroll_start_date="" scroll_day=-30]
98 + * 1 Year View Mode:
99 + * [bookingtimeline type="4" view_days_num=365 scroll_start_date="" scroll_month=-3]
100 + */
772 101 function bookingtimeline_shortcode($attr) {
773 102
774 103 if ( wpbc_is_on_edit_page() ) {
775 104 return wpbc_get_preview_for_shortcode( 'bookingtimeline', $attr ); // FixIn: 9.9.0.39.
@@ -780,149 +109,10 @@
780 109 // FixIn: 8.6.1.13.
781 110 $timeline_results = bookingflextimeline_shortcode($attr);
782 111 return $timeline_results;
783 112 }
784 -
785 - // Replace MARK at post with content at client side ----- [booking nummonths='1' type='1']
786 - function booking_shortcode($attr) {
787 113
788 - if ( wpbc_is_on_edit_page() ) {
789 - return wpbc_get_preview_for_shortcode( 'booking', $attr ); // FixIn: 9.9.0.39.
790 - }
791 114
792 - $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1
793 -
794 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
795 - if ( isset( $_GET['booking_hash'] ) ) {
796 - return
797 - __( 'You need to use special shortcode [bookingedit] for booking editing.', 'booking' )
798 - . ' '
799 - /* translators: 1: ... */
800 - . sprintf( __( 'Please check FAQ instruction how to configure it here %s', 'booking' )
801 - , '<a href="https://wpbookingcalendar.com/faq/configure-editing-cancel-payment-bookings-for-visitors/">https://wpbookingcalendar.com/faq/configure-editing-cancel-payment-bookings-for-visitors/</a>'
802 - );
803 - }
804 -
805 - //if ( function_exists( 'wpbc_br_cache' ) ) $br_cache = wpbc_br_cache(); // Init booking resources cache
806 -
807 - $my_boook_count = get_bk_option( 'booking_client_cal_count' );
808 - $my_boook_type = 1;
809 - $my_booking_form = 'standard';
810 - $start_month_calendar = false;
811 - $bk_otions = array();
812 -
813 - if ( isset( $attr['nummonths'] ) ) { $my_boook_count = $attr['nummonths']; }
814 -
815 - if ( isset( $attr['resource_id'] ) ) {
816 - $attr['type'] = intval( $attr['resource_id'] ); // FixIn: 10.2.2.2.
817 - }
818 - if ( isset( $attr['type'] ) ) {
819 - $my_boook_type = intval( $attr['type'] ); // FixIn: 10.2.2.2.
820 - }
821 -
822 - if ( isset( $attr['form_type'] ) ) { $my_booking_form = $attr['form_type']; }
823 -
824 - if ( isset( $attr['agregate'] ) && (! empty( $attr['agregate'] )) ) {
825 - $additional_bk_types = $attr['agregate'];
826 - $my_boook_type .= ';'.$additional_bk_types;
827 - }
828 - if ( isset( $attr['aggregate'] ) && (! empty( $attr['aggregate'] )) ) {
829 - $additional_bk_types = $attr['aggregate'];
830 - $my_boook_type .= ';'.$additional_bk_types;
831 - }
832 -
833 -
834 - if ( isset( $attr['startmonth'] ) ) { // Set start month of calendar, fomrat: '2011-1'
835 -
836 - $start_month_calendar = explode( '-', $attr['startmonth'] );
837 - if ( (is_array($start_month_calendar)) && ( count($start_month_calendar) > 1) ) { }
838 - else $start_month_calendar = false;
839 -
840 - }
841 -
842 - if ( isset( $attr['options'] ) ) { $bk_otions = $attr['options']; }
843 -
844 - $res = $this->add_booking_form_action( $my_boook_type, $my_boook_count, 0, $my_booking_form, '', $start_month_calendar, $bk_otions );
845 -
846 - return $res;
847 - }
848 -
849 - // Replace MARK at post with content at client side ----- [booking nummonths='1' type='1']
850 - function booking_calendar_only_shortcode($attr) {
851 -
852 - if ( wpbc_is_on_edit_page() ) {
853 - return wpbc_get_preview_for_shortcode( 'bookingcalendar', $attr ); // FixIn: 9.9.0.39.
854 - }
855 -
856 - $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1
857 -
858 - //if ( function_exists( 'wpbc_br_cache' ) ) $br_cache = wpbc_br_cache(); // Init booking resources cache
859 -
860 - $my_boook_count = get_bk_option( 'booking_client_cal_count' );
861 - $my_boook_type = 1;
862 - $start_month_calendar = false;
863 - $bk_otions = array();
864 - if ( isset( $attr['nummonths'] ) ) { $my_boook_count = $attr['nummonths']; }
865 - if ( isset( $attr['resource_id'] ) ) {
866 - $attr['type'] = intval( $attr['resource_id'] ); // FixIn: 10.2.2.2.
867 - }
868 - if ( isset( $attr['type'] ) ) {
869 - $my_boook_type = intval( $attr['type'] ); // FixIn: 10.2.2.2.
870 - }
871 - if ( isset( $attr['agregate'] ) && (! empty( $attr['agregate'] )) ) {
872 - $additional_bk_types = $attr['agregate'];
873 - $my_boook_type .= ';'.$additional_bk_types;
874 - }
875 - if ( isset( $attr['aggregate'] ) && (! empty( $attr['aggregate'] )) ) { // FixIn: 8.3.3.8.
876 - $additional_bk_types = $attr['aggregate'];
877 - $my_boook_type .= ';'.$additional_bk_types;
878 - }
879 -
880 - if ( isset( $attr['startmonth'] ) ) { // Set start month of calendar, fomrat: '2011-1'
881 - $start_month_calendar = explode( '-', $attr['startmonth'] );
882 - if ( (is_array($start_month_calendar)) && ( count($start_month_calendar) > 1) ) { }
883 - else $start_month_calendar = false;
884 - }
885 -
886 - if ( isset( $attr['options'] ) ) { $bk_otions = $attr['options']; }
887 - $res = $this->add_calendar_action($my_boook_type,$my_boook_count, 0, $start_month_calendar, $bk_otions );
888 -
889 -
890 - $start_script_code = "<div id='calendar_booking_unselectable".$my_boook_type."'></div>";
891 - return "<div class='wpbc_only_calendar wpbc_container'>" . $start_script_code . $res . '</div>'; // FixIn: 8.0.1.2.
892 - }
893 -
894 - // Show only booking form, with already selected dates
895 - function bookingform_shortcode($attr) {
896 -
897 - if ( wpbc_is_on_edit_page() ) {
898 - return wpbc_get_preview_for_shortcode( 'bookingform', $attr ); // FixIn: 9.9.0.39.
899 - }
900 -
901 - $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1
902 -
903 - //if ( function_exists( 'wpbc_br_cache' ) ) $br_cache = wpbc_br_cache(); // Init booking resources cache
904 -
905 - $my_boook_type = 1;
906 - $my_booking_form = 'standard';
907 - $my_boook_count = 1;
908 - $my_selected_dates_without_calendar = '';
909 -
910 - if ( isset( $attr['resource_id'] ) ) {
911 - $attr['type'] = intval( $attr['resource_id'] ); // FixIn: 10.2.2.2.
912 - }
913 - if ( isset( $attr['type'] ) ) {
914 - $my_boook_type = intval( $attr['type'] ); // FixIn: 10.2.2.2.
915 - }
916 - if ( isset( $attr['form_type'] ) ) { $my_booking_form = $attr['form_type']; }
917 - if ( isset( $attr['selected_dates'] ) ) { $my_selected_dates_without_calendar = $attr['selected_dates']; } //$my_selected_dates_without_calendar = '20.08.2010, 29.08.2010';
918 -
919 - $res = $this->add_booking_form_action($my_boook_type,$my_boook_count, 0 , $my_booking_form, $my_selected_dates_without_calendar, false );
920 -
921 - return $res;
922 - }
923 -
924 -
925 115 // Show booking form for editing
926 116 function bookingedit_shortcode($attr) {
927 117
928 118 if ( wpbc_is_on_edit_page() ) {
@@ -949,24 +139,25 @@
949 139
950 140 $my_boook_count = get_bk_option( 'booking_client_cal_count' );
951 141 $my_boook_type = 1;
952 142 $my_booking_form = 'standard';
953 - $bk_otions = array();
954 - if ( isset( $attr['nummonths'] ) ) { $my_boook_count = $attr['nummonths']; }
955 - if ( isset( $attr['resource_id'] ) ) { $attr['type'] = $attr['resource_id']; }
956 - if ( isset( $attr['type'] ) ) { $my_boook_type = $attr['type']; }
143 + $shortcode_param__options = array();
144 + if ( isset( $attr['nummonths'] ) ) { $my_boook_count = intval( $attr['nummonths'] ); }
145 + if ( isset( $attr['resource_id'] ) ) { $attr['type'] = intval( $attr['resource_id']); }
146 + if ( isset( $attr['type'] ) ) { $my_boook_type = intval( $attr['type']); }
957 147 if ( isset( $attr['form_type'] ) ) { $my_booking_form = $attr['form_type']; }
958 - if ( isset( $attr['agregate'] ) && (! empty( $attr['agregate'] )) ) { // FixIn: 7.0.1.26.
959 - $additional_bk_types = $attr['agregate'];
960 - $my_boook_type .= ';'.$additional_bk_types;
961 - }
962 - if ( isset( $attr['aggregate'] ) && (! empty( $attr['aggregate'] )) ) {
963 - $additional_bk_types = $attr['aggregate'];
964 - $my_boook_type .= ';'.$additional_bk_types;
965 - }
966 - if ( isset( $attr['options'] ) ) { $bk_otions = $attr['options']; }
148 + if ( isset( $attr['agregate'] ) && ( ! empty( $attr['agregate'] ) ) ) { // FixIn: 7.0.1.26.
149 + $my_boook_type .= ';' . $attr['agregate'];
150 + }
151 + if ( isset( $attr['aggregate'] ) && ( ! empty( $attr['aggregate'] ) ) ) {
152 + $my_boook_type .= ';' . $attr['aggregate'];
153 + }
154 + // Escape any XSS in aggregate parameter.
155 + $my_boook_type = str_replace( ',', ';', wpbc_clean_digit_or_csd( $my_boook_type ) );
967 156
157 + if ( isset( $attr['options'] ) ) { $shortcode_param__options = $attr['options']; }
968 158
159 +
969 160 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
970 161 if (isset($_GET['booking_hash'])) {
971 162 $get_booking_hash = ( ( isset( $_GET['booking_hash'] ) ) ? sanitize_text_field( wp_unslash( $_GET['booking_hash'] ) ) : '' ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */
972 163 $my_booking_id_type = wpbc_hash__get_booking_id__resource_id( $get_booking_hash );
@@ -972,16 +163,16 @@
972 163 $my_booking_id_type = wpbc_hash__get_booking_id__resource_id( $get_booking_hash );
973 164 if ($my_booking_id_type !== false) {
974 165 $my_edited_bk_id = $my_booking_id_type[0];
975 166 $my_boook_type = $my_booking_id_type[1];
976 - if ($my_boook_type == '') return '<strong>' . esc_html__('Oops!' ,'booking') . '</strong> ' . esc_html__('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');
167 + if ($my_boook_type == '') 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> ' . esc_html__('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>';
977 168 } else {
978 - return '<strong>' . esc_html__('Oops!' ,'booking') . '</strong> ' . esc_html__('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');
169 + 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> ' . esc_html__('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>';
979 170 }
980 171
981 172 } else {
982 173 return __('This page can only be accessed through links in emails related to your booking.' ,'booking')
983 - . ' <br/><em>'
174 + . ' <br/><em>'
984 175 /* translators: 1: ... */
985 176 . sprintf( __( 'Please check more about configuration at %1$sthis page%2$s', 'booking' )
986 177 , '<a href="https://wpbookingcalendar.com/faq/configure-editing-cancel-payment-bookings-for-visitors/" target="_blank">' , '</a>.')
987 178 . '</em>';
@@ -987,9 +178,9 @@
987 178 . '</em>';
988 179 }
989 180
990 181
991 - $res = $this->add_booking_form_action($my_boook_type,$my_boook_count, 0 , $my_booking_form, '', false, $bk_otions );
182 + $res = wpbc_get_rendered_booking_form_html($my_boook_type,$my_boook_count, 0 , $my_booking_form, '', false, $shortcode_param__options );
992 183
993 184 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
994 185 if (isset($_GET['booking_pay'])) {
995 186 // Payment form
@@ -1074,9 +265,8 @@
1074 265
1075 266 return $search_results_to_show;
1076 267 }
1077 268
1078 -
1079 269 // Select Booking form using the selectbox
1080 270 function bookingselect_shortcode($attr) {
1081 271
1082 272 if ( ! class_exists( 'wpdev_bk_personal' ) ) {
@@ -1089,9 +279,9 @@
1089 279
1090 280 $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1
1091 281
1092 282 //if ( function_exists( 'wpbc_br_cache' ) ) $br_cache = wpbc_br_cache(); // Init booking resources cache
1093 -
283 +
1094 284 $search_form = apply_bk_filter('wpdev_get_booking_select_form','', $attr );
1095 285
1096 286 return $search_form ;
1097 287 }
@@ -1109,13 +299,12 @@
1109 299
1110 300 $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1
1111 301
1112 302 //if ( function_exists( 'wpbc_br_cache' ) ) $br_cache = wpbc_br_cache(); // Init booking resources cache
1113 -
303 +
1114 304 $search_form = apply_bk_filter('wpbc_booking_resource_info','', $attr );
1115 305
1116 306 return $search_form ;
1117 307 }
1118 -
1119 -
308 +
1120 309 // </editor-fold>
1121 -}
310 +}