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 -882 10.11.211.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,633 +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'] ) ) // FixIn: 10.10.1.2 && ( ! 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 - // Re-update other hints, such as availability times hint.
463 - $form = apply_filters( 'wpbc_booking_form_content__after_load', $form, $resource_id, $my_booking_form );
464 - }
465 -
466 -
467 - // Insert calendar into form
468 - if ( strpos( $form, '[calendar]' ) !== false ) {
469 - $form = str_replace( '[calendar]', $calendar, $form );
470 - } else {
471 - $form = '<div class="booking_form_div">' . $calendar . '</div>' . $nl . $form;
472 - }
473 -
474 - // Replace additional calendars like [calendar id=9] to HTML and JS code
475 - $form = apply_bk_filter( 'wpdev_check_for_additional_calendars_in_form'
476 - , $form
477 - , $resource_id
478 - , array(
479 - 'booking_form' => $my_booking_form ,
480 - 'selected_dates' => $my_selected_dates_without_calendar ,
481 - 'cal_count' => $cal_count ,
482 - 'otions' => $bk_otions
483 - )
484 - );
485 -
486 - if ( strpos($form, '[captcha]') !== false ) {
487 - $captcha = $this->createCapthaContent($resource_id);
488 - $form =str_replace('[captcha]', $captcha ,$form);
489 - }
490 -
491 - // Set additional "Check in/out" times, if activated to use change-over days!
492 - $form = apply_filters( 'wpbc_booking_form_html__update__append_change_over_times', $form, $resource_id );
493 -
494 -
495 -
496 - // Add booking type field
497 - $form .= '<input id="bk_type' . $resource_id . '" name="bk_type' . $resource_id . '" class="" type="hidden" value="' . $resource_id . '" /></div>';
498 - $submitting = '<div id="submiting' . $resource_id . '"></div><div class="form_bk_messages" id="form_bk_messages' . $resource_id . '" ></div>';
499 -
500 - //Params: $action = -1, $name = "_wpnonce", $referer = true , $echo = true
501 -
502 - $wpbc_nonce = wp_nonce_field('CALCULATE_THE_COST', ( "wpbc_nonceCALCULATE_THE_COST" . $resource_id) , true , false );
503 -
504 -
505 - $res = $form . $submitting . $wpbc_nonce;
506 -
507 - $my_random_id = time() * wp_rand(0,1000);
508 - $my_random_id = 'form_id'. $my_random_id;
509 -
510 - $booking_form_is_using_bs_css = get_bk_option( 'booking_form_is_using_bs_css');
511 - $booking_form_format_type = get_bk_option( 'booking_form_format_type');
512 - $booking_form_theme = get_bk_option( 'booking_form_theme');
513 -
514 - $return_form = '<div id="' . $my_random_id . '" '
515 - . ' class="wpbc_container wpbc_form wpbc_container_booking_form '
516 - . ( ( wpbc_is_this_demo() == 'On' ) ? 'wpbc_demo_site ' : '' )
517 - . esc_attr( $booking_form_theme ) . ' '
518 - . ( ( $booking_form_is_using_bs_css == 'On' ) ? 'wpdevelop ' : '' )
519 - . '" >' .
520 - '<form id="booking_form' . $resource_id . '" class="booking_form ' . $booking_form_format_type . '" method="post" action="">' .
521 - '<div id="ajax_respond_insert' . $resource_id . '" class="ajax_respond_insert" style="display:none;"></div>' .
522 - $res.
523 - '</form></div>';
524 -
525 - $return_form .= '<div id="booking_form_garbage' . $resource_id . '" class="booking_form_garbage"></div>';
526 -
527 - if ($my_selected_dates_without_calendar == '' ) {
528 - // Check according already shown Booking Calendar and set do not visible of it
529 -
530 - $return_form .= '<script type="text/javascript"> ' . wpbc_jq_ready_start(); // FixIn: 10.1.3.7.
531 - $return_form .= ' jQuery(".widget_wpdev_booking .booking_form.form-horizontal").removeClass("form-horizontal");
532 - var visible_calendars_count = _wpbc.get_other_param( "calendars__on_this_page" ).length;
533 - if (visible_calendars_count !== null ) {
534 - for (var i=0;i< visible_calendars_count ;i++){
535 - if ( _wpbc.get_other_param( "calendars__on_this_page" )[i] === ' . $resource_id . ' ) {
536 - document.getElementById("'.$my_random_id.'").innerHTML = "<span style=\'color:#A00;font-size:10px;\'>'.
537 - /* translators: 1: ... */
538 - 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' )
539 - , ''
540 - , ''
541 - , ': https://wpbookingcalendar.com/faq/why-the-booking-calendar-widget-not-show-on-page/'
542 - ) )
543 - .'</span>";
544 - jQuery("#'.$my_random_id.'").animate( {opacity: 1}, 10000 ).fadeOut(5000);
545 - return;
546 - }
547 - }
548 - _wpbc.get_other_param( "calendars__on_this_page" )[ visible_calendars_count ]=' . intval( $resource_id ) . ';
549 - } ';
550 - $return_form .= wpbc_jq_ready_end() . '</script>'; // FixIn: 10.1.3.7.
551 - } else {
552 - //FixIn:6.1.1.16 // FixIn: 8.2.1.13.
553 - $return_form .= '<script type="text/javascript"> ' . wpbc_jq_ready_start(); // FixIn: 10.1.3.7.
554 - $return_form .= ' if(typeof( showCostHintInsideBkForm ) == "function") { showCostHintInsideBkForm(' . $resource_id . '); } ';
555 - $return_form .= wpbc_jq_ready_end() . '</script>'; // FixIn: 10.1.3.7.
556 - }
557 -
558 - $is_use_auto_fill_for_logged = get_bk_option( 'booking_is_use_autofill_4_logged_user' ) ;
559 -
560 -
561 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
562 - if (! isset($_GET['booking_hash']))
563 - if ($is_use_auto_fill_for_logged == 'On') {
564 -
565 - $curr_user = wpbc_get_current_user();
566 - if ( $curr_user->ID > 0 ) {
567 - $user_nick_name = get_user_meta( $curr_user->ID, 'nickname' );
568 - $user_nick_name = ( empty( $user_nick_name ) ) ? '' : $user_nick_name[0]; // FixIn: 8.7.1.5.
569 -
570 - $return_form .= '<script type="text/javascript"> ' . wpbc_jq_ready_start(); // FixIn: 10.1.3.7.
571 - $return_form .= 'var bk_af_submit_form = document.getElementById( "booking_form' . $resource_id . '" );
572 - var bk_af_count = bk_af_submit_form.elements.length;
573 - var bk_af_element;
574 - var bk_af_reg;
575 - for (var bk_af_i=0; bk_af_i<bk_af_count; bk_af_i++) {
576 - bk_af_element = bk_af_submit_form.elements[bk_af_i];
577 - // FixIn: 9.4.3.4.
578 - if ( ( bk_af_element.type == "text" ) || ( bk_af_element.type == "email" ) )
579 - if ( bk_af_element.name !== ("date_booking' . $resource_id . '" ) )
580 - {
581 - // NickName // FixIn: 8.6.1.2.
582 - bk_af_reg = /^([A-Za-z0-9_\-\.])*(nickname){1}([A-Za-z0-9_\-\.])*$/;
583 - if(bk_af_reg.test(bk_af_element.name) != false)
584 - if (bk_af_element.value == "" )
585 - bk_af_element.value = "' . str_replace( "'", '', $user_nick_name ) . '";
586 - // Second Name
587 - bk_af_reg = /^([A-Za-z0-9_\-\.])*(last|second){1}([_\-\.])?name([A-Za-z0-9_\-\.])*$/;
588 - if(bk_af_reg.test(bk_af_element.name) != false)
589 - if (bk_af_element.value == "" )
590 - bk_af_element.value = "'.str_replace("'",'',$curr_user->last_name).'";
591 - // First Name
592 - bk_af_reg = /^name([0-9_\-\.])*$/;
593 - if(bk_af_reg.test(bk_af_element.name) != false)
594 - if (bk_af_element.value == "" )
595 - bk_af_element.value = "'.str_replace("'",'',$curr_user->first_name).'";
596 - bk_af_reg = /^([A-Za-z0-9_\-\.])*(first|my){1}([_\-\.])?name([A-Za-z0-9_\-\.])*$/;
597 - if(bk_af_reg.test(bk_af_element.name) != false)
598 - if (bk_af_element.value == "" )
599 - bk_af_element.value = "'.str_replace("'",'',$curr_user->first_name).'";
600 - // Email
601 - bk_af_reg = /^(e)?([_\-\.])?mail([0-9_\-\.])*$/;
602 - if(bk_af_reg.test(bk_af_element.name) != false)
603 - if (bk_af_element.value == "" )
604 - bk_af_element.value = "'.str_replace("'",'',$curr_user->user_email).'";
605 - // Phone
606 - bk_af_reg = /^([A-Za-z0-9_\-\.])*(phone|fone){1}([A-Za-z0-9_\-\.])*$/;
607 - if(bk_af_reg.test(bk_af_element.name) != false)
608 - if (bk_af_element.value == "" )
609 - bk_af_element.value = "'.str_replace("'",'',$curr_user->phone_number).'";
610 - // NB Enfants
611 - bk_af_reg = /^(e)?([_\-\.])?nb_enfant([0-9_\-\.])*$/;
612 - if(bk_af_reg.test(bk_af_element.name) != false)
613 - if (bk_af_element.value == "" )
614 - bk_af_element.value = "'.str_replace("'",'',$curr_user->nb_enfant).'";
615 - // URL
616 - bk_af_reg = /^([A-Za-z0-9_\-\.])*(URL|site|web|WEB){1}([A-Za-z0-9_\-\.])*$/;
617 - if(bk_af_reg.test(bk_af_element.name) != false)
618 - if (bk_af_element.value == "" )
619 - bk_af_element.value = "'.str_replace("'",'',$curr_user->user_url).'";
620 - }
621 - }';
622 - $return_form .= wpbc_jq_ready_end() . '</script>'; // FixIn: 10.1.3.7.
623 - }
624 - }
625 -
626 - return $return_form ;
627 - }
628 - // </editor-fold>
629 -
630 -
631 - // FixIn: 8.7.11.13.
632 - function wpbc_test_speed_shortcode( $attr ) {
633 -
634 - if ( wpbc_is_on_edit_page() ) {
635 - return wpbc_get_preview_for_shortcode( 'booking_test_speed', $attr ); // FixIn: 9.9.0.39.
636 - }
637 -
638 - $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1
639 -
640 - echo '<h4>Booking Calendar Test</h4>';
641 -
642 - $datesArray = Array(
643 - '2021-09-10'
644 - , '2021-09-11'
645 - , '2021-09-12'
646 - , '2021-09-13'
647 - , '2021-09-14'
648 - , '2021-09-15'
649 - , '2021-09-16'
650 - , '2021-09-17'
651 - , '2021-09-18'
652 - ) ;
653 - for( $i = 0; $i < 1 ; $i++) {
654 -$result = wpbc_api_is_dates_booked( $datesArray, $resource_id = 13 );
655 -//debuge((int) $result );
656 - }
657 -
658 - debuge_speed('(int)');
659 - echo '<hr/>';
660 - echo '<hr/>';
661 - }
662 -
663 -
664 45 // <editor-fold defaultstate="collapsed" desc=" S H O R T C O D E S ">
665 46
666 47 // FixIn: 8.1.3.5.
667 - /** Listing customners bookings in timeline view
48 + /** Render verified customer access and the customer's booking list.
668 49 *
669 - * @param $attr - The same parameters as for bookingtimeline shortcode (function)
50 + * @param array $attr Shortcode attributes.
670 51 *
671 - * @return mixed|string|void
52 + * @return string Customer verification or booking-listing HTML.
672 53 */
673 54 function bookingcustomerlisting_shortcode( $attr ){
674 55
675 56 if ( ! class_exists( 'wpdev_bk_personal' ) ) {
@@ -680,99 +61,44 @@
680 61 return wpbc_get_preview_for_shortcode( 'bookingcustomerlisting', $attr ); // FixIn: 9.9.0.39.
681 62 }
682 63
683 64 $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1
65 + $attr = is_array( $attr ) ? $attr : array();
684 66
685 - // FixIn: 8.4.5.11.
686 - if (! is_array($attr)) {
687 - $attr = array();
67 + if ( ! function_exists( 'wpbc_customer_bookings_render_shortcode' ) ) {
68 + return '<strong>' . esc_html__( 'Customer booking access is temporarily unavailable.', 'booking' ) . '</strong>';
688 69 }
689 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
690 - if ( ( isset( $_GET['booking_hash'] ) ) || ( isset( $attr['booking_hash'] ) ) ) {
691 70
692 -
693 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
694 - if ( isset( $_GET['booking_hash'] ) ) {
695 - $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 */
696 - $my_booking_id_type = wpbc_hash__get_booking_id__resource_id( $get_booking_hash );
697 -
698 - $attr['booking_hash'] = $get_booking_hash;
699 - } else {
700 - $my_booking_id_type = wpbc_hash__get_booking_id__resource_id( $attr['booking_hash'] );
701 - }
702 -
703 - if ( $my_booking_id_type !== false ) {
704 -
705 - if ( ! isset( $attr['type' ] ) ) { // 8.1.3.5.2
706 -
707 - $br_list = wpbc_get_all_booking_resources_list();
708 - $br_list = array_keys( $br_list );
709 - $br_list = implode(',',$br_list);
710 - $attr['type' ] = $br_list; //wpbc_get_default_resource();
711 - }
712 - if ( ! isset( $attr['view_days_num' ] ) ) {
713 - $attr['view_days_num' ] = 30;
714 - }
715 - if ( ! isset( $attr['scroll_start_date' ] ) ) {
716 - $attr['scroll_start_date' ] = '';
717 - }
718 - if ( ! isset( $attr['scroll_day' ] ) ) {
719 - $attr['scroll_day' ] = 0;
720 - }
721 - if ( ! isset( $attr['scroll_month' ] ) ) {
722 - $attr['scroll_month' ] = 0;
723 - }
724 - if ( ! isset( $attr['header_title' ] ) ) {
725 - $attr['header_title' ] = __( 'My bookings' , 'booking');
726 - }
727 -
728 - $timeline_results = $this->bookingtimeline_shortcode( $attr );
729 -
730 - return $timeline_results ;
731 -
732 - } else {
733 - 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');
734 - }
735 -
736 - } else {
737 - return __( 'This page can only be accessed through links in emails related to your booking.', 'booking' )
738 - . ' <br/><em>'
739 - /* translators: 1: ... */
740 - . 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>.' )
741 - . '</em>';
742 - }
71 + return wpbc_customer_bookings_render_shortcode( $attr );
743 72 }
744 73
745 -
746 - /**
74 + /**
747 75 * TimeLine shortcode
748 - *
749 - * @param type $attr
750 - * @return type
751 - *
752 - * Shortcodes exmaples:
753 - *
754 - *
755 -** Matrix:
756 - * 1 Month View Mode:
757 -[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']
758 - * 2 Months View Mode:
759 -[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']
760 - * 1 Week View Mode:
761 -[bookingtimeline type="3,4" view_days_num=7 scroll_start_date="" scroll_day=-7 header_title='All Bookings']
762 - * 1 Day View Mode:
763 -[bookingtimeline type="3,4" view_days_num=1 scroll_start_date="" scroll_day=0 header_title='All Bookings']
764 -
765 -** Single:
766 - * 1 Month View Mode:
767 -[bookingtimeline type="4" view_days_num=30 scroll_start_date="" scroll_day=-15 scroll_month=0 header_title='All Bookings']
768 - * 3 Months View Mode:
769 -[bookingtimeline type="4" view_days_num=90 scroll_start_date="" scroll_day=-30]
770 - * 1 Year View Mode:
771 -[bookingtimeline type="4" view_days_num=365 scroll_start_date="" scroll_month=-3]
772 -
773 -
774 - */
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 + */
775 101 function bookingtimeline_shortcode($attr) {
776 102
777 103 if ( wpbc_is_on_edit_page() ) {
778 104 return wpbc_get_preview_for_shortcode( 'bookingtimeline', $attr ); // FixIn: 9.9.0.39.
@@ -783,149 +109,10 @@
783 109 // FixIn: 8.6.1.13.
784 110 $timeline_results = bookingflextimeline_shortcode($attr);
785 111 return $timeline_results;
786 112 }
787 -
788 - // Replace MARK at post with content at client side ----- [booking nummonths='1' type='1']
789 - function booking_shortcode($attr) {
790 113
791 - if ( wpbc_is_on_edit_page() ) {
792 - return wpbc_get_preview_for_shortcode( 'booking', $attr ); // FixIn: 9.9.0.39.
793 - }
794 114
795 - $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1
796 -
797 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
798 - if ( isset( $_GET['booking_hash'] ) ) {
799 - return
800 - __( 'You need to use special shortcode [bookingedit] for booking editing.', 'booking' )
801 - . ' '
802 - /* translators: 1: ... */
803 - . sprintf( __( 'Please check FAQ instruction how to configure it here %s', 'booking' )
804 - , '<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>'
805 - );
806 - }
807 -
808 - //if ( function_exists( 'wpbc_br_cache' ) ) $br_cache = wpbc_br_cache(); // Init booking resources cache
809 -
810 - $my_boook_count = get_bk_option( 'booking_client_cal_count' );
811 - $my_boook_type = 1;
812 - $my_booking_form = 'standard';
813 - $start_month_calendar = false;
814 - $bk_otions = array();
815 -
816 - if ( isset( $attr['nummonths'] ) ) { $my_boook_count = $attr['nummonths']; }
817 -
818 - if ( isset( $attr['resource_id'] ) ) {
819 - $attr['type'] = intval( $attr['resource_id'] ); // FixIn: 10.2.2.2.
820 - }
821 - if ( isset( $attr['type'] ) ) {
822 - $my_boook_type = intval( $attr['type'] ); // FixIn: 10.2.2.2.
823 - }
824 -
825 - if ( isset( $attr['form_type'] ) ) { $my_booking_form = $attr['form_type']; }
826 -
827 - if ( isset( $attr['agregate'] ) && (! empty( $attr['agregate'] )) ) {
828 - $additional_bk_types = $attr['agregate'];
829 - $my_boook_type .= ';'.$additional_bk_types;
830 - }
831 - if ( isset( $attr['aggregate'] ) && (! empty( $attr['aggregate'] )) ) {
832 - $additional_bk_types = $attr['aggregate'];
833 - $my_boook_type .= ';'.$additional_bk_types;
834 - }
835 -
836 -
837 - if ( isset( $attr['startmonth'] ) ) { // Set start month of calendar, fomrat: '2011-1'
838 -
839 - $start_month_calendar = explode( '-', $attr['startmonth'] );
840 - if ( (is_array($start_month_calendar)) && ( count($start_month_calendar) > 1) ) { }
841 - else $start_month_calendar = false;
842 -
843 - }
844 -
845 - if ( isset( $attr['options'] ) ) { $bk_otions = $attr['options']; }
846 -
847 - $res = $this->add_booking_form_action( $my_boook_type, $my_boook_count, 0, $my_booking_form, '', $start_month_calendar, $bk_otions );
848 -
849 - return $res;
850 - }
851 -
852 - // Replace MARK at post with content at client side ----- [booking nummonths='1' type='1']
853 - function booking_calendar_only_shortcode($attr) {
854 -
855 - if ( wpbc_is_on_edit_page() ) {
856 - return wpbc_get_preview_for_shortcode( 'bookingcalendar', $attr ); // FixIn: 9.9.0.39.
857 - }
858 -
859 - $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1
860 -
861 - //if ( function_exists( 'wpbc_br_cache' ) ) $br_cache = wpbc_br_cache(); // Init booking resources cache
862 -
863 - $my_boook_count = get_bk_option( 'booking_client_cal_count' );
864 - $my_boook_type = 1;
865 - $start_month_calendar = false;
866 - $bk_otions = array();
867 - if ( isset( $attr['nummonths'] ) ) { $my_boook_count = $attr['nummonths']; }
868 - if ( isset( $attr['resource_id'] ) ) {
869 - $attr['type'] = intval( $attr['resource_id'] ); // FixIn: 10.2.2.2.
870 - }
871 - if ( isset( $attr['type'] ) ) {
872 - $my_boook_type = intval( $attr['type'] ); // FixIn: 10.2.2.2.
873 - }
874 - if ( isset( $attr['agregate'] ) && (! empty( $attr['agregate'] )) ) {
875 - $additional_bk_types = $attr['agregate'];
876 - $my_boook_type .= ';'.$additional_bk_types;
877 - }
878 - if ( isset( $attr['aggregate'] ) && (! empty( $attr['aggregate'] )) ) { // FixIn: 8.3.3.8.
879 - $additional_bk_types = $attr['aggregate'];
880 - $my_boook_type .= ';'.$additional_bk_types;
881 - }
882 -
883 - if ( isset( $attr['startmonth'] ) ) { // Set start month of calendar, fomrat: '2011-1'
884 - $start_month_calendar = explode( '-', $attr['startmonth'] );
885 - if ( (is_array($start_month_calendar)) && ( count($start_month_calendar) > 1) ) { }
886 - else $start_month_calendar = false;
887 - }
888 -
889 - if ( isset( $attr['options'] ) ) { $bk_otions = $attr['options']; }
890 - $res = $this->add_calendar_action($my_boook_type,$my_boook_count, 0, $start_month_calendar, $bk_otions );
891 -
892 -
893 - $start_script_code = "<div id='calendar_booking_unselectable".$my_boook_type."'></div>";
894 - return "<div class='wpbc_only_calendar wpbc_container'>" . $start_script_code . $res . '</div>'; // FixIn: 8.0.1.2.
895 - }
896 -
897 - // Show only booking form, with already selected dates
898 - function bookingform_shortcode($attr) {
899 -
900 - if ( wpbc_is_on_edit_page() ) {
901 - return wpbc_get_preview_for_shortcode( 'bookingform', $attr ); // FixIn: 9.9.0.39.
902 - }
903 -
904 - $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1
905 -
906 - //if ( function_exists( 'wpbc_br_cache' ) ) $br_cache = wpbc_br_cache(); // Init booking resources cache
907 -
908 - $my_boook_type = 1;
909 - $my_booking_form = 'standard';
910 - $my_boook_count = 1;
911 - $my_selected_dates_without_calendar = '';
912 -
913 - if ( isset( $attr['resource_id'] ) ) {
914 - $attr['type'] = intval( $attr['resource_id'] ); // FixIn: 10.2.2.2.
915 - }
916 - if ( isset( $attr['type'] ) ) {
917 - $my_boook_type = intval( $attr['type'] ); // FixIn: 10.2.2.2.
918 - }
919 - if ( isset( $attr['form_type'] ) ) { $my_booking_form = $attr['form_type']; }
920 - if ( isset( $attr['selected_dates'] ) ) { $my_selected_dates_without_calendar = $attr['selected_dates']; } //$my_selected_dates_without_calendar = '20.08.2010, 29.08.2010';
921 -
922 - $res = $this->add_booking_form_action($my_boook_type,$my_boook_count, 0 , $my_booking_form, $my_selected_dates_without_calendar, false );
923 -
924 - return $res;
925 - }
926 -
927 -
928 115 // Show booking form for editing
929 116 function bookingedit_shortcode($attr) {
930 117
931 118 if ( wpbc_is_on_edit_page() ) {
@@ -952,24 +139,25 @@
952 139
953 140 $my_boook_count = get_bk_option( 'booking_client_cal_count' );
954 141 $my_boook_type = 1;
955 142 $my_booking_form = 'standard';
956 - $bk_otions = array();
957 - if ( isset( $attr['nummonths'] ) ) { $my_boook_count = $attr['nummonths']; }
958 - if ( isset( $attr['resource_id'] ) ) { $attr['type'] = $attr['resource_id']; }
959 - 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']); }
960 147 if ( isset( $attr['form_type'] ) ) { $my_booking_form = $attr['form_type']; }
961 - if ( isset( $attr['agregate'] ) && (! empty( $attr['agregate'] )) ) { // FixIn: 7.0.1.26.
962 - $additional_bk_types = $attr['agregate'];
963 - $my_boook_type .= ';'.$additional_bk_types;
964 - }
965 - if ( isset( $attr['aggregate'] ) && (! empty( $attr['aggregate'] )) ) {
966 - $additional_bk_types = $attr['aggregate'];
967 - $my_boook_type .= ';'.$additional_bk_types;
968 - }
969 - 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 ) );
970 156
157 + if ( isset( $attr['options'] ) ) { $shortcode_param__options = $attr['options']; }
971 158
159 +
972 160 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
973 161 if (isset($_GET['booking_hash'])) {
974 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 */
975 163 $my_booking_id_type = wpbc_hash__get_booking_id__resource_id( $get_booking_hash );
@@ -975,16 +163,16 @@
975 163 $my_booking_id_type = wpbc_hash__get_booking_id__resource_id( $get_booking_hash );
976 164 if ($my_booking_id_type !== false) {
977 165 $my_edited_bk_id = $my_booking_id_type[0];
978 166 $my_boook_type = $my_booking_id_type[1];
979 - 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>';
980 168 } else {
981 - 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>';
982 170 }
983 171
984 172 } else {
985 173 return __('This page can only be accessed through links in emails related to your booking.' ,'booking')
986 - . ' <br/><em>'
174 + . ' <br/><em>'
987 175 /* translators: 1: ... */
988 176 . sprintf( __( 'Please check more about configuration at %1$sthis page%2$s', 'booking' )
989 177 , '<a href="https://wpbookingcalendar.com/faq/configure-editing-cancel-payment-bookings-for-visitors/" target="_blank">' , '</a>.')
990 178 . '</em>';
@@ -990,9 +178,9 @@
990 178 . '</em>';
991 179 }
992 180
993 181
994 - $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 );
995 183
996 184 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
997 185 if (isset($_GET['booking_pay'])) {
998 186 // Payment form
@@ -1077,9 +265,8 @@
1077 265
1078 266 return $search_results_to_show;
1079 267 }
1080 268
1081 -
1082 269 // Select Booking form using the selectbox
1083 270 function bookingselect_shortcode($attr) {
1084 271
1085 272 if ( ! class_exists( 'wpdev_bk_personal' ) ) {
@@ -1092,9 +279,9 @@
1092 279
1093 280 $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1
1094 281
1095 282 //if ( function_exists( 'wpbc_br_cache' ) ) $br_cache = wpbc_br_cache(); // Init booking resources cache
1096 -
283 +
1097 284 $search_form = apply_bk_filter('wpdev_get_booking_select_form','', $attr );
1098 285
1099 286 return $search_form ;
1100 287 }
@@ -1112,13 +299,12 @@
1112 299
1113 300 $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1
1114 301
1115 302 //if ( function_exists( 'wpbc_br_cache' ) ) $br_cache = wpbc_br_cache(); // Init booking resources cache
1116 -
303 +
1117 304 $search_form = apply_bk_filter('wpbc_booking_resource_info','', $attr );
1118 305
1119 306 return $search_form ;
1120 307 }
1121 -
1122 -
308 +
1123 309 // </editor-fold>
1124 -}
310 +}