PluginProbe
Booking Calendar / 11.4.3
Booking Calendar v11.4.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
booking / includes / ui_modal__shortcodes / sh_tpl_booking.php

sh_tpl_booking.php in Booking Calendar 11.4.3, at includes/ui_modal__shortcodes/sh_tpl_booking.php

1,809 lines 82.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @version 1.0
4 * @package Booking Calendar Shortcodes Config
5 * @subpackage Shortcodes Content - Booking Calendar Form e.g.: [booking resource_id=1 nummonths=3 options='{calendar months_num_in_row=3 width=100% cell_height=50px}']
6 * @category Shortcodes
7 *
8 * @author wpdevelop
9 * @link https://wpbookingcalendar.com/
10 * @email info@wpbookingcalendar.com
11 *
12 * @modified 2024-01-21
13 */
14
15 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly // FixIn: 9.9.0.15.
16
17 // =====================================================================================================================
18 // Left Navigation Panel
19 // =====================================================================================================================
20
21 /**
22 * Left Vertical Navigation panel
23 * @return void
24 */
25 function wpbc_shortcode_config__navigation_panel(){
26
27 $wpbm_version = wpbc_get_wpbm_version();
28 $wpbm_minimum_version = '2.1';
29
30 // If lower than 2, than show warning
31 if ( version_compare( $wpbm_version, $wpbm_minimum_version, '<') ) {
32 $is_bm_exist = false;
33 } else {
34 $is_bm_exist = true;
35 }
36
37 ?>
38 <div class="wpbc_settings_navigation_column wpbc_shortcode_config_navigation_column">
39 <div id="wpbc_shortcode_config__nav_tab__booking" class="wpbc_settings_navigation_item wpbc_settings_navigation_item_active">
40 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_booking', 'booking' );" href="javascript:void(0);">
41 <span><?php esc_html_e( 'Booking Form with Calendar', 'booking' ) ?></span>
42 </a>
43 </div>
44 <div id="wpbc_shortcode_config__nav_tab__bookingcalendar" class="wpbc_settings_navigation_item wpbc_navigation_sub_item">
45 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingcalendar', 'bookingcalendar' );" href="javascript:void(0);">
46 <span><?php esc_html_e( 'Availability Calendar / Days Not Selectable', 'booking' ); ?></span>
47 </a>
48 </div>
49 <div id="wpbc_shortcode_config__nav_tab__bookingselect" class="wpbc_settings_navigation_item wpbc_dismiss__booking_select <?php echo ( ! class_exists( 'wpdev_bk_personal' ) ) ? ' wpbc_settings_navigation_item_disabled ' : ''; ?>">
50 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingselect', 'bookingselect' );" href="javascript:void(0);">
51 <span><?php esc_html_e( 'Resource Selection', 'booking' ); ?></span><?php
52 echo ( ! class_exists( 'wpdev_bk_personal' ) ) ? '<span class="wpbc_pro_label">Pro</span>' : '';
53 ?>
54 </a>
55 </div>
56 <div id="wpbc_shortcode_config__nav_tab__bookingform" class="wpbc_settings_navigation_item wpbc_dismiss__booking_form_only <?php echo ( ! class_exists( 'wpdev_bk_biz_l' ) ) ? ' wpbc_settings_navigation_item_disabled ' : ''; ?>">
57 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingform', 'bookingform' );" href="javascript:void(0);">
58 <span><?php esc_html_e( 'Only Form', 'booking' ) ?></span><?php
59 if ( ! class_exists( 'wpdev_bk_personal' ) ){
60 echo '<span class="wpbc_pro_label">Pro</span>';
61 } else{
62 echo ( ! class_exists( 'wpdev_bk_biz_l' ) ) ? '<span class="wpbc_pro_label">BL</span>' : '';
63 }
64 ?>
65 </a>
66 </div>
67 <div id="wpbc_shortcode_config__nav_tab__bookingtimeline" class="wpbc_settings_navigation_item wpbc_navigation_top_border">
68 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingtimeline', 'bookingtimeline' );" href="javascript:void(0);">
69 <span><?php esc_html_e( 'TimeLine', 'booking' ); ?></span>
70 </a>
71 </div>
72 <div id="wpbc_shortcode_config__nav_tab__bookingsearch" class="wpbc_settings_navigation_item wpbc_dismiss__booking_search <?php echo ( ! class_exists( 'wpdev_bk_biz_l' ) ) ? ' wpbc_settings_navigation_item_disabled ' : ''; ?>">
73 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingsearch', 'bookingsearch' );" href="javascript:void(0);">
74 <span><?php esc_html_e( 'Search Availability', 'booking' ) ?></span><?php
75 if ( ! class_exists( 'wpdev_bk_personal' ) ){
76 echo '<span class="wpbc_pro_label">Pro</span>';
77 } else{
78 echo ( ! class_exists( 'wpdev_bk_biz_l' ) ) ? '<span class="wpbc_pro_label">BL</span>' : '';
79 }
80 ?>
81 </a>
82 </div>
83 <div id="wpbc_shortcode_config__nav_tab__bookingother" class="wpbc_settings_navigation_item">
84 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingother', 'bookingother' );" href="javascript:void(0);">
85 <span><?php esc_html_e( 'Other', 'booking' ); ?></span><?php
86 //echo ( ! class_exists( 'wpdev_bk_personal' ) ) ? '<span class="wpbc_pro_label">Pro</span>' : '';
87 ?>
88 </a>
89 </div>
90 <?php if ( $is_bm_exist ) { ?>
91 <div id="wpbc_shortcode_config__nav_tab__booking_import_ics" class="wpbc_settings_navigation_item wpbc_navigation_top_border">
92 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_booking_import_ics', 'booking_import_ics' );" href="javascript:void(0);">
93 <span><?php esc_html_e( 'Import Events (.ics feed)', 'booking' ) ?></span>
94 </a>
95 </div>
96 <div id="wpbc_shortcode_config__nav_tab__booking_listing_ics" class="wpbc_settings_navigation_item wpbc_navigation_sub_item">
97 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_booking_listing_ics' , 'booking_listing_ics');" href="javascript:void(0);">
98 <span><?php esc_html_e( 'Show .ics Listing of Events', 'booking' ); ?></span>
99 </a>
100 </div>
101 <?php } ?>
102 </div>
103 <?php
104 }
105
106
107 // =====================================================================================================================
108 // Shortcode [booking ... ]
109 // =====================================================================================================================
110
111 /**
112 * Content of PopUp - for shortcode [booking ...]
113 *
114 * @return void
115 */
116 function wpbc_shortcode_config__content__booking() {
117
118 $shortcode_name = 'booking';
119
120 ?><div id="wpbc_sc_container__shortcode_<?php echo esc_attr( $shortcode_name ); ?>" class="wpbc_sc_container__shortcode wpbc_sc_container__shortcode_<?php echo esc_attr( $shortcode_name ); ?>"><?php
121
122 wpbc_shortcode_config__booking__top_tabs();
123
124 // 'General' --------------------------------------------------------------------------------------------------
125 ?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__general">
126 <table class="form-table"><tbody><?php
127
128 // Booking Resource
129 wpbc_shortcode_config_fields__select_resource( $shortcode_name . '_wpbc_resource_id', $shortcode_name );
130
131 // Custom form
132 wpbc_shortcode_config_fields__select_custom_form( $shortcode_name . '_wpbc_custom_form', $shortcode_name );
133
134 // Number of Months
135 wpbc_shortcode_config_fields__select_nummonths( $shortcode_name . '_wpbc_nummonths', $shortcode_name );
136
137 // Calendar Size
138 wpbc_shortcode_config_fields__calendar_size( $shortcode_name . '_wpbc_size', $shortcode_name );
139
140 // Open booking form in popup.
141 wpbc_shortcode_config_fields__booking_popup( $shortcode_name . '_wpbc_popup', $shortcode_name );
142
143 ?></tbody></table>
144 </div><?php
145
146 // 'Conditional Days Selection' --------------------------------------------------------------------------------
147 ?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__conditions"><?php
148
149 wpbc_shortcode_config_fields__dates_conditions_toolbar(); // TOOLBAR
150
151 ?><div class="wpbc_sc_container__shortcode_subsection wpbc_sc_container__shortcode_subsection__weekdays_conditions">
152 <?php
153 wpbc_shortcode_config_fields__weekdays_conditions( $shortcode_name . 'wpbc_select_day_weekday', $shortcode_name );
154 ?>
155 </div><?php
156
157 ?><div class="wpbc_sc_container__shortcode_subsection wpbc_sc_container__shortcode_subsection__seasons_conditions">
158 <?php
159 wpbc_shortcode_config_fields__season_conditions( $shortcode_name . 'wpbc_select_day_season', $shortcode_name );
160 ?>
161 </div><?php
162
163 ?><div class="wpbc_sc_container__shortcode_subsection wpbc_sc_container__shortcode_subsection__startseason_conditions">
164 <?php
165 wpbc_shortcode_config_fields__season_start_day_conditions( $shortcode_name . 'wpbc_start_day_season', $shortcode_name )
166 ?>
167 </div><?php
168
169 ?><div class="wpbc_sc_container__shortcode_subsection wpbc_sc_container__shortcode_subsection__dates_conditions">
170 <?php
171 wpbc_shortcode_config_fields__fordate_conditions( $shortcode_name . 'wpbc_select_day_fordate', $shortcode_name );
172 ?>
173 </div><?php
174
175 ?></div><?php
176
177 // 'AGGREGATE' -------------------------------------------------------------------------------------------------
178 ?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__aggregate"><?php
179
180 wpbc_shortcode_config_fields__aggregate( $shortcode_name . '_wpbc_aggregate', $shortcode_name );
181
182 ?></div><?php
183
184 // 'START MONTH' -----------------------------------------------------------------------------------------------
185 ?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__other"><?php
186 ?><table class="form-table"><tbody><?php
187
188 wpbc_shortcode_config_fields__calendar_dates_start( $shortcode_name . '_wpbc_calendar_dates_start', $shortcode_name );
189
190 wpbc_shortcode_config_fields__calendar_dates_end( $shortcode_name . '_wpbc_calendar_dates_end', $shortcode_name );
191
192 wpbc_shortcode_config_fields__start_month( $shortcode_name . '_wpbc_startmonth', $shortcode_name );
193
194 ?></tbody></table><?php
195 ?></div><?php
196
197
198
199 ?>
200 <div class="wpbc_shortcode_config_content_toolbar__next_prior">
201 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config_content_toolbar__next_prior(this,'prior');" class="button">
202 <span class="in-button-text">&lsaquo;</span>
203 </a>
204 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config_content_toolbar__next_prior(this,'next');" class="button">
205 <span class="in-button-text">&rsaquo;</span>
206 </a>
207 </div>
208 <?php
209
210 ?></div><?php
211
212 wpbc_clear_div();
213 }
214
215
216 /**
217 * Top Tabs for shortcode [booking ...]
218 * @return void
219 */
220 function wpbc_shortcode_config__booking__top_tabs(){
221
222 $shortcode_name = 'booking';
223
224 wpbc_bs_toolbar_tabs_html_container_start();
225
226 $js = "jQuery(this).parents( '.wpbc_sc_container__shortcode' ).find( '.nav-tab' ).removeClass('nav-tab-active');"
227 . "jQuery(this).addClass('nav-tab-active');"
228 . "jQuery('.nav-tab i.icon-white').removeClass('icon-white');"
229 . "jQuery('.nav-tab-active i').addClass('icon-white');"
230 . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section').hide();";
231
232 wpbc_bs_display_tab( array(
233 'title' => __('Booking Calendar Form', 'booking')
234 // , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' )
235 , 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__general').show();"
236 , 'font_icon' => 'wpbc-bi-calendar3-range'
237 , 'default' => true
238 ) );
239 wpbc_bs_display_tab( array(
240 'title' => __('Conditional Days Selection', 'booking')
241 // , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' )
242 , 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__conditions').show();"
243 , 'font_icon' => 'wpbc-bi-calendar2-week'
244 , 'default' => false
245 , 'css_classes' => 'wpbc_dismiss__conditional_days'
246 ) );
247 wpbc_bs_display_tab( array(
248 'title' => __('Aggregate', 'booking')
249 // , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' )
250 , 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__aggregate').show();"
251 , 'font_icon' => 'wpbc-bi-calendar2-plus'
252 , 'default' => false
253 , 'css_classes' => 'wpbc_dismiss__booking_param_aggregate'
254 ) );
255 wpbc_bs_display_tab( array(
256 'title' => __('Advanced', 'booking')
257 // , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' )
258 , 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__other').show();"
259 , 'font_icon' => 'wpbc_icn_tune'
260 , 'default' => false
261
262 ) );
263
264 wpbc_bs_toolbar_tabs_html_container_end();
265 }
266
267
268
269 // =====================================================================================================================
270 // Fields
271 // =====================================================================================================================
272
273 /**
274 * Shortcode Field: Select-box - "Booking Resource"
275 *
276 * @param $id
277 * @param $group_key
278 *
279 * @return void
280 */
281 function wpbc_shortcode_config_fields__select_resource( $id , $group_key ){
282
283 if ( class_exists( 'wpdev_bk_personal' ) ){
284
285 WPBC_Settings_API::field_select_row_static( $id
286 , array(
287 'type' => 'select'
288 , 'title' => __( 'Booking resource', 'booking')
289 , 'description' => __( 'Select booking resource', 'booking' )
290 , 'description_tag' => 'span'
291 , 'label' => ''
292 , 'multiple' => false
293 , 'group' => $group_key
294 , 'tr_class' => $group_key . '_standard_section'
295 , 'class' => ''
296 , 'css' => 'margin-right:10px;'
297 , 'only_field' => false
298 , 'attr' => array()
299 , 'value' => ''
300 , 'options' => wpbc_get_all_booking_resources_list()
301 ) );
302 }
303
304 }
305
306 /**
307 * Shortcode Field: Select-box - "Custom Booking Form"
308 *
309 * @param $id
310 * @param $group_key
311 *
312 * @return void
313 */
314 function wpbc_shortcode_config_fields__select_custom_form( $id , $group_key ){
315
316 WPBC_FE_Custom_Form_Helper::wpbc_bfb__custom_booking_forms_list__selectbox_html__sh_modal(
317 array(
318 'name' => $id,
319 'title' => __( 'Booking Form', 'booking' ),
320 'description' => __( 'Select custom booking form', 'booking' ),
321 'group' => $group_key,
322 )
323 );
324 }
325
326 /**
327 * Shortcode Field: Select-box - "Calendar Months Number"
328 *
329 * @param $id
330 * @param $group_key
331 *
332 * @return void
333 */
334 function wpbc_shortcode_config_fields__select_nummonths( $id , $group_key ){
335
336 WPBC_Settings_API::field_select_row_static( $id
337 , array(
338 'type' => 'select'
339 , 'title' => __('Visible months', 'booking')
340 , 'description' => __('Select number of month to show for calendar.' ,'booking')
341 , 'description_tag' => 'span'
342 , 'label' => ''
343 , 'multiple' => false
344 , 'group' => $group_key
345 , 'tr_class' => $group_key . '_standard_section'
346 , 'class' => ''
347 , 'css' => 'margin-right:10px;'
348 , 'only_field' => false
349 , 'attr' => array()
350 , 'value' => get_bk_option( 'booking_client_cal_count' )
351 , 'options' => array_combine( range( 1, 12 ), range( 1, 12 ) )
352 )
353 );
354 }
355
356 /**
357 * Shortcode Fields: OPTION - "Define Calendar Size"
358 *
359 * @param $id
360 * @param $group_key
361 *
362 * @return void
363 */
364 function wpbc_shortcode_config_fields__calendar_size( $id , $group_key ){
365
366 // ---------------------------------------------------------------------------------------------------------
367 WPBC_Settings_API::field_checkbox_row_static( $id . '_enabled'
368 , array(
369 'type' => 'checkbox'
370 , 'title' => __('Setup Size & Structure', 'booking')
371 , 'description' => __('Configure Calendar Size and Structure', 'booking')
372 , 'description_tag' => 'span'
373 , 'label' => ''
374 , 'class' => ''
375 , 'css' => ''
376 , 'tr_class' => ''
377 , 'attr' => array()
378 , 'group' => $group_key
379 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed'
380 , 'only_field' => !true
381 , 'is_new_line' => false
382 , 'value' => false
383 )
384 );
385
386 WPBC_Settings_API::field_select_row_static( $id . '_months_num_in_row'
387 , array(
388 'type' => 'select'
389 , 'title' => __('Number of months in a row', 'booking')
390 , 'description' => __('Select the number of months to show in one row on a wide screen.' ,'booking')
391 , 'description_tag' => 'span'
392 , 'label' => ''
393 , 'multiple' => false
394 , 'group' => $group_key
395 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_calendar_size'
396 , 'class' => ''
397 , 'css' => 'margin-right:10px;'
398 , 'only_field' => false
399 , 'attr' => array()
400 , 'value' => get_bk_option( 'booking_client_cal_count' )
401 , 'options' => array_combine( range( 1, 6 ), range( 1, 6 ) )
402 )
403 );
404
405 ?><tr valign="top" class="<?php echo esc_attr( $group_key . '_standard_section' ); ?> wpbc_sub_settings_grayed <?php echo esc_attr( $id ); ?>_wpbc_sc_calendar_size">
406 <th scope="row" style="vertical-align: middle;">
407 <label for="wpbc_booking_width" class="wpbc-form-text"><?php esc_html_e('Calendar width:', 'booking'); ?></label>
408 </th>
409 <td class=""><fieldset><?php
410
411 WPBC_Settings_API::field_text_row_static( $id . '_calendar_width'
412 , array(
413 'type' => 'text'
414 , 'placeholder' => '100'
415 , 'class' => ''
416 , 'css' => 'width:5em;'
417 , 'only_field' => true
418 , 'attr' => array()
419 , 'value' => '100'
420 )
421 );
422 WPBC_Settings_API::field_select_row_static( $id . '_calendar_width_px_pr'
423 , array(
424 'type' => 'select'
425 , 'multiple' => false
426 , 'class' => ''
427 , 'css' => 'width:4em;'
428 , 'only_field' => true
429 , 'attr' => array()
430 , 'value' => '%'
431 , 'options' => array( 'px' => 'px', '%' => '%' )
432 )
433 );
434 ?><span class="description"> <?php esc_html_e('Set width of calendar' ,'booking'); ?></span></fieldset></td>
435 </tr><?php
436
437 ?><tr valign="top" class="<?php echo esc_attr( $group_key . '_standard_section' ); ?> wpbc_sub_settings_grayed <?php echo esc_attr( $id ); ?>_wpbc_sc_calendar_size">
438 <th scope="row" style="vertical-align: middle;"><label for="wpbc_booking_cell_height" class="wpbc-form-text"><?php esc_html_e('Calendar cell height:', 'booking'); ?></label></th>
439 <td class="">
440 <fieldset><?php
441
442 WPBC_Settings_API::field_text_row_static( $id . '_calendar_cell_height'
443 , array(
444 'type' => 'text'
445 , 'placeholder' => '50'
446 , 'class' => ''
447 , 'css' => 'width:5em;'
448 , 'only_field' => true
449 , 'attr' => array()
450 , 'value' => '50'
451 )
452 );
453 WPBC_Settings_API::field_select_row_static( $id . '_calendar_cell_height_px_pr'
454 , array(
455 'type' => 'select'
456 , 'multiple' => false
457 , 'class' => ''
458 , 'css' => 'width:4em;'
459 , 'only_field' => true
460 , 'attr' => array()
461 , 'value' => '%'
462 , 'options' => array( 'px' => 'px' )
463 )
464 );
465 ?><span class="description"> <?php esc_html_e('Set cell height for calendar' ,'booking'); ?></span>
466 </fieldset>
467 </td>
468 </tr><?php
469
470 }
471
472 /**
473 * Shortcode Fields: Open booking form in popup.
474 *
475 * @param string $id Field ID prefix.
476 * @param string $group_key Shortcode group key.
477 *
478 * @return void
479 */
480 function wpbc_shortcode_config_fields__booking_popup( $id, $group_key ) {
481
482 WPBC_Settings_API::field_checkbox_row_static( $id . '_enabled'
483 , array(
484 'type' => 'checkbox'
485 , 'title' => __( 'Open in popup', 'booking' )
486 , 'description' => __( 'Show a button that opens the booking form in a popup window.', 'booking' )
487 , 'description_tag' => 'span'
488 , 'label' => ''
489 , 'class' => ''
490 , 'css' => ''
491 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed'
492 , 'attr' => array()
493 , 'group' => $group_key
494 , 'only_field' => false
495 , 'is_new_line' => false
496 , 'value' => false
497 )
498 );
499
500 WPBC_Settings_API::field_text_row_static( $id . '_button_title'
501 , array(
502 'type' => 'text'
503 , 'title' => __( 'Button title', 'booking' )
504 , 'description' => __( 'Text on the button that opens the booking form popup.', 'booking' )
505 , 'description_tag' => 'span'
506 , 'placeholder' => __( 'Book now', 'booking' )
507 , 'class' => ''
508 , 'css' => ''
509 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_booking_popup'
510 , 'attr' => array()
511 , 'group' => $group_key
512 , 'only_field' => false
513 , 'value' => __( 'Book now', 'booking' )
514 )
515 );
516
517 WPBC_Settings_API::field_text_row_static( $id . '_title'
518 , array(
519 'type' => 'text'
520 , 'title' => __( 'Popup title', 'booking' )
521 , 'description' => __( 'Title displayed in the popup header.', 'booking' )
522 , 'description_tag' => 'span'
523 , 'placeholder' => __( 'Booking Form', 'booking' )
524 , 'class' => ''
525 , 'css' => ''
526 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_booking_popup'
527 , 'attr' => array()
528 , 'group' => $group_key
529 , 'only_field' => false
530 , 'value' => __( 'Booking Form', 'booking' )
531 )
532 );
533
534 WPBC_Settings_API::field_text_row_static( $id . '_button_class'
535 , array(
536 'type' => 'text'
537 , 'title' => __( 'Button CSS class', 'booking' )
538 , 'description' => __( 'CSS class for the popup button.', 'booking' )
539 , 'description_tag' => 'span'
540 , 'placeholder' => 'wp-element-button'
541 , 'class' => ''
542 , 'css' => ''
543 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_booking_popup'
544 , 'attr' => array()
545 , 'group' => $group_key
546 , 'only_field' => false
547 , 'value' => 'wp-element-button'
548 )
549 );
550
551 WPBC_Settings_API::field_text_row_static( $id . '_modal_class'
552 , array(
553 'type' => 'text'
554 , 'title' => __( 'Popup CSS class', 'booking' )
555 , 'description' => __( 'Optional CSS class for the popup modal.', 'booking' )
556 , 'description_tag' => 'span'
557 , 'placeholder' => ''
558 , 'class' => ''
559 , 'css' => ''
560 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_booking_popup'
561 , 'attr' => array()
562 , 'group' => $group_key
563 , 'only_field' => false
564 , 'value' => ''
565 )
566 );
567
568 WPBC_Settings_API::field_select_row_static( $id . '_size'
569 , array(
570 'type' => 'select'
571 , 'title' => __( 'Popup size', 'booking' )
572 , 'description' => __( 'Select the popup window size.', 'booking' )
573 , 'description_tag' => 'span'
574 , 'label' => ''
575 , 'multiple' => false
576 , 'group' => $group_key
577 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_booking_popup'
578 , 'class' => ''
579 , 'css' => 'margin-right:10px;'
580 , 'only_field' => false
581 , 'attr' => array()
582 , 'value' => 'lg'
583 , 'options' => array(
584 'lg' => __( 'Large', 'booking' ),
585 'default' => __( 'Default', 'booking' ),
586 'sm' => __( 'Small', 'booking' ),
587 )
588 )
589 );
590 }
591
592 /**
593 * Shortcode Fields: Start Month
594 *
595 * @param $id
596 * @param $group_key
597 *
598 * @return void
599 */
600 function wpbc_shortcode_config_fields__start_month( $id , $group_key ){
601
602 ////////////////////////////////////////////////////////////////////
603 // Start Month
604 ////////////////////////////////////////////////////////////////////
605 ?><tr valign="top" class="<?php echo esc_attr( $group_key . '_standard_section' ); ?>">
606 <th scope="row" style="vertical-align: middle;"><label for="<?php echo esc_attr( $id ); ?>_active" class="wpbc-form-text"><?php esc_html_e('Start month:', 'booking'); ?></label></th>
607 <td class=""><fieldset><?php
608
609 WPBC_Settings_API::field_checkbox_row_static( $id . '_active'
610 , array(
611 'type' => 'checkbox'
612 , 'title' => ''
613 , 'description' => ''
614 , 'description_tag' => 'span'
615 , 'label' => ''
616 , 'class' => ''
617 , 'css' => ''
618 , 'tr_class' => ''
619 , 'attr' => array()
620 , 'group' => $group_key
621 , 'only_field' => true
622 , 'is_new_line' => false
623 , 'value' => false
624 )
625 );
626
627 WPBC_Settings_API::field_select_row_static( $id . '_year'
628 , array(
629 'type' => 'select'
630 , 'title' => ''
631 , 'description' => ''
632 , 'description_tag' => 'span'
633 , 'label' => ''
634 , 'multiple' => false
635 , 'group' => $group_key
636 , 'class' => ''
637 , 'css' => 'width:5em;'
638 , 'only_field' => true
639 , 'attr' => array()
640 , 'value' => gmdate( 'Y' )
641 , 'options' => array_combine( range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ), range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ) )
642 )
643 );
644 ?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> / </span><?php
645
646 WPBC_Settings_API::field_select_row_static( $id . '_month'
647 , array(
648 'type' => 'select'
649 , 'title' => ''
650 , 'description' => ''
651 , 'description_tag' => 'span'
652 , 'label' => ''
653 , 'multiple' => false
654 , 'group' => $group_key
655 , 'class' => ''
656 , 'css' => 'width:4em;'
657 , 'only_field' => true
658 , 'attr' => array()
659 , 'value' => gmdate('n')
660 , 'options' => array_combine( range( 1, 12 ), range( 1, 12 ) )
661 )
662 );
663
664 ?><span class="description"> <?php esc_html_e('Select start month of calendar' ,'booking'); ?></span></fieldset></td>
665 </tr><?php
666
667 }
668
669
670 /**
671 * Shortcode Fields: Start Dates
672 *
673 * @param $id
674 * @param $group_key
675 *
676 * @return void
677 */
678 function wpbc_shortcode_config_fields__calendar_dates_start( $id , $group_key ){
679
680 ?><tr valign="top" class="<?php echo esc_attr( $group_key . '_standard_section' ); ?>">
681 <th scope="row" style="vertical-align: middle;"><label for="<?php echo esc_attr( $id ); ?>_active" class="wpbc-form-text"><?php
682 esc_html_e('Start dates', 'booking'); ?></label></th>
683 <td class=""><fieldset><?php
684
685 WPBC_Settings_API::field_checkbox_row_static( $id . '_active'
686 , array(
687 'type' => 'checkbox'
688 , 'title' => ''
689 , 'description' => ''
690 , 'description_tag' => 'span'
691 , 'label' => ''
692 , 'class' => ''
693 , 'css' => ''
694 , 'tr_class' => ''
695 , 'attr' => array()
696 , 'group' => $group_key
697 , 'only_field' => true
698 , 'is_new_line' => false
699 , 'value' => false
700 )
701 );
702
703 WPBC_Settings_API::field_select_row_static( $id . '_year'
704 , array(
705 'type' => 'select'
706 , 'title' => ''
707 , 'description' => ''
708 , 'description_tag' => 'span'
709 , 'label' => ''
710 , 'multiple' => false
711 , 'group' => $group_key
712 , 'class' => ''
713 , 'css' => 'width:5em;'
714 , 'only_field' => true
715 , 'attr' => array()
716 , 'value' => gmdate( 'Y' )
717 , 'options' => array_combine( range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ), range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ) )
718 )
719 );
720
721 ?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> / </span><?php
722
723 WPBC_Settings_API::field_select_row_static( $id . '_month'
724 , array(
725 'type' => 'select'
726 , 'title' => ''
727 , 'description' => ''
728 , 'description_tag' => 'span'
729 , 'label' => ''
730 , 'multiple' => false
731 , 'group' => $group_key
732 , 'class' => ''
733 , 'css' => 'width:4em;'
734 , 'only_field' => true
735 , 'attr' => array()
736 , 'value' => gmdate('m')
737 , 'options' => array_combine(
738 array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 12 ) ),
739 array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 12 ) )
740 )
741 )
742 );
743
744
745 ?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> / </span><?php
746
747 WPBC_Settings_API::field_select_row_static( $id . '_date'
748 , array(
749 'type' => 'select'
750 , 'title' => ''
751 , 'description' => ''
752 , 'description_tag' => 'span'
753 , 'label' => ''
754 , 'multiple' => false
755 , 'group' => $group_key
756 , 'class' => ''
757 , 'css' => 'width:4em;'
758 , 'only_field' => true
759 , 'attr' => array()
760 , 'value' => gmdate('d')
761 , 'options' => array_combine(
762 array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 31 ) ),
763 array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 31 ) )
764 )
765
766 )
767 );
768
769 ?><span class="description"> <?php esc_html_e('Earliest date visible/selectable in the calendar.' ,'booking'); ?></span></fieldset></td>
770 </tr><?php
771 }
772
773
774 /**
775 * Shortcode Fields: End Dates
776 *
777 * @param $id
778 * @param $group_key
779 *
780 * @return void
781 */
782 function wpbc_shortcode_config_fields__calendar_dates_end( $id , $group_key ){
783
784 ?><tr valign="top" class="<?php echo esc_attr( $group_key . '_standard_section' ); ?>">
785 <th scope="row" style="vertical-align: middle;"><label for="<?php echo esc_attr( $id ); ?>_active" class="wpbc-form-text"><?php
786 esc_html_e('End dates', 'booking'); ?></label></th>
787 <td class=""><fieldset><?php
788
789 WPBC_Settings_API::field_checkbox_row_static( $id . '_active'
790 , array(
791 'type' => 'checkbox'
792 , 'title' => ''
793 , 'description' => ''
794 , 'description_tag' => 'span'
795 , 'label' => ''
796 , 'class' => ''
797 , 'css' => ''
798 , 'tr_class' => ''
799 , 'attr' => array()
800 , 'group' => $group_key
801 , 'only_field' => true
802 , 'is_new_line' => false
803 , 'value' => false
804 )
805 );
806
807 WPBC_Settings_API::field_select_row_static( $id . '_year'
808 , array(
809 'type' => 'select'
810 , 'title' => ''
811 , 'description' => ''
812 , 'description_tag' => 'span'
813 , 'label' => ''
814 , 'multiple' => false
815 , 'group' => $group_key
816 , 'class' => ''
817 , 'css' => 'width:5em;'
818 , 'only_field' => true
819 , 'attr' => array()
820 , 'value' => intval( gmdate( 'Y' ) ) + 2
821 , 'options' => array_combine( range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ), range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ) )
822 )
823 );
824
825 ?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> / </span><?php
826
827 WPBC_Settings_API::field_select_row_static( $id . '_month'
828 , array(
829 'type' => 'select'
830 , 'title' => ''
831 , 'description' => ''
832 , 'description_tag' => 'span'
833 , 'label' => ''
834 , 'multiple' => false
835 , 'group' => $group_key
836 , 'class' => ''
837 , 'css' => 'width:4em;'
838 , 'only_field' => true
839 , 'attr' => array()
840 , 'value' => gmdate('m')
841 , 'options' => array_combine(
842 array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 12 ) ),
843 array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 12 ) )
844 )
845
846 )
847 );
848
849
850 ?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> / </span><?php
851
852 WPBC_Settings_API::field_select_row_static( $id . '_date'
853 , array(
854 'type' => 'select'
855 , 'title' => ''
856 , 'description' => ''
857 , 'description_tag' => 'span'
858 , 'label' => ''
859 , 'multiple' => false
860 , 'group' => $group_key
861 , 'class' => ''
862 , 'css' => 'width:4em;'
863 , 'only_field' => true
864 , 'attr' => array()
865 , 'value' => gmdate('d')
866 , 'options' => array_combine(
867 array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 31 ) ),
868 array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 31 ) )
869 )
870
871 )
872 );
873
874 ?><span class="description"> <?php esc_html_e('Latest date visible/selectable in the calendar.' ,'booking'); ?></span></fieldset></td>
875 </tr><?php
876 }
877
878
879
880 /**
881 * Shortcode Fields: AGGREGATE
882 *
883 * @param $id
884 * @param $group_key
885 *
886 * @return void
887 */
888 function wpbc_shortcode_config_fields__aggregate( $id , $group_key ){
889
890 //--------------------------------------------------------------------------------------------------------------
891 // 'Upgrade to Pro' widget
892 //--------------------------------------------------------------------------------------------------------------
893 $upgrade_content_arr = wpbc_get_upgrade_widget( array(
894 'id' => 'widget_wpbc_dismiss__booking_param_aggregate',
895 'dismiss_css_class' => '.wpbc_dismiss__booking_param_aggregate',
896 'blured_in_versions' => array( 'free' ),
897 'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#booking-resources' ),
898 'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ),
899 'versions' => 'paid versions',
900 'css' => 'transform: translate(0) translateY(180px);'
901 ) );
902 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
903 echo $upgrade_content_arr['content'];
904
905 //--------------------------------------------------------------------------------------------------------------
906 // Real Content
907 //--------------------------------------------------------------------------------------------------------------
908
909 $resources_list = array();
910 if ( class_exists( 'wpdev_bk_personal' ) ){
911 $resources_list_orig = wpbc_get_all_booking_resources_list();
912
913 $resources_list[0] = array( 'title' => __('None', 'booking' ), 'attr' => array ( 'class' => 'wpbc_single_resource', 'style' => 'border-bottom:1px dashed #ddd;') );
914 foreach ($resources_list_orig as $res_id => $res_val) {
915 $resources_list[$res_id] = $res_val;
916 }
917 }
918
919 ?>
920 <div class="clear"></div>
921 <div class="wpbc-settings-notice0 notice-info notice-header" style="font-size: 15px;font-weight: 600;margin: 15px 0 15px 15px;">
922 <label for="<?php echo esc_attr($id); ?>"><?php esc_html_e( 'Aggregate booking dates from other resources', 'booking' ); ?></label>
923 </div>
924
925 <div class="wpbc_shortcode_config__rules_container wpbc_dismiss__booking_param_aggregate <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>">
926 <div class="wpbc_shortcode_config__rules__params_section wpbc_aggregate">
927
928 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
929 <div class="ui_container ui_container_mini">
930 <div class="ui_group">
931 <div class="ui_element wpdevelop"><?php
932
933 WPBC_Settings_API::field_select_row_static( $id //. '__aggregate'
934 , array(
935 'type' => 'select'
936 , 'title' => __('Aggregate booking dates from other resources', 'booking')
937 , 'description' => ''//__( 'Select booking resources, for getting booking dates from them and set such dates as unavailable in destination calendar.', 'booking' )
938 , 'description_tag' => 'span'
939 , 'label' => ''
940 , 'multiple' => true
941 , 'group' => $group_key
942 , 'tr_class' => ''//$group_key . '_advanced_section'
943 , 'class' => 'wpbc_ui_control wpbc_ui_select'
944 , 'css' => 'margin-right:10px;height:20em;min-width:15em;'
945 , 'only_field' => true
946 , 'attr' => array()
947 , 'value' => '0'
948 , 'options' => $resources_list
949 )
950 );
951
952
953
954 ?></div>
955 </div>
956 </div>
957 </div>
958 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
959 <div class="ui_container ui_container_mini ui_container_weekdays">
960 <div class="ui_group ui_group_weekdays_checkboxes">
961 <div class="ui_element"><?php
962
963 WPBC_Settings_API::field_checkbox_row_static( $id . '__bookings_only'
964 , array(
965 'type' => 'checkbox'
966 , 'title' => ''
967 , 'description' => ''
968 , 'description_tag' => 'span'
969 , 'label' => __( 'Aggregate only bookings', 'booking' )
970 , 'class' => ''
971 , 'css' => ''
972 , 'tr_class' => ''
973 , 'attr' => array()
974 , 'group' => $group_key
975 , 'only_field' => true
976 , 'is_new_line' => false
977 , 'value' => false //// FixIn: 10.0.0.6.
978 )
979 );
980 ?></div>
981 </div>
982 </div>
983 </div>
984 </div>
985 <div class="wpbc_shortcode_config__rules__help_section" style="margin-top: 8px;">
986 <div class="wpbc-settings-notice notice-info notice-list">
987 <ol>
988 <li>
989 <?php esc_html_e( "Show dates as booked in the current calendar if such dates are unavailable in one of the selected resources.", 'booking' ); ?>
990 </li>
991 <li>
992 <?php
993 echo esc_html__( 'To set this up, select one or multiple booking resources in the multi-select box.', 'booking' )
994 . '<br>'
995 . esc_html__( 'Hold down the Ctrl button to make multiple selections.', 'booking' );
996
997 echo ' <strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>'
998 . '<code>[booking resource_id=1 aggregate=\'3;5;9\']</code>';
999 ?>
1000
1001 </li>
1002
1003 <li>
1004 <?php
1005 /* translators: 1: ... */
1006 echo wp_kses_post( sprintf( __( 'Enable %1$sAggregate only bookings%2$s option to aggregate only bookings without including unavailable dates from the %3$s page.', 'booking' )
1007 , '<strong>', '</strong>'
1008 , '<strong>Booking > Availability > Days Availability</strong>'
1009 ) );
1010 ?>
1011
1012 <?php
1013 echo ' <strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>'
1014 , '<code>[booking resource_id=1 aggregate=\'3;5;9\' options=\'{aggregate type=bookings_only}\']</code>';
1015
1016 ?>
1017 </li>
1018 <li>
1019 <?php
1020 /* translators: 1: ... */
1021 echo wp_kses_post( sprintf( __( 'Check the FAQ for details on %1$sshortcode configuration%2$s, especially this %3$soption%4$s.' , 'booking' )
1022 , '<a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/" target="_blank">', '</a>'
1023 , '<strong><a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/#booking-options-start-day-condition" target="_blank">', '</a></strong>' ) );
1024 ?>
1025 </li>
1026 </ol>
1027 </div>
1028 </div>
1029 </div><?php
1030
1031
1032 }
1033
1034
1035
1036 // -----------------------------------------------------------------------------------------------------------------
1037
1038
1039 function wpbc_shortcode_config_fields__dates_conditions_toolbar(){
1040
1041 ?><div class="clear"></div><?php
1042 ?><div class="wpdevelop wpdvlp-nav-tabs-container wpbc_shortcode_config_fields__dates_conditions_toolbar"><?php
1043
1044 $js = "jQuery(this).parents( '.wpbc_shortcode_config_fields__dates_conditions_toolbar' ).find( '.nav-tab' ).removeClass('wpdevelop-submenu-tab-selected');
1045 jQuery(this).addClass('wpdevelop-submenu-tab-selected');
1046 jQuery('.nav-tab i.icon-white').removeClass('icon-white');
1047 jQuery('.nav-tab-active i').addClass('icon-white');
1048 jQuery(this).parents('.wpbc_sc_container__shortcode_section').find('.wpbc_sc_container__shortcode_subsection').hide();
1049 jQuery(this).parents('.wpbc_sc_container__shortcode_section')";
1050
1051 wpbc_bs_toolbar_sub_html_container_start();
1052
1053 ?><a class="nav-tab wpdevelop-submenu-tab tooltip_top wpdevelop-submenu-tab-selected wpbc_dismiss__conditional_days"
1054 onclick="javascript:<?php
1055 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1056 echo $js; ?>.find('.wpbc_sc_container__shortcode_subsection__weekdays_conditions').show();" href="javascript:void(0)"
1057 ><span class="nav-tab-text"><i class="menu_icon icon-1x wpbc-bi-calendar2-week"></i>&nbsp;&nbsp;<?php
1058 esc_html_e( 'Weekdays Conditions', 'booking' );
1059 ?></span></a><?php
1060
1061 ?><a class="nav-tab wpdevelop-submenu-tab tooltip_top wpbc_dismiss__conditional_days"
1062 onclick="javascript:<?php
1063 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1064 echo $js; ?>.find('.wpbc_sc_container__shortcode_subsection__seasons_conditions').show();" href="javascript:void(0)"
1065 ><span class="nav-tab-text"><i class="menu_icon icon-1x wpbc-bi-calendar2-month"></i>&nbsp;&nbsp;<?php
1066 esc_html_e( 'Seasons Conditions', 'booking' );
1067 ?></span></a><?php
1068
1069 ?><a class="nav-tab wpdevelop-submenu-tab tooltip_top wpbc_dismiss__conditional_days"
1070 onclick="javascript:<?php
1071 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1072 echo $js; ?>.find('.wpbc_sc_container__shortcode_subsection__startseason_conditions').show();" href="javascript:void(0)"
1073 ><span class="nav-tab-text"><i class="menu_icon icon-1x wpbc-bi-calendar2-day"></i>&nbsp;&nbsp;<?php
1074 esc_html_e( 'Start selection at Seasons', 'booking' );
1075 ?></span></a><?php
1076
1077 ?><a class="nav-tab wpdevelop-submenu-tab tooltip_top wpbc_dismiss__conditional_days"
1078 onclick="javascript:<?php
1079 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1080 echo $js; ?>.find('.wpbc_sc_container__shortcode_subsection__dates_conditions').show();" href="javascript:void(0)"
1081 ><span class="nav-tab-text"><i class="menu_icon icon-1x wpbc-bi-calendar2-date"></i>&nbsp;&nbsp;<?php
1082 esc_html_e( 'Dates selection Conditions', 'booking' );
1083 ?></span></a><?php
1084
1085 wpbc_bs_toolbar_sub_html_container_end();
1086
1087 ?>
1088 </div><?php
1089 }
1090
1091
1092 /**
1093 * Week Days - Condition fields for 'option' parameter.
1094 *
1095 * @param $id
1096 * @param $group_key
1097 *
1098 * @return void
1099 */
1100 function wpbc_shortcode_config_fields__weekdays_conditions( $id , $group_key ){
1101
1102 //--------------------------------------------------------------------------------------------------------------
1103 // 'Upgrade to Pro' widget
1104 //--------------------------------------------------------------------------------------------------------------
1105 $upgrade_content_arr = wpbc_get_upgrade_widget( array(
1106 'id' => $id . '_' . 'conditional_days_weekdays',
1107 'dismiss_css_class' => '.wpbc_dismiss__conditional_days',
1108 'blured_in_versions' => array( 'free', 'ps', 'bs' ),
1109 'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#advanced-days-selection' ),
1110 'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ),
1111 'versions' => 'Business Medium / Large, MultiUser versions',
1112 'css' => 'transform: translate(0) translateY(120px);'
1113 ) );
1114 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1115 echo $upgrade_content_arr['content'];
1116
1117 //--------------------------------------------------------------------------------------------------------------
1118 // Conditions for Weekdays selection
1119 //--------------------------------------------------------------------------------------------------------------
1120 ?><div class="wpbc_shortcode_config__rules_container wpbc_dismiss__conditional_days <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>">
1121
1122 <div class="wpbc_shortcode_config__rules__params_section wpbc_select_day_weekday">
1123
1124 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
1125 <div class="ui_container ui_container_mini ui_container_weekdays">
1126 <?php
1127
1128 $week_days_arr = array(
1129 1 => __( 'Mo', 'booking' )
1130 , 2 => __( 'Tu', 'booking' )
1131 , 3 => __( 'We', 'booking' )
1132 , 4 => __( 'Th', 'booking' )
1133 , 5 => __( 'Fr', 'booking' )
1134 , 6 => __( 'Sa', 'booking' )
1135 , 0 => __( 'Su', 'booking' )
1136 );
1137 foreach ( $week_days_arr as $weekday_key => $weekday_title ) {
1138
1139 ?><div class="ui_group ui_group_weekdays_checkboxes"><?php
1140
1141 ?><div class="ui_element"><?php
1142
1143 WPBC_Settings_API::field_checkbox_row_static( $id . '__weekday_' . $weekday_key
1144 , array(
1145 'type' => 'checkbox'
1146 , 'title' => ''
1147 , 'description' => ''
1148 , 'description_tag' => 'span'
1149 , 'label' => $weekday_title
1150 , 'class' => ''
1151 , 'css' => ''
1152 , 'tr_class' => ''
1153 , 'attr' => array()
1154 , 'group' => $group_key
1155 , 'only_field' => true
1156 , 'is_new_line' => false
1157 , 'value' => false
1158 )
1159 );
1160
1161 ?></div>
1162 <div class="ui_element"><?php
1163
1164 $placeholder = '';
1165 switch ( $weekday_key ) {
1166 case 0: $placeholder = '1-7'; break;
1167 case 1: $placeholder = '5,7'; break;
1168 case 2: $placeholder = '3,4'; break;
1169 case 3: $placeholder = '5'; break;
1170 case 4: $placeholder = '4'; break;
1171 case 5: $placeholder = '3'; break;
1172 case 6: $placeholder = '2-7'; break;
1173 }
1174
1175 WPBC_Settings_API::field_text_row_static( $id . '__days_number_' . $weekday_key
1176 , array(
1177 'type' => 'text'
1178 , 'placeholder' => $placeholder
1179 , 'class' => 'wpbc_dates_conditions_value_weekday'
1180 , 'css' => ''
1181 , 'only_field' => true
1182 , 'attr' => array()
1183 , 'value' => ''
1184 )
1185 );
1186
1187 ?></div>
1188 <div class="ui_element"><?php
1189 ?><div class="wpbc_ui_control" style="line-height: 2;"><?php esc_html_e('days to select' ,'booking'); ?></div><?php
1190 ?></div><?php
1191
1192 ?></div><?php
1193 }
1194
1195 ?>
1196 </div>
1197 </div>
1198
1199 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
1200 <div class="ui_container ui_container_mini">
1201 <div class="ui_group"><?php
1202
1203 ?><div class="ui_element">
1204 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_weekday__add('<?php echo esc_attr( $id ); ?>');" class="button button-primary"><?php esc_html_e( 'Set Rule', 'booking' ); ?></a>
1205 </div><?php
1206 ?><div class="ui_element">
1207 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_weekday__reset('<?php echo esc_attr( $id ); ?>');"
1208 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger" ><?php esc_html_e('Reset','booking'); ?></a>
1209 </div><?php
1210
1211 ?>
1212 </div>
1213 </div>
1214 </div>
1215
1216 </div>
1217
1218 <div class="wpbc_shortcode_config__rules__help_section">
1219 <div class="wpbc-settings-notice notice-info notice-header">
1220 <span><?php esc_html_e( 'Specify the number of days to select when starting the selection on a specific weekday.', 'booking' ); ?></span>
1221 </div>
1222 <div class="wpbc-settings-notice notice-info notice-list">
1223 <ol>
1224 <li>
1225 <?php esc_html_e( "For example, a visitor can choose to book only 5 or 7 days starting on Monday, or any number from 2 to 7 days starting on Saturday, and so forth. To configure this, check the 'Monday' box and set the number of days to select as '5,7'. Then, check the 'Saturday' box and set the number of days to select as '2-7'. Finally, click the 'Set Rule' button.", 'booking' ); ?>
1226 </li>
1227 <li>
1228 <?php
1229 echo '<strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>'
1230 . '<code>{select-day condition="weekday" for="1" value="5,7"},{select-day condition="weekday" for="6" value="2-7"}</code>';
1231 ?>
1232 </li>
1233 <li>
1234 <?php
1235 /* translators: 1: ... */
1236 echo wp_kses_post( sprintf( __( 'Check the FAQ for details on %1$sshortcode configuration%2$s, especially this %3$soption%4$s.' , 'booking' )
1237 , '<a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/" target="_blank">', '</a>'
1238 , '<strong><a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/#booking-options-condition" target="_blank">', '</a></strong>' ) );
1239 ?>
1240 </li>
1241 <li>
1242 <?php
1243 /* translators: 1: ... */
1244 echo wp_kses_post( sprintf( __( 'Explore %1$sJavaScript customization%2$s for advanced different day selection in different calendars.', 'booking' )
1245 , '<a href="https://wpbookingcalendar.com/faq/advanced-javascript-for-the-booking-shortcodes/" target="_blank">','</a>') );
1246 ?>
1247 </li>
1248 </ol>
1249 </div>
1250 <textarea id="<?php echo esc_attr( $id ); ?>_textarea" name="<?php echo esc_attr( $id ); ?>_textarea" style="width:100%;margin-top:15px;"></textarea>
1251 </div>
1252 </div><?php
1253
1254 }
1255
1256
1257 /**
1258 * Season Days Selection - Condition fields for 'option' parameter.
1259 *
1260 * @param $id
1261 * @param $group_key
1262 *
1263 * @return void
1264 */
1265 function wpbc_shortcode_config_fields__season_conditions( $id, $group_key ) {
1266
1267 //--------------------------------------------------------------------------------------------------------------
1268 // 'Upgrade to Pro' widget
1269 //--------------------------------------------------------------------------------------------------------------
1270 $upgrade_content_arr = wpbc_get_upgrade_widget( array(
1271 'id' => $id . '_' . 'conditional_days_seasons',
1272 'dismiss_css_class' => '.wpbc_dismiss__conditional_days',
1273 'blured_in_versions' => array( 'free', 'ps', 'bs' ),
1274 'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#advanced-days-selection' ),
1275 'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ),
1276 'versions' => 'Business Medium / Large, MultiUser versions',
1277 'css' => 'transform: translate(0) translateY(120px);'
1278 ) );
1279 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1280 echo $upgrade_content_arr['content'];
1281
1282 //--------------------------------------------------------------------------------------------------------------
1283 // Conditions for Seasons days selection
1284 //--------------------------------------------------------------------------------------------------------------
1285
1286 $options = wpbc_shortcode_config_fields__get_options_for_seasons();
1287
1288 ?><div class="wpbc_shortcode_config__rules_container wpbc_dismiss__conditional_days <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>">
1289 <div class="wpbc_shortcode_config__rules__params_section wpbc_select_day_season">
1290
1291 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
1292 <div class="ui_container ui_container_mini">
1293 <div class="ui_group">
1294
1295 <div class="ui_element">
1296 <div class="wpbc_ui_control" style="line-height: 2;">
1297 <span><?php esc_html_e('In season' ,'booking'); ?></span>
1298 </div>
1299 </div>
1300
1301 <div class="ui_element wpdevelop"><?php
1302 WPBC_Settings_API::field_select_row_static( $id . '__season_filter_name'
1303 , array(
1304 'type' => 'select'
1305 , 'title' => ''
1306 , 'label' => ''
1307 , 'disabled' => false
1308 , 'disabled_options' => array()
1309 , 'multiple' => false
1310 , 'description' => ''
1311 , 'description_tag' => 'span'
1312 , 'group' => $group_key
1313 , 'tr_class' => ''
1314 , 'class' => 'wpbc_ui_control wpbc_ui_select'
1315 , 'css' => 'max-width: Min(14em, 100%);flex: 0 1 auto;width: 14em;border-radius:3px 0 0 3px;'
1316 , 'only_field' => true
1317 , 'attr' => array()
1318 , 'value' => '0'
1319 , 'options' => $options
1320 )
1321 );
1322 ?><a href="<?php echo esc_url( wpbc_get_availability_url() . '' ); ?>"
1323 title="<?php echo esc_attr( __( 'Add new season', 'booking' ) ); ?>"
1324 class="wpbc_ui_control wpbc_ui_button tooltip_top" ><i class="menu_icon icon-1x wpbc_icn_add _circle_outline"></i></a><?php
1325 ?></div>
1326
1327 </div>
1328 </div>
1329
1330 <div class="ui_container ui_container_mini">
1331 <div class="ui_group">
1332
1333 <div class="ui_element">
1334 <div class="wpbc_ui_control " style="line-height: 2;"><?php esc_html_e('allow to select' ,'booking'); ?></div>
1335 </div>
1336
1337 <div class="ui_element"><?php
1338 WPBC_Settings_API::field_text_row_static( $id . '__days_number'
1339 , array(
1340 'type' => 'text'
1341 , 'placeholder' => '5 ' . __( 'or', 'booking' ) . ' 1-7 ' . __( 'or', 'booking' ) . ' 1,5,7'
1342 , 'class' => 'wpbc_ui_control wpbc_ui_text'
1343 , 'css' => 'width:9em;border-radius:3px;'
1344 , 'only_field' => true
1345 , 'attr' => array()
1346 , 'value' => ''
1347 )
1348 );
1349 ?></div>
1350
1351 <div class="ui_element">
1352 <div class="wpbc_ui_control" style="line-height: 2;"><?php esc_html_e('days' ,'booking'); ?></div>
1353 </div>
1354 </div>
1355 </div>
1356
1357 <div class="ui_container ui_container_mini">
1358 <div class="ui_group">
1359
1360 <div class="ui_element">
1361 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_season__add('<?php echo esc_attr( $id ); ?>');"
1362 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_primary" ><?php esc_html_e('Add Rule','booking'); ?></a>
1363 </div>
1364 <div class="ui_element">
1365 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_season__reset('<?php echo esc_attr( $id ); ?>');"
1366 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger" ><?php esc_html_e('Reset','booking'); ?></a>
1367 </div>
1368 </div>
1369 </div>
1370
1371 </div>
1372 </div>
1373 <div class="wpbc_shortcode_config__rules__help_section">
1374 <div class="wpbc-settings-notice notice-info notice-header">
1375 <span><?php esc_html_e( 'Specify the number of days to select when starting the selection in a specific season.', 'booking' ); ?></span>
1376 </div>
1377 <div class="wpbc-settings-notice notice-info notice-list">
1378 <ol>
1379 <li>
1380 <?php esc_html_e( "For example, a visitor can choose to book any number from 7 to 14 days or 21 days starting on 'High season', or any number from 2 to 5 days starting on 'Low season', and so forth. To configure this, select the 'High season' option in the dropdown menu and set the number of days to select as '7-14,21'. Click the 'Add Rule' button. Next, select the 'Low season' option in the dropdown menu and set the number of days to select as '2-5'. Click the 'Add Rule' button again.", 'booking' ); ?>
1381 </li>
1382 <li>
1383 <?php
1384 echo '<strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>'
1385 . '<code>{select-day condition="season" for="High season" value="7-14,21"},{select-day condition="season" for="Low season" value="2-5"}</code>';
1386 ?>
1387 </li>
1388 <li>
1389 <?php
1390 /* translators: 1: ... */
1391 echo wp_kses_post( sprintf( __( 'Check the FAQ for details on %1$sshortcode configuration%2$s, especially this %3$soption%4$s.' , 'booking' )
1392 , '<a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/" target="_blank">', '</a>'
1393 , '<strong><a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/#booking-options-condition-seasons" target="_blank">', '</a></strong>' ) );
1394 ?>
1395 </li>
1396 <li>
1397 <?php
1398 /* translators: 1: ... */
1399 echo wp_kses_post( sprintf( __( 'Explore %1$sJavaScript customization%2$s for advanced different day selection in different calendars.', 'booking' )
1400 , '<a href="https://wpbookingcalendar.com/faq/advanced-javascript-for-the-booking-shortcodes/" target="_blank">','</a>') );
1401 ?>
1402 </li>
1403 </ol>
1404 </div>
1405 <textarea id="<?php echo esc_attr( $id ); ?>_textarea" name="<?php echo esc_attr( $id ); ?>_textarea" style="width:100%;margin:10px 0;"></textarea>
1406 </div>
1407 </div><?php
1408
1409 }
1410
1411
1412 /**
1413 * Get Season Filters options - for selectbox in PopUp shortcode config
1414 *
1415 * @return array|array[]
1416 */
1417 function wpbc_shortcode_config_fields__get_options_for_seasons(){
1418
1419 if (function_exists('wpbc_sf_cache')) {
1420 // -----------------------------------------------------------------------------------------------------------------
1421 // Get Season Filters data:
1422 // -----------------------------------------------------------------------------------------------------------------
1423 $wpbc_sf_cache = wpbc_sf_cache();
1424 /**
1425 * $wpbc_sf_cache->get_data() = [
1426 * 1 => [
1427 * booking_filter_id = "1"
1428 * title = "Weekend"
1429 * filter = "a:4:{s:8:"weekdays";a:7..."
1430 * users = "1"
1431 * id = "1"
1432 */
1433 $season_filter_arr = $wpbc_sf_cache->get_data();
1434 } else {
1435 $season_filter_arr = array();
1436 }
1437 // $wpbc_br_cache = wpbc_br_cache();
1438 /*
1439 $wpbc_br_cache->get_resources() = [
1440 1 = [
1441 booking_type_id = "1"
1442 title = "Standard"
1443 users = "1"
1444 import = null
1445 export = "/ics/wpbm.ics"
1446 cost = "25"
1447 default_form = "standard"
1448 prioritet = "1"
1449 parent = "0"
1450 visitors = "2"
1451 id = "1"
1452 count = {int} 5
1453 7 = [...
1454 */
1455 $current_user_id = wpbc_get_current_user_id();
1456
1457 $options = array(
1458 0 => array(
1459 'title' => ' - ' . __( 'Please Select', 'booking' ) . ' - ',
1460 'attr' => array( 'style' => 'color:#999;font-weight: 400;' )
1461 )
1462 );
1463 foreach ( $season_filter_arr as $filter_id => $filter_arr ) {
1464
1465 $options[ $filter_arr['id'] ] = $filter_arr;
1466
1467 // MultiUser functionality for regular users showing season filters.
1468 if ( ( class_exists( 'wpdev_bk_multiuser' ) ) && ( ! empty( $filter_arr['users'] ) ) ) {
1469
1470 // Is current user suer booking admin and if this user was simulated log in
1471 $season_user_id = intval( $filter_arr['users'] );
1472 $is_user_super_admin = apply_bk_filter( 'is_user_super_admin', $season_user_id );
1473
1474 if ( ( ! $is_user_super_admin ) && ( $current_user_id != $season_user_id ) ) {
1475 $options[ $filter_arr['id'] ]['attr'] = array( 'style' => 'color:#a43232;font-weight: 400;font-style: italic;' );
1476 $user_name = get_userdata( $season_user_id );
1477 $user_name = $user_name->display_name;
1478 $options[ $filter_arr['id'] ]['title'] .= ' &nbsp; (' . __( 'Regular User', 'booking' ) . ': ' . $user_name . ')';
1479 }
1480 }
1481 }
1482
1483 return $options;
1484
1485 }
1486
1487
1488 /**
1489 * Season Days Start Day - Condition fields for 'option' parameter.
1490 *
1491 * @param $id
1492 * @param $group_key
1493 *
1494 * @return void
1495 */
1496 function wpbc_shortcode_config_fields__season_start_day_conditions( $id, $group_key ) {
1497
1498 //--------------------------------------------------------------------------------------------------------------
1499 // 'Upgrade to Pro' widget
1500 //--------------------------------------------------------------------------------------------------------------
1501 $upgrade_content_arr = wpbc_get_upgrade_widget( array(
1502 'id' => $id . '_' . 'conditional_days_startday',
1503 'dismiss_css_class' => '.wpbc_dismiss__conditional_days',
1504 'blured_in_versions' => array( 'free', 'ps', 'bs' ),
1505 'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#advanced-days-selection' ),
1506 'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ),
1507 'versions' => 'Business Medium / Large, MultiUser versions',
1508 'css' => 'transform: translate(0) translateY(120px);'
1509 ) );
1510 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1511 echo $upgrade_content_arr['content'];
1512
1513 //--------------------------------------------------------------------------------------------------------------
1514 // Conditions for Seasons days START selection
1515 //--------------------------------------------------------------------------------------------------------------
1516
1517 $options = wpbc_shortcode_config_fields__get_options_for_seasons();
1518
1519 ?><div class="wpbc_shortcode_config__rules_container wpbc_dismiss__conditional_days <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>">
1520 <div class="wpbc_shortcode_config__rules__params_section wpbc_start_day_season">
1521
1522 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
1523 <div class="ui_container ui_container_mini">
1524 <div class="ui_group">
1525 <div class="ui_element">
1526 <div class="wpbc_ui_control" style="line-height: 2;">
1527 <span><?php esc_html_e('In season' ,'booking'); ?></span>
1528 </div>
1529 </div>
1530 <div class="ui_element wpdevelop"><?php
1531
1532 WPBC_Settings_API::field_select_row_static( $id . '__season_filter_name'
1533 , array(
1534 'type' => 'select'
1535 , 'title' => ''
1536 , 'label' => ''
1537 , 'disabled' => false
1538 , 'disabled_options' => array()
1539 , 'multiple' => false
1540 , 'description' => ''
1541 , 'description_tag' => 'span'
1542 , 'group' => $group_key
1543 , 'tr_class' => ''
1544 , 'class' => 'wpbc_ui_control wpbc_ui_select'
1545 , 'css' => 'max-width: Min(14em, 100%);flex: 0 1 auto;width: 14em;border-radius:3px 0 0 3px;'
1546 , 'only_field' => true
1547 , 'attr' => array()
1548 , 'value' => '0'
1549 , 'options' => $options
1550 )
1551 );
1552
1553 ?><a href="<?php echo esc_url( wpbc_get_availability_url() . '' ); ?>"
1554 title="<?php echo esc_attr( __( 'Add new season', 'booking' ) ); ?>"
1555 class="wpbc_ui_control wpbc_ui_button tooltip_top" ><i class="menu_icon icon-1x wpbc_icn_add _circle_outline"></i></a><?php
1556
1557 ?></div>
1558 </div>
1559 </div>
1560 </div>
1561 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
1562 <div class="ui_container ui_container_mini ui_container_weekdays">
1563 <div class="ui_group">
1564 <div class="ui_element">
1565 <div class="wpbc_ui_control " style="line-height: 2;"><?php
1566 esc_html_e('allow to start days selection only for these weekdays' ,'booking');
1567 ?></div>
1568 </div>
1569 </div>
1570 <div class="ui_group ui_group_weekdays_checkboxes"><?php
1571
1572 $week_days_arr = array(
1573 1 => __( 'Mo', 'booking' )
1574 , 2 => __( 'Tu', 'booking' )
1575 , 3 => __( 'We', 'booking' )
1576 , 4 => __( 'Th', 'booking' )
1577 , 5 => __( 'Fr', 'booking' )
1578 , 6 => __( 'Sa', 'booking' )
1579 , 0 => __( 'Su', 'booking' )
1580 );
1581 foreach ( $week_days_arr as $weekday_key => $weekday_title ) {
1582
1583 ?><div class="ui_element"><?php
1584
1585 WPBC_Settings_API::field_checkbox_row_static( $id . '__weekday_' . $weekday_key
1586 , array(
1587 'type' => 'checkbox'
1588 , 'title' => ''
1589 , 'description' => ''
1590 , 'description_tag' => 'span'
1591 , 'label' => $weekday_title
1592 , 'class' => ''
1593 , 'css' => ''
1594 , 'tr_class' => ''
1595 , 'attr' => array()
1596 , 'group' => $group_key
1597 , 'only_field' => true
1598 , 'is_new_line' => false
1599 , 'value' => false
1600 )
1601 );
1602 ?></div><?php
1603
1604 }
1605
1606 ?></div>
1607 </div>
1608 </div>
1609 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
1610 <div class="ui_container ui_container_mini">
1611 <div class="ui_group"><?php
1612
1613 ?><div class="ui_element">
1614 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__start_day_season__add('<?php echo esc_attr( $id ); ?>');"
1615 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_primary" ><?php esc_html_e('Add Rule','booking'); ?></a>
1616 </div><?php
1617 ?><div class="ui_element">
1618 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__start_day_season__reset('<?php echo esc_attr( $id ); ?>');"
1619 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger" ><?php esc_html_e('Reset','booking'); ?></a>
1620 </div><?php
1621
1622 ?>
1623 </div>
1624 </div>
1625 </div>
1626 </div>
1627 <div class="wpbc_shortcode_config__rules__help_section">
1628 <div class="wpbc-settings-notice notice-info notice-header">
1629 <span><?php esc_html_e( 'Specify the weekdays as start days for selection when starting the selection in a specific season.', 'booking' ); ?></span>
1630 </div>
1631 <div class="wpbc-settings-notice notice-info notice-list">
1632 <ol>
1633 <li>
1634 <?php esc_html_e( "For example, a visitor can starting days selection only on 'Sunday' or 'Friday' if select days on 'Low season'. To configure this, select the 'Low season' option in the dropdown menu and enable 'Sunday' and 'Friday' boxes. Click the 'Add Rule' button.", 'booking' ); ?>
1635 </li>
1636 <li>
1637 <?php
1638 echo '<strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>'
1639 . '<code>{start-day condition="season" for="Low season" value="0,5"}</code>';
1640 ?>
1641 </li>
1642 <li>
1643 <?php
1644 /* translators: 1: ... */
1645 echo wp_kses_post( sprintf( __( 'Check the FAQ for details on %1$sshortcode configuration%2$s, especially this %3$soption%4$s.' , 'booking' )
1646 , '<a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/" target="_blank">', '</a>'
1647 , '<strong><a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/#booking-options-start-day-condition" target="_blank">', '</a></strong>' ) );
1648 ?>
1649 </li>
1650 <li>
1651 <?php
1652 /* translators: 1: ... */
1653 echo wp_kses_post( sprintf( __( 'Explore %1$sJavaScript customization%2$s for advanced different day selection in different calendars.', 'booking' )
1654 , '<a href="https://wpbookingcalendar.com/faq/advanced-javascript-for-the-booking-shortcodes/" target="_blank">','</a>') );
1655 ?>
1656 </li>
1657 </ol>
1658 </div>
1659 <textarea id="<?php echo esc_attr( $id ); ?>_textarea" name="<?php echo esc_attr( $id ); ?>_textarea" style="width:100%;margin:10px 0;"></textarea>
1660 </div>
1661 </div><?php
1662
1663 }
1664
1665
1666
1667 /**
1668 * Dates Condition - Set Number of Days to Select, if start selection on specific date '2024-02-14'
1669 *
1670 * Config dialog for Booking Calendar shortcode
1671 *
1672 * @param $id
1673 * @param $group_key
1674 *
1675 * @return void
1676 */
1677 function wpbc_shortcode_config_fields__fordate_conditions( $id, $group_key ) {
1678
1679 //--------------------------------------------------------------------------------------------------------------
1680 // 'Upgrade to Pro' widget
1681 //--------------------------------------------------------------------------------------------------------------
1682 $upgrade_content_arr = wpbc_get_upgrade_widget( array(
1683 'id' => $id . '_' . 'conditional_days_fordate',
1684 'dismiss_css_class' => '.wpbc_dismiss__conditional_days',
1685 'blured_in_versions' => array( 'free', 'ps', 'bs' ),
1686 'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#advanced-days-selection' ),
1687 'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ),
1688 'versions' => 'Business Medium / Large, MultiUser versions',
1689 'css' => 'transform: translate(0) translateY(120px);'
1690 ) );
1691 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1692 echo $upgrade_content_arr['content'];
1693
1694 //--------------------------------------------------------------------------------------------------------------
1695 // Conditions for DATE selection
1696 //--------------------------------------------------------------------------------------------------------------
1697
1698 ?><div class="wpbc_shortcode_config__rules_container wpbc_dismiss__conditional_days <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>">
1699 <div class="wpbc_shortcode_config__rules__params_section wpbc_select_fordate">
1700
1701 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
1702 <div class="ui_container ui_container_mini">
1703 <div class="ui_group">
1704
1705 <div class="ui_element">
1706 <div class="wpbc_ui_control" style="line-height: 2;">
1707 <span><?php esc_html_e('For date' ,'booking'); ?></span>
1708 </div>
1709 </div>
1710
1711 <div class="ui_element wpdevelop"><?php
1712 WPBC_Settings_API::field_text_row_static( $id . '__date'
1713 , array(
1714 'type' => 'text'
1715 , 'placeholder' => '2024-02-14'
1716 , 'class' => 'wpbc_ui_control wpbc_ui_text'
1717 , 'css' => 'width:9em;border-radius:3px;'
1718 , 'only_field' => true
1719 , 'attr' => array()
1720 , 'value' => ''
1721 )
1722 );
1723 ?></div>
1724
1725 </div>
1726 </div>
1727
1728 <div class="ui_container ui_container_mini">
1729 <div class="ui_group">
1730
1731 <div class="ui_element">
1732 <div class="wpbc_ui_control " style="line-height: 2;"><?php esc_html_e('allow to select' ,'booking'); ?></div>
1733 </div>
1734
1735 <div class="ui_element"><?php
1736 WPBC_Settings_API::field_text_row_static( $id . '__days_number'
1737 , array(
1738 'type' => 'text'
1739 , 'placeholder' => '5 ' . __( 'or', 'booking' ) . ' 1-7 ' . __( 'or', 'booking' ) . ' 1,5,7'
1740 , 'class' => 'wpbc_ui_control wpbc_ui_text'
1741 , 'css' => 'width:9em;border-radius:3px;'
1742 , 'only_field' => true
1743 , 'attr' => array()
1744 , 'value' => ''
1745 )
1746 );
1747 ?></div>
1748
1749 <div class="ui_element">
1750 <div class="wpbc_ui_control" style="line-height: 2;"><?php esc_html_e('days' ,'booking'); ?></div>
1751 </div>
1752 </div>
1753 </div>
1754
1755 <div class="ui_container ui_container_mini">
1756 <div class="ui_group">
1757
1758 <div class="ui_element">
1759 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_fordate__add('<?php echo esc_attr( $id ); ?>');"
1760 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_primary" ><?php esc_html_e('Add Rule','booking'); ?></a>
1761 </div>
1762 <div class="ui_element">
1763 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_fordate__reset('<?php echo esc_attr( $id ); ?>');"
1764 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger" ><?php esc_html_e('Reset','booking'); ?></a>
1765 </div>
1766 </div>
1767 </div>
1768
1769 </div>
1770 </div>
1771 <div class="wpbc_shortcode_config__rules__help_section">
1772 <div class="wpbc-settings-notice notice-info notice-header">
1773 <span><?php esc_html_e( 'Specify the number of days to select when starting the selection on a specific date.', 'booking' ); ?></span>
1774 </div>
1775 <div class="wpbc-settings-notice notice-info notice-list">
1776 <ol>
1777 <li>
1778 <?php esc_html_e( "For example, a visitor can choose to book 7 or 14 days or 21 days starting on '2027-02-15'. To configure this, enter date in format 'YYYY-MM-DD' such as '2027-02-15' and set the number of days to select as '7,14,21'. Click the 'Add Rule' button.", 'booking' ); ?>
1779 </li>
1780 <li>
1781 <?php
1782 echo '<strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>'
1783 . '<code>{select-day condition="date" for="2027-02-15" value="7,14,21"}</code>';
1784 ?>
1785 </li>
1786 <li>
1787 <?php
1788 /* translators: 1: ... */
1789 echo wp_kses_post( sprintf( __( 'Check the FAQ for details on %1$sshortcode configuration%2$s, especially this %3$soption%4$s.' , 'booking' )
1790 , '<a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/" target="_blank">', '</a>'
1791 , '<strong><a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/#aggregate" target="_blank">', '</a></strong>' ) );
1792 ?>
1793 </li>
1794 <li>
1795 <?php
1796 /* translators: 1: ... */
1797 echo wp_kses_post( sprintf( __( 'Explore %1$sJavaScript customization%2$s for advanced different day selection in different calendars.', 'booking' )
1798 , '<a href="https://wpbookingcalendar.com/faq/advanced-javascript-for-the-booking-shortcodes/" target="_blank">','</a>') );
1799 ?>
1800 </li>
1801 </ol>
1802 </div>
1803 <textarea id="<?php echo esc_attr( $id ); ?>_textarea" name="<?php echo esc_attr( $id ); ?>_textarea" style="width:100%;margin:10px 0;"></textarea>
1804 </div>
1805 </div><?php
1806
1807 }
1808
1809