PluginProbe
Booking Calendar / 11.8.4
Booking Calendar v11.8.4
11.8.4 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 All 204 releases
← All changes | core/admin/wpbc-toolbars.php +281 -494 10.1.311.8.4 View file →
@@ -1,4 +1,4 @@
1 1 <?php /**
2 2 * @version 1.0
3 3 * @package Booking Calendar
4 4 * @category Toolbar. Data for UI Elements at Booking Calendar admin pages
@@ -12,113 +12,24 @@
12 12
13 13 if ( ! defined( 'ABSPATH' ) ) exit; // Exit, if accessed directly
14 14
15 15
16 -////////////////////////////////////////////////////////////////////////////////
17 -// T o o l b a r s
18 -////////////////////////////////////////////////////////////////////////////////
16 +// ---------------------------------------------------------------------------------------------------------------------
17 +// == T o o l b a r s ==
18 +// ---------------------------------------------------------------------------------------------------------------------
19 19
20 -//FixIn: 9.6.3.5
21 20
22 -/** T o o l b a r C o n t a i n e r f o r Timeline */
23 -function wpbc_timeline_toolbar() {
21 +/** T o o l b a r C o n t a i n e r f o r Add New Booking */
22 +function wpbc_add_new_booking_toolbar( $args = array() ) {
24 23
25 - wpbc_clear_div();
24 + $defaults = array(
25 + 'resource_id' => null,
26 + 'booking_form' => null,
27 + );
28 + $args = wp_parse_args( $args, $defaults );
26 29
27 - //wpbc_toolbar_search_by_id_bookings(); // Search bookings by ID - form at the top right side of the page
28 -
29 - //wpbc_toolbar_btn__view_mode(); // Vertical Buttons //FixIn: 9.8.15.2
30 -
31 - // Toolbar ////////////////////////////////////////////////////////////////
32 -
33 - ?><div id="toolbar_booking_listing" class="wpbc_timeline_toolbar_container"><?php
34 -/*
35 - wpbc_bs_toolbar_tabs_html_container_start();
36 -
37 - // <editor-fold defaultstate="collapsed" desc=" T O P T A B s " >
38 -
39 - if ( ! isset( $_REQUEST['tab_cvm'] ) ) $_REQUEST['tab_cvm'] = 'actions_cvm';
40 - $selected_tab = $_REQUEST['tab_cvm'];
41 -
42 - wpbc_bs_display_tab( array(
43 - 'title' => __('View', 'booking')
44 - // , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' )
45 - , 'onclick' => "jQuery('.visibility_container').hide();"
46 - . "jQuery('#actions_toolbar_container').show();"
47 - . "jQuery('#toolbar_booking_listing .nav-tab').removeClass('nav-tab-active');" //FixIn: 9.8.15.2
48 - . "jQuery(this).addClass('nav-tab-active');"
49 - . "jQuery('.nav-tab i.icon-white').removeClass('icon-white');"
50 - . "jQuery('.nav-tab-active i').addClass('icon-white');"
51 - , 'font_icon' => 'wpbc-bi-calendar2-range-fill'
52 - , 'default' => ( $selected_tab == 'actions_cvm' ) ? true : false
53 -
54 - ) );
55 -
56 -
57 - wpbc_bs_dropdown_menu_help();
58 -
59 - // </editor-fold>
60 -
61 - wpbc_bs_toolbar_tabs_html_container_end();
62 -*/
63 - ////////////////////////////////////////////////////////////////////////
64 -
65 - wpbc_bs_toolbar_sub_html_container_start();
66 -
67 - // A c t i o n s T o o l b a r f o r T i m e l i n e
68 -/*
69 - ?><div id="actions_toolbar_container" class="visibility_container clearfix-height" style="display:<?php echo ( $selected_tab == 'actions_cvm' ) ? 'block' : 'none' ?>;margin-top:-5px;"><?php
70 -
71 - wpbc_toolbar_btn__timeline_view_mode(); // View Mode Buttons
72 -
73 - wpbc_toolbar_btn__timeline_navigation(); // Navigation Buttons
74 -
75 -
76 - ?></div><?php
77 -*/
78 -
79 - ?><div class="wpbc_timeline_toolbar_structure"><?php
80 -
81 - make_bk_action( 'wpbc_br_selection_for_timeline' );
82 -
83 - wpbc_toolbar_is_send_emails_btn( '');
84 -
85 - ?></div><?php
86 -
87 - wpbc_bs_toolbar_sub_html_container_end();
88 -
89 - ?></div><?php
90 -
91 30 wpbc_clear_div();
92 31
93 -}
94 -
95 -/**
96 - * Show Search by Booking ID form at top right side of Calendar Overview page
97 - *
98 - * @param $page_tag
99 - * @param $active_page_tab
100 - * @param $active_page_subtab
101 - *
102 - * @return false|void
103 - */
104 -function wpbc_calendar_overview__search_by_id_bookings( $page_tag, $active_page_tab, $active_page_subtab ) {
105 -
106 - if ( ( 'wpbc' !== $page_tag ) || ( 'vm_calendar' !== $active_page_tab ) ) {
107 - return false;
108 - }
109 - ?><span class="wpdevelop wpbc_page wpbc_toolbar_search_by_id_bookings"><?php
110 - wpbc_toolbar_search_by_id_bookings(); // Search bookings by ID - form at the top right side of the page
111 - ?></span><?php
112 -}
113 -add_bk_action('wpbc_h1_header_content_end', 'wpbc_calendar_overview__search_by_id_bookings');
114 -
115 -
116 -/** T o o l b a r C o n t a i n e r f o r Add New Booking */
117 -function wpbc_add_new_booking_toolbar() {
118 -
119 - wpbc_clear_div();
120 -
121 32 // Toolbar ////////////////////////////////////////////////////////////////
122 33
123 34 ?><div id="toolbar_booking_listing" style="position:relative;"><?php
124 35
@@ -125,10 +36,11 @@
125 36 wpbc_bs_toolbar_tabs_html_container_start();
126 37
127 38 // <editor-fold defaultstate="collapsed" desc=" T O P T A B s " >
128 39
40 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
129 41 if ( ! isset( $_REQUEST['toolbar'] ) ) $_REQUEST['toolbar'] = 'filter';
130 - $selected_tab = $_REQUEST['toolbar'];
42 + $selected_tab = sanitize_text_field( wp_unslash( $_REQUEST['toolbar'] ) ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */
131 43
132 44 wpbc_bs_display_tab( array(
133 45 'title' => __('Options', 'booking')
134 46 // , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' )
@@ -133,9 +45,9 @@
133 45 'title' => __('Options', 'booking')
134 46 // , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' )
135 47 , 'onclick' => "jQuery('.visibility_container').hide();"
136 48 . "jQuery('#filter_toolbar_container').show();"
137 - . "jQuery('#toolbar_booking_listing .nav-tab').removeClass('nav-tab-active');" //FixIn: 9.8.15.2
49 + . "jQuery('#toolbar_booking_listing .nav-tab').removeClass('nav-tab-active');" // FixIn: 9.8.15.2.
138 50 . "jQuery(this).addClass('nav-tab-active');"
139 51 . "jQuery('.nav-tab i.icon-white').removeClass('icon-white');"
140 52 . "jQuery('.nav-tab-active i').addClass('icon-white');"
141 53 , 'font_icon' => 'wpbc_icn_adjust'
@@ -147,9 +59,9 @@
147 59 'title' => __('Calendar View', 'booking')
148 60 // , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' )
149 61 , 'onclick' => "jQuery('.visibility_container').hide();"
150 62 . "jQuery('#calendar_size_toolbar_container').show();"
151 - . "jQuery('#toolbar_booking_listing .nav-tab').removeClass('nav-tab-active');" //FixIn: 9.8.15.2
63 + . "jQuery('#toolbar_booking_listing .nav-tab').removeClass('nav-tab-active');" // FixIn: 9.8.15.2.
152 64 . "jQuery(this).addClass('nav-tab-active');"
153 65 . "jQuery('.nav-tab i.icon-white').removeClass('icon-white');"
154 66 . "jQuery('.nav-tab-active i').addClass('icon-white');"
155 67 , 'font_icon' => 'wpbc-bi-calendar2'
@@ -170,25 +82,30 @@
170 82
171 83 // T o o l b a r
172 84 ?><div id="filter_toolbar_container" class="visibility_container clearfix-height" style="display:<?php echo ( $selected_tab == 'filter' ) ? 'block' : 'none' ?>;margin-top:-5px;"><?php
173 85
174 - if ( ( function_exists( 'wpbc_toolbar_btn__resource_selection' ) )
175 - && ( empty( $_GET['booking_hash'] ) ) ) //Do not show resource seleciton if editing booking. //FixIn:7.1.2.10
176 - wpbc_toolbar_btn__resource_selection();
86 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended
87 + if ( ( function_exists( 'wpbc_toolbar_btn__resource_selection' ) ) && ( empty( $_GET['booking_hash'] ) ) ) {
88 + // Do not show resource seleciton if editing booking. // FixIn: 7.1.2.10.
177 89
178 - if ( function_exists( 'wpbc_toolbar_btn__form_selection' ) )
179 - wpbc_toolbar_btn__form_selection();
90 + wpbc_toolbar_btn__resource_selection();
91 + }
180 92
181 - ////////////////////////////////////////////////////////////////////
93 + WPBC_FE_Custom_Form_Helper::wpbc_bfb__custom_booking_forms_list__selectbox_html();
94 +
95 + ////////////////////////////////////////////////////////////////////
182 96 ?><div class="clear-for-mobile"></div><?php
183 97
184 98 ?><div class="control-group wpbc-no-padding" style="float:right;margin-right: 0;margin-left: 15px;"><?php
185 99
186 - if ( function_exists( 'wpbc_toolbar_btn__auto_fill' ) )
187 - wpbc_toolbar_btn__auto_fill();
100 + wpbc_toolbar_btn__add_past_booking( $args );
188 101
189 - wpbc_toolbar_btn__add_new_booking();
102 + if ( function_exists( 'wpbc_toolbar_btn__auto_fill' ) ) {
103 + wpbc_toolbar_btn__auto_fill();
104 + }
190 105
106 + wpbc_toolbar_btn__add_new_booking( $args );
107 +
191 108 ?></div><?php
192 109 ////////////////////////////////////////////////////////////////////
193 110
194 111 ?></div><?php
@@ -243,11 +160,11 @@
243 160
244 161 }
245 162
246 163
247 -////////////////////////////////////////////////////////////////////////////////
164 +// ---------------------------------------------------------------------------------------------------------------------
248 165 // HTML elements for Toolbar
249 -////////////////////////////////////////////////////////////////////////////////
166 +// ---------------------------------------------------------------------------------------------------------------------
250 167
251 168 /**
252 169 * Expand or Collapse Advanced Filter set
253 170 *
@@ -255,18 +172,18 @@
255 172 */
256 173 function wpbc_toolbar_expand_collapse_btn( $css_class_of_expand_element ) {
257 174
258 175 ?><span id="show_link_advanced_booking_filter" class="tab-bottom tooltip_right advanced_booking_filter"
259 - title="<?php _e('Expand Advanced Toolbar' ,'booking'); ?>"
176 + title="<?php esc_attr_e('Expand Advanced Toolbar' ,'booking'); ?>"
260 177 ><a href="javascript:void(0)"
261 - onclick="javascript:jQuery('.<?php echo $css_class_of_expand_element; ?>').show();
178 + onclick="javascript:jQuery('.<?php echo esc_js( $css_class_of_expand_element ); ?>').show();
262 179 jQuery('#show_link_advanced_booking_filter').hide();
263 180 jQuery('#hide_link_advanced_booking_filter').show();"><i
264 181 class="wpbc_icn_expand_more"></i></a></span>
265 182 <span id="hide_link_advanced_booking_filter" class="tab-bottom tooltip_right advanced_booking_filter" style="display:none;"
266 - title="<?php _e('Collapse Advanced Toolbar' ,'booking'); ?>"
183 + title="<?php esc_attr_e('Collapse Advanced Toolbar' ,'booking'); ?>"
267 184 ><a href="javascript:void(0)"
268 - onclick="javascript:jQuery('.<?php echo $css_class_of_expand_element; ?>').hide();
185 + onclick="javascript:jQuery('.<?php echo esc_js( $css_class_of_expand_element ); ?>').hide();
269 186 jQuery('#hide_link_advanced_booking_filter').hide();
270 187 jQuery('#show_link_advanced_booking_filter').show();"><i
271 188 class="wpbc_icn_expand_less"></i></a></span><?php
272 189
@@ -281,9 +198,9 @@
281 198 * @return void
282 199 */
283 200 function wpbc_toolbar_is_send_emails_btn( $style = 'position:absolute;right:0px;margin-top:10px;' ) {
284 201
285 - ?><div class="btn-group" style="<?php echo $style; ?>"><?php
202 + ?><div class="btn-group" style="<?php echo esc_attr( $style ); ?>"><?php
286 203
287 204 $el_id = 'is_send_email_for_pending';
288 205
289 206 $el_value = ( get_bk_option( 'booking_send_emails_off_addbooking' ) !== 'On' ) ? 'On' : 'Off';
@@ -290,9 +207,9 @@
290 207
291 208 $params_checkbox = array(
292 209 'id' => $el_id // HTML ID of element
293 210 , 'name' => $el_id
294 - , 'label' => array( 'title' => __( 'Emails sending', 'booking' ) , 'position' => 'right' ) //FixIn: 9.6.1.5
211 + , 'label' => array( 'title' => __( 'Emails sending', 'booking' ) , 'position' => 'right' ) // FixIn: 9.6.1.5.
295 212 , 'style' => '' // CSS of select element
296 213 , 'class' => '' // CSS Class of select element
297 214 , 'disabled' => false
298 215 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
@@ -309,49 +226,12 @@
309 226 ?></div><?php
310 227 }
311 228
312 229
313 -/** Search form by booking ID (at top right side of page) */
314 -function wpbc_toolbar_search_by_id_bookings() {
315 230
316 - $bk_admin_url = wpbc_get_params_in_url( wpbc_get_bookings_url( true, false ), array('view_mode', 'wh_booking_id', 'page_num' ) );
317 -
318 - ?>
319 - <div style=" position: absolute; right: 23px; top: 11px;z-index: 9;">
320 - <form name="booking_filters_formID" action="<?php echo $bk_admin_url . '&view_mode=vm_listing' ; ?>" method="post" id="booking_filters_formID" >
321 - <?php
322 -
323 - if (isset($_REQUEST['wh_booking_id'])) $wh_booking_id = wpbc_clean_digit_or_csd( $_REQUEST['wh_booking_id'] ); // {'1', '2', .... }
324 - else $wh_booking_id = '';
325 -
326 -
327 - $params = array( 'label_for' => 'wh_booking_id'
328 - , 'label' => ''//__('Keyword:', 'booking')
329 - , 'items' => array(
330 - array( 'type' => 'text', 'id' => 'wh_booking_id', 'value' => $wh_booking_id, 'placeholder' => __('Booking ID', 'booking'), 'style' => 'border-right: none;' )
331 - , array(
332 - 'type' => 'button'
333 - , 'title' => __('Go', 'booking')
334 - , 'class' => 'button-secondary'
335 - , 'font_icon' => 'wpbc_icn_search'
336 - , 'icon_position' => 'right'
337 - , 'action' => "jQuery('#booking_filters_formID').trigger( 'submit' );" )
338 - )
339 - );
340 - ?><div class="control-group wpbc-no-padding" ><?php
341 - wpbc_bs_input_group( $params );
342 - ?></div><?php
343 - ?>
344 - </form>
345 - <?php wpbc_clear_div(); ?>
346 - </div>
347 - <?php
348 -}
349 -
350 -
351 -////////////////////////////////////////////////////////////////////////////////
231 +// ---------------------------------------------------------------------------------------------------------------------
352 232 // U I E l e m e n t s
353 -////////////////////////////////////////////////////////////////////////////////
233 +// ---------------------------------------------------------------------------------------------------------------------
354 234
355 235 /** Help - Drop Down Menu - T a b */
356 236 function wpbc_bs_dropdown_menu_help() {
357 237
@@ -359,20 +239,21 @@
359 239 'title' => __( 'Help', 'booking' )
360 240 , 'font_icon' => 'wpbc_icn_support' //FixIn: 9.0.1.4 'glyphicon glyphicon-question-sign'
361 241 , 'position' => 'right'
362 242 , 'items' => array(
363 - array( 'type' => 'link', 'title' => "What's New"/*__('Get Started')*/, 'url' => esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-about' ), 'index.php' ) ) ) )
243 + array( 'type' => 'link', 'title' => __('FAQ', 'booking'), 'url' => 'https://wpbookingcalendar.com/faq/' )
244 + , array( 'type' => 'link', 'title' => __('Support Forum', 'booking'), 'url' => 'https://wpbookingcalendar.com/support/' )
245 + , array( 'type' => 'divider' )
246 + , array( 'type' => 'link', 'title' => __('Contact Support', 'booking'), 'url' => 'mailto:support@wpbookingcalendar.com'
247 + , 'attr' => array( 'style' => 'font-weight: 600;' ) )
364 248 , array( 'type' => 'divider' )
365 - , array( 'type' => 'link', 'title' => __('Help', 'booking'), 'url' => 'https://wpbookingcalendar.com/help/' )
366 - , array( 'type' => 'link', 'title' => __('FAQ', 'booking'), 'url' => 'https://wpbookingcalendar.com/faq/' )
367 - , array( 'type' => 'link', 'title' => __('Technical Support', 'booking'), 'url' => 'https://wpbookingcalendar.com/support/' )
368 - , array( 'type' => 'divider' )
369 - , array( 'type' => 'link', 'title' => __('About Booking Calendar', 'booking')
249 + , array( 'type' => 'link', 'title' => "What's New"/*__('Get Started')*/, 'url' => esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-about' ), 'index.php' ) ) ) )
250 + , array( 'type' => 'link', 'title' => __('About', 'booking')
370 251 // , 'url' => wpbc_up_link()
371 - , 'url' => esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-about-premium' ), 'index.php' ) ) )
252 + , 'url' => 'https://wpbookingcalendar.com/' //esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-about-premium' ), 'index.php' ) ) )
372 253 , 'attr' => array(
373 254 // 'target' => '_blank'
374 - 'style' => 'font-weight: 600;font-size: 1em;'
255 + // 'style' => 'font-weight: 600;'
375 256 )
376 257 )
377 258 )
378 259 ) );
@@ -378,226 +259,27 @@
378 259 ) );
379 260 }
380 261
381 262
382 -/** View Mode - B u t t o n */
383 -function wpbc_toolbar_btn__view_mode() {
384 -
385 - $selected_view_mode = ( isset( $_REQUEST['view_mode'] ) ) ? $_REQUEST['view_mode'] : '';
386 -
387 - $bk_admin_url = wpbc_get_params_in_url( wpbc_get_bookings_url( false ), array('view_mode', 'wh_booking_id', 'page_num' ) );
388 -
389 - $params = array();
390 -
391 -
392 - //FixIn: 9.6.3.5
393 - $is_selected = ( ( $selected_view_mode == 'vm_booking_listing' ) || ( $selected_view_mode == 'vm_listing' ) ) ? true : false;
394 -
395 - $params['btn_vm_listing_new'] = array(
396 - 'title' => ''
397 - , 'hint' => array( 'title' => __('Booking Listing' ,'booking') , 'position' => 'top' )
398 - , 'selected' => $is_selected
399 - , 'link' => wpbc_get_bookings_url('booking-listing', true ) . '&view_mode=vm_booking_listing'
400 - , 'icon' => ''
401 - , 'font_icon' => 'wpbc-bi-collection'//'glyphicon glyphicon-align-justify'
402 - );
403 -
404 -
405 - $bk_admin_url = wpbc_get_params_in_url( wpbc_get_bookings_url( false ) , array() // Exclude Value of this parameter
406 - , array( 'page', 'tab', 'tab_cvm', 'wh_booking_type', 'scroll_start_date', 'scroll_month', 'view_days_num'
407 - , 'wh_trash' //FixIn: 6.1.1.10
408 - ) // Only this parameters
409 - );
410 - $params['btn_vm_calendar'] = array(
411 - 'title' => ''
412 - , 'hint' => array( 'title' => __('Calendar Overview' ,'booking') , 'position' => 'bottom' )
413 - , 'selected' => ( $selected_view_mode == 'vm_calendar' ) ? true : false
414 - , 'link' => $bk_admin_url . '&view_mode=vm_calendar'
415 - , 'icon' => ''
416 - , 'font_icon' => 'wpbc-bi-calendar2-range'// 'glyphicon glyphicon-calendar'
417 - );
418 -
419 - ?><div style="position:absolute;" class="wpbc_mode_switcher"><?php
420 -
421 - wpbc_bs_vertical_buttons_group( $params );
422 -
423 - ?></div><?php
424 -}
425 -
426 -//FixIn: 9.6.3.5
427 -
428 -////////////////////////////////////////////////////////////////////////////////
263 +// ---------------------------------------------------------------------------------------------------------------------
429 264 // Toolbar Actions B u t t o n s - T i m e l i n e //////////////////
430 -////////////////////////////////////////////////////////////////////////////////
265 +// ---------------------------------------------------------------------------------------------------------------------
431 266
432 267
433 -/** View Mode Timeline - B u t t o n s */
434 -function wpbc_toolbar_btn__timeline_view_mode() {
435 268
436 - if ((isset($_REQUEST['wh_booking_type'])) && ( strpos($_REQUEST['wh_booking_type'], ',') !== false ) )
437 - $is_show_resources_matrix = true;
438 - else $is_show_resources_matrix = false;
439 269
440 -
441 - if ( isset( $_REQUEST['view_days_num'] ) )
442 - $view_days_num = intval( $_REQUEST['view_days_num'] );
443 - else $view_days_num = get_bk_option( 'booking_view_days_num');
444 -
445 -
446 - $bk_admin_url = wpbc_get_params_in_url( wpbc_get_bookings_url( false ), array('view_days_num') );
447 -
448 -
449 - if ( ! $is_show_resources_matrix ) {
450 -
451 - $params = array(
452 - 'label_for' => 'calendar_overview_number_of_days_to_show' // "For" parameter of button group element
453 - , 'label' => '' //__('Calendar view mode', 'booking') // Label above the button group
454 - , 'style' => '' // CSS Style of entire div element
455 - , 'items' => array(
456 - array(
457 - 'type' => 'button'
458 - , 'title' => __('Day', 'booking') . '&nbsp;&nbsp;' // Title of the button //FixIn: Flex TimeLine 1.0
459 - , 'hint' => array( 'title' => __('Show day' ,'booking') , 'position' => 'top' ) // Hint
460 - , 'font_icon' => 'wpbc-bi-calendar-event'
461 -// , 'title' => __('Month', 'booking') . '&nbsp;&nbsp;' // Title of the button
462 -// , 'hint' => array( 'title' => __('Show month' ,'booking') , 'position' => 'top' ) // Hint
463 - , 'link' => $bk_admin_url . '&view_days_num=30' // Direct link or skip it
464 - , 'action' => "" // Some JavaScript to execure, for example run the function
465 - , 'class' => 'button-secondary btn_dn_30' // button-secondary | button-primary
466 - , 'icon' => ''
467 -// , 'font_icon' => 'glyphicon glyphicon-align-justify'
468 - , 'icon_position' => 'right' // Position of icon relative to Text: left | right
469 - , 'style' => '' // Any CSS class here
470 - , 'mobile_show_text' => true // Show or hide text, when viewing on Mobile devices (small window size).
471 - , 'attr' => array()
472 - )
473 - , array(
474 - 'type' => 'button'
475 - , 'title' => __('Week', 'booking') . '&nbsp;&nbsp;' // Title of the button //FixIn: Flex TimeLine 1.0
476 - , 'hint' => array( 'title' => __('Show week' ,'booking') , 'position' => 'top' ) // Hint
477 - , 'font_icon' => 'wpbc-bi-calendar-week'
478 -// , 'title' => __('3 Months', 'booking') . '&nbsp;&nbsp;' // Title of the button
479 -// , 'hint' => array( 'title' => __('Show 3 months' ,'booking') , 'position' => 'top' ) // Hint
480 - , 'link' => $bk_admin_url . '&view_days_num=90' // Direct link or skip it
481 - , 'action' => "" // Some JavaScript to execure, for example run the function
482 - , 'class' => 'button-secondary btn_dn_90' // button-secondary | button-primary
483 - , 'icon' => ''
484 -// , 'font_icon' => 'glyphicon glyphicon-th-list'
485 - , 'icon_position' => 'right' // Position of icon relative to Text: left | right
486 - , 'style' => '' // Any CSS class here
487 - , 'mobile_show_text' => true // Show or hide text, when viewing on Mobile devices (small window size).
488 - , 'attr' => array()
489 - )
490 - , array(
491 - 'type' => 'button'
492 - , 'title' => __('Month', 'booking') . '&nbsp;&nbsp;' // Title of the button
493 - , 'hint' => array( 'title' => __('Show month' ,'booking') , 'position' => 'top' ) // Hint
494 - , 'font_icon' => 'wpbc-bi-calendar3'
495 -// , 'title' => __('Year', 'booking') . '&nbsp;&nbsp;' // Title of the button
496 -// , 'hint' => array( 'title' => __('Show year' ,'booking') , 'position' => 'top' ) // Hint
497 - , 'link' => $bk_admin_url . '&view_days_num=365' // Direct link or skip it
498 - , 'action' => "" // Some JavaScript to execure, for example run the function
499 - , 'class' => 'button-secondary btn_dn_365' // button-secondary | button-primary
500 - , 'icon' => ''
501 -// , 'font_icon' => 'glyphicon glyphicon-th'
502 - , 'icon_position' => 'right' // Position of icon relative to Text: left | right
503 - , 'style' => '' // Any CSS class here
504 - , 'mobile_show_text' => true // Show or hide text, when viewing on Mobile devices (small window size).
505 - , 'attr' => array()
506 - )
507 - )
508 - );
509 - } else {
510 -
511 - $params = array(
512 - 'label_for' => 'calendar_overview_number_of_days_to_show' // "For" parameter of button group element
513 - , 'label' => '' //__('Calendar view mode:', 'booking') // Label above the button group
514 - , 'style' => '' // CSS Style of entire div element
515 - , 'items' => array(
516 - array(
517 - 'type' => 'button'
518 - , 'title' => __('Day', 'booking') . '&nbsp;&nbsp;' // Title of the button
519 - , 'hint' => array( 'title' => __('Show day' ,'booking') , 'position' => 'top' ) // Hint
520 - , 'link' => $bk_admin_url . '&view_days_num=1' // Direct link or skip it
521 - , 'action' => "" // Some JavaScript to execure, for example run the function
522 - , 'class' => 'button-secondary btn_dn_1' // button-secondary | button-primary
523 - , 'icon' => ''
524 - , 'font_icon' => 'wpbc-bi-calendar-event' //'wpbc_icn_event'
525 - , 'icon_position' => 'right' // Position of icon relative to Text: left | right
526 - , 'style' => '' // Any CSS class here
527 - , 'mobile_show_text' => true // Show or hide text, when viewing on Mobile devices (small window size).
528 - , 'attr' => array()
529 - )
530 - , array(
531 - 'type' => 'button'
532 - , 'title' => __('Week', 'booking') . '&nbsp;&nbsp;' // Title of the button
533 - , 'hint' => array( 'title' => __('Show week' ,'booking') , 'position' => 'top' ) // Hint
534 - , 'link' => $bk_admin_url . '&view_days_num=7' // Direct link or skip it
535 - , 'action' => "" // Some JavaScript to execure, for example run the function
536 - , 'class' => 'button-secondary btn_dn_7' // button-secondary | button-primary
537 - , 'icon' => ''
538 - , 'font_icon' => 'wpbc-bi-calendar-week'//'wpbc_icn_calendar_view_week'
539 - , 'icon_position' => 'right' // Position of icon relative to Text: left | right
540 - , 'style' => '' // Any CSS class here
541 - , 'mobile_show_text' => true // Show or hide text, when viewing on Mobile devices (small window size).
542 - , 'attr' => array()
543 - )
544 - , array(
545 - 'type' => 'button'
546 - , 'title' => __('Month', 'booking') . '&nbsp;&nbsp;' // Title of the button
547 - , 'hint' => array( 'title' => __('Show month' ,'booking') , 'position' => 'top' ) // Hint
548 - , 'link' => $bk_admin_url . '&view_days_num=30' // Direct link or skip it
549 - , 'action' => "" // Some JavaScript to execure, for example run the function
550 - , 'class' => 'button-secondary btn_dn_30' // button-secondary | button-primary
551 - , 'icon' => ''
552 - , 'font_icon' => 'wpbc-bi-calendar3'//'wpbc_icn_calendar_view_month'
553 - , 'icon_position' => 'right' // Position of icon relative to Text: left | right
554 - , 'style' => '' // Any CSS class here
555 - , 'mobile_show_text' => true // Show or hide text, when viewing on Mobile devices (small window size).
556 - , 'attr' => array()
557 - )
558 - , array(
559 - 'type' => 'button'
560 - , 'title' => __('2 Months', 'booking') . '&nbsp;&nbsp;' // Title of the button
561 - , 'hint' => array( 'title' => __('Show 2 months' ,'booking') , 'position' => 'top' ) // Hint
562 - , 'link' => $bk_admin_url . '&view_days_num=60' // Direct link or skip it
563 - , 'action' => "" // Some JavaScript to execure, for example run the function
564 - , 'class' => 'button-secondary btn_dn_60' // button-secondary | button-primary
565 - , 'icon' => ''
566 - , 'font_icon' => 'wpbc-bi-calendar2-week'//'wpbc_icn_density_medium'
567 - , 'icon_position' => 'right' // Position of icon relative to Text: left | right
568 - , 'style' => '' // Any CSS class here
569 - , 'mobile_show_text' => true // Show or hide text, when viewing on Mobile devices (small window size).
570 - , 'attr' => array()
571 - )
572 - )
573 - );
574 -
575 - }
576 - wpbc_bs_button_group( $params );
577 -
578 - //FixIn: 7.0.1.10
579 - ?><script type="text/javascript">
580 - if ( 'function' === typeof( jQuery('#calendar_overview_number_of_days_to_show .button').button ) ) {
581 - jQuery('#calendar_overview_number_of_days_to_show .button').button();
582 - jQuery('#calendar_overview_number_of_days_to_show .button.btn_dn_<?php echo $view_days_num; ?>').button('toggle');
583 - } else {
584 - console.log('Warning! Booking Calendar. Its seems that you have deactivated loading of Bootstrap JS files at Booking Settings General page in Advanced section.')
585 - }
586 - </script><?php
587 -}
588 -
589 -
590 270 /** Navigation Timeline - B u t t o n s */
591 271 function wpbc_toolbar_btn__timeline_navigation() {
592 272
273 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
593 274 if ((isset($_REQUEST['wh_booking_type'])) && ( strpos($_REQUEST['wh_booking_type'], ',') !== false ) )
594 275 $is_show_resources_matrix = true;
595 276 else $is_show_resources_matrix = false;
596 277
597 278
279 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
598 280 if ( isset( $_REQUEST['view_days_num'] ) )
599 - $view_days_num = intval( $_REQUEST['view_days_num'] );
281 + $view_days_num = intval( $_REQUEST['view_days_num'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
600 282 else $view_days_num = get_bk_option( 'booking_view_days_num');
601 283
602 284
603 285 $bk_admin_url = wpbc_get_params_in_url( wpbc_get_bookings_url( false ), array('scroll_month', 'scroll_day') );
@@ -607,9 +289,10 @@
607 289 if (! $is_show_resources_matrix) {
608 290
609 291 switch ($view_days_num) {
610 292 case '90':
611 - if (isset($_REQUEST['scroll_day'])) $scroll_day = intval( $_REQUEST['scroll_day'] );
293 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
294 + if (isset($_REQUEST['scroll_day'])) $scroll_day = intval( $_REQUEST['scroll_day'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
612 295 else $scroll_day = 0;
613 296 $scroll_params = array( '&scroll_day='.intval($scroll_day-4*7),
614 297 '&scroll_day='.intval($scroll_day-7),
615 298 '&scroll_day=0',
@@ -621,12 +304,13 @@
621 304 __('Next week' ,'booking'),
622 305 __('Next 4 weeks' ,'booking') );
623 306 break;
624 307 case '30':
625 - if (isset($_REQUEST['scroll_day'])) $scroll_day = intval( $_REQUEST['scroll_day'] );
308 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
309 + if (isset($_REQUEST['scroll_day'])) $scroll_day = intval( $_REQUEST['scroll_day'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
626 310 else $scroll_day = 0;
627 311
628 - //FixIn: 8.9.4.3
312 + // FixIn: 8.9.4.3.
629 313 // Here we need to define number of days to scroll depends from selected number of days to show.
630 314 $days_num_to_scroll = intval( get_bk_option( 'booking_calendar_overview__day_mode__days_number_show' ) );;
631 315 if ( empty( $days_num_to_scroll ) ) {
632 316 $days_num_to_scroll = 7;
@@ -643,10 +327,11 @@
643 327 __( 'Next', 'booking' ) . ' ' . $days_num_to_scroll . ' ' . __( 'days', 'booking' ),
644 328 __( 'Next', 'booking' ) . ' ' . ( 2 * $days_num_to_scroll ) . ' ' . __( 'days', 'booking' ) );
645 329 break;
646 330 default: // 365
331 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
647 332 if (! isset($_REQUEST['scroll_month'])) $_REQUEST['scroll_month'] = 0;
648 - $scroll_month = intval( $_REQUEST['scroll_month'] );
333 + $scroll_month = intval( $_REQUEST['scroll_month'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
649 334 $scroll_params = array( '&scroll_month='.intval($scroll_month-3),
650 335 '&scroll_month='.intval($scroll_month-1),
651 336 '&scroll_month=0',
652 337 '&scroll_month='.intval($scroll_month+1 ),
@@ -661,9 +346,10 @@
661 346 } else { // Matrix
662 347
663 348 switch ($view_days_num) {
664 349 case '1': //Day
665 - if (isset($_REQUEST['scroll_day'])) $scroll_day = intval( $_REQUEST['scroll_day'] );
350 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
351 + if (isset($_REQUEST['scroll_day'])) $scroll_day = intval( $_REQUEST['scroll_day'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
666 352 else $scroll_day = 0;
667 353 $scroll_params = array( '&scroll_day='.intval($scroll_day-7),
668 354 '&scroll_day='.intval($scroll_day-1),
669 355 '&scroll_day=0',
@@ -676,9 +362,10 @@
676 362 __('Next 7 days' ,'booking') );
677 363 break;
678 364
679 365 case '7': //Week
680 - if (isset($_REQUEST['scroll_day'])) $scroll_day = intval( $_REQUEST['scroll_day'] );
366 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
367 + if (isset($_REQUEST['scroll_day'])) $scroll_day = intval( $_REQUEST['scroll_day'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
681 368 else $scroll_day = 0;
682 369 $scroll_params = array( '&scroll_day='.intval($scroll_day-4*7),
683 370 '&scroll_day='.intval($scroll_day-7),
684 371 '&scroll_day=0',
@@ -693,10 +380,11 @@
693 380
694 381 case '30':
695 382 case '60':
696 383 case '90': //3 months
384 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
697 385 if (! isset($_REQUEST['scroll_month'])) $_REQUEST['scroll_month'] = 0;
698 - $scroll_month = intval( $_REQUEST['scroll_month'] );
386 + $scroll_month = intval( $_REQUEST['scroll_month'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
699 387 $scroll_params = array( '&scroll_month='.intval($scroll_month-3),
700 388 '&scroll_month='.intval($scroll_month-1),
701 389 '&scroll_month=0',
702 390 '&scroll_month='.intval($scroll_month+1 ),
@@ -708,10 +396,11 @@
708 396 __('Next 3 months' ,'booking') );
709 397 break;
710 398
711 399 default: // 30, 60, 90...
400 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
712 401 if (! isset($_REQUEST['scroll_month'])) $_REQUEST['scroll_month'] = 0;
713 - $scroll_month = intval( $_REQUEST['scroll_month'] );
402 + $scroll_month = intval( $_REQUEST['scroll_month'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
714 403 $scroll_params = array( '&scroll_month='.intval($scroll_month-3),
715 404 '&scroll_month='.intval($scroll_month-1),
716 405 '&scroll_month=0',
717 406 '&scroll_month='.intval($scroll_month+1 ),
@@ -736,9 +425,9 @@
736 425 , 'title' => '' // Title of the button
737 426 , 'hint' => array( 'title' => $scroll_titles[0] , 'position' => 'top' ) // Hint
738 427 , 'link' => $bk_admin_url .$scroll_params[0] // Direct link or skip it
739 428 , 'action' => "" // Some JavaScript to execure, for example run the function
740 - , 'class' => 'button-secondary' // button-secondary | button-primary
429 + , 'class' => 'button-secondary wpbc_button_no_background' // button-secondary | button-primary
741 430 , 'icon' => ''
742 431 , 'font_icon' => 'wpbc_icn_keyboard_double_arrow_left'
743 432 , 'icon_position' => 'left' // Position of icon relative to Text: left | right
744 433 , 'style' => '' // Any CSS class here
@@ -750,9 +439,9 @@
750 439 , 'title' => '' // Title of the button
751 440 , 'hint' => array( 'title' => $scroll_titles[1] , 'position' => 'top' ) // Hint
752 441 , 'link' => $bk_admin_url .$scroll_params[1] // Direct link or skip it
753 442 , 'action' => "" // Some JavaScript to execure, for example run the function
754 - , 'class' => 'button-secondary' // button-secondary | button-primary
443 + , 'class' => 'button-secondary wpbc_button_no_background' // button-secondary | button-primary
755 444 , 'icon' => ''
756 445 , 'font_icon' => 'wpbc_icn_keyboard_arrow_left'
757 446 , 'icon_position' => 'left' // Position of icon relative to Text: left | right
758 447 , 'style' => '' // Any CSS class here
@@ -763,9 +452,9 @@
763 452 'type' => 'dropdown'
764 453 , 'id' => 'timeline_navigation_date'
765 454 , 'title' => '' // Title of the button
766 455 , 'hint' => array( 'title' => __('Custom' ,'booking') , 'position' => 'top' ) // Hint
767 - , 'class' => 'button-secondary' // button-secondary | button-primary
456 + , 'class' => 'button-secondary wpbc_button_no_background' // button-secondary | button-primary
768 457 , 'icon' => ''
769 458 , 'font_icon' => 'wpbc_icn_gps_fixed'
770 459 , 'icon_position' => 'left' // Position of icon relative to Text: left | right
771 460 , 'style' => '' // Any CSS class here
@@ -785,15 +474,15 @@
785 474 , 'label' => __('Start Date' ,'booking') . ':'
786 475 , 'disabled' => false
787 476 , 'class' => 'wpdevbk-filters-section-calendar'
788 477 , 'style' => ''
789 - , 'placeholder' => date('Y-m-d')
478 + , 'placeholder' => gmdate('Y-m-d')
790 479 , 'attr' => array()
791 480 , 'value' => ''
792 481 )
793 482 )
794 483 , 'divider2' => 'divider'
795 - , 'buttons' => array( array( 'type' => 'group', 'class' => 'btn-group' ),
484 + , 'buttons' => array( array( 'type' => 'group', 'class' => 'btn-group0', 'style'=>'display: flex;flex-flow: row nowrap;align-items: center;justify-content: flex-end;' ),
796 485 array(
797 486 'type' => 'button'
798 487 , 'title' => __('Apply' ,'booking') // Title of the button
799 488 , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
@@ -822,9 +511,9 @@
822 511 , 'class' => 'button-secondary' // button-secondary | button-primary
823 512 , 'icon' => ''
824 513 , 'font_icon' => ''
825 514 , 'icon_position' => 'left' // Position of icon relative to Text: left | right
826 - , 'style' => '' // Any CSS class here
515 + , 'style' => 'margin:0 10px;' // Any CSS class here
827 516 , 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
828 517 , 'attr' => array()
829 518 )
830 519 )
@@ -835,9 +524,9 @@
835 524 , 'title' => '' // Title of the button
836 525 , 'hint' => array( 'title' => $scroll_titles[3] , 'position' => 'top' ) // Hint
837 526 , 'link' => $bk_admin_url .$scroll_params[3] // Direct link or skip it
838 527 , 'action' => "" // Some JavaScript to execure, for example run the function
839 - , 'class' => 'button-secondary' // button-secondary | button-primary
528 + , 'class' => 'button-secondary wpbc_button_no_background' // button-secondary | button-primary
840 529 , 'icon' => ''
841 530 , 'font_icon' => 'wpbc_icn_keyboard_arrow_right'
842 531 , 'icon_position' => 'left' // Position of icon relative to Text: left | right
843 532 , 'style' => '' // Any CSS class here
@@ -849,9 +538,9 @@
849 538 , 'title' => '' // Title of the button
850 539 , 'hint' => array( 'title' => $scroll_titles[4] , 'position' => 'top' ) // Hint
851 540 , 'link' => $bk_admin_url .$scroll_params[4] // Direct link or skip it
852 541 , 'action' => "" // Some JavaScript to execure, for example run the function
853 - , 'class' => 'button-secondary' // button-secondary | button-primary
542 + , 'class' => 'button-secondary wpbc_button_no_background' // button-secondary | button-primary
854 543 , 'icon' => ''
855 544 , 'font_icon' => 'wpbc_icn_keyboard_double_arrow_right'
856 545 , 'icon_position' => 'left' // Position of icon relative to Text: left | right
857 546 , 'style' => '' // Any CSS class here
@@ -865,11 +554,11 @@
865 554 }
866 555
867 556
868 557
869 -////////////////////////////////////////////////////////////////////////////////
558 +// ---------------------------------------------------------------------------------------------------------------------
870 559 // Toolbar Options B u t t o n s - Add New Booking //////////////////
871 -////////////////////////////////////////////////////////////////////////////////
560 +// ---------------------------------------------------------------------------------------------------------------------
872 561
873 562 /** Genereate URL based on GET parameters */
874 563 function wpbc_get_new_booking_url__base( $skip_parameters = array() ) {
875 564
@@ -875,14 +564,20 @@
875 564
876 565 $link_base = wpbc_get_new_booking_url( true, false );
877 566
878 567 $link_params = array();
879 - if ( ( isset( $_GET['booking_type'] ) ) && ( $_GET['booking_type'] > 0 ) ) $link_params['booking_type'] = $_GET['booking_type'];
880 - if ( isset( $_GET['booking_hash'] ) ) $link_params['booking_hash'] = $_GET['booking_hash'];
881 - if ( isset( $_GET['parent_res'] ) ) $link_params['parent_res'] = $_GET['parent_res'];
882 - if ( isset( $_GET['booking_form'] ) ) $link_params['booking_form'] = $_GET['booking_form'];
883 - if ( isset( $_GET['calendar_months_count'] ) ) $link_params['calendar_months_count'] = intval( $_GET['calendar_months_count'] );
884 - if ( isset( $_GET['calendar_months_num_in_1_row'] ) ) $link_params['calendar_months_num_in_1_row'] = intval( $_GET['calendar_months_num_in_1_row'] );
568 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
569 + if ( ( isset( $_GET['booking_type'] ) ) && ( $_GET['booking_type'] > 0 ) ) $link_params['booking_type'] = sanitize_text_field( wp_unslash( $_GET['booking_type'] ) ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */
570 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
571 + if ( isset( $_GET['booking_hash'] ) ) $link_params['booking_hash'] = sanitize_text_field( wp_unslash( $_GET['booking_hash'] ) ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */
572 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
573 + if ( isset( $_GET['parent_res'] ) ) $link_params['parent_res'] = sanitize_text_field( wp_unslash( $_GET['parent_res'] ) ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */
574 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
575 + if ( isset( $_GET['booking_form'] ) ) $link_params['booking_form'] = sanitize_text_field( wp_unslash( $_GET['booking_form'] ) ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */
576 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
577 + if ( isset( $_GET['calendar_months_count'] ) ) $link_params['calendar_months_count'] = intval( $_GET['calendar_months_count'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
578 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
579 + if ( isset( $_GET['calendar_months_num_in_1_row'] ) ) $link_params['calendar_months_num_in_1_row'] = intval( $_GET['calendar_months_num_in_1_row'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
885 580
886 581
887 582 foreach ( $link_params as $key => $value ) {
888 583
@@ -1099,14 +794,14 @@
1099 794 data_params.calendar_widthunits = jQuery('#calendar_widthunits').val();
1100 795 data_params.calendar_cell_height = jQuery('#calendar_cell_height').val();
1101 796 data_params.calendar_cell_heightunits = jQuery('#calendar_cell_heightunits').val();
1102 797 var ajax_data_params = jQuery.param( data_params );
1103 - wpbc_save_custom_user_data(<?php echo wpbc_get_current_user_id(); ?>
798 + wpbc_save_custom_user_data(<?php echo esc_js( wpbc_get_current_user_id() ); ?>
1104 799 , '<?php echo 'add_booking_calendar_options'; ?>'
1105 800 , ajax_data_params
1106 801 , 1
1107 802 );"
1108 - ><?php _e('Save' , 'booking') ?></a><?php
803 + ><?php esc_html_e('Save' , 'booking' ); ?></a><?php
1109 804 ?></div><?php
1110 805 }
1111 806
1112 807
@@ -1124,30 +819,99 @@
1124 819 jQuery('#calendar_cell_height').val('0');
1125 820 jQuery('#calendar_cell_heightunits').val('px');
1126 821 jQuery( '#toolbar_btn__calendar_options_save').trigger('click');
1127 822 "
1128 - ><?php _e('Reset' , 'booking') ?></a><?php
823 + ><?php esc_html_e('Reset' , 'booking' ); ?></a><?php
1129 824 ?></div><?php
1130 825 }
1131 826
827 +/**
828 + * Button for ability to add bookings in the past.
829 + *
830 + * @return void
831 + */
832 +function wpbc_toolbar_btn__add_past_booking( $args = array() ) {
1132 833
834 + if ( isset( $_GET['allow_past'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
835 + return;
836 + }
1133 837
838 + $defaults = array(
839 + 'resource_id' => null,
840 + 'booking_form' => null,
841 + );
842 + $args = wp_parse_args( $args, $defaults );
843 +
844 + $link = wpbc_get_new_booking_url();
845 +
846 + if ( null !== $args['resource_id'] ) {
847 + $link .= '&booking_type=' . absint( $args['resource_id'] );
848 + } else {
849 + $link .= ( ! empty( $_REQUEST['booking_type'] ) ) ? '&booking_type=' . intval( $_REQUEST['booking_type'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
850 + }
851 +
852 + if ( null !== $args['booking_form'] ) {
853 + $link .= '&booking_form=' . sanitize_text_field( wp_unslash( (string) $args['booking_form'] ) );
854 + } else {
855 + $link .= ( ! empty( $_REQUEST['booking_form'] ) ) ? '&booking_form=' . sanitize_text_field( wp_unslash( $_REQUEST['booking_form'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
856 + }
857 +
858 + $link .= ( ! empty( $_REQUEST['booking_hash'] ) ) ? '&booking_hash=' . sanitize_text_field( wp_unslash( $_REQUEST['booking_hash'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
859 + $link .= ( ! empty( $_REQUEST['is_show_payment_form'] ) ) ? '&is_show_payment_form=Off' : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
860 + $link .= ( ! empty( $_REQUEST['parent_res'] ) ) ? '&parent_res=' . intval( $_REQUEST['parent_res'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
861 +
862 + $el_id = 'is_allow_bookings_in_past';
863 + $el_value = 'Off';
864 +
865 + $params_checkbox = array(
866 + 'id' => $el_id // HTML ID of element
867 + , 'name' => $el_id
868 + , 'label' => array( 'title' => __( 'Allow booking in the past', 'booking' ) , 'position' => 'right' ) // FixIn: 9.6.1.5.
869 + , 'style' => '' // CSS of select element
870 + , 'class' => '' // CSS Class of select element
871 + , 'disabled' => false
872 + , 'attr' => array() // Any additional attributes, if this radio | checkbox element
873 + , 'legend' => '' // aria-label parameter
874 + , 'value' => $el_value // Some Value from optins array that selected by default
875 + , 'selected' => ( ( 'On' == $el_value ) ? true : false ) // Selected or not
876 + //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
877 + , 'onchange' => "window.location.href='". $link . "&allow_past=1';" // JavaScript code
878 + , 'hint' => array( 'title' => __('Allow booking in the past' ,'booking') , 'position' => 'top' )
879 + );
880 +
881 + ?><div class="btn-group" style="display: inline-flex;min-height: 31px;flex-flow: row nowrap;align-items: center;"><?php
882 +
883 + wpbc_flex_toggle( $params_checkbox );
884 +
885 + ?></div><?php
886 +}
887 +
888 +
1134 889 /** Add New Booking Button*/
1135 -function wpbc_toolbar_btn__add_new_booking() {
890 +function wpbc_toolbar_btn__add_new_booking( $args = array() ) {
1136 891
1137 - if ( isset( $_GET['booking_type'] ) )
1138 - $bk_type = intval ( $_GET['booking_type'] );
1139 - else $bk_type = 1;
892 + $defaults = array(
893 + 'resource_id' => null,
894 + );
895 + $args = wp_parse_args( $args, $defaults );
1140 896
1141 - ?><a
1142 - class="button-primary button wpbc_submit_button"
1143 - href="javascript:void(0)"
1144 - onclick="mybooking_submit(
1145 - document.getElementById('booking_form<?php echo $bk_type; ?>' )
1146 - , <?php echo $bk_type; ?>
1147 - , '<?php echo wpbc_get_maybe_reloaded_booking_locale(); ?>'
1148 - );"
1149 - ><?php _e('Add booking' , 'booking') ?></a><?php
897 + if ( null !== $args['resource_id'] ) {
898 + $bk_type = absint( $args['resource_id'] );
899 + } elseif ( isset( $_GET['booking_type'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
900 + $bk_type = intval( $_GET['booking_type'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
901 + } else {
902 + $bk_type = 1;
903 + }
904 +
905 + ?><a
906 + class="button-primary button wpbc_submit_button"
907 + href="javascript:void(0)"
908 + onclick="wpbc_booking_form_submit(
909 + document.getElementById('booking_form<?php echo intval( $bk_type ); ?>' )
910 + , <?php echo intval( $bk_type ); ?>
911 + , '<?php echo esc_js( wpbc_get_maybe_reloaded_booking_locale() ); ?>'
912 + );"
913 + ><?php esc_html_e( 'Add booking', 'booking' ); ?></a><?php
1150 914 }
1151 915
1152 916
1153 917 /** Checkbox - sending emails or not - duplicated button, usually at the bottom of page*/
@@ -1161,9 +925,9 @@
1161 925
1162 926 $params_checkbox = array(
1163 927 'id' => $el_id // HTML ID of element
1164 928 , 'name' => $el_id
1165 - , 'label' => array( 'title' => __( 'Emails sending', 'booking' ) , 'position' => 'right' ) //FixIn: 9.6.1.5
929 + , 'label' => array( 'title' => __( 'Emails sending', 'booking' ) , 'position' => 'right' ) // FixIn: 9.6.1.5.
1166 930 , 'style' => '' // CSS of select element
1167 931 , 'class' => '' // CSS Class of select element
1168 932 , 'disabled' => false
1169 933 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
@@ -1196,9 +960,9 @@
1196 960 * @param array $button_attr
1197 961 * @param bool $echo
1198 962 * @return string
1199 963 */
1200 -function wpbc_btn_add_booking_to_google_calendar( $booking_data, $button_attr = array(), $echo = true ) { //FixIn: 7.1.2.5
964 +function wpbc_btn_add_booking_to_google_calendar( $booking_data, $button_attr = array(), $echo = true ) { // FixIn: 7.1.2.5.
1201 965
1202 966 //debuge($booking_data);
1203 967 if ( ! $echo ) {
1204 968 ob_start();
@@ -1238,9 +1002,9 @@
1238 1002 if ( ! empty( $booking_gcal_events_form_fields[ $key_name ] ) ) {
1239 1003
1240 1004 $field_name = explode( '^', $booking_gcal_events_form_fields[ $key_name ] );
1241 1005
1242 - $field_name = $field_name[ ( count( $field_name ) - 1 ) ]; //FixIn: 8.7.7.6
1006 + $field_name = $field_name[ ( count( $field_name ) - 1 ) ]; // FixIn: 8.7.7.6.
1243 1007
1244 1008 if ( (! empty($field_name))
1245 1009 && (! empty($booking_data['form_data']))
1246 1010 && (! empty($booking_data['form_data']['_all_fields_']))
@@ -1246,11 +1010,11 @@
1246 1010 && (! empty($booking_data['form_data']['_all_fields_']))
1247 1011 && (! empty($booking_data['form_data']['_all_fields_'][ $field_name ]))
1248 1012 ) {
1249 1013
1250 - if ( 'description' === $key_name ) { //FixIn: 8.1.3.2
1251 - if ( isset( $booking_data['form_show'] ) ) { //FixIn: 8.7.3.14
1252 - //FixIn: 8.7.11.4
1014 + if ( 'description' === $key_name ) { // FixIn: 8.1.3.2.
1015 + if ( isset( $booking_data['form_show'] ) ) { // FixIn: 8.7.3.14.
1016 + // FixIn: 8.7.11.4.
1253 1017 $fields[ $key_name ] = $booking_data['form_show'];
1254 1018 $fields[ $key_name ] = htmlspecialchars_decode($fields[ $key_name ], ENT_QUOTES );
1255 1019 $fields[ $key_name ] = urlencode($fields[ $key_name ]);
1256 1020 $fields[ $key_name ] = htmlentities($fields[ $key_name ] );
@@ -1256,9 +1020,9 @@
1256 1020 $fields[ $key_name ] = htmlentities($fields[ $key_name ] );
1257 1021 $fields[ $key_name ] = htmlspecialchars_decode ( $fields[ $key_name ], ENT_NOQUOTES );
1258 1022 }
1259 1023 } else {
1260 - //FixIn: 8.7.11.4
1024 + // FixIn: 8.7.11.4.
1261 1025 $fields[ $key_name ] = $booking_data['form_data']['_all_fields_'][ $field_name ];
1262 1026 $fields[ $key_name ] = htmlspecialchars_decode($fields[ $key_name ], ENT_QUOTES );
1263 1027 // Convert here from usual symbols to URL symbols https://www.url-encode-decode.com/
1264 1028 // $fields[ $key_name ] = str_replace( array( '%','#', '+', '&' )
@@ -1286,21 +1050,21 @@
1286 1050 */
1287 1051
1288 1052 $check_in_timestamp = strtotime( $booking_data[ 'dates_short' ][ 0 ], current_time( 'timestamp' ) );
1289 1053 if ( trim( substr( $booking_data[ 'dates_short' ][ 0 ], 11 ) ) == '00:00:00' ) {
1290 - $check_in_timestamp = date( "Ymd", $check_in_timestamp ); // All day
1054 + $check_in_timestamp = gmdate( "Ymd", $check_in_timestamp ); // All day
1291 1055 } else {
1292 - $check_in_timestamp = date( "Ymd\THis", $check_in_timestamp );
1293 - //$check_in_timestamp = date( "Ymd\THis\Z", $check_in_timestamp );
1056 + $check_in_timestamp = gmdate( "Ymd\THis", $check_in_timestamp );
1057 + //$check_in_timestamp = gmdate( "Ymd\THis\Z", $check_in_timestamp );
1294 1058 }
1295 1059
1296 1060 $check_out_timestamp = strtotime( $booking_data[ 'dates_short' ][ ( count( $booking_data[ 'dates_short' ] ) - 1 ) ], current_time( 'timestamp' ) );
1297 1061 if ( trim( substr( $booking_data[ 'dates_short' ][ ( count( $booking_data[ 'dates_short' ] ) - 1 ) ], 11 ) ) == '00:00:00' ) {
1298 1062 $check_out_timestamp = strtotime( '+1 day', $check_out_timestamp );
1299 - $check_out_timestamp = date( "Ymd", $check_out_timestamp ); // All day
1063 + $check_out_timestamp = gmdate( "Ymd", $check_out_timestamp ); // All day
1300 1064 } else {
1301 - $check_out_timestamp = date( "Ymd\THis", $check_out_timestamp );
1302 - //$check_out_timestamp = date( "Ymd\THis\Z", $check_out_timestamp );
1065 + $check_out_timestamp = gmdate( "Ymd\THis", $check_out_timestamp );
1066 + //$check_out_timestamp = gmdate( "Ymd\THis\Z", $check_out_timestamp );
1303 1067 }
1304 1068
1305 1069 }
1306 1070
@@ -1309,9 +1073,9 @@
1309 1073 //function iso_to_ts( $iso ) {
1310 1074 // sscanf( $iso, "%u-%u-%uT%u:%u:%uZ", $year, $month, $day, $hour, $minute, $second );
1311 1075 // return mktime( intval($hour), intval($minute), intval($second), intval($month), intval($day), intval($year) );
1312 1076 // 20140127T224000Z
1313 - // date("Ymd\THis\Z", time());
1077 + // gmdate("Ymd\THis\Z", time());
1314 1078
1315 1079 /**
1316 1080 action:
1317 1081 action=TEMPLATE
@@ -1349,15 +1113,15 @@
1349 1113 */
1350 1114
1351 1115 // $link_add2gcal = 'http://www.google.com/calendar/event?action=TEMPLATE';
1352 1116 // $link_add2gcal .= '&text=' . $fields['title'];
1353 - //FixIn: 8.7.3.10
1117 + // FixIn: 8.7.3.10.
1354 1118 $link_add2gcal = 'https://calendar.google.com/calendar/r/eventedit?';
1355 - $link_add2gcal .= 'text=' . $fields['title']; //FixIn: 8.7.11.4
1119 + $link_add2gcal .= 'text=' . $fields['title']; // FixIn: 8.7.11.4.
1356 1120 //$link_add2gcal .= '&dates=[start-custom format='Ymd\\THi00\\Z']/[end-custom format='Ymd\\THi00\\Z']';
1357 1121 $link_add2gcal .= '&dates=' . $check_in_timestamp . '/' . $check_out_timestamp;
1358 - $link_add2gcal .= '&details=' . $fields['description']; //FixIn: 8.7.11.4
1359 - $link_add2gcal .= '&location=' . $fields['where']; //FixIn: 8.7.11.4
1122 + $link_add2gcal .= '&details=' . ( ( 'On' !== get_bk_option( 'booking_g_cal_export_no_data' ) ) ? $fields['description'] : '' ); // FixIn: 10.3.0.1.
1123 + $link_add2gcal .= '&location=' . ( ( 'On' !== get_bk_option( 'booking_g_cal_export_no_data' ) ) ? $fields['where'] : '' );
1360 1124 $link_add2gcal .= '&trp=false';
1361 1125 if ( ! empty( $params['timezone'] ) ) {
1362 1126 $link_add2gcal .= '&ctz=' . str_replace( '%', '%25', $params['timezone'] ); //FixIn: 8.7.3.10 //TimeZone
1363 1127 }
@@ -1366,12 +1130,13 @@
1366 1130 //$link_add2gcal .= '&sprop=';
1367 1131 //$link_add2gcal .= '&sprop=name:';
1368 1132
1369 1133 if ( $button_attr['is_only_url'] ) {
1134 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1370 1135 echo $link_add2gcal;
1371 1136 } else {
1372 1137
1373 - ?><a href="<?php echo $link_add2gcal; ?>" target="_blank" rel="nofollow"
1138 + ?><a href="<?php echo esc_url( $link_add2gcal ); ?>" target="_blank" rel="nofollow"
1374 1139 class="tooltip_top <?php echo esc_attr( $button_attr['class'] ) ?>"
1375 1140 title="<?php echo esc_attr( $button_attr['hint'] ); ?>"
1376 1141 ><?php
1377 1142 if ( $button_attr['is_show_icon'] ) {
@@ -1386,11 +1151,11 @@
1386 1151 return ob_get_clean();
1387 1152 }
1388 1153
1389 1154 }
1390 -////////////////////////////////////////////////////////////////////////////////
1155 +// ---------------------------------------------------------------------------------------------------------------------
1391 1156 // Toolbar Other UI elements - General
1392 -////////////////////////////////////////////////////////////////////////////////
1157 +// ---------------------------------------------------------------------------------------------------------------------
1393 1158
1394 1159 /**
1395 1160 * Selection elements in toolbar UI selectbox
1396 1161 *
@@ -1407,9 +1172,9 @@
1407 1172 */
1408 1173 function wpbc_toolbar_btn__selection_element( $params ) {
1409 1174
1410 1175 $defaults = array(
1411 - 'name' => 'random_' . rand( 1000, 10000 )
1176 + 'name' => 'random_' . wp_rand( 1000, 10000 )
1412 1177 , 'title' => __('Total', 'booking') . ':'
1413 1178 , 'on_change' => '' //'location.href=\'' . $link_base . '\' + this.value;'; //$link_base = wpbc_get_new_booking_url__base( array( $params['name'] ) ) . '&' . $params['name'] . '=' ;
1414 1179 , 'options' => array()
1415 1180 , 'selected' => 0
@@ -1453,13 +1218,13 @@
1453 1218 ?></div><?php
1454 1219 }
1455 1220
1456 1221
1457 -////////////////////////////////////////////////////////////////////////////////
1222 +// ---------------------------------------------------------------------------------------------------------------------
1458 1223 // Toolbar S e a r c h F o r m at Top Right side of Settings page
1459 -////////////////////////////////////////////////////////////////////////////////
1224 +// ---------------------------------------------------------------------------------------------------------------------
1460 1225
1461 -//FixIn: 8.0.1.12
1226 +// FixIn: 8.0.1.12.
1462 1227 /**
1463 1228 * Add hidden input SEARCH KEY field into main form, if previosly was searching by ID or Title
1464 1229 * @param array $params => array( 'search_get_key' => 'wh_resource_id' )
1465 1230 */
@@ -1471,11 +1236,15 @@
1471 1236 $params = wp_parse_args( $params, $defaults );
1472 1237
1473 1238
1474 1239 $search_form_value = '';
1240 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
1475 1241 if ( isset( $_REQUEST[ $params[ 'search_get_key' ] ] ) ) {
1476 - $wh_resource_id = wpbc_clean_digit_or_csd( $_REQUEST[ $params[ 'search_get_key' ] ] ); // '12,0,45,9' or '10'
1477 - $wh_resource_title = wpbc_clean_string_for_form( $_REQUEST[ $params[ 'search_get_key' ] ] ); // Clean string
1242 + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1243 + $wh_resource_id = wpbc_clean_digit_or_csd( $_REQUEST[ $params['search_get_key'] ] ); // '12,0,45,9' or '10'.
1244 + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1245 + $wh_resource_title = wpbc_clean_string_for_form( $_REQUEST[ $params['search_get_key'] ] ); // Clean string.
1246 +
1478 1247 if ( ! empty( $wh_resource_id ) ) {
1479 1248 $search_form_value = $wh_resource_id;
1480 1249 } else {
1481 1250 $search_form_value = $wh_resource_title;
@@ -1504,9 +1273,9 @@
1504 1273 $defaults = array(
1505 1274 'search_form_id' => 'wpbc_seasonfilters_search_form'
1506 1275 , 'search_get_key' => 'wh_search_id'
1507 1276 , 'is_pseudo' => false //'location.href=\'' . $link_base . '\' + this.value;'; //$link_base = wpbc_get_new_booking_url__base( array( $params['name'] ) ) . '&' . $params['name'] . '=' ;
1508 - , 'container_style' => 'position: absolute; right: 20px; top: 0px;z-index: 0;' //FixIn: 10.0.0.29
1277 + , 'container_style' => 'position: absolute; right: 20px; top: 0px;z-index: 0;' // FixIn: 10.0.0.29.
1509 1278 );
1510 1279 $params = wp_parse_args( $params, $defaults );
1511 1280
1512 1281
@@ -1515,11 +1284,12 @@
1515 1284 $wpbc_admin_url = wpbc_get_params_in_url( wpbc_get_bookings_url( false, false ), $exclude_params, $only_these_parameters );
1516 1285
1517 1286
1518 1287 $search_form_value = '';
1288 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
1519 1289 if ( isset( $_REQUEST[ $params[ 'search_get_key' ] ] ) ) {
1520 - $wh_resource_id = wpbc_clean_digit_or_csd( $_REQUEST[ $params[ 'search_get_key' ] ] ); // '12,0,45,9' or '10'
1521 - $wh_resource_title = wpbc_clean_string_for_form( $_REQUEST[ $params[ 'search_get_key' ] ] ); // Clean string
1290 + $wh_resource_id = wpbc_clean_digit_or_csd( $_REQUEST[ $params[ 'search_get_key' ] ] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized // '12,0,45,9' or '10'
1291 + $wh_resource_title = wpbc_clean_string_for_form( $_REQUEST[ $params[ 'search_get_key' ] ] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized // Clean string
1522 1292 if ( ! empty( $wh_resource_id ) ) {
1523 1293 $search_form_value = $wh_resource_id;
1524 1294 } else {
1525 1295 $search_form_value = $wh_resource_title;
@@ -1533,12 +1303,12 @@
1533 1303 <span class="wpdevelop">
1534 1304
1535 1305 <?php if ( ! $params['is_pseudo'] ) { ?>
1536 1306 <div style="<?php echo esc_attr( $params['container_style'] ); ?>">
1537 - <form action="<?php echo $wpbc_admin_url; ?>" method="post" id="<?php echo $params[ 'search_form_id' ]; ?>" name="<?php echo $params[ 'search_form_id' ]; ?>" >
1307 + <form action="<?php echo esc_url( $wpbc_admin_url ); ?>" method="post" id="<?php echo esc_attr( $params[ 'search_form_id' ] ); ?>" name="<?php echo esc_attr( $params[ 'search_form_id' ] ); ?>" >
1538 1308 <?php
1539 1309 } else {
1540 - ?><div style="float:right;" id="<?php echo $params['search_form_id'] . '_pseudo'; ?>"><?php
1310 + ?><div style="float:right;" id="<?php echo esc_attr( $params['search_form_id'] . '_pseudo' ); ?>"><?php
1541 1311 }
1542 1312
1543 1313
1544 1314 if(0){
@@ -1631,9 +1401,9 @@
1631 1401 $booking_action = 'booking_resource_search_keyword_btn';
1632 1402
1633 1403 $el_id = 'ui_btn_' . $booking_action;
1634 1404
1635 - // Escaped construction of search keyword. //FixIn: 9.9.0.11
1405 + // Escaped construction of search keyword. // FixIn: 9.9.0.11.
1636 1406 $params_for_element = array(
1637 1407 'type' => 'button' ,
1638 1408 'title' => '',//__( 'Search', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
1639 1409 'hint' => array( 'title' => __('Search' ,'booking'), 'position' => 'top' ), // Hint
@@ -1680,9 +1450,11 @@
1680 1450
1681 1451 <?php
1682 1452 if ( $params['is_pseudo'] ) {
1683 1453 // Required for opening specific page NUM during saving ////////
1684 - ?><input type="hidden" value="<?php echo $search_form_value; ?>" name="<?php echo $params[ 'search_get_key' ]; ?>" /><?php
1454 + ?><input type="hidden" value="<?php
1455 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1456 + echo $search_form_value; ?>" name="<?php echo esc_attr( $params[ 'search_get_key' ] ); ?>" /><?php
1685 1457 ?><div class="clear" style="height:20px;"></div><?php
1686 1458 }
1687 1459 ?>
1688 1460 </div>
@@ -1694,10 +1466,10 @@
1694 1466 // Hide pseudo form, if real search form does not exist
1695 1467 ?>
1696 1468 <script type="text/javascript">
1697 1469 jQuery(document).ready(function(){
1698 - if ( jQuery('#<?php echo $params[ 'search_form_id' ]; ?>').length == 0 ) {
1699 - jQuery('#<?php echo $params['search_form_id'] . '_pseudo'; ?>').hide();
1470 + if ( jQuery('#<?php echo esc_js( $params[ 'search_form_id' ] ); ?>').length == 0 ) {
1471 + jQuery('#<?php echo esc_js( $params['search_form_id'] . '_pseudo' ); ?>').hide();
1700 1472 }
1701 1473 });
1702 1474 </script>
1703 1475 <?php
@@ -1704,68 +1476,83 @@
1704 1476 }
1705 1477 }
1706 1478
1707 1479
1708 -//FixIn: 9.6.3.5
1480 +// FixIn: 9.6.3.5.
1709 1481
1710 -////////////////////////////////////////////////////////////////////////////////
1482 +// ---------------------------------------------------------------------------------------------------------------------
1711 1483 // JS & CSS
1712 -////////////////////////////////////////////////////////////////////////////////
1484 +// ---------------------------------------------------------------------------------------------------------------------
1713 1485
1714 -/** Load suport JavaScript for "Bookings" page*/
1486 +/**
1487 + * Load support JavaScript for "Bookings" page :: JS Tooltips, Popover, Datepicker
1488 + */
1715 1489 function wpbc_js_for_bookings_page() {
1716 1490
1717 - $is_use_hints = get_bk_option( 'booking_is_use_hints_at_admin_panel' );
1718 - if ( $is_use_hints == 'On' )
1719 - wpbc_bs_javascript_tooltips(); // JS Tooltips
1720 -
1721 - wpbc_bs_javascript_popover(); // JS Popover
1722 -
1723 - wpbc_datepicker_js(); // JS Datepicker
1724 - wpbc_datepicker_css(); // CSS DatePicker
1491 + wpbc_bs_javascript_tooltips(); // JS Tooltips
1492 + wpbc_bs_javascript_popover(); // JS Popover
1493 + wpbc_datepicker_js(); // JS Datepicker
1494 + wpbc_datepicker_css(); // CSS DatePicker
1725 1495 }
1726 1496
1727 1497
1728 1498 /** Datepicker activation JavaScript */
1729 1499 function wpbc_datepicker_js() {
1730 -
1731 - ?><script type="text/javascript">
1732 - jQuery(document).ready( function(){
1733 -
1500 + ?>
1501 + <script type="text/javascript">
1502 + <?php
1503 + echo wpbc_jq_ready_start(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1504 + ?>
1734 1505 if ( 'function' === typeof( jQuery('input.wpdevbk-filters-section-calendar').datepick ) ) {
1735 -
1736 - function applyCSStoDays( date ){
1737 - return [true, 'date_available'];
1738 - }
1739 - jQuery('input.wpdevbk-filters-section-calendar').datepick(
1740 - { beforeShowDay: applyCSStoDays,
1741 - showOn: 'focus',
1742 - multiSelect: 0,
1743 - numberOfMonths: 1,
1744 - stepMonths: 1,
1745 - prevText: '&laquo;',
1746 - nextText: '&raquo;',
1747 - dateFormat: 'yy-mm-dd',
1748 - changeMonth: false,
1749 - changeYear: false,
1750 - minDate: null,
1751 - maxDate: null, //'1Y',
1752 - showStatus: false,
1753 - multiSeparator: ', ',
1754 - closeAtTop: null,//!false,
1755 - firstDay:<?php echo get_bk_option( 'booking_start_day_weeek' ); ?>,
1756 - gotoCurrent: false,
1757 - hideIfNoPrevNext:true,
1758 - useThemeRoller :false,
1759 - mandatory: true
1506 + jQuery( 'input.wpdevbk-filters-section-calendar' ).datepick(
1507 + {
1508 + beforeShowDay : function ( date ) {
1509 + return [true, 'date_available'];
1510 + },
1511 + onSelect : function ( string_dates, js_dates_arr ){ /**
1512 + * string_dates = '23.08.2023 - 26.08.2023' | '23.08.2023 - 23.08.2023' | '19.09.2023, 24.08.2023, 30.09.2023'
1513 + * js_dates_arr = range: [ Date (Aug 23 2023), Date (Aug 25 2023)] | multiple: [ Date(Oct 24 2023), Date(Oct 20 2023), Date(Oct 16 2023) ]
1514 + */
1515 + return wpbc_filters_section_calendar_selected_day( string_dates, {}, this );
1516 + },
1517 + showOn : 'focus',
1518 + multiSelect : 0,
1519 + numberOfMonths : 1,
1520 + stepMonths : 1,
1521 + prevText : '&lsaquo;',
1522 + nextText : '&rsaquo;',
1523 + dateFormat : 'yy-mm-dd',
1524 + changeMonth : false,
1525 + changeYear : false,
1526 + minDate : null,
1527 + maxDate : null, //'1Y',
1528 + showStatus : false,
1529 + multiSeparator : ', ',
1530 + closeAtTop : null, //!false,
1531 + firstDay : <?php echo intval( get_bk_option( 'booking_start_day_weeek' ) ); ?>,
1532 + gotoCurrent : false,
1533 + hideIfNoPrevNext: true,
1534 + useThemeRoller : false,
1535 + mandatory : true
1760 1536 }
1761 1537 );
1538 + function wpbc_filters_section_calendar_selected_day( string_dates, params_arr, _this ) {
1539 + // FixIn: 10.11.4.2.
1540 + if ( 'ui_wh_booking_date_checkin' === jQuery( _this ).attr( 'id' ) ) {
1541 + setTimeout( function () {
1542 + jQuery( '#ui_wh_booking_date_checkout' ).val( string_dates );
1543 + jQuery( '#ui_wh_booking_date_checkout' ).trigger( 'focus' );
1544 + }, 100 );
1545 + }
1546 + }
1762 1547 } else {
1763 - alert( 'WPBC Error. JavaScript library "datepick" was not defined.' );
1548 + console.log( 'WPBC Error. JavaScript library "datepick" was not defined.' );
1764 1549 }
1765 -
1766 - });
1767 - </script><?php
1550 + <?php
1551 + echo wpbc_jq_ready_end(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1552 + ?>
1553 + </script>
1554 + <?php
1768 1555 }
1769 1556
1770 1557
1771 1558 /** Support CSS - datepick, etc... */
@@ -1776,15 +1563,15 @@
1776 1563 $height = 40;
1777 1564 ?>
1778 1565 <style type="text/css">
1779 1566 #datepick-div {
1780 - max-width: <?php echo $width ?>px !important;
1567 + max-width: <?php echo intval( $width ); ?>px !important;
1781 1568 width:100%;
1782 1569 margin-top: 2px;
1783 1570 background: #fff;
1784 1571 }
1785 1572 #datepick-div .datepick-days-cell {
1786 - height: <?php echo $height ?>px !important;
1573 + height: <?php echo intval( $height ); ?>px !important;
1787 1574 }
1788 1575 #datepick-div .datepick-control {
1789 1576 display: none;
1790 1577 font-size: 10px;
@@ -1834,5 +1621,5 @@
1834 1621 });
1835 1622 </script>
1836 1623 <?php
1837 1624
1838 -}
1625 +}