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