| 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__booking_appointment" class="wpbc_settings_navigation_item wpbc_navigation_top_border"> |
| 50 |
<a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_booking_appointment', 'booking_appointment' );" href="javascript:void(0);"> |
| 51 |
<span><?php esc_html_e( 'Appointment Booking', 'booking' ); ?></span> |
| 52 |
</a> |
| 53 |
</div> |
| 54 |
<div id="wpbc_shortcode_config__nav_tab__booking_resource_selector" class="wpbc_settings_navigation_item"> |
| 55 |
<a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_booking_resource_selector', 'booking_resource_selector' );" href="javascript:void(0);"> |
| 56 |
<span><?php esc_html_e( 'Booking Resource Selector', 'booking' ); ?></span> |
| 57 |
</a> |
| 58 |
</div> |
| 59 |
<div id="wpbc_shortcode_config__nav_tab__bookingselect" class="wpbc_settings_navigation_item wpbc_navigation_sub_item wpbc_dismiss__booking_select <?php echo ( ! class_exists( 'wpdev_bk_personal' ) ) ? ' wpbc_settings_navigation_item_disabled ' : ''; ?>"> |
| 60 |
<a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingselect', 'bookingselect' );" href="javascript:void(0);"> |
| 61 |
<span><?php esc_html_e( 'Booking Resources Dropdown', 'booking' ); ?></span><?php |
| 62 |
echo ( ! class_exists( 'wpdev_bk_personal' ) ) ? '<span class="wpbc_pro_label">Pro</span>' : ''; |
| 63 |
?> |
| 64 |
</a> |
| 65 |
</div> |
| 66 |
<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 ' : ''; ?>"> |
| 67 |
<a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingform', 'bookingform' );" href="javascript:void(0);"> |
| 68 |
<span><?php esc_html_e( 'Only Form', 'booking' ) ?></span><?php |
| 69 |
if ( ! class_exists( 'wpdev_bk_personal' ) ){ |
| 70 |
echo '<span class="wpbc_pro_label">Pro</span>'; |
| 71 |
} else{ |
| 72 |
echo ( ! class_exists( 'wpdev_bk_biz_l' ) ) ? '<span class="wpbc_pro_label">BL</span>' : ''; |
| 73 |
} |
| 74 |
?> |
| 75 |
</a> |
| 76 |
</div> |
| 77 |
<div id="wpbc_shortcode_config__nav_tab__bookingtimeline" class="wpbc_settings_navigation_item wpbc_navigation_top_border"> |
| 78 |
<a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingtimeline', 'bookingtimeline' );" href="javascript:void(0);"> |
| 79 |
<span><?php esc_html_e( 'TimeLine', 'booking' ); ?></span> |
| 80 |
</a> |
| 81 |
</div> |
| 82 |
<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 ' : ''; ?>"> |
| 83 |
<a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingsearch', 'bookingsearch' );" href="javascript:void(0);"> |
| 84 |
<span><?php esc_html_e( 'Search Availability', 'booking' ) ?></span><?php |
| 85 |
if ( ! class_exists( 'wpdev_bk_personal' ) ){ |
| 86 |
echo '<span class="wpbc_pro_label">Pro</span>'; |
| 87 |
} else{ |
| 88 |
echo ( ! class_exists( 'wpdev_bk_biz_l' ) ) ? '<span class="wpbc_pro_label">BL</span>' : ''; |
| 89 |
} |
| 90 |
?> |
| 91 |
</a> |
| 92 |
</div> |
| 93 |
<div id="wpbc_shortcode_config__nav_tab__bookingother" class="wpbc_settings_navigation_item"> |
| 94 |
<a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingother', 'bookingother' );" href="javascript:void(0);"> |
| 95 |
<span><?php esc_html_e( 'Other', 'booking' ); ?></span><?php |
| 96 |
//echo ( ! class_exists( 'wpdev_bk_personal' ) ) ? '<span class="wpbc_pro_label">Pro</span>' : ''; |
| 97 |
?> |
| 98 |
</a> |
| 99 |
</div> |
| 100 |
<?php if ( $is_bm_exist ) { ?> |
| 101 |
<div id="wpbc_shortcode_config__nav_tab__booking_import_ics" class="wpbc_settings_navigation_item wpbc_navigation_top_border"> |
| 102 |
<a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_booking_import_ics', 'booking_import_ics' );" href="javascript:void(0);"> |
| 103 |
<span><?php esc_html_e( 'Import Events (.ics feed)', 'booking' ) ?></span> |
| 104 |
</a> |
| 105 |
</div> |
| 106 |
<div id="wpbc_shortcode_config__nav_tab__booking_listing_ics" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> |
| 107 |
<a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_booking_listing_ics' , 'booking_listing_ics');" href="javascript:void(0);"> |
| 108 |
<span><?php esc_html_e( 'Show .ics Listing of Events', 'booking' ); ?></span> |
| 109 |
</a> |
| 110 |
</div> |
| 111 |
<?php } ?> |
| 112 |
</div> |
| 113 |
<?php |
| 114 |
} |
| 115 |
|
| 116 |
|
| 117 |
// ===================================================================================================================== |
| 118 |
// Shortcode [booking ... ] |
| 119 |
// ===================================================================================================================== |
| 120 |
|
| 121 |
/** |
| 122 |
* Content of PopUp - for shortcode [booking ...] |
| 123 |
* |
| 124 |
* @return void |
| 125 |
*/ |
| 126 |
function wpbc_shortcode_config__content__booking() { |
| 127 |
|
| 128 |
$shortcode_name = 'booking'; |
| 129 |
|
| 130 |
?><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 ); ?> wpbc_sc_container__shortcode_is_active"><?php |
| 131 |
|
| 132 |
wpbc_shortcode_config__booking__top_tabs(); |
| 133 |
|
| 134 |
// 'General' -------------------------------------------------------------------------------------------------- |
| 135 |
?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__general"> |
| 136 |
<table class="form-table"><tbody><?php |
| 137 |
|
| 138 |
// Booking Resource |
| 139 |
wpbc_shortcode_config_fields__select_resource( $shortcode_name . '_wpbc_resource_id', $shortcode_name ); |
| 140 |
|
| 141 |
// Custom form |
| 142 |
wpbc_shortcode_config_fields__select_custom_form( $shortcode_name . '_wpbc_custom_form', $shortcode_name ); |
| 143 |
|
| 144 |
// Number of Months |
| 145 |
wpbc_shortcode_config_fields__select_nummonths( $shortcode_name . '_wpbc_nummonths', $shortcode_name ); |
| 146 |
|
| 147 |
// Calendar Size |
| 148 |
wpbc_shortcode_config_fields__calendar_size( $shortcode_name . '_wpbc_size', $shortcode_name ); |
| 149 |
|
| 150 |
// Open booking form in popup. |
| 151 |
wpbc_shortcode_config_fields__booking_popup( $shortcode_name . '_wpbc_popup', $shortcode_name ); |
| 152 |
|
| 153 |
?></tbody></table> |
| 154 |
</div><?php |
| 155 |
|
| 156 |
// 'Conditional Days Selection' -------------------------------------------------------------------------------- |
| 157 |
?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__conditions"><?php |
| 158 |
|
| 159 |
wpbc_shortcode_config_fields__dates_conditions_toolbar(); // TOOLBAR |
| 160 |
|
| 161 |
?><div class="wpbc_sc_container__shortcode_subsection wpbc_sc_container__shortcode_subsection__weekdays_conditions"> |
| 162 |
<?php |
| 163 |
wpbc_shortcode_config_fields__weekdays_conditions( $shortcode_name . 'wpbc_select_day_weekday', $shortcode_name ); |
| 164 |
?> |
| 165 |
</div><?php |
| 166 |
|
| 167 |
?><div class="wpbc_sc_container__shortcode_subsection wpbc_sc_container__shortcode_subsection__seasons_conditions"> |
| 168 |
<?php |
| 169 |
wpbc_shortcode_config_fields__season_conditions( $shortcode_name . 'wpbc_select_day_season', $shortcode_name ); |
| 170 |
?> |
| 171 |
</div><?php |
| 172 |
|
| 173 |
?><div class="wpbc_sc_container__shortcode_subsection wpbc_sc_container__shortcode_subsection__startseason_conditions"> |
| 174 |
<?php |
| 175 |
wpbc_shortcode_config_fields__season_start_day_conditions( $shortcode_name . 'wpbc_start_day_season', $shortcode_name ) |
| 176 |
?> |
| 177 |
</div><?php |
| 178 |
|
| 179 |
?><div class="wpbc_sc_container__shortcode_subsection wpbc_sc_container__shortcode_subsection__dates_conditions"> |
| 180 |
<?php |
| 181 |
wpbc_shortcode_config_fields__fordate_conditions( $shortcode_name . 'wpbc_select_day_fordate', $shortcode_name ); |
| 182 |
?> |
| 183 |
</div><?php |
| 184 |
|
| 185 |
?></div><?php |
| 186 |
|
| 187 |
// 'AGGREGATE' ------------------------------------------------------------------------------------------------- |
| 188 |
?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__aggregate"><?php |
| 189 |
|
| 190 |
wpbc_shortcode_config_fields__aggregate( $shortcode_name . '_wpbc_aggregate', $shortcode_name ); |
| 191 |
|
| 192 |
?></div><?php |
| 193 |
|
| 194 |
// 'START MONTH' ----------------------------------------------------------------------------------------------- |
| 195 |
?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__other"><?php |
| 196 |
?><table class="form-table"><tbody><?php |
| 197 |
|
| 198 |
wpbc_shortcode_config_fields__calendar_dates_start( $shortcode_name . '_wpbc_calendar_dates_start', $shortcode_name ); |
| 199 |
|
| 200 |
wpbc_shortcode_config_fields__calendar_dates_end( $shortcode_name . '_wpbc_calendar_dates_end', $shortcode_name ); |
| 201 |
|
| 202 |
wpbc_shortcode_config_fields__start_month( $shortcode_name . '_wpbc_startmonth', $shortcode_name ); |
| 203 |
|
| 204 |
?></tbody></table><?php |
| 205 |
?></div><?php |
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
?> |
| 210 |
<div class="wpbc_shortcode_config_content_toolbar__next_prior"> |
| 211 |
<a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config_content_toolbar__next_prior(this,'prior');" class="button"> |
| 212 |
<span class="in-button-text">‹</span> |
| 213 |
</a> |
| 214 |
<a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config_content_toolbar__next_prior(this,'next');" class="button"> |
| 215 |
<span class="in-button-text">›</span> |
| 216 |
</a> |
| 217 |
</div> |
| 218 |
<?php |
| 219 |
|
| 220 |
?></div><?php |
| 221 |
|
| 222 |
wpbc_clear_div(); |
| 223 |
} |
| 224 |
|
| 225 |
|
| 226 |
/** |
| 227 |
* Top Tabs for shortcode [booking ...] |
| 228 |
* @return void |
| 229 |
*/ |
| 230 |
function wpbc_shortcode_config__booking__top_tabs(){ |
| 231 |
|
| 232 |
$shortcode_name = 'booking'; |
| 233 |
|
| 234 |
wpbc_bs_toolbar_tabs_html_container_start(); |
| 235 |
|
| 236 |
$js = "jQuery(this).parents( '.wpbc_sc_container__shortcode' ).find( '.nav-tab' ).removeClass('nav-tab-active');" |
| 237 |
. "jQuery(this).addClass('nav-tab-active');" |
| 238 |
. "jQuery('.nav-tab i.icon-white').removeClass('icon-white');" |
| 239 |
. "jQuery('.nav-tab-active i').addClass('icon-white');" |
| 240 |
. "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section').hide();"; |
| 241 |
|
| 242 |
wpbc_bs_display_tab( array( |
| 243 |
'title' => __('Booking Calendar Form', 'booking') |
| 244 |
// , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' ) |
| 245 |
, 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__general').show();" |
| 246 |
, 'font_icon' => 'wpbc-bi-calendar3-range' |
| 247 |
, 'default' => true |
| 248 |
) ); |
| 249 |
wpbc_bs_display_tab( array( |
| 250 |
'title' => __('Conditional Days Selection', 'booking') |
| 251 |
// , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' ) |
| 252 |
, 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__conditions').show();" |
| 253 |
, 'font_icon' => 'wpbc-bi-calendar2-week' |
| 254 |
, 'default' => false |
| 255 |
, 'css_classes' => 'wpbc_dismiss__conditional_days' |
| 256 |
) ); |
| 257 |
wpbc_bs_display_tab( array( |
| 258 |
'title' => __('Aggregate', 'booking') |
| 259 |
// , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' ) |
| 260 |
, 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__aggregate').show();" |
| 261 |
, 'font_icon' => 'wpbc-bi-calendar2-plus' |
| 262 |
, 'default' => false |
| 263 |
, 'css_classes' => 'wpbc_dismiss__booking_param_aggregate' |
| 264 |
) ); |
| 265 |
wpbc_bs_display_tab( array( |
| 266 |
'title' => __('Advanced', 'booking') |
| 267 |
// , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' ) |
| 268 |
, 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__other').show();" |
| 269 |
, 'font_icon' => 'wpbc_icn_tune' |
| 270 |
, 'default' => false |
| 271 |
|
| 272 |
) ); |
| 273 |
|
| 274 |
wpbc_bs_toolbar_tabs_html_container_end(); |
| 275 |
} |
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
// ===================================================================================================================== |
| 280 |
// Fields |
| 281 |
// ===================================================================================================================== |
| 282 |
|
| 283 |
/** |
| 284 |
* Shortcode Field: Select-box - "Booking Resource" |
| 285 |
* |
| 286 |
* @param $id |
| 287 |
* @param $group_key |
| 288 |
* |
| 289 |
* @return void |
| 290 |
*/ |
| 291 |
function wpbc_shortcode_config_fields__select_resource( $id , $group_key ){ |
| 292 |
|
| 293 |
if ( class_exists( 'wpdev_bk_personal' ) ){ |
| 294 |
|
| 295 |
WPBC_Settings_API::field_select_row_static( $id |
| 296 |
, array( |
| 297 |
'type' => 'select' |
| 298 |
, 'title' => __( 'Booking resource', 'booking') |
| 299 |
, 'description' => __( 'Select booking resource', 'booking' ) |
| 300 |
, 'description_tag' => 'span' |
| 301 |
, 'label' => '' |
| 302 |
, 'multiple' => false |
| 303 |
, 'group' => $group_key |
| 304 |
, 'tr_class' => $group_key . '_standard_section' |
| 305 |
, 'class' => '' |
| 306 |
, 'css' => 'margin-right:10px;' |
| 307 |
, 'only_field' => false |
| 308 |
, 'attr' => array() |
| 309 |
, 'value' => '' |
| 310 |
, 'options' => wpbc_get_all_booking_resources_list() |
| 311 |
) ); |
| 312 |
} |
| 313 |
|
| 314 |
} |
| 315 |
|
| 316 |
/** |
| 317 |
* Shortcode Field: Select-box - "Custom Booking Form" |
| 318 |
* |
| 319 |
* @param $id |
| 320 |
* @param $group_key |
| 321 |
* |
| 322 |
* @return void |
| 323 |
*/ |
| 324 |
function wpbc_shortcode_config_fields__select_custom_form( $id , $group_key ){ |
| 325 |
|
| 326 |
WPBC_FE_Custom_Form_Helper::wpbc_bfb__custom_booking_forms_list__selectbox_html__sh_modal( |
| 327 |
array( |
| 328 |
'name' => $id, |
| 329 |
'title' => __( 'Booking Form', 'booking' ), |
| 330 |
'description' => __( 'Select custom booking form', 'booking' ), |
| 331 |
'group' => $group_key, |
| 332 |
) |
| 333 |
); |
| 334 |
} |
| 335 |
|
| 336 |
/** |
| 337 |
* Shortcode Field: Select-box - "Calendar Months Number" |
| 338 |
* |
| 339 |
* @param $id |
| 340 |
* @param $group_key |
| 341 |
* |
| 342 |
* @return void |
| 343 |
*/ |
| 344 |
function wpbc_shortcode_config_fields__select_nummonths( $id , $group_key ){ |
| 345 |
|
| 346 |
WPBC_Settings_API::field_select_row_static( $id |
| 347 |
, array( |
| 348 |
'type' => 'select' |
| 349 |
, 'title' => __('Visible months', 'booking') |
| 350 |
, 'description' => __('Select number of month to show for calendar.' ,'booking') |
| 351 |
, 'description_tag' => 'span' |
| 352 |
, 'label' => '' |
| 353 |
, 'multiple' => false |
| 354 |
, 'group' => $group_key |
| 355 |
, 'tr_class' => $group_key . '_standard_section' |
| 356 |
, 'class' => '' |
| 357 |
, 'css' => 'margin-right:10px;' |
| 358 |
, 'only_field' => false |
| 359 |
, 'attr' => array() |
| 360 |
, 'value' => get_bk_option( 'booking_client_cal_count' ) |
| 361 |
, 'options' => array_combine( range( 1, 12 ), range( 1, 12 ) ) |
| 362 |
) |
| 363 |
); |
| 364 |
} |
| 365 |
|
| 366 |
/** |
| 367 |
* Shortcode Fields: OPTION - "Define Calendar Size" |
| 368 |
* |
| 369 |
* @param $id |
| 370 |
* @param $group_key |
| 371 |
* |
| 372 |
* @return void |
| 373 |
*/ |
| 374 |
function wpbc_shortcode_config_fields__calendar_size( $id , $group_key ){ |
| 375 |
|
| 376 |
// --------------------------------------------------------------------------------------------------------- |
| 377 |
WPBC_Settings_API::field_checkbox_row_static( $id . '_enabled' |
| 378 |
, array( |
| 379 |
'type' => 'checkbox' |
| 380 |
, 'title' => __('Setup Size & Structure', 'booking') |
| 381 |
, 'description' => __('Configure Calendar Size and Structure', 'booking') |
| 382 |
, 'description_tag' => 'span' |
| 383 |
, 'label' => '' |
| 384 |
, 'class' => '' |
| 385 |
, 'css' => '' |
| 386 |
, 'tr_class' => '' |
| 387 |
, 'attr' => array() |
| 388 |
, 'group' => $group_key |
| 389 |
, 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed' |
| 390 |
, 'only_field' => !true |
| 391 |
, 'is_new_line' => false |
| 392 |
, 'value' => false |
| 393 |
) |
| 394 |
); |
| 395 |
|
| 396 |
WPBC_Settings_API::field_select_row_static( $id . '_months_num_in_row' |
| 397 |
, array( |
| 398 |
'type' => 'select' |
| 399 |
, 'title' => __('Number of months in a row', 'booking') |
| 400 |
, 'description' => __('Select the number of months to show in one row on a wide screen.' ,'booking') |
| 401 |
, 'description_tag' => 'span' |
| 402 |
, 'label' => '' |
| 403 |
, 'multiple' => false |
| 404 |
, 'group' => $group_key |
| 405 |
, 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_calendar_size' |
| 406 |
, 'class' => '' |
| 407 |
, 'css' => 'margin-right:10px;' |
| 408 |
, 'only_field' => false |
| 409 |
, 'attr' => array() |
| 410 |
, 'value' => get_bk_option( 'booking_client_cal_count' ) |
| 411 |
, 'options' => array_combine( range( 1, 6 ), range( 1, 6 ) ) |
| 412 |
) |
| 413 |
); |
| 414 |
|
| 415 |
?><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"> |
| 416 |
<th scope="row" style="vertical-align: middle;"> |
| 417 |
<label for="wpbc_booking_width" class="wpbc-form-text"><?php esc_html_e('Calendar width:', 'booking'); ?></label> |
| 418 |
</th> |
| 419 |
<td class=""><fieldset><?php |
| 420 |
|
| 421 |
WPBC_Settings_API::field_text_row_static( $id . '_calendar_width' |
| 422 |
, array( |
| 423 |
'type' => 'text' |
| 424 |
, 'placeholder' => '100' |
| 425 |
, 'class' => '' |
| 426 |
, 'css' => 'width:5em;' |
| 427 |
, 'only_field' => true |
| 428 |
, 'attr' => array() |
| 429 |
, 'value' => '100' |
| 430 |
) |
| 431 |
); |
| 432 |
WPBC_Settings_API::field_select_row_static( $id . '_calendar_width_px_pr' |
| 433 |
, array( |
| 434 |
'type' => 'select' |
| 435 |
, 'multiple' => false |
| 436 |
, 'class' => '' |
| 437 |
, 'css' => 'width:4em;' |
| 438 |
, 'only_field' => true |
| 439 |
, 'attr' => array() |
| 440 |
, 'value' => '%' |
| 441 |
, 'options' => array( 'px' => 'px', '%' => '%' ) |
| 442 |
) |
| 443 |
); |
| 444 |
?><span class="description"> <?php esc_html_e('Set width of calendar' ,'booking'); ?></span></fieldset></td> |
| 445 |
</tr><?php |
| 446 |
|
| 447 |
?><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"> |
| 448 |
<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> |
| 449 |
<td class=""> |
| 450 |
<fieldset><?php |
| 451 |
|
| 452 |
WPBC_Settings_API::field_text_row_static( $id . '_calendar_cell_height' |
| 453 |
, array( |
| 454 |
'type' => 'text' |
| 455 |
, 'placeholder' => '50' |
| 456 |
, 'class' => '' |
| 457 |
, 'css' => 'width:5em;' |
| 458 |
, 'only_field' => true |
| 459 |
, 'attr' => array() |
| 460 |
, 'value' => '50' |
| 461 |
) |
| 462 |
); |
| 463 |
WPBC_Settings_API::field_select_row_static( $id . '_calendar_cell_height_px_pr' |
| 464 |
, array( |
| 465 |
'type' => 'select' |
| 466 |
, 'multiple' => false |
| 467 |
, 'class' => '' |
| 468 |
, 'css' => 'width:4em;' |
| 469 |
, 'only_field' => true |
| 470 |
, 'attr' => array() |
| 471 |
, 'value' => '%' |
| 472 |
, 'options' => array( 'px' => 'px' ) |
| 473 |
) |
| 474 |
); |
| 475 |
?><span class="description"> <?php esc_html_e('Set cell height for calendar' ,'booking'); ?></span> |
| 476 |
</fieldset> |
| 477 |
</td> |
| 478 |
</tr><?php |
| 479 |
|
| 480 |
} |
| 481 |
|
| 482 |
/** |
| 483 |
* Shortcode Fields: Open booking form in popup. |
| 484 |
* |
| 485 |
* @param string $id Field ID prefix. |
| 486 |
* @param string $group_key Shortcode group key. |
| 487 |
* |
| 488 |
* @return void |
| 489 |
*/ |
| 490 |
function wpbc_shortcode_config_fields__booking_popup( $id, $group_key ) { |
| 491 |
|
| 492 |
WPBC_Settings_API::field_checkbox_row_static( $id . '_enabled' |
| 493 |
, array( |
| 494 |
'type' => 'checkbox' |
| 495 |
, 'title' => __( 'Open in popup', 'booking' ) |
| 496 |
, 'description' => __( 'Show a button that opens the booking form in a popup window.', 'booking' ) |
| 497 |
, 'description_tag' => 'span' |
| 498 |
, 'label' => '' |
| 499 |
, 'class' => '' |
| 500 |
, 'css' => '' |
| 501 |
, 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed' |
| 502 |
, 'attr' => array() |
| 503 |
, 'group' => $group_key |
| 504 |
, 'only_field' => false |
| 505 |
, 'is_new_line' => false |
| 506 |
, 'value' => false |
| 507 |
) |
| 508 |
); |
| 509 |
|
| 510 |
WPBC_Settings_API::field_text_row_static( $id . '_button_title' |
| 511 |
, array( |
| 512 |
'type' => 'text' |
| 513 |
, 'title' => __( 'Button title', 'booking' ) |
| 514 |
, 'description' => __( 'Text on the button that opens the booking form popup.', 'booking' ) |
| 515 |
, 'description_tag' => 'span' |
| 516 |
, 'placeholder' => __( 'Book now', 'booking' ) |
| 517 |
, 'class' => '' |
| 518 |
, 'css' => '' |
| 519 |
, 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_booking_popup' |
| 520 |
, 'attr' => array() |
| 521 |
, 'group' => $group_key |
| 522 |
, 'only_field' => false |
| 523 |
, 'value' => __( 'Book now', 'booking' ) |
| 524 |
) |
| 525 |
); |
| 526 |
|
| 527 |
WPBC_Settings_API::field_text_row_static( $id . '_title' |
| 528 |
, array( |
| 529 |
'type' => 'text' |
| 530 |
, 'title' => __( 'Popup title', 'booking' ) |
| 531 |
, 'description' => __( 'Title displayed in the popup header.', 'booking' ) |
| 532 |
, 'description_tag' => 'span' |
| 533 |
, 'placeholder' => __( 'Booking Form', 'booking' ) |
| 534 |
, 'class' => '' |
| 535 |
, 'css' => '' |
| 536 |
, 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_booking_popup' |
| 537 |
, 'attr' => array() |
| 538 |
, 'group' => $group_key |
| 539 |
, 'only_field' => false |
| 540 |
, 'value' => __( 'Booking Form', 'booking' ) |
| 541 |
) |
| 542 |
); |
| 543 |
|
| 544 |
WPBC_Settings_API::field_text_row_static( $id . '_button_class' |
| 545 |
, array( |
| 546 |
'type' => 'text' |
| 547 |
, 'title' => __( 'Button CSS class', 'booking' ) |
| 548 |
, 'description' => __( 'CSS class for the popup button.', 'booking' ) |
| 549 |
, 'description_tag' => 'span' |
| 550 |
, 'placeholder' => 'wp-element-button' |
| 551 |
, 'class' => '' |
| 552 |
, 'css' => '' |
| 553 |
, 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_booking_popup' |
| 554 |
, 'attr' => array() |
| 555 |
, 'group' => $group_key |
| 556 |
, 'only_field' => false |
| 557 |
, 'value' => 'wp-element-button' |
| 558 |
) |
| 559 |
); |
| 560 |
|
| 561 |
WPBC_Settings_API::field_text_row_static( $id . '_modal_class' |
| 562 |
, array( |
| 563 |
'type' => 'text' |
| 564 |
, 'title' => __( 'Popup CSS class', 'booking' ) |
| 565 |
, 'description' => __( 'Optional CSS class for the popup modal.', 'booking' ) |
| 566 |
, 'description_tag' => 'span' |
| 567 |
, 'placeholder' => '' |
| 568 |
, 'class' => '' |
| 569 |
, 'css' => '' |
| 570 |
, 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_booking_popup' |
| 571 |
, 'attr' => array() |
| 572 |
, 'group' => $group_key |
| 573 |
, 'only_field' => false |
| 574 |
, 'value' => '' |
| 575 |
) |
| 576 |
); |
| 577 |
|
| 578 |
WPBC_Settings_API::field_select_row_static( $id . '_size' |
| 579 |
, array( |
| 580 |
'type' => 'select' |
| 581 |
, 'title' => __( 'Popup size', 'booking' ) |
| 582 |
, 'description' => __( 'Select the popup window size.', 'booking' ) |
| 583 |
, 'description_tag' => 'span' |
| 584 |
, 'label' => '' |
| 585 |
, 'multiple' => false |
| 586 |
, 'group' => $group_key |
| 587 |
, 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_booking_popup' |
| 588 |
, 'class' => '' |
| 589 |
, 'css' => 'margin-right:10px;' |
| 590 |
, 'only_field' => false |
| 591 |
, 'attr' => array() |
| 592 |
, 'value' => 'lg' |
| 593 |
, 'options' => array( |
| 594 |
'lg' => __( 'Large', 'booking' ), |
| 595 |
'default' => __( 'Default', 'booking' ), |
| 596 |
'sm' => __( 'Small', 'booking' ), |
| 597 |
) |
| 598 |
) |
| 599 |
); |
| 600 |
} |
| 601 |
|
| 602 |
/** |
| 603 |
* Shortcode Fields: Start Month |
| 604 |
* |
| 605 |
* @param $id |
| 606 |
* @param $group_key |
| 607 |
* |
| 608 |
* @return void |
| 609 |
*/ |
| 610 |
function wpbc_shortcode_config_fields__start_month( $id , $group_key ){ |
| 611 |
|
| 612 |
//////////////////////////////////////////////////////////////////// |
| 613 |
// Start Month |
| 614 |
//////////////////////////////////////////////////////////////////// |
| 615 |
?><tr valign="top" class="<?php echo esc_attr( $group_key . '_standard_section' ); ?>"> |
| 616 |
<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> |
| 617 |
<td class=""><fieldset><?php |
| 618 |
|
| 619 |
WPBC_Settings_API::field_checkbox_row_static( $id . '_active' |
| 620 |
, array( |
| 621 |
'type' => 'checkbox' |
| 622 |
, 'title' => '' |
| 623 |
, 'description' => '' |
| 624 |
, 'description_tag' => 'span' |
| 625 |
, 'label' => '' |
| 626 |
, 'class' => '' |
| 627 |
, 'css' => '' |
| 628 |
, 'tr_class' => '' |
| 629 |
, 'attr' => array() |
| 630 |
, 'group' => $group_key |
| 631 |
, 'only_field' => true |
| 632 |
, 'is_new_line' => false |
| 633 |
, 'value' => false |
| 634 |
) |
| 635 |
); |
| 636 |
|
| 637 |
WPBC_Settings_API::field_select_row_static( $id . '_year' |
| 638 |
, array( |
| 639 |
'type' => 'select' |
| 640 |
, 'title' => '' |
| 641 |
, 'description' => '' |
| 642 |
, 'description_tag' => 'span' |
| 643 |
, 'label' => '' |
| 644 |
, 'multiple' => false |
| 645 |
, 'group' => $group_key |
| 646 |
, 'class' => '' |
| 647 |
, 'css' => 'width:5em;' |
| 648 |
, 'only_field' => true |
| 649 |
, 'attr' => array() |
| 650 |
, 'value' => gmdate( 'Y' ) |
| 651 |
, 'options' => array_combine( range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ), range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ) ) |
| 652 |
) |
| 653 |
); |
| 654 |
?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> / </span><?php |
| 655 |
|
| 656 |
WPBC_Settings_API::field_select_row_static( $id . '_month' |
| 657 |
, array( |
| 658 |
'type' => 'select' |
| 659 |
, 'title' => '' |
| 660 |
, 'description' => '' |
| 661 |
, 'description_tag' => 'span' |
| 662 |
, 'label' => '' |
| 663 |
, 'multiple' => false |
| 664 |
, 'group' => $group_key |
| 665 |
, 'class' => '' |
| 666 |
, 'css' => 'width:4em;' |
| 667 |
, 'only_field' => true |
| 668 |
, 'attr' => array() |
| 669 |
, 'value' => gmdate('n') |
| 670 |
, 'options' => array_combine( range( 1, 12 ), range( 1, 12 ) ) |
| 671 |
) |
| 672 |
); |
| 673 |
|
| 674 |
?><span class="description"> <?php esc_html_e('Select start month of calendar' ,'booking'); ?></span></fieldset></td> |
| 675 |
</tr><?php |
| 676 |
|
| 677 |
} |
| 678 |
|
| 679 |
|
| 680 |
/** |
| 681 |
* Shortcode Fields: Start Dates |
| 682 |
* |
| 683 |
* @param $id |
| 684 |
* @param $group_key |
| 685 |
* |
| 686 |
* @return void |
| 687 |
*/ |
| 688 |
function wpbc_shortcode_config_fields__calendar_dates_start( $id , $group_key ){ |
| 689 |
|
| 690 |
?><tr valign="top" class="<?php echo esc_attr( $group_key . '_standard_section' ); ?>"> |
| 691 |
<th scope="row" style="vertical-align: middle;"><label for="<?php echo esc_attr( $id ); ?>_active" class="wpbc-form-text"><?php |
| 692 |
esc_html_e('Start dates', 'booking'); ?></label></th> |
| 693 |
<td class=""><fieldset><?php |
| 694 |
|
| 695 |
WPBC_Settings_API::field_checkbox_row_static( $id . '_active' |
| 696 |
, array( |
| 697 |
'type' => 'checkbox' |
| 698 |
, 'title' => '' |
| 699 |
, 'description' => '' |
| 700 |
, 'description_tag' => 'span' |
| 701 |
, 'label' => '' |
| 702 |
, 'class' => '' |
| 703 |
, 'css' => '' |
| 704 |
, 'tr_class' => '' |
| 705 |
, 'attr' => array() |
| 706 |
, 'group' => $group_key |
| 707 |
, 'only_field' => true |
| 708 |
, 'is_new_line' => false |
| 709 |
, 'value' => false |
| 710 |
) |
| 711 |
); |
| 712 |
|
| 713 |
WPBC_Settings_API::field_select_row_static( $id . '_year' |
| 714 |
, array( |
| 715 |
'type' => 'select' |
| 716 |
, 'title' => '' |
| 717 |
, 'description' => '' |
| 718 |
, 'description_tag' => 'span' |
| 719 |
, 'label' => '' |
| 720 |
, 'multiple' => false |
| 721 |
, 'group' => $group_key |
| 722 |
, 'class' => '' |
| 723 |
, 'css' => 'width:5em;' |
| 724 |
, 'only_field' => true |
| 725 |
, 'attr' => array() |
| 726 |
, 'value' => gmdate( 'Y' ) |
| 727 |
, 'options' => array_combine( range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ), range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ) ) |
| 728 |
) |
| 729 |
); |
| 730 |
|
| 731 |
?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> / </span><?php |
| 732 |
|
| 733 |
WPBC_Settings_API::field_select_row_static( $id . '_month' |
| 734 |
, array( |
| 735 |
'type' => 'select' |
| 736 |
, 'title' => '' |
| 737 |
, 'description' => '' |
| 738 |
, 'description_tag' => 'span' |
| 739 |
, 'label' => '' |
| 740 |
, 'multiple' => false |
| 741 |
, 'group' => $group_key |
| 742 |
, 'class' => '' |
| 743 |
, 'css' => 'width:4em;' |
| 744 |
, 'only_field' => true |
| 745 |
, 'attr' => array() |
| 746 |
, 'value' => gmdate('m') |
| 747 |
, 'options' => array_combine( |
| 748 |
array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 12 ) ), |
| 749 |
array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 12 ) ) |
| 750 |
) |
| 751 |
) |
| 752 |
); |
| 753 |
|
| 754 |
|
| 755 |
?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> / </span><?php |
| 756 |
|
| 757 |
WPBC_Settings_API::field_select_row_static( $id . '_date' |
| 758 |
, array( |
| 759 |
'type' => 'select' |
| 760 |
, 'title' => '' |
| 761 |
, 'description' => '' |
| 762 |
, 'description_tag' => 'span' |
| 763 |
, 'label' => '' |
| 764 |
, 'multiple' => false |
| 765 |
, 'group' => $group_key |
| 766 |
, 'class' => '' |
| 767 |
, 'css' => 'width:4em;' |
| 768 |
, 'only_field' => true |
| 769 |
, 'attr' => array() |
| 770 |
, 'value' => gmdate('d') |
| 771 |
, 'options' => array_combine( |
| 772 |
array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 31 ) ), |
| 773 |
array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 31 ) ) |
| 774 |
) |
| 775 |
|
| 776 |
) |
| 777 |
); |
| 778 |
|
| 779 |
?><span class="description"> <?php esc_html_e('Earliest date visible/selectable in the calendar.' ,'booking'); ?></span></fieldset></td> |
| 780 |
</tr><?php |
| 781 |
} |
| 782 |
|
| 783 |
|
| 784 |
/** |
| 785 |
* Shortcode Fields: End Dates |
| 786 |
* |
| 787 |
* @param $id |
| 788 |
* @param $group_key |
| 789 |
* |
| 790 |
* @return void |
| 791 |
*/ |
| 792 |
function wpbc_shortcode_config_fields__calendar_dates_end( $id , $group_key ){ |
| 793 |
|
| 794 |
?><tr valign="top" class="<?php echo esc_attr( $group_key . '_standard_section' ); ?>"> |
| 795 |
<th scope="row" style="vertical-align: middle;"><label for="<?php echo esc_attr( $id ); ?>_active" class="wpbc-form-text"><?php |
| 796 |
esc_html_e('End dates', 'booking'); ?></label></th> |
| 797 |
<td class=""><fieldset><?php |
| 798 |
|
| 799 |
WPBC_Settings_API::field_checkbox_row_static( $id . '_active' |
| 800 |
, array( |
| 801 |
'type' => 'checkbox' |
| 802 |
, 'title' => '' |
| 803 |
, 'description' => '' |
| 804 |
, 'description_tag' => 'span' |
| 805 |
, 'label' => '' |
| 806 |
, 'class' => '' |
| 807 |
, 'css' => '' |
| 808 |
, 'tr_class' => '' |
| 809 |
, 'attr' => array() |
| 810 |
, 'group' => $group_key |
| 811 |
, 'only_field' => true |
| 812 |
, 'is_new_line' => false |
| 813 |
, 'value' => false |
| 814 |
) |
| 815 |
); |
| 816 |
|
| 817 |
WPBC_Settings_API::field_select_row_static( $id . '_year' |
| 818 |
, array( |
| 819 |
'type' => 'select' |
| 820 |
, 'title' => '' |
| 821 |
, 'description' => '' |
| 822 |
, 'description_tag' => 'span' |
| 823 |
, 'label' => '' |
| 824 |
, 'multiple' => false |
| 825 |
, 'group' => $group_key |
| 826 |
, 'class' => '' |
| 827 |
, 'css' => 'width:5em;' |
| 828 |
, 'only_field' => true |
| 829 |
, 'attr' => array() |
| 830 |
, 'value' => intval( gmdate( 'Y' ) ) + 2 |
| 831 |
, 'options' => array_combine( range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ), range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ) ) |
| 832 |
) |
| 833 |
); |
| 834 |
|
| 835 |
?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> / </span><?php |
| 836 |
|
| 837 |
WPBC_Settings_API::field_select_row_static( $id . '_month' |
| 838 |
, array( |
| 839 |
'type' => 'select' |
| 840 |
, 'title' => '' |
| 841 |
, 'description' => '' |
| 842 |
, 'description_tag' => 'span' |
| 843 |
, 'label' => '' |
| 844 |
, 'multiple' => false |
| 845 |
, 'group' => $group_key |
| 846 |
, 'class' => '' |
| 847 |
, 'css' => 'width:4em;' |
| 848 |
, 'only_field' => true |
| 849 |
, 'attr' => array() |
| 850 |
, 'value' => gmdate('m') |
| 851 |
, 'options' => array_combine( |
| 852 |
array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 12 ) ), |
| 853 |
array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 12 ) ) |
| 854 |
) |
| 855 |
|
| 856 |
) |
| 857 |
); |
| 858 |
|
| 859 |
|
| 860 |
?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> / </span><?php |
| 861 |
|
| 862 |
WPBC_Settings_API::field_select_row_static( $id . '_date' |
| 863 |
, array( |
| 864 |
'type' => 'select' |
| 865 |
, 'title' => '' |
| 866 |
, 'description' => '' |
| 867 |
, 'description_tag' => 'span' |
| 868 |
, 'label' => '' |
| 869 |
, 'multiple' => false |
| 870 |
, 'group' => $group_key |
| 871 |
, 'class' => '' |
| 872 |
, 'css' => 'width:4em;' |
| 873 |
, 'only_field' => true |
| 874 |
, 'attr' => array() |
| 875 |
, 'value' => gmdate('d') |
| 876 |
, 'options' => array_combine( |
| 877 |
array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 31 ) ), |
| 878 |
array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 31 ) ) |
| 879 |
) |
| 880 |
|
| 881 |
) |
| 882 |
); |
| 883 |
|
| 884 |
?><span class="description"> <?php esc_html_e('Latest date visible/selectable in the calendar.' ,'booking'); ?></span></fieldset></td> |
| 885 |
</tr><?php |
| 886 |
} |
| 887 |
|
| 888 |
|
| 889 |
|
| 890 |
/** |
| 891 |
* Shortcode Fields: AGGREGATE |
| 892 |
* |
| 893 |
* @param $id |
| 894 |
* @param $group_key |
| 895 |
* |
| 896 |
* @return void |
| 897 |
*/ |
| 898 |
function wpbc_shortcode_config_fields__aggregate( $id , $group_key ){ |
| 899 |
|
| 900 |
//-------------------------------------------------------------------------------------------------------------- |
| 901 |
// 'Upgrade to Pro' widget |
| 902 |
//-------------------------------------------------------------------------------------------------------------- |
| 903 |
$upgrade_content_arr = wpbc_get_upgrade_widget( array( |
| 904 |
'id' => 'widget_wpbc_dismiss__booking_param_aggregate', |
| 905 |
'dismiss_css_class' => '.wpbc_dismiss__booking_param_aggregate', |
| 906 |
'blured_in_versions' => array( 'free' ), |
| 907 |
'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#booking-resources' ), |
| 908 |
'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ), |
| 909 |
'versions' => 'paid versions', |
| 910 |
'css' => 'transform: translate(0) translateY(180px);' |
| 911 |
) ); |
| 912 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 913 |
echo $upgrade_content_arr['content']; |
| 914 |
|
| 915 |
//-------------------------------------------------------------------------------------------------------------- |
| 916 |
// Real Content |
| 917 |
//-------------------------------------------------------------------------------------------------------------- |
| 918 |
|
| 919 |
$resources_list = array(); |
| 920 |
if ( class_exists( 'wpdev_bk_personal' ) ){ |
| 921 |
$resources_list_orig = wpbc_get_all_booking_resources_list(); |
| 922 |
|
| 923 |
$resources_list[0] = array( 'title' => __('None', 'booking' ), 'attr' => array ( 'class' => 'wpbc_single_resource', 'style' => 'border-bottom:1px dashed #ddd;') ); |
| 924 |
foreach ($resources_list_orig as $res_id => $res_val) { |
| 925 |
$resources_list[$res_id] = $res_val; |
| 926 |
} |
| 927 |
} |
| 928 |
|
| 929 |
?> |
| 930 |
<div class="clear"></div> |
| 931 |
<div class="wpbc-settings-notice0 notice-info notice-header" style="font-size: 15px;font-weight: 600;margin: 15px 0 15px 15px;"> |
| 932 |
<label for="<?php echo esc_attr($id); ?>"><?php esc_html_e( 'Aggregate booking dates from other resources', 'booking' ); ?></label> |
| 933 |
</div> |
| 934 |
|
| 935 |
<div class="wpbc_shortcode_config__rules_container wpbc_dismiss__booking_param_aggregate <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>"> |
| 936 |
<div class="wpbc_shortcode_config__rules__params_section wpbc_aggregate"> |
| 937 |
|
| 938 |
<div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row"> |
| 939 |
<div class="ui_container ui_container_mini"> |
| 940 |
<div class="ui_group"> |
| 941 |
<div class="ui_element wpdevelop"><?php |
| 942 |
|
| 943 |
WPBC_Settings_API::field_select_row_static( $id //. '__aggregate' |
| 944 |
, array( |
| 945 |
'type' => 'select' |
| 946 |
, 'title' => __('Aggregate booking dates from other resources', 'booking') |
| 947 |
, 'description' => ''//__( 'Select booking resources, for getting booking dates from them and set such dates as unavailable in destination calendar.', 'booking' ) |
| 948 |
, 'description_tag' => 'span' |
| 949 |
, 'label' => '' |
| 950 |
, 'multiple' => true |
| 951 |
, 'group' => $group_key |
| 952 |
, 'tr_class' => ''//$group_key . '_advanced_section' |
| 953 |
, 'class' => 'wpbc_ui_control wpbc_ui_select' |
| 954 |
, 'css' => 'margin-right:10px;height:20em;min-width:15em;' |
| 955 |
, 'only_field' => true |
| 956 |
, 'attr' => array() |
| 957 |
, 'value' => '0' |
| 958 |
, 'options' => $resources_list |
| 959 |
) |
| 960 |
); |
| 961 |
|
| 962 |
|
| 963 |
|
| 964 |
?></div> |
| 965 |
</div> |
| 966 |
</div> |
| 967 |
</div> |
| 968 |
<div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row"> |
| 969 |
<div class="ui_container ui_container_mini ui_container_weekdays"> |
| 970 |
<div class="ui_group ui_group_weekdays_checkboxes"> |
| 971 |
<div class="ui_element"><?php |
| 972 |
|
| 973 |
WPBC_Settings_API::field_checkbox_row_static( $id . '__bookings_only' |
| 974 |
, array( |
| 975 |
'type' => 'checkbox' |
| 976 |
, 'title' => '' |
| 977 |
, 'description' => '' |
| 978 |
, 'description_tag' => 'span' |
| 979 |
, 'label' => __( 'Aggregate only bookings', 'booking' ) |
| 980 |
, 'class' => '' |
| 981 |
, 'css' => '' |
| 982 |
, 'tr_class' => '' |
| 983 |
, 'attr' => array() |
| 984 |
, 'group' => $group_key |
| 985 |
, 'only_field' => true |
| 986 |
, 'is_new_line' => false |
| 987 |
, 'value' => false //// FixIn: 10.0.0.6. |
| 988 |
) |
| 989 |
); |
| 990 |
?></div> |
| 991 |
</div> |
| 992 |
</div> |
| 993 |
</div> |
| 994 |
</div> |
| 995 |
<div class="wpbc_shortcode_config__rules__help_section" style="margin-top: 8px;"> |
| 996 |
<div class="wpbc-settings-notice notice-info notice-list"> |
| 997 |
<ol> |
| 998 |
<li> |
| 999 |
<?php esc_html_e( "Show dates as booked in the current calendar if such dates are unavailable in one of the selected resources.", 'booking' ); ?> |
| 1000 |
</li> |
| 1001 |
<li> |
| 1002 |
<?php |
| 1003 |
echo esc_html__( 'To set this up, select one or multiple booking resources in the multi-select box.', 'booking' ) |
| 1004 |
. '<br>' |
| 1005 |
. esc_html__( 'Hold down the Ctrl button to make multiple selections.', 'booking' ); |
| 1006 |
|
| 1007 |
echo ' <strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>' |
| 1008 |
. '<code>[booking resource_id=1 aggregate=\'3;5;9\']</code>'; |
| 1009 |
?> |
| 1010 |
|
| 1011 |
</li> |
| 1012 |
|
| 1013 |
<li> |
| 1014 |
<?php |
| 1015 |
/* translators: 1: ... */ |
| 1016 |
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' ) |
| 1017 |
, '<strong>', '</strong>' |
| 1018 |
, '<strong>Booking > Availability > Days Availability</strong>' |
| 1019 |
) ); |
| 1020 |
?> |
| 1021 |
|
| 1022 |
<?php |
| 1023 |
echo ' <strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>' |
| 1024 |
, '<code>[booking resource_id=1 aggregate=\'3;5;9\' options=\'{aggregate type=bookings_only}\']</code>'; |
| 1025 |
|
| 1026 |
?> |
| 1027 |
</li> |
| 1028 |
<li> |
| 1029 |
<?php |
| 1030 |
/* translators: 1: ... */ |
| 1031 |
echo wp_kses_post( sprintf( __( 'Check the FAQ for details on %1$sshortcode configuration%2$s, especially this %3$soption%4$s.' , 'booking' ) |
| 1032 |
, '<a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/" target="_blank">', '</a>' |
| 1033 |
, '<strong><a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/#booking-options-start-day-condition" target="_blank">', '</a></strong>' ) ); |
| 1034 |
?> |
| 1035 |
</li> |
| 1036 |
</ol> |
| 1037 |
</div> |
| 1038 |
</div> |
| 1039 |
</div><?php |
| 1040 |
|
| 1041 |
|
| 1042 |
} |
| 1043 |
|
| 1044 |
|
| 1045 |
|
| 1046 |
// ----------------------------------------------------------------------------------------------------------------- |
| 1047 |
|
| 1048 |
|
| 1049 |
function wpbc_shortcode_config_fields__dates_conditions_toolbar(){ |
| 1050 |
|
| 1051 |
?><div class="clear"></div><?php |
| 1052 |
?><div class="wpdevelop wpdvlp-nav-tabs-container wpbc_shortcode_config_fields__dates_conditions_toolbar"><?php |
| 1053 |
|
| 1054 |
$js = "jQuery(this).parents( '.wpbc_shortcode_config_fields__dates_conditions_toolbar' ).find( '.nav-tab' ).removeClass('wpdevelop-submenu-tab-selected'); |
| 1055 |
jQuery(this).addClass('wpdevelop-submenu-tab-selected'); |
| 1056 |
jQuery('.nav-tab i.icon-white').removeClass('icon-white'); |
| 1057 |
jQuery('.nav-tab-active i').addClass('icon-white'); |
| 1058 |
jQuery(this).parents('.wpbc_sc_container__shortcode_section').find('.wpbc_sc_container__shortcode_subsection').hide(); |
| 1059 |
jQuery(this).parents('.wpbc_sc_container__shortcode_section')"; |
| 1060 |
|
| 1061 |
wpbc_bs_toolbar_sub_html_container_start(); |
| 1062 |
|
| 1063 |
?><a class="nav-tab wpdevelop-submenu-tab tooltip_top wpdevelop-submenu-tab-selected wpbc_dismiss__conditional_days" |
| 1064 |
onclick="javascript:<?php |
| 1065 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 1066 |
echo $js; ?>.find('.wpbc_sc_container__shortcode_subsection__weekdays_conditions').show();" href="javascript:void(0)" |
| 1067 |
><span class="nav-tab-text"><i class="menu_icon icon-1x wpbc-bi-calendar2-week"></i> <?php |
| 1068 |
esc_html_e( 'Weekdays Conditions', 'booking' ); |
| 1069 |
?></span></a><?php |
| 1070 |
|
| 1071 |
?><a class="nav-tab wpdevelop-submenu-tab tooltip_top wpbc_dismiss__conditional_days" |
| 1072 |
onclick="javascript:<?php |
| 1073 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 1074 |
echo $js; ?>.find('.wpbc_sc_container__shortcode_subsection__seasons_conditions').show();" href="javascript:void(0)" |
| 1075 |
><span class="nav-tab-text"><i class="menu_icon icon-1x wpbc-bi-calendar2-month"></i> <?php |
| 1076 |
esc_html_e( 'Seasons Conditions', 'booking' ); |
| 1077 |
?></span></a><?php |
| 1078 |
|
| 1079 |
?><a class="nav-tab wpdevelop-submenu-tab tooltip_top wpbc_dismiss__conditional_days" |
| 1080 |
onclick="javascript:<?php |
| 1081 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 1082 |
echo $js; ?>.find('.wpbc_sc_container__shortcode_subsection__startseason_conditions').show();" href="javascript:void(0)" |
| 1083 |
><span class="nav-tab-text"><i class="menu_icon icon-1x wpbc-bi-calendar2-day"></i> <?php |
| 1084 |
esc_html_e( 'Start selection at Seasons', 'booking' ); |
| 1085 |
?></span></a><?php |
| 1086 |
|
| 1087 |
?><a class="nav-tab wpdevelop-submenu-tab tooltip_top wpbc_dismiss__conditional_days" |
| 1088 |
onclick="javascript:<?php |
| 1089 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 1090 |
echo $js; ?>.find('.wpbc_sc_container__shortcode_subsection__dates_conditions').show();" href="javascript:void(0)" |
| 1091 |
><span class="nav-tab-text"><i class="menu_icon icon-1x wpbc-bi-calendar2-date"></i> <?php |
| 1092 |
esc_html_e( 'Dates selection Conditions', 'booking' ); |
| 1093 |
?></span></a><?php |
| 1094 |
|
| 1095 |
wpbc_bs_toolbar_sub_html_container_end(); |
| 1096 |
|
| 1097 |
?> |
| 1098 |
</div><?php |
| 1099 |
} |
| 1100 |
|
| 1101 |
|
| 1102 |
/** |
| 1103 |
* Week Days - Condition fields for 'option' parameter. |
| 1104 |
* |
| 1105 |
* @param $id |
| 1106 |
* @param $group_key |
| 1107 |
* |
| 1108 |
* @return void |
| 1109 |
*/ |
| 1110 |
function wpbc_shortcode_config_fields__weekdays_conditions( $id , $group_key ){ |
| 1111 |
|
| 1112 |
//-------------------------------------------------------------------------------------------------------------- |
| 1113 |
// 'Upgrade to Pro' widget |
| 1114 |
//-------------------------------------------------------------------------------------------------------------- |
| 1115 |
$upgrade_content_arr = wpbc_get_upgrade_widget( array( |
| 1116 |
'id' => $id . '_' . 'conditional_days_weekdays', |
| 1117 |
'dismiss_css_class' => '.wpbc_dismiss__conditional_days', |
| 1118 |
'blured_in_versions' => array( 'free', 'ps', 'bs' ), |
| 1119 |
'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#advanced-days-selection' ), |
| 1120 |
'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ), |
| 1121 |
'versions' => 'Business Medium / Large, MultiUser versions', |
| 1122 |
'css' => 'transform: translate(0) translateY(120px);' |
| 1123 |
) ); |
| 1124 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 1125 |
echo $upgrade_content_arr['content']; |
| 1126 |
|
| 1127 |
//-------------------------------------------------------------------------------------------------------------- |
| 1128 |
// Conditions for Weekdays selection |
| 1129 |
//-------------------------------------------------------------------------------------------------------------- |
| 1130 |
?><div class="wpbc_shortcode_config__rules_container wpbc_dismiss__conditional_days <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>"> |
| 1131 |
|
| 1132 |
<div class="wpbc_shortcode_config__rules__params_section wpbc_select_day_weekday"> |
| 1133 |
|
| 1134 |
<div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row"> |
| 1135 |
<div class="ui_container ui_container_mini ui_container_weekdays"> |
| 1136 |
<?php |
| 1137 |
|
| 1138 |
$week_days_arr = array( |
| 1139 |
1 => __( 'Mo', 'booking' ) |
| 1140 |
, 2 => __( 'Tu', 'booking' ) |
| 1141 |
, 3 => __( 'We', 'booking' ) |
| 1142 |
, 4 => __( 'Th', 'booking' ) |
| 1143 |
, 5 => __( 'Fr', 'booking' ) |
| 1144 |
, 6 => __( 'Sa', 'booking' ) |
| 1145 |
, 0 => __( 'Su', 'booking' ) |
| 1146 |
); |
| 1147 |
foreach ( $week_days_arr as $weekday_key => $weekday_title ) { |
| 1148 |
|
| 1149 |
?><div class="ui_group ui_group_weekdays_checkboxes"><?php |
| 1150 |
|
| 1151 |
?><div class="ui_element"><?php |
| 1152 |
|
| 1153 |
WPBC_Settings_API::field_checkbox_row_static( $id . '__weekday_' . $weekday_key |
| 1154 |
, array( |
| 1155 |
'type' => 'checkbox' |
| 1156 |
, 'title' => '' |
| 1157 |
, 'description' => '' |
| 1158 |
, 'description_tag' => 'span' |
| 1159 |
, 'label' => $weekday_title |
| 1160 |
, 'class' => '' |
| 1161 |
, 'css' => '' |
| 1162 |
, 'tr_class' => '' |
| 1163 |
, 'attr' => array() |
| 1164 |
, 'group' => $group_key |
| 1165 |
, 'only_field' => true |
| 1166 |
, 'is_new_line' => false |
| 1167 |
, 'value' => false |
| 1168 |
) |
| 1169 |
); |
| 1170 |
|
| 1171 |
?></div> |
| 1172 |
<div class="ui_element"><?php |
| 1173 |
|
| 1174 |
$placeholder = ''; |
| 1175 |
switch ( $weekday_key ) { |
| 1176 |
case 0: $placeholder = '1-7'; break; |
| 1177 |
case 1: $placeholder = '5,7'; break; |
| 1178 |
case 2: $placeholder = '3,4'; break; |
| 1179 |
case 3: $placeholder = '5'; break; |
| 1180 |
case 4: $placeholder = '4'; break; |
| 1181 |
case 5: $placeholder = '3'; break; |
| 1182 |
case 6: $placeholder = '2-7'; break; |
| 1183 |
} |
| 1184 |
|
| 1185 |
WPBC_Settings_API::field_text_row_static( $id . '__days_number_' . $weekday_key |
| 1186 |
, array( |
| 1187 |
'type' => 'text' |
| 1188 |
, 'placeholder' => $placeholder |
| 1189 |
, 'class' => 'wpbc_dates_conditions_value_weekday' |
| 1190 |
, 'css' => '' |
| 1191 |
, 'only_field' => true |
| 1192 |
, 'attr' => array() |
| 1193 |
, 'value' => '' |
| 1194 |
) |
| 1195 |
); |
| 1196 |
|
| 1197 |
?></div> |
| 1198 |
<div class="ui_element"><?php |
| 1199 |
?><div class="wpbc_ui_control" style="line-height: 2;"><?php esc_html_e('days to select' ,'booking'); ?></div><?php |
| 1200 |
?></div><?php |
| 1201 |
|
| 1202 |
?></div><?php |
| 1203 |
} |
| 1204 |
|
| 1205 |
?> |
| 1206 |
</div> |
| 1207 |
</div> |
| 1208 |
|
| 1209 |
<div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row"> |
| 1210 |
<div class="ui_container ui_container_mini"> |
| 1211 |
<div class="ui_group"><?php |
| 1212 |
|
| 1213 |
?><div class="ui_element"> |
| 1214 |
<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> |
| 1215 |
</div><?php |
| 1216 |
?><div class="ui_element"> |
| 1217 |
<a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_weekday__reset('<?php echo esc_attr( $id ); ?>');" |
| 1218 |
class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger" ><?php esc_html_e('Reset','booking'); ?></a> |
| 1219 |
</div><?php |
| 1220 |
|
| 1221 |
?> |
| 1222 |
</div> |
| 1223 |
</div> |
| 1224 |
</div> |
| 1225 |
|
| 1226 |
</div> |
| 1227 |
|
| 1228 |
<div class="wpbc_shortcode_config__rules__help_section"> |
| 1229 |
<div class="wpbc-settings-notice notice-info notice-header"> |
| 1230 |
<span><?php esc_html_e( 'Specify the number of days to select when starting the selection on a specific weekday.', 'booking' ); ?></span> |
| 1231 |
</div> |
| 1232 |
<div class="wpbc-settings-notice notice-info notice-list"> |
| 1233 |
<ol> |
| 1234 |
<li> |
| 1235 |
<?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' ); ?> |
| 1236 |
</li> |
| 1237 |
<li> |
| 1238 |
<?php |
| 1239 |
echo '<strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>' |
| 1240 |
. '<code>{select-day condition="weekday" for="1" value="5,7"},{select-day condition="weekday" for="6" value="2-7"}</code>'; |
| 1241 |
?> |
| 1242 |
</li> |
| 1243 |
<li> |
| 1244 |
<?php |
| 1245 |
/* translators: 1: ... */ |
| 1246 |
echo wp_kses_post( sprintf( __( 'Check the FAQ for details on %1$sshortcode configuration%2$s, especially this %3$soption%4$s.' , 'booking' ) |
| 1247 |
, '<a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/" target="_blank">', '</a>' |
| 1248 |
, '<strong><a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/#booking-options-condition" target="_blank">', '</a></strong>' ) ); |
| 1249 |
?> |
| 1250 |
</li> |
| 1251 |
<li> |
| 1252 |
<?php |
| 1253 |
/* translators: 1: ... */ |
| 1254 |
echo wp_kses_post( sprintf( __( 'Explore %1$sJavaScript customization%2$s for advanced different day selection in different calendars.', 'booking' ) |
| 1255 |
, '<a href="https://wpbookingcalendar.com/faq/advanced-javascript-for-the-booking-shortcodes/" target="_blank">','</a>') ); |
| 1256 |
?> |
| 1257 |
</li> |
| 1258 |
</ol> |
| 1259 |
</div> |
| 1260 |
<textarea id="<?php echo esc_attr( $id ); ?>_textarea" name="<?php echo esc_attr( $id ); ?>_textarea" style="width:100%;margin-top:15px;"></textarea> |
| 1261 |
</div> |
| 1262 |
</div><?php |
| 1263 |
|
| 1264 |
} |
| 1265 |
|
| 1266 |
|
| 1267 |
/** |
| 1268 |
* Season Days Selection - Condition fields for 'option' parameter. |
| 1269 |
* |
| 1270 |
* @param $id |
| 1271 |
* @param $group_key |
| 1272 |
* |
| 1273 |
* @return void |
| 1274 |
*/ |
| 1275 |
function wpbc_shortcode_config_fields__season_conditions( $id, $group_key ) { |
| 1276 |
|
| 1277 |
//-------------------------------------------------------------------------------------------------------------- |
| 1278 |
// 'Upgrade to Pro' widget |
| 1279 |
//-------------------------------------------------------------------------------------------------------------- |
| 1280 |
$upgrade_content_arr = wpbc_get_upgrade_widget( array( |
| 1281 |
'id' => $id . '_' . 'conditional_days_seasons', |
| 1282 |
'dismiss_css_class' => '.wpbc_dismiss__conditional_days', |
| 1283 |
'blured_in_versions' => array( 'free', 'ps', 'bs' ), |
| 1284 |
'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#advanced-days-selection' ), |
| 1285 |
'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ), |
| 1286 |
'versions' => 'Business Medium / Large, MultiUser versions', |
| 1287 |
'css' => 'transform: translate(0) translateY(120px);' |
| 1288 |
) ); |
| 1289 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 1290 |
echo $upgrade_content_arr['content']; |
| 1291 |
|
| 1292 |
//-------------------------------------------------------------------------------------------------------------- |
| 1293 |
// Conditions for Seasons days selection |
| 1294 |
//-------------------------------------------------------------------------------------------------------------- |
| 1295 |
|
| 1296 |
$options = wpbc_shortcode_config_fields__get_options_for_seasons(); |
| 1297 |
|
| 1298 |
?><div class="wpbc_shortcode_config__rules_container wpbc_dismiss__conditional_days <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>"> |
| 1299 |
<div class="wpbc_shortcode_config__rules__params_section wpbc_select_day_season"> |
| 1300 |
|
| 1301 |
<div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row"> |
| 1302 |
<div class="ui_container ui_container_mini"> |
| 1303 |
<div class="ui_group"> |
| 1304 |
|
| 1305 |
<div class="ui_element"> |
| 1306 |
<div class="wpbc_ui_control" style="line-height: 2;"> |
| 1307 |
<span><?php esc_html_e('In season' ,'booking'); ?></span> |
| 1308 |
</div> |
| 1309 |
</div> |
| 1310 |
|
| 1311 |
<div class="ui_element wpdevelop"><?php |
| 1312 |
WPBC_Settings_API::field_select_row_static( $id . '__season_filter_name' |
| 1313 |
, array( |
| 1314 |
'type' => 'select' |
| 1315 |
, 'title' => '' |
| 1316 |
, 'label' => '' |
| 1317 |
, 'disabled' => false |
| 1318 |
, 'disabled_options' => array() |
| 1319 |
, 'multiple' => false |
| 1320 |
, 'description' => '' |
| 1321 |
, 'description_tag' => 'span' |
| 1322 |
, 'group' => $group_key |
| 1323 |
, 'tr_class' => '' |
| 1324 |
, 'class' => 'wpbc_ui_control wpbc_ui_select' |
| 1325 |
, 'css' => 'max-width: Min(14em, 100%);flex: 0 1 auto;width: 14em;border-radius:3px 0 0 3px;' |
| 1326 |
, 'only_field' => true |
| 1327 |
, 'attr' => array() |
| 1328 |
, 'value' => '0' |
| 1329 |
, 'options' => $options |
| 1330 |
) |
| 1331 |
); |
| 1332 |
?><a href="<?php echo esc_url( wpbc_get_availability_url() . '' ); ?>" |
| 1333 |
title="<?php echo esc_attr( __( 'Add new season', 'booking' ) ); ?>" |
| 1334 |
class="wpbc_ui_control wpbc_ui_button tooltip_top" ><i class="menu_icon icon-1x wpbc_icn_add _circle_outline"></i></a><?php |
| 1335 |
?></div> |
| 1336 |
|
| 1337 |
</div> |
| 1338 |
</div> |
| 1339 |
|
| 1340 |
<div class="ui_container ui_container_mini"> |
| 1341 |
<div class="ui_group"> |
| 1342 |
|
| 1343 |
<div class="ui_element"> |
| 1344 |
<div class="wpbc_ui_control " style="line-height: 2;"><?php esc_html_e('allow to select' ,'booking'); ?></div> |
| 1345 |
</div> |
| 1346 |
|
| 1347 |
<div class="ui_element"><?php |
| 1348 |
WPBC_Settings_API::field_text_row_static( $id . '__days_number' |
| 1349 |
, array( |
| 1350 |
'type' => 'text' |
| 1351 |
, 'placeholder' => '5 ' . __( 'or', 'booking' ) . ' 1-7 ' . __( 'or', 'booking' ) . ' 1,5,7' |
| 1352 |
, 'class' => 'wpbc_ui_control wpbc_ui_text' |
| 1353 |
, 'css' => 'width:9em;border-radius:3px;' |
| 1354 |
, 'only_field' => true |
| 1355 |
, 'attr' => array() |
| 1356 |
, 'value' => '' |
| 1357 |
) |
| 1358 |
); |
| 1359 |
?></div> |
| 1360 |
|
| 1361 |
<div class="ui_element"> |
| 1362 |
<div class="wpbc_ui_control" style="line-height: 2;"><?php esc_html_e('days' ,'booking'); ?></div> |
| 1363 |
</div> |
| 1364 |
</div> |
| 1365 |
</div> |
| 1366 |
|
| 1367 |
<div class="ui_container ui_container_mini"> |
| 1368 |
<div class="ui_group"> |
| 1369 |
|
| 1370 |
<div class="ui_element"> |
| 1371 |
<a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_season__add('<?php echo esc_attr( $id ); ?>');" |
| 1372 |
class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_primary" ><?php esc_html_e('Add Rule','booking'); ?></a> |
| 1373 |
</div> |
| 1374 |
<div class="ui_element"> |
| 1375 |
<a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_season__reset('<?php echo esc_attr( $id ); ?>');" |
| 1376 |
class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger" ><?php esc_html_e('Reset','booking'); ?></a> |
| 1377 |
</div> |
| 1378 |
</div> |
| 1379 |
</div> |
| 1380 |
|
| 1381 |
</div> |
| 1382 |
</div> |
| 1383 |
<div class="wpbc_shortcode_config__rules__help_section"> |
| 1384 |
<div class="wpbc-settings-notice notice-info notice-header"> |
| 1385 |
<span><?php esc_html_e( 'Specify the number of days to select when starting the selection in a specific season.', 'booking' ); ?></span> |
| 1386 |
</div> |
| 1387 |
<div class="wpbc-settings-notice notice-info notice-list"> |
| 1388 |
<ol> |
| 1389 |
<li> |
| 1390 |
<?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' ); ?> |
| 1391 |
</li> |
| 1392 |
<li> |
| 1393 |
<?php |
| 1394 |
echo '<strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>' |
| 1395 |
. '<code>{select-day condition="season" for="High season" value="7-14,21"},{select-day condition="season" for="Low season" value="2-5"}</code>'; |
| 1396 |
?> |
| 1397 |
</li> |
| 1398 |
<li> |
| 1399 |
<?php |
| 1400 |
/* translators: 1: ... */ |
| 1401 |
echo wp_kses_post( sprintf( __( 'Check the FAQ for details on %1$sshortcode configuration%2$s, especially this %3$soption%4$s.' , 'booking' ) |
| 1402 |
, '<a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/" target="_blank">', '</a>' |
| 1403 |
, '<strong><a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/#booking-options-condition-seasons" target="_blank">', '</a></strong>' ) ); |
| 1404 |
?> |
| 1405 |
</li> |
| 1406 |
<li> |
| 1407 |
<?php |
| 1408 |
/* translators: 1: ... */ |
| 1409 |
echo wp_kses_post( sprintf( __( 'Explore %1$sJavaScript customization%2$s for advanced different day selection in different calendars.', 'booking' ) |
| 1410 |
, '<a href="https://wpbookingcalendar.com/faq/advanced-javascript-for-the-booking-shortcodes/" target="_blank">','</a>') ); |
| 1411 |
?> |
| 1412 |
</li> |
| 1413 |
</ol> |
| 1414 |
</div> |
| 1415 |
<textarea id="<?php echo esc_attr( $id ); ?>_textarea" name="<?php echo esc_attr( $id ); ?>_textarea" style="width:100%;margin:10px 0;"></textarea> |
| 1416 |
</div> |
| 1417 |
</div><?php |
| 1418 |
|
| 1419 |
} |
| 1420 |
|
| 1421 |
|
| 1422 |
/** |
| 1423 |
* Get Season Filters options - for selectbox in PopUp shortcode config |
| 1424 |
* |
| 1425 |
* @return array|array[] |
| 1426 |
*/ |
| 1427 |
function wpbc_shortcode_config_fields__get_options_for_seasons(){ |
| 1428 |
|
| 1429 |
if (function_exists('wpbc_sf_cache')) { |
| 1430 |
// ----------------------------------------------------------------------------------------------------------------- |
| 1431 |
// Get Season Filters data: |
| 1432 |
// ----------------------------------------------------------------------------------------------------------------- |
| 1433 |
$wpbc_sf_cache = wpbc_sf_cache(); |
| 1434 |
/** |
| 1435 |
* $wpbc_sf_cache->get_data() = [ |
| 1436 |
* 1 => [ |
| 1437 |
* booking_filter_id = "1" |
| 1438 |
* title = "Weekend" |
| 1439 |
* filter = "a:4:{s:8:"weekdays";a:7..." |
| 1440 |
* users = "1" |
| 1441 |
* id = "1" |
| 1442 |
*/ |
| 1443 |
$season_filter_arr = $wpbc_sf_cache->get_data(); |
| 1444 |
} else { |
| 1445 |
$season_filter_arr = array(); |
| 1446 |
} |
| 1447 |
// $wpbc_br_cache = wpbc_br_cache(); |
| 1448 |
/* |
| 1449 |
$wpbc_br_cache->get_resources() = [ |
| 1450 |
1 = [ |
| 1451 |
booking_type_id = "1" |
| 1452 |
title = "Standard" |
| 1453 |
users = "1" |
| 1454 |
import = null |
| 1455 |
export = "/ics/wpbm.ics" |
| 1456 |
cost = "25" |
| 1457 |
default_form = "standard" |
| 1458 |
prioritet = "1" |
| 1459 |
parent = "0" |
| 1460 |
visitors = "2" |
| 1461 |
id = "1" |
| 1462 |
count = {int} 5 |
| 1463 |
7 = [... |
| 1464 |
*/ |
| 1465 |
$current_user_id = wpbc_get_current_user_id(); |
| 1466 |
|
| 1467 |
$options = array( |
| 1468 |
0 => array( |
| 1469 |
'title' => ' - ' . __( 'Please Select', 'booking' ) . ' - ', |
| 1470 |
'attr' => array( 'style' => 'color:#999;font-weight: 400;' ) |
| 1471 |
) |
| 1472 |
); |
| 1473 |
foreach ( $season_filter_arr as $filter_id => $filter_arr ) { |
| 1474 |
|
| 1475 |
$options[ $filter_arr['id'] ] = $filter_arr; |
| 1476 |
|
| 1477 |
// MultiUser functionality for regular users showing season filters. |
| 1478 |
if ( ( class_exists( 'wpdev_bk_multiuser' ) ) && ( ! empty( $filter_arr['users'] ) ) ) { |
| 1479 |
|
| 1480 |
// Is current user suer booking admin and if this user was simulated log in |
| 1481 |
$season_user_id = intval( $filter_arr['users'] ); |
| 1482 |
$is_user_super_admin = apply_bk_filter( 'is_user_super_admin', $season_user_id ); |
| 1483 |
|
| 1484 |
if ( ( ! $is_user_super_admin ) && ( $current_user_id != $season_user_id ) ) { |
| 1485 |
$options[ $filter_arr['id'] ]['attr'] = array( 'style' => 'color:#a43232;font-weight: 400;font-style: italic;' ); |
| 1486 |
$user_name = get_userdata( $season_user_id ); |
| 1487 |
$user_name = $user_name->display_name; |
| 1488 |
$options[ $filter_arr['id'] ]['title'] .= ' (' . __( 'Regular User', 'booking' ) . ': ' . $user_name . ')'; |
| 1489 |
} |
| 1490 |
} |
| 1491 |
} |
| 1492 |
|
| 1493 |
return $options; |
| 1494 |
|
| 1495 |
} |
| 1496 |
|
| 1497 |
|
| 1498 |
/** |
| 1499 |
* Season Days Start Day - Condition fields for 'option' parameter. |
| 1500 |
* |
| 1501 |
* @param $id |
| 1502 |
* @param $group_key |
| 1503 |
* |
| 1504 |
* @return void |
| 1505 |
*/ |
| 1506 |
function wpbc_shortcode_config_fields__season_start_day_conditions( $id, $group_key ) { |
| 1507 |
|
| 1508 |
//-------------------------------------------------------------------------------------------------------------- |
| 1509 |
// 'Upgrade to Pro' widget |
| 1510 |
//-------------------------------------------------------------------------------------------------------------- |
| 1511 |
$upgrade_content_arr = wpbc_get_upgrade_widget( array( |
| 1512 |
'id' => $id . '_' . 'conditional_days_startday', |
| 1513 |
'dismiss_css_class' => '.wpbc_dismiss__conditional_days', |
| 1514 |
'blured_in_versions' => array( 'free', 'ps', 'bs' ), |
| 1515 |
'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#advanced-days-selection' ), |
| 1516 |
'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ), |
| 1517 |
'versions' => 'Business Medium / Large, MultiUser versions', |
| 1518 |
'css' => 'transform: translate(0) translateY(120px);' |
| 1519 |
) ); |
| 1520 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 1521 |
echo $upgrade_content_arr['content']; |
| 1522 |
|
| 1523 |
//-------------------------------------------------------------------------------------------------------------- |
| 1524 |
// Conditions for Seasons days START selection |
| 1525 |
//-------------------------------------------------------------------------------------------------------------- |
| 1526 |
|
| 1527 |
$options = wpbc_shortcode_config_fields__get_options_for_seasons(); |
| 1528 |
|
| 1529 |
?><div class="wpbc_shortcode_config__rules_container wpbc_dismiss__conditional_days <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>"> |
| 1530 |
<div class="wpbc_shortcode_config__rules__params_section wpbc_start_day_season"> |
| 1531 |
|
| 1532 |
<div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row"> |
| 1533 |
<div class="ui_container ui_container_mini"> |
| 1534 |
<div class="ui_group"> |
| 1535 |
<div class="ui_element"> |
| 1536 |
<div class="wpbc_ui_control" style="line-height: 2;"> |
| 1537 |
<span><?php esc_html_e('In season' ,'booking'); ?></span> |
| 1538 |
</div> |
| 1539 |
</div> |
| 1540 |
<div class="ui_element wpdevelop"><?php |
| 1541 |
|
| 1542 |
WPBC_Settings_API::field_select_row_static( $id . '__season_filter_name' |
| 1543 |
, array( |
| 1544 |
'type' => 'select' |
| 1545 |
, 'title' => '' |
| 1546 |
, 'label' => '' |
| 1547 |
, 'disabled' => false |
| 1548 |
, 'disabled_options' => array() |
| 1549 |
, 'multiple' => false |
| 1550 |
, 'description' => '' |
| 1551 |
, 'description_tag' => 'span' |
| 1552 |
, 'group' => $group_key |
| 1553 |
, 'tr_class' => '' |
| 1554 |
, 'class' => 'wpbc_ui_control wpbc_ui_select' |
| 1555 |
, 'css' => 'max-width: Min(14em, 100%);flex: 0 1 auto;width: 14em;border-radius:3px 0 0 3px;' |
| 1556 |
, 'only_field' => true |
| 1557 |
, 'attr' => array() |
| 1558 |
, 'value' => '0' |
| 1559 |
, 'options' => $options |
| 1560 |
) |
| 1561 |
); |
| 1562 |
|
| 1563 |
?><a href="<?php echo esc_url( wpbc_get_availability_url() . '' ); ?>" |
| 1564 |
title="<?php echo esc_attr( __( 'Add new season', 'booking' ) ); ?>" |
| 1565 |
class="wpbc_ui_control wpbc_ui_button tooltip_top" ><i class="menu_icon icon-1x wpbc_icn_add _circle_outline"></i></a><?php |
| 1566 |
|
| 1567 |
?></div> |
| 1568 |
</div> |
| 1569 |
</div> |
| 1570 |
</div> |
| 1571 |
<div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row"> |
| 1572 |
<div class="ui_container ui_container_mini ui_container_weekdays"> |
| 1573 |
<div class="ui_group"> |
| 1574 |
<div class="ui_element"> |
| 1575 |
<div class="wpbc_ui_control " style="line-height: 2;"><?php |
| 1576 |
esc_html_e('allow to start days selection only for these weekdays' ,'booking'); |
| 1577 |
?></div> |
| 1578 |
</div> |
| 1579 |
</div> |
| 1580 |
<div class="ui_group ui_group_weekdays_checkboxes"><?php |
| 1581 |
|
| 1582 |
$week_days_arr = array( |
| 1583 |
1 => __( 'Mo', 'booking' ) |
| 1584 |
, 2 => __( 'Tu', 'booking' ) |
| 1585 |
, 3 => __( 'We', 'booking' ) |
| 1586 |
, 4 => __( 'Th', 'booking' ) |
| 1587 |
, 5 => __( 'Fr', 'booking' ) |
| 1588 |
, 6 => __( 'Sa', 'booking' ) |
| 1589 |
, 0 => __( 'Su', 'booking' ) |
| 1590 |
); |
| 1591 |
foreach ( $week_days_arr as $weekday_key => $weekday_title ) { |
| 1592 |
|
| 1593 |
?><div class="ui_element"><?php |
| 1594 |
|
| 1595 |
WPBC_Settings_API::field_checkbox_row_static( $id . '__weekday_' . $weekday_key |
| 1596 |
, array( |
| 1597 |
'type' => 'checkbox' |
| 1598 |
, 'title' => '' |
| 1599 |
, 'description' => '' |
| 1600 |
, 'description_tag' => 'span' |
| 1601 |
, 'label' => $weekday_title |
| 1602 |
, 'class' => '' |
| 1603 |
, 'css' => '' |
| 1604 |
, 'tr_class' => '' |
| 1605 |
, 'attr' => array() |
| 1606 |
, 'group' => $group_key |
| 1607 |
, 'only_field' => true |
| 1608 |
, 'is_new_line' => false |
| 1609 |
, 'value' => false |
| 1610 |
) |
| 1611 |
); |
| 1612 |
?></div><?php |
| 1613 |
|
| 1614 |
} |
| 1615 |
|
| 1616 |
?></div> |
| 1617 |
</div> |
| 1618 |
</div> |
| 1619 |
<div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row"> |
| 1620 |
<div class="ui_container ui_container_mini"> |
| 1621 |
<div class="ui_group"><?php |
| 1622 |
|
| 1623 |
?><div class="ui_element"> |
| 1624 |
<a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__start_day_season__add('<?php echo esc_attr( $id ); ?>');" |
| 1625 |
class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_primary" ><?php esc_html_e('Add Rule','booking'); ?></a> |
| 1626 |
</div><?php |
| 1627 |
?><div class="ui_element"> |
| 1628 |
<a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__start_day_season__reset('<?php echo esc_attr( $id ); ?>');" |
| 1629 |
class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger" ><?php esc_html_e('Reset','booking'); ?></a> |
| 1630 |
</div><?php |
| 1631 |
|
| 1632 |
?> |
| 1633 |
</div> |
| 1634 |
</div> |
| 1635 |
</div> |
| 1636 |
</div> |
| 1637 |
<div class="wpbc_shortcode_config__rules__help_section"> |
| 1638 |
<div class="wpbc-settings-notice notice-info notice-header"> |
| 1639 |
<span><?php esc_html_e( 'Specify the weekdays as start days for selection when starting the selection in a specific season.', 'booking' ); ?></span> |
| 1640 |
</div> |
| 1641 |
<div class="wpbc-settings-notice notice-info notice-list"> |
| 1642 |
<ol> |
| 1643 |
<li> |
| 1644 |
<?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' ); ?> |
| 1645 |
</li> |
| 1646 |
<li> |
| 1647 |
<?php |
| 1648 |
echo '<strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>' |
| 1649 |
. '<code>{start-day condition="season" for="Low season" value="0,5"}</code>'; |
| 1650 |
?> |
| 1651 |
</li> |
| 1652 |
<li> |
| 1653 |
<?php |
| 1654 |
/* translators: 1: ... */ |
| 1655 |
echo wp_kses_post( sprintf( __( 'Check the FAQ for details on %1$sshortcode configuration%2$s, especially this %3$soption%4$s.' , 'booking' ) |
| 1656 |
, '<a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/" target="_blank">', '</a>' |
| 1657 |
, '<strong><a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/#booking-options-start-day-condition" target="_blank">', '</a></strong>' ) ); |
| 1658 |
?> |
| 1659 |
</li> |
| 1660 |
<li> |
| 1661 |
<?php |
| 1662 |
/* translators: 1: ... */ |
| 1663 |
echo wp_kses_post( sprintf( __( 'Explore %1$sJavaScript customization%2$s for advanced different day selection in different calendars.', 'booking' ) |
| 1664 |
, '<a href="https://wpbookingcalendar.com/faq/advanced-javascript-for-the-booking-shortcodes/" target="_blank">','</a>') ); |
| 1665 |
?> |
| 1666 |
</li> |
| 1667 |
</ol> |
| 1668 |
</div> |
| 1669 |
<textarea id="<?php echo esc_attr( $id ); ?>_textarea" name="<?php echo esc_attr( $id ); ?>_textarea" style="width:100%;margin:10px 0;"></textarea> |
| 1670 |
</div> |
| 1671 |
</div><?php |
| 1672 |
|
| 1673 |
} |
| 1674 |
|
| 1675 |
|
| 1676 |
|
| 1677 |
/** |
| 1678 |
* Dates Condition - Set Number of Days to Select, if start selection on specific date '2024-02-14' |
| 1679 |
* |
| 1680 |
* Config dialog for Booking Calendar shortcode |
| 1681 |
* |
| 1682 |
* @param $id |
| 1683 |
* @param $group_key |
| 1684 |
* |
| 1685 |
* @return void |
| 1686 |
*/ |
| 1687 |
function wpbc_shortcode_config_fields__fordate_conditions( $id, $group_key ) { |
| 1688 |
|
| 1689 |
//-------------------------------------------------------------------------------------------------------------- |
| 1690 |
// 'Upgrade to Pro' widget |
| 1691 |
//-------------------------------------------------------------------------------------------------------------- |
| 1692 |
$upgrade_content_arr = wpbc_get_upgrade_widget( array( |
| 1693 |
'id' => $id . '_' . 'conditional_days_fordate', |
| 1694 |
'dismiss_css_class' => '.wpbc_dismiss__conditional_days', |
| 1695 |
'blured_in_versions' => array( 'free', 'ps', 'bs' ), |
| 1696 |
'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#advanced-days-selection' ), |
| 1697 |
'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ), |
| 1698 |
'versions' => 'Business Medium / Large, MultiUser versions', |
| 1699 |
'css' => 'transform: translate(0) translateY(120px);' |
| 1700 |
) ); |
| 1701 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 1702 |
echo $upgrade_content_arr['content']; |
| 1703 |
|
| 1704 |
//-------------------------------------------------------------------------------------------------------------- |
| 1705 |
// Conditions for DATE selection |
| 1706 |
//-------------------------------------------------------------------------------------------------------------- |
| 1707 |
|
| 1708 |
?><div class="wpbc_shortcode_config__rules_container wpbc_dismiss__conditional_days <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>"> |
| 1709 |
<div class="wpbc_shortcode_config__rules__params_section wpbc_select_fordate"> |
| 1710 |
|
| 1711 |
<div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row"> |
| 1712 |
<div class="ui_container ui_container_mini"> |
| 1713 |
<div class="ui_group"> |
| 1714 |
|
| 1715 |
<div class="ui_element"> |
| 1716 |
<div class="wpbc_ui_control" style="line-height: 2;"> |
| 1717 |
<span><?php esc_html_e('For date' ,'booking'); ?></span> |
| 1718 |
</div> |
| 1719 |
</div> |
| 1720 |
|
| 1721 |
<div class="ui_element wpdevelop"><?php |
| 1722 |
WPBC_Settings_API::field_text_row_static( $id . '__date' |
| 1723 |
, array( |
| 1724 |
'type' => 'text' |
| 1725 |
, 'placeholder' => '2024-02-14' |
| 1726 |
, 'class' => 'wpbc_ui_control wpbc_ui_text' |
| 1727 |
, 'css' => 'width:9em;border-radius:3px;' |
| 1728 |
, 'only_field' => true |
| 1729 |
, 'attr' => array() |
| 1730 |
, 'value' => '' |
| 1731 |
) |
| 1732 |
); |
| 1733 |
?></div> |
| 1734 |
|
| 1735 |
</div> |
| 1736 |
</div> |
| 1737 |
|
| 1738 |
<div class="ui_container ui_container_mini"> |
| 1739 |
<div class="ui_group"> |
| 1740 |
|
| 1741 |
<div class="ui_element"> |
| 1742 |
<div class="wpbc_ui_control " style="line-height: 2;"><?php esc_html_e('allow to select' ,'booking'); ?></div> |
| 1743 |
</div> |
| 1744 |
|
| 1745 |
<div class="ui_element"><?php |
| 1746 |
WPBC_Settings_API::field_text_row_static( $id . '__days_number' |
| 1747 |
, array( |
| 1748 |
'type' => 'text' |
| 1749 |
, 'placeholder' => '5 ' . __( 'or', 'booking' ) . ' 1-7 ' . __( 'or', 'booking' ) . ' 1,5,7' |
| 1750 |
, 'class' => 'wpbc_ui_control wpbc_ui_text' |
| 1751 |
, 'css' => 'width:9em;border-radius:3px;' |
| 1752 |
, 'only_field' => true |
| 1753 |
, 'attr' => array() |
| 1754 |
, 'value' => '' |
| 1755 |
) |
| 1756 |
); |
| 1757 |
?></div> |
| 1758 |
|
| 1759 |
<div class="ui_element"> |
| 1760 |
<div class="wpbc_ui_control" style="line-height: 2;"><?php esc_html_e('days' ,'booking'); ?></div> |
| 1761 |
</div> |
| 1762 |
</div> |
| 1763 |
</div> |
| 1764 |
|
| 1765 |
<div class="ui_container ui_container_mini"> |
| 1766 |
<div class="ui_group"> |
| 1767 |
|
| 1768 |
<div class="ui_element"> |
| 1769 |
<a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_fordate__add('<?php echo esc_attr( $id ); ?>');" |
| 1770 |
class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_primary" ><?php esc_html_e('Add Rule','booking'); ?></a> |
| 1771 |
</div> |
| 1772 |
<div class="ui_element"> |
| 1773 |
<a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_fordate__reset('<?php echo esc_attr( $id ); ?>');" |
| 1774 |
class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger" ><?php esc_html_e('Reset','booking'); ?></a> |
| 1775 |
</div> |
| 1776 |
</div> |
| 1777 |
</div> |
| 1778 |
|
| 1779 |
</div> |
| 1780 |
</div> |
| 1781 |
<div class="wpbc_shortcode_config__rules__help_section"> |
| 1782 |
<div class="wpbc-settings-notice notice-info notice-header"> |
| 1783 |
<span><?php esc_html_e( 'Specify the number of days to select when starting the selection on a specific date.', 'booking' ); ?></span> |
| 1784 |
</div> |
| 1785 |
<div class="wpbc-settings-notice notice-info notice-list"> |
| 1786 |
<ol> |
| 1787 |
<li> |
| 1788 |
<?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' ); ?> |
| 1789 |
</li> |
| 1790 |
<li> |
| 1791 |
<?php |
| 1792 |
echo '<strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>' |
| 1793 |
. '<code>{select-day condition="date" for="2027-02-15" value="7,14,21"}</code>'; |
| 1794 |
?> |
| 1795 |
</li> |
| 1796 |
<li> |
| 1797 |
<?php |
| 1798 |
/* translators: 1: ... */ |
| 1799 |
echo wp_kses_post( sprintf( __( 'Check the FAQ for details on %1$sshortcode configuration%2$s, especially this %3$soption%4$s.' , 'booking' ) |
| 1800 |
, '<a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/" target="_blank">', '</a>' |
| 1801 |
, '<strong><a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/#aggregate" target="_blank">', '</a></strong>' ) ); |
| 1802 |
?> |
| 1803 |
</li> |
| 1804 |
<li> |
| 1805 |
<?php |
| 1806 |
/* translators: 1: ... */ |
| 1807 |
echo wp_kses_post( sprintf( __( 'Explore %1$sJavaScript customization%2$s for advanced different day selection in different calendars.', 'booking' ) |
| 1808 |
, '<a href="https://wpbookingcalendar.com/faq/advanced-javascript-for-the-booking-shortcodes/" target="_blank">','</a>') ); |
| 1809 |
?> |
| 1810 |
</li> |
| 1811 |
</ol> |
| 1812 |
</div> |
| 1813 |
<textarea id="<?php echo esc_attr( $id ); ?>_textarea" name="<?php echo esc_attr( $id ); ?>_textarea" style="width:100%;margin:10px 0;"></textarea> |
| 1814 |
</div> |
| 1815 |
</div><?php |
| 1816 |
|
| 1817 |
} |
| 1818 |
|
| 1819 |
|
| 1820 |
// ===================================================================================================================== |
| 1821 |
// Shared fields for modern workflow shortcodes. |
| 1822 |
// ===================================================================================================================== |
| 1823 |
|
| 1824 |
/** |
| 1825 |
* Return Booking Resources in the established shortcode-popup option format. |
| 1826 |
* |
| 1827 |
* Personal and higher editions already expose the hierarchy-aware resource |
| 1828 |
* list used by the legacy shortcode controls. The fallback keeps the default |
| 1829 |
* resource selectable in editions where that list is intentionally empty. |
| 1830 |
* |
| 1831 |
* @param bool $include_empty Whether to prepend an empty automatic choice. |
| 1832 |
* @param string $empty_title Label for the empty choice. |
| 1833 |
* |
| 1834 |
* @return array<int|string,array<string,mixed>|string> Booking Resource options. |
| 1835 |
*/ |
| 1836 |
function wpbc_shortcode_config__workflow_resource_options( $include_empty = false, $empty_title = '' ) { |
| 1837 |
$options = array(); |
| 1838 |
if ( $include_empty ) { |
| 1839 |
$options[''] = array( |
| 1840 |
'title' => $empty_title ? $empty_title : __( 'No preselection', 'booking' ), |
| 1841 |
'attr' => array( 'class' => 'wpbc_single_resource' ), |
| 1842 |
); |
| 1843 |
} |
| 1844 |
|
| 1845 |
$resource_options = function_exists( 'wpbc_get_all_booking_resources_list' ) |
| 1846 |
? (array) wpbc_get_all_booking_resources_list() |
| 1847 |
: array(); |
| 1848 |
if ( empty( $resource_options ) && function_exists( 'wpbc_booking_resource_selector_get_catalog' ) ) { |
| 1849 |
foreach ( (array) wpbc_booking_resource_selector_get_catalog( array() ) as $resource_id => $resource ) { |
| 1850 |
$resource_options[ absint( $resource_id ) ] = array( |
| 1851 |
'title' => ! empty( $resource['title'] ) ? $resource['title'] : sprintf( __( 'Booking Resource #%d', 'booking' ), absint( $resource_id ) ), |
| 1852 |
'attr' => array( 'class' => 'wpbc_single_resource' ), |
| 1853 |
); |
| 1854 |
} |
| 1855 |
} |
| 1856 |
if ( empty( $resource_options ) && function_exists( 'wpbc_appointment_services_get_provider_options' ) ) { |
| 1857 |
foreach ( (array) wpbc_appointment_services_get_provider_options() as $resource_id => $resource_title ) { |
| 1858 |
$resource_options[ absint( $resource_id ) ] = array( |
| 1859 |
'title' => $resource_title, |
| 1860 |
'attr' => array( 'class' => 'wpbc_single_resource' ), |
| 1861 |
); |
| 1862 |
} |
| 1863 |
} |
| 1864 |
|
| 1865 |
return $options + $resource_options; |
| 1866 |
} |
| 1867 |
|
| 1868 |
/** |
| 1869 |
* Return the automatic, standard, and published Booking Form choices. |
| 1870 |
* |
| 1871 |
* The empty option is important for both workflow shortcodes: it preserves |
| 1872 |
* their automatic Service/Resource form resolution instead of silently |
| 1873 |
* forcing the Standard form merely by opening the popup. |
| 1874 |
* |
| 1875 |
* @return array<string,array<string,mixed>> Booking Form options keyed by public form slug. |
| 1876 |
*/ |
| 1877 |
function wpbc_shortcode_config__workflow_form_options() { |
| 1878 |
$options = array( |
| 1879 |
'' => array( 'title' => __( 'Automatic (Service or Resource default)', 'booking' ), 'attr' => array() ), |
| 1880 |
'standard' => array( 'title' => __( 'Standard', 'booking' ), 'attr' => array() ), |
| 1881 |
); |
| 1882 |
|
| 1883 |
if ( ! class_exists( 'WPBC_FE_Custom_Form_Helper' ) ) { |
| 1884 |
return $options; |
| 1885 |
} |
| 1886 |
|
| 1887 |
$is_allowed = apply_bk_filter( 'multiuser_is_user_can_be_here', true, 'only_super_admin' ); |
| 1888 |
if ( ! $is_allowed && 'On' !== get_bk_option( 'booking_is_custom_forms_for_regular_users' ) ) { |
| 1889 |
return $options; |
| 1890 |
} |
| 1891 |
|
| 1892 |
$owner_user_id = WPBC_FE_Custom_Form_Helper::wpbc_mu__get_current__owner_user_id(); |
| 1893 |
$custom_forms = WPBC_FE_Custom_Form_Helper::get_custom_booking_forms_list( |
| 1894 |
array( |
| 1895 |
'include_standard' => false, |
| 1896 |
'owner_user_id' => $owner_user_id, |
| 1897 |
'statuses' => array( 'published' ), |
| 1898 |
'list_mode' => 'auto', |
| 1899 |
) |
| 1900 |
); |
| 1901 |
if ( empty( $custom_forms ) ) { |
| 1902 |
return $options; |
| 1903 |
} |
| 1904 |
|
| 1905 |
$options['wpbc_workflow_forms_start'] = array( |
| 1906 |
'optgroup' => true, |
| 1907 |
'close' => false, |
| 1908 |
'title' => ' ' . __( 'Custom Forms', 'booking' ), |
| 1909 |
); |
| 1910 |
foreach ( $custom_forms as $form_key => $custom_form ) { |
| 1911 |
$form_slug = ! empty( $custom_form['name'] ) ? (string) $custom_form['name'] : (string) $form_key; |
| 1912 |
if ( '' === $form_slug ) { |
| 1913 |
continue; |
| 1914 |
} |
| 1915 |
$options[ $form_slug ] = array( |
| 1916 |
'title' => ! empty( $custom_form['title'] ) ? wpbc_lang( $custom_form['title'] ) : wpbc_lang( $form_slug ), |
| 1917 |
'attr' => array(), |
| 1918 |
); |
| 1919 |
} |
| 1920 |
$options['wpbc_workflow_forms_end'] = array( 'optgroup' => true, 'close' => true ); |
| 1921 |
|
| 1922 |
return $options; |
| 1923 |
} |
| 1924 |
|
| 1925 |
/** |
| 1926 |
* Render one modern workflow shortcode parameter using the established settings-row controls. |
| 1927 |
* |
| 1928 |
* Data attributes on the control provide one serializer contract. Display-text |
| 1929 |
* defaults are placed in the input so clearing a value intentionally generates |
| 1930 |
* an empty attribute instead of silently restoring the frontend default. |
| 1931 |
* |
| 1932 |
* @param string $shortcode_name Shortcode name without brackets. |
| 1933 |
* @param string $parameter_name Public shortcode parameter name. |
| 1934 |
* @param array<string,mixed> $field Field label, description, type, default, and validation metadata. |
| 1935 |
* |
| 1936 |
* @return void |
| 1937 |
*/ |
| 1938 |
function wpbc_shortcode_config__workflow_field( $shortcode_name, $parameter_name, $field ) { |
| 1939 |
$field = wp_parse_args( |
| 1940 |
$field, |
| 1941 |
array( |
| 1942 |
'title' => $parameter_name, |
| 1943 |
'description' => '', |
| 1944 |
'type' => 'text', |
| 1945 |
'value_type' => 'text', |
| 1946 |
'default' => '', |
| 1947 |
'placeholder' => '', |
| 1948 |
'options' => array(), |
| 1949 |
'attr' => array(), |
| 1950 |
'css' => 'width:100%;max-width:32em;', |
| 1951 |
'class' => '', |
| 1952 |
) |
| 1953 |
); |
| 1954 |
|
| 1955 |
$field_id = $shortcode_name . '_wpbc_' . $parameter_name; |
| 1956 |
$field_attr = array_merge( |
| 1957 |
(array) $field['attr'], |
| 1958 |
array( |
| 1959 |
'data-wpbc-shortcode-parameter' => $parameter_name, |
| 1960 |
'data-wpbc-shortcode-default' => is_bool( $field['default'] ) ? ( $field['default'] ? 'on' : 'off' ) : (string) $field['default'], |
| 1961 |
'data-wpbc-shortcode-value-type' => $field['value_type'], |
| 1962 |
) |
| 1963 |
); |
| 1964 |
$description = sprintf( |
| 1965 |
/* translators: %s: Shortcode parameter name. */ |
| 1966 |
__( 'Shortcode parameter: %s', 'booking' ), |
| 1967 |
'<code>' . esc_html( $parameter_name ) . '</code>' |
| 1968 |
); |
| 1969 |
if ( '' !== $field['description'] ) { |
| 1970 |
$description .= '<br>' . $field['description']; |
| 1971 |
} |
| 1972 |
|
| 1973 |
$common_args = array( |
| 1974 |
'title' => $field['title'], |
| 1975 |
'description' => $description, |
| 1976 |
'description_tag' => 'span', |
| 1977 |
'group' => $shortcode_name, |
| 1978 |
'tr_class' => $shortcode_name . '_standard_section', |
| 1979 |
'class' => trim( 'wpbc_shortcode_config__workflow_parameter ' . $field['class'] ), |
| 1980 |
'css' => $field['css'], |
| 1981 |
'only_field' => false, |
| 1982 |
'attr' => $field_attr, |
| 1983 |
); |
| 1984 |
|
| 1985 |
if ( 'checkbox' === $field['type'] ) { |
| 1986 |
WPBC_Settings_API::field_checkbox_row_static( |
| 1987 |
$field_id, |
| 1988 |
array_merge( |
| 1989 |
$common_args, |
| 1990 |
array( |
| 1991 |
'label' => $field['title'], |
| 1992 |
'value' => $field['default'] ? 'On' : 'Off', |
| 1993 |
'css' => '', |
| 1994 |
) |
| 1995 |
) |
| 1996 |
); |
| 1997 |
return; |
| 1998 |
} |
| 1999 |
|
| 2000 |
if ( in_array( $field['type'], array( 'select', 'multiselect' ), true ) ) { |
| 2001 |
WPBC_Settings_API::field_select_row_static( |
| 2002 |
$field_id, |
| 2003 |
array_merge( |
| 2004 |
$common_args, |
| 2005 |
array( |
| 2006 |
'value' => (string) $field['default'], |
| 2007 |
'options' => (array) $field['options'], |
| 2008 |
'multiple' => 'multiselect' === $field['type'], |
| 2009 |
) |
| 2010 |
) |
| 2011 |
); |
| 2012 |
return; |
| 2013 |
} |
| 2014 |
|
| 2015 |
WPBC_Settings_API::field_text_row_static( |
| 2016 |
$field_id, |
| 2017 |
array_merge( |
| 2018 |
$common_args, |
| 2019 |
array( |
| 2020 |
'type' => 'number' === $field['type'] ? 'number' : 'text', |
| 2021 |
'value' => (string) $field['default'], |
| 2022 |
'placeholder' => $field['placeholder'], |
| 2023 |
) |
| 2024 |
) |
| 2025 |
); |
| 2026 |
} |
| 2027 |
|
| 2028 |
/** |
| 2029 |
* Render top tabs for one modern workflow shortcode configuration. |
| 2030 |
* |
| 2031 |
* @param string $shortcode_name Shortcode name without brackets. |
| 2032 |
* @param array<string,array<string,string|bool>> $tabs Tab definitions keyed by section ID. |
| 2033 |
* |
| 2034 |
* @return void |
| 2035 |
*/ |
| 2036 |
function wpbc_shortcode_config__workflow_tabs( $shortcode_name, $tabs ) { |
| 2037 |
wpbc_bs_toolbar_tabs_html_container_start(); |
| 2038 |
|
| 2039 |
$tab_script = "jQuery(this).parents( '.wpbc_sc_container__shortcode' ).find( '.nav-tab' ).removeClass('nav-tab-active');" |
| 2040 |
. "jQuery(this).addClass('nav-tab-active');" |
| 2041 |
. "jQuery('.nav-tab i.icon-white').removeClass('icon-white');" |
| 2042 |
. "jQuery('.nav-tab-active i').addClass('icon-white');" |
| 2043 |
. "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section').hide();"; |
| 2044 |
|
| 2045 |
foreach ( $tabs as $section_id => $tab ) { |
| 2046 |
wpbc_bs_display_tab( |
| 2047 |
array( |
| 2048 |
'title' => $tab['title'], |
| 2049 |
'onclick' => $tab_script . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . ' .wpbc_sc_container__shortcode_section__' . $section_id . "').show();", |
| 2050 |
'font_icon' => $tab['icon'], |
| 2051 |
'default' => ! empty( $tab['default'] ), |
| 2052 |
) |
| 2053 |
); |
| 2054 |
} |
| 2055 |
|
| 2056 |
wpbc_bs_toolbar_tabs_html_container_end(); |
| 2057 |
} |
| 2058 |
|
| 2059 |
/** |
| 2060 |
* Render the standard previous/next controls used by shortcode popup sections. |
| 2061 |
* |
| 2062 |
* @return void |
| 2063 |
*/ |
| 2064 |
function wpbc_shortcode_config__workflow_pager() { |
| 2065 |
?> |
| 2066 |
<div class="wpbc_shortcode_config_content_toolbar__next_prior"> |
| 2067 |
<a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config_content_toolbar__next_prior(this,'prior');" class="button"> |
| 2068 |
<span class="in-button-text">‹</span> |
| 2069 |
</a> |
| 2070 |
<a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config_content_toolbar__next_prior(this,'next');" class="button"> |
| 2071 |
<span class="in-button-text">›</span> |
| 2072 |
</a> |
| 2073 |
</div> |
| 2074 |
<?php |
| 2075 |
} |
| 2076 |
|
| 2077 |
/** |
| 2078 |
* Render a complete parameter reference including compatibility-only aliases. |
| 2079 |
* |
| 2080 |
* @param array<string,string> $parameters Parameter descriptions keyed by accepted shortcode name. |
| 2081 |
* |
| 2082 |
* @return void |
| 2083 |
*/ |
| 2084 |
function wpbc_shortcode_config__workflow_parameter_reference( $parameters ) { |
| 2085 |
?> |
| 2086 |
<table class="widefat striped wpbc_shortcode_config__parameter_reference"> |
| 2087 |
<thead> |
| 2088 |
<tr> |
| 2089 |
<th scope="col"><?php esc_html_e( 'Parameter', 'booking' ); ?></th> |
| 2090 |
<th scope="col"><?php esc_html_e( 'Accepted value and behavior', 'booking' ); ?></th> |
| 2091 |
</tr> |
| 2092 |
</thead> |
| 2093 |
<tbody> |
| 2094 |
<?php foreach ( $parameters as $parameter_name => $description ) : ?> |
| 2095 |
<tr> |
| 2096 |
<th scope="row"><code><?php echo esc_html( $parameter_name ); ?></code></th> |
| 2097 |
<td><?php echo wp_kses_post( $description ); ?></td> |
| 2098 |
</tr> |
| 2099 |
<?php endforeach; ?> |
| 2100 |
</tbody> |
| 2101 |
</table> |
| 2102 |
<?php |
| 2103 |
} |
| 2104 |
|
| 2105 |
|
| 2106 |
// ===================================================================================================================== |
| 2107 |
// Shortcode [booking_appointment ...]. |
| 2108 |
// ===================================================================================================================== |
| 2109 |
|
| 2110 |
/** |
| 2111 |
* Get the popup field contract for the Appointment shortcode. |
| 2112 |
* |
| 2113 |
* The keys intentionally match the public parser-backed attribute names. The |
| 2114 |
* compatibility aliases are reference-only so newly generated shortcodes use |
| 2115 |
* the normalized progress_item_N_* form. |
| 2116 |
* |
| 2117 |
* @return array<string,array<string,mixed>> Appointment parameter fields. |
| 2118 |
*/ |
| 2119 |
function wpbc_shortcode_config__booking_appointment_parameters() { |
| 2120 |
$month_options = array_combine( range( 1, 24 ), range( 1, 24 ) ); |
| 2121 |
|
| 2122 |
$parameters = array( |
| 2123 |
'service_id' => array( |
| 2124 |
'section' => 'general', 'title' => __( 'Preselected Service', 'booking' ), 'type' => 'number', 'value_type' => 'positive_integer', 'default' => '', |
| 2125 |
'description' => __( 'Preselect and restrict the flow to one positive Service ID.', 'booking' ), 'attr' => array( 'min' => 1, 'step' => 1 ), |
| 2126 |
), |
| 2127 |
'provider_id' => array( |
| 2128 |
'section' => 'general', 'title' => __( 'Preselected Provider', 'booking' ), 'type' => 'select', 'value_type' => 'positive_integer', 'default' => '', |
| 2129 |
'options' => wpbc_shortcode_config__workflow_resource_options( true, __( 'No Provider preselected', 'booking' ) ), |
| 2130 |
'description' => __( 'Preselect and restrict the flow to one Provider Booking Resource.', 'booking' ), |
| 2131 |
), |
| 2132 |
'services' => array( |
| 2133 |
'section' => 'general', 'title' => __( 'Allowed Services', 'booking' ), 'value_type' => 'id_list', 'default' => '', 'placeholder' => '12,15', |
| 2134 |
'description' => __( 'Comma-, semicolon-, or whitespace-separated positive Service IDs, retained in the requested order.', 'booking' ), |
| 2135 |
), |
| 2136 |
'providers' => array( |
| 2137 |
'section' => 'general', 'title' => __( 'Allowed Providers', 'booking' ), 'type' => 'multiselect', 'value_type' => 'id_list', 'default' => '', |
| 2138 |
'options' => wpbc_shortcode_config__workflow_resource_options(), 'css' => 'width:100%;max-width:32em;height:12em;', |
| 2139 |
'description' => __( 'Select the Provider Booking Resources allowed in this Appointment flow. Leave every option unselected to allow all compatible Providers.', 'booking' ), |
| 2140 |
), |
| 2141 |
'auto_select_provider' => array( |
| 2142 |
'section' => 'general', 'title' => __( 'Auto-select the only Provider', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => false, |
| 2143 |
'description' => __( 'Skip Provider selection only when exactly one compatible Provider exists.', 'booking' ), |
| 2144 |
), |
| 2145 |
'catalog_layout' => array( |
| 2146 |
'section' => 'catalog', 'title' => __( 'Catalog layout', 'booking' ), 'type' => 'select', 'value_type' => 'text', 'default' => 'grid', |
| 2147 |
'options' => array( 'grid' => __( 'Responsive grid', 'booking' ), 'list' => __( 'List', 'booking' ) ), |
| 2148 |
'description' => __( 'Show Services and Providers as responsive cards or compact list items. Selecting List applies recommended display settings that you can adjust afterward.', 'booking' ), |
| 2149 |
), |
| 2150 |
'show_resource_filters' => array( |
| 2151 |
'section' => 'catalog', 'title' => __( 'Show catalog search', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => false, |
| 2152 |
'description' => __( 'Let visitors search the permitted Services or compatible Providers on the active selection screen.', 'booking' ), |
| 2153 |
), |
| 2154 |
'show_resource_image' => array( |
| 2155 |
'section' => 'catalog', 'title' => __( 'Show images', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => true, |
| 2156 |
'description' => __( 'Show configured Service pictures and Provider photos or generated initials.', 'booking' ), |
| 2157 |
), |
| 2158 |
'show_resource_title' => array( |
| 2159 |
'section' => 'catalog', 'title' => __( 'Show titles', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => true, |
| 2160 |
'description' => __( 'Show Service and Provider titles. Each title remains available to assistive technology when hidden.', 'booking' ), |
| 2161 |
), |
| 2162 |
'show_resource_description' => array( |
| 2163 |
'section' => 'catalog', 'title' => __( 'Show Service descriptions', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => true, |
| 2164 |
'description' => __( 'Show the public Service description when one is configured.', 'booking' ), |
| 2165 |
), |
| 2166 |
'catalog_item_width' => array( |
| 2167 |
'section' => 'catalog', 'title' => __( 'Catalog item width', 'booking' ), 'value_type' => 'css_width', 'default' => '', |
| 2168 |
'placeholder' => __( 'Automatic, 360px, or 50%', 'booking' ), |
| 2169 |
'description' => __( 'Optional explicit card or list-row width. Use px, %, em, rem, or vw. An items-per-row setting takes precedence for its active layout.', 'booking' ), |
| 2170 |
), |
| 2171 |
'catalog_item_max_width' => array( |
| 2172 |
'section' => 'catalog', 'title' => __( 'Maximum catalog item width', 'booking' ), 'type' => 'number', 'value_type' => 'positive_integer', 'default' => '', |
| 2173 |
'placeholder' => __( 'Automatic', 'booking' ), 'attr' => array( 'min' => 280, 'max' => 1200, 'step' => 1 ), |
| 2174 |
'description' => __( 'Optional maximum card or list-row width in pixels, from 280 through 1200. Leave empty to fill the available layout width.', 'booking' ), |
| 2175 |
), |
| 2176 |
'catalog_grid_items_per_row' => array( |
| 2177 |
'section' => 'catalog', 'title' => __( 'Grid items per row', 'booking' ), 'type' => 'number', 'value_type' => 'positive_integer', 'default' => '', |
| 2178 |
'placeholder' => __( 'Automatic', 'booking' ), 'attr' => array( 'min' => 1, 'max' => 12, 'step' => 1 ), |
| 2179 |
'description' => __( 'Optional exact number of equal-width items per row in the grid layout, from 1 through 12.', 'booking' ), |
| 2180 |
), |
| 2181 |
'catalog_list_items_per_row' => array( |
| 2182 |
'section' => 'catalog', 'title' => __( 'List items per row', 'booking' ), 'type' => 'number', 'value_type' => 'positive_integer', 'default' => '', |
| 2183 |
'placeholder' => __( 'One item per row', 'booking' ), 'attr' => array( 'min' => 1, 'max' => 12, 'step' => 1 ), |
| 2184 |
'description' => __( 'Optional number of equal-width items per row in the list layout, from 1 through 12. Empty keeps one item per row.', 'booking' ), |
| 2185 |
), |
| 2186 |
'show_resource_hierarchy' => array( |
| 2187 |
'section' => 'catalog', 'title' => __( 'Show Service relationship', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => true, |
| 2188 |
'description' => __( 'Explain that each listed Provider offers the selected Service.', 'booking' ), |
| 2189 |
), |
| 2190 |
'show_availability' => array( |
| 2191 |
'section' => 'catalog', 'title' => __( 'Show availability summary', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => true, |
| 2192 |
'description' => __( 'Show when a Provider has no weekly availability configured. Exact availability remains confirmed after dates are selected.', 'booking' ), |
| 2193 |
), |
| 2194 |
'show_starting_price' => array( |
| 2195 |
'section' => 'catalog', 'title' => __( 'Show starting price', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => true, |
| 2196 |
'description' => __( 'Show the effective Service or Provider price when pricing is available in this edition.', 'booking' ), |
| 2197 |
), |
| 2198 |
'nummonths' => array( |
| 2199 |
'section' => 'calendar', 'title' => __( 'Visible months', 'booking' ), 'type' => 'select', 'value_type' => 'positive_integer', 'default' => 1, 'options' => $month_options, |
| 2200 |
'description' => __( 'Number of calendar months from 1 through 24.', 'booking' ), |
| 2201 |
), |
| 2202 |
'startmonth' => array( |
| 2203 |
'section' => 'calendar', 'title' => __( 'Start month', 'booking' ), 'value_type' => 'month', 'default' => '', 'placeholder' => '2026-08', |
| 2204 |
'description' => __( 'Initial calendar month in YYYY-MM, YYYY/MM, or YYYYMM format.', 'booking' ), |
| 2205 |
), |
| 2206 |
'calendar_dates_start' => array( |
| 2207 |
'section' => 'calendar', 'title' => __( 'First calendar date', 'booking' ), 'value_type' => 'date', 'default' => '', 'placeholder' => '2026-08-01', |
| 2208 |
'description' => __( 'Inclusive first displayed date in YYYY-MM-DD format.', 'booking' ), |
| 2209 |
), |
| 2210 |
'calendar_dates_end' => array( |
| 2211 |
'section' => 'calendar', 'title' => __( 'Last calendar date', 'booking' ), 'value_type' => 'date', 'default' => '', 'placeholder' => '2026-12-31', |
| 2212 |
'description' => __( 'Inclusive last displayed date in YYYY-MM-DD format.', 'booking' ), |
| 2213 |
), |
| 2214 |
'options' => array( |
| 2215 |
'section' => 'calendar', 'title' => __( 'Calendar options', 'booking' ), 'value_type' => 'text', 'default' => '', |
| 2216 |
'description' => __( 'Native Booking Calendar options string passed to the resolved calendar and form.', 'booking' ), |
| 2217 |
), |
| 2218 |
'form_type' => array( |
| 2219 |
'section' => 'calendar', 'title' => __( 'Booking Form', 'booking' ), 'type' => 'select', 'value_type' => 'text', 'default' => '', |
| 2220 |
'options' => wpbc_shortcode_config__workflow_form_options(), |
| 2221 |
'description' => __( 'Select a published Booking Form override. Automatic uses the Service form and then the Standard form.', 'booking' ), |
| 2222 |
), |
| 2223 |
'allow_past' => array( |
| 2224 |
'section' => 'calendar', 'title' => __( 'Allow past bookings', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => false, |
| 2225 |
'description' => __( 'Permit any visitor to select and submit past dates inside the signed shortcode range.', 'booking' ), |
| 2226 |
), |
| 2227 |
'show_progress' => array( |
| 2228 |
'section' => 'progress', 'title' => __( 'Show progress', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => true, |
| 2229 |
'description' => __( 'Show the complete numbered Appointment progress line.', 'booking' ), |
| 2230 |
), |
| 2231 |
'progress_item_1_title' => array( |
| 2232 |
'section' => 'progress', 'title' => __( 'First progress title', 'booking' ), 'default' => __( 'Service', 'booking' ), |
| 2233 |
'description' => __( 'Title below the first progress number. Clear it to hide the title.', 'booking' ), |
| 2234 |
), |
| 2235 |
'progress_item_1_number' => array( |
| 2236 |
'section' => 'progress', 'title' => __( 'First progress number', 'booking' ), 'default' => '1', |
| 2237 |
'description' => __( 'First displayed progress number. Clear it to hide the number.', 'booking' ), |
| 2238 |
), |
| 2239 |
'progress_item_2_title' => array( |
| 2240 |
'section' => 'progress', 'title' => __( 'Second progress title', 'booking' ), 'default' => __( 'Provider', 'booking' ), |
| 2241 |
'description' => __( 'Title below the second progress number. Clear it to hide the title.', 'booking' ), |
| 2242 |
), |
| 2243 |
'progress_item_2_number' => array( |
| 2244 |
'section' => 'progress', 'title' => __( 'Second progress number', 'booking' ), 'default' => '2', |
| 2245 |
'description' => __( 'Second displayed progress number. Clear it to hide the number.', 'booking' ), |
| 2246 |
), |
| 2247 |
'progress_item_3_title' => array( |
| 2248 |
'section' => 'progress', 'title' => __( 'Third progress title', 'booking' ), 'default' => __( 'Date & Details', 'booking' ), |
| 2249 |
'description' => __( 'Title below the third progress number. Clear it to hide the title.', 'booking' ), |
| 2250 |
), |
| 2251 |
'progress_item_3_number' => array( |
| 2252 |
'section' => 'progress', 'title' => __( 'Third progress number', 'booking' ), 'default' => '3', |
| 2253 |
'description' => __( 'Third displayed progress number. Clear it to hide the number.', 'booking' ), |
| 2254 |
), |
| 2255 |
'screen_1_title' => array( |
| 2256 |
'section' => 'text', 'title' => __( 'Service screen title', 'booking' ), 'default' => __( 'Choose a Service', 'booking' ), |
| 2257 |
'description' => __( 'Heading on the Service selection screen. Clear it to hide the heading.', 'booking' ), |
| 2258 |
), |
| 2259 |
'screen_1_description' => array( |
| 2260 |
'section' => 'text', 'title' => __( 'Service screen description', 'booking' ), 'default' => __( 'Select what you would like to book.', 'booking' ), |
| 2261 |
'description' => __( 'Description on the Service selection screen. Clear it to hide the description.', 'booking' ), |
| 2262 |
), |
| 2263 |
'screen_2_title' => array( |
| 2264 |
'section' => 'text', 'title' => __( 'Provider screen title', 'booking' ), 'default' => __( 'Choose a Provider', 'booking' ), |
| 2265 |
'description' => __( 'Heading on the Provider selection screen. Clear it to hide the heading.', 'booking' ), |
| 2266 |
), |
| 2267 |
'screen_2_description' => array( |
| 2268 |
'section' => 'text', 'title' => __( 'Provider screen description', 'booking' ), 'default' => __( 'Select who will provide this Service.', 'booking' ), |
| 2269 |
'description' => __( 'Description on the Provider selection screen. Clear it to hide the description.', 'booking' ), |
| 2270 |
), |
| 2271 |
); |
| 2272 |
|
| 2273 |
if ( ! function_exists( 'wpbc_is_11_6_features_enabled' ) || ! wpbc_is_11_6_features_enabled() ) { |
| 2274 |
unset( |
| 2275 |
$parameters['catalog_layout'], |
| 2276 |
$parameters['show_resource_filters'], |
| 2277 |
$parameters['show_resource_image'], |
| 2278 |
$parameters['show_resource_title'], |
| 2279 |
$parameters['show_resource_description'], |
| 2280 |
$parameters['catalog_item_width'], |
| 2281 |
$parameters['catalog_item_max_width'], |
| 2282 |
$parameters['catalog_grid_items_per_row'], |
| 2283 |
$parameters['catalog_list_items_per_row'], |
| 2284 |
$parameters['show_resource_hierarchy'], |
| 2285 |
$parameters['show_availability'], |
| 2286 |
$parameters['show_starting_price'] |
| 2287 |
); |
| 2288 |
} |
| 2289 |
|
| 2290 |
return $parameters; |
| 2291 |
} |
| 2292 |
|
| 2293 |
/** |
| 2294 |
* Get every accepted public Appointment shortcode parameter for the reference tab. |
| 2295 |
* |
| 2296 |
* @return array<string,string> Parameter descriptions keyed by public attribute. |
| 2297 |
*/ |
| 2298 |
function wpbc_shortcode_config__booking_appointment_parameter_reference() { |
| 2299 |
$reference = array(); |
| 2300 |
foreach ( wpbc_shortcode_config__booking_appointment_parameters() as $parameter_name => $field ) { |
| 2301 |
$reference[ $parameter_name ] = $field['description']; |
| 2302 |
} |
| 2303 |
|
| 2304 |
$reference['progress_service_title'] = __( 'Compatibility alias for progress_item_1_title.', 'booking' ); |
| 2305 |
$reference['progress_service_number'] = __( 'Compatibility alias for progress_item_1_number.', 'booking' ); |
| 2306 |
$reference['progress_provider_title'] = __( 'Compatibility alias for progress_item_2_title.', 'booking' ); |
| 2307 |
$reference['progress_provider_number'] = __( 'Compatibility alias for progress_item_2_number.', 'booking' ); |
| 2308 |
$reference['progress_details_title'] = __( 'Compatibility alias for progress_item_3_title.', 'booking' ); |
| 2309 |
$reference['progress_details_number'] = __( 'Compatibility alias for progress_item_3_number.', 'booking' ); |
| 2310 |
|
| 2311 |
return $reference; |
| 2312 |
} |
| 2313 |
|
| 2314 |
/** |
| 2315 |
* Render the [booking_appointment] configuration section in the shortcode popup. |
| 2316 |
* |
| 2317 |
* @return void |
| 2318 |
*/ |
| 2319 |
function wpbc_shortcode_config__content__booking_appointment() { |
| 2320 |
$shortcode_name = 'booking_appointment'; |
| 2321 |
$tabs = array( |
| 2322 |
'general' => array( 'title' => __( 'Service & Provider', 'booking' ), 'icon' => 'wpbc-bi-person-check', 'default' => true ), |
| 2323 |
'catalog' => array( 'title' => __( 'Catalog', 'booking' ), 'icon' => 'wpbc-bi-grid', 'default' => false ), |
| 2324 |
'calendar' => array( 'title' => __( 'Calendar & Form', 'booking' ), 'icon' => 'wpbc-bi-calendar3', 'default' => false ), |
| 2325 |
'progress' => array( 'title' => __( 'Progress', 'booking' ), 'icon' => 'wpbc-bi-list-ol', 'default' => false ), |
| 2326 |
'text' => array( 'title' => __( 'Screen Text', 'booking' ), 'icon' => 'wpbc-bi-card-text', 'default' => false ), |
| 2327 |
'reference' => array( 'title' => __( 'Parameters', 'booking' ), 'icon' => 'wpbc-bi-code-square', 'default' => false ), |
| 2328 |
); |
| 2329 |
if ( ! function_exists( 'wpbc_is_11_6_features_enabled' ) || ! wpbc_is_11_6_features_enabled() ) { |
| 2330 |
unset( $tabs['catalog'] ); |
| 2331 |
} |
| 2332 |
$parameters = wpbc_shortcode_config__booking_appointment_parameters(); |
| 2333 |
?> |
| 2334 |
<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 ); ?>"> |
| 2335 |
<?php wpbc_shortcode_config__workflow_tabs( $shortcode_name, $tabs ); ?> |
| 2336 |
<?php foreach ( array_keys( $tabs ) as $section_id ) : ?> |
| 2337 |
<div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__<?php echo esc_attr( $section_id ); ?>"> |
| 2338 |
<?php if ( 'reference' === $section_id ) : ?> |
| 2339 |
<?php wpbc_shortcode_config__workflow_parameter_reference( wpbc_shortcode_config__booking_appointment_parameter_reference() ); ?> |
| 2340 |
<?php else : ?> |
| 2341 |
<table class="form-table"><tbody> |
| 2342 |
<?php foreach ( $parameters as $parameter_name => $field ) : ?> |
| 2343 |
<?php if ( $section_id === $field['section'] ) : ?> |
| 2344 |
<?php wpbc_shortcode_config__workflow_field( $shortcode_name, $parameter_name, $field ); ?> |
| 2345 |
<?php endif; ?> |
| 2346 |
<?php endforeach; ?> |
| 2347 |
</tbody></table> |
| 2348 |
<?php endif; ?> |
| 2349 |
</div> |
| 2350 |
<?php endforeach; ?> |
| 2351 |
<?php wpbc_shortcode_config__workflow_pager(); ?> |
| 2352 |
</div> |
| 2353 |
<?php |
| 2354 |
wpbc_clear_div(); |
| 2355 |
} |
| 2356 |
|
| 2357 |
|
| 2358 |
// ===================================================================================================================== |
| 2359 |
// Shortcode [booking_resource_selector ...]. |
| 2360 |
// ===================================================================================================================== |
| 2361 |
|
| 2362 |
/** |
| 2363 |
* Get the popup field contract for the Booking Resource Selector shortcode. |
| 2364 |
* |
| 2365 |
* Compatibility aliases remain visible in the reference tab, while newly |
| 2366 |
* generated shortcodes use the normalized public parameter names. |
| 2367 |
* |
| 2368 |
* @return array<string,array<string,mixed>> Resource Selector parameter fields. |
| 2369 |
*/ |
| 2370 |
function wpbc_shortcode_config__booking_resource_selector_parameters() { |
| 2371 |
$month_options = array_combine( range( 1, 24 ), range( 1, 24 ) ); |
| 2372 |
|
| 2373 |
$parameters = array( |
| 2374 |
'resource_id' => array( |
| 2375 |
'section' => 'general', 'title' => __( 'Preselected Booking Resource', 'booking' ), 'type' => 'select', 'value_type' => 'positive_integer', 'default' => '', |
| 2376 |
'options' => wpbc_shortcode_config__workflow_resource_options( true, __( 'No Booking Resource preselected', 'booking' ) ), |
| 2377 |
'description' => __( 'Check one Booking Resource by default without skipping the selection stage.', 'booking' ), |
| 2378 |
), |
| 2379 |
'resources' => array( |
| 2380 |
'section' => 'general', 'title' => __( 'Allowed Booking Resources', 'booking' ), 'type' => 'multiselect', 'value_type' => 'id_list', 'default' => '', |
| 2381 |
'options' => wpbc_shortcode_config__workflow_resource_options(), 'css' => 'width:100%;max-width:32em;height:12em;', |
| 2382 |
'description' => __( 'Select the Booking Resources shown by this workflow. Leave every option unselected to allow all available Resources.', 'booking' ), |
| 2383 |
), |
| 2384 |
'aggregate' => array( |
| 2385 |
'section' => 'general', 'title' => __( 'Aggregate Booking Resources', 'booking' ), 'type' => 'multiselect', 'value_type' => 'id_list', 'default' => '', |
| 2386 |
'options' => wpbc_shortcode_config__workflow_resource_options(), 'css' => 'width:100%;max-width:32em;height:12em;', |
| 2387 |
'description' => __( 'Select Booking Resources whose bookings should also block availability in the selected primary Resource.', 'booking' ), |
| 2388 |
), |
| 2389 |
'auto_select_resource' => array( |
| 2390 |
'section' => 'general', 'title' => __( 'Auto-select Booking Resource', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => false, |
| 2391 |
'description' => __( 'Open the preselected Resource immediately, or skip selection when exactly one Resource is available.', 'booking' ), |
| 2392 |
), |
| 2393 |
'catalog_layout' => array( |
| 2394 |
'section' => 'catalog', 'title' => __( 'Resource layout', 'booking' ), 'type' => 'select', 'value_type' => 'text', 'default' => 'grid', |
| 2395 |
'options' => array( 'grid' => __( 'Responsive grid', 'booking' ), 'list' => __( 'List', 'booking' ) ), |
| 2396 |
'description' => __( 'Show Booking Resources as responsive cards or compact list items. Selecting List applies recommended display settings that you can adjust afterward.', 'booking' ), |
| 2397 |
), |
| 2398 |
'show_resource_filters' => array( |
| 2399 |
'section' => 'catalog', 'title' => __( 'Show Resource search', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => false, |
| 2400 |
'description' => __( 'Let visitors search the permitted Resources by title, description, or parent title.', 'booking' ), |
| 2401 |
), |
| 2402 |
'show_resource_image' => array( |
| 2403 |
'section' => 'catalog', 'title' => __( 'Show Resource image', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => true, |
| 2404 |
'description' => __( 'Show the Resource photo or its generated initials.', 'booking' ), |
| 2405 |
), |
| 2406 |
'show_resource_title' => array( |
| 2407 |
'section' => 'catalog', 'title' => __( 'Show Resource title', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => true, |
| 2408 |
'description' => __( 'Show the public Resource title. The title remains available to assistive technology when hidden.', 'booking' ), |
| 2409 |
), |
| 2410 |
'show_resource_description' => array( |
| 2411 |
'section' => 'catalog', 'title' => __( 'Show Resource description', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => true, |
| 2412 |
'description' => __( 'Show the public Resource description when one is configured.', 'booking' ), |
| 2413 |
), |
| 2414 |
'catalog_item_width' => array( |
| 2415 |
'section' => 'catalog', 'title' => __( 'Resource item width', 'booking' ), 'value_type' => 'css_width', 'default' => '', |
| 2416 |
'placeholder' => __( 'Automatic, 360px, or 50%', 'booking' ), |
| 2417 |
'description' => __( 'Optional explicit card or list-row width. Use px, %, em, rem, or vw. An items-per-row setting takes precedence for its active layout.', 'booking' ), |
| 2418 |
), |
| 2419 |
'catalog_item_max_width' => array( |
| 2420 |
'section' => 'catalog', 'title' => __( 'Maximum Resource item width', 'booking' ), 'type' => 'number', 'value_type' => 'positive_integer', 'default' => '', |
| 2421 |
'placeholder' => __( 'Automatic', 'booking' ), 'attr' => array( 'min' => 280, 'max' => 1200, 'step' => 1 ), |
| 2422 |
'description' => __( 'Optional maximum card or list-row width in pixels, from 280 through 1200. Leave empty to fill the available layout width.', 'booking' ), |
| 2423 |
), |
| 2424 |
'catalog_grid_items_per_row' => array( |
| 2425 |
'section' => 'catalog', 'title' => __( 'Grid items per row', 'booking' ), 'type' => 'number', 'value_type' => 'positive_integer', 'default' => '', |
| 2426 |
'placeholder' => __( 'Automatic', 'booking' ), 'attr' => array( 'min' => 1, 'max' => 12, 'step' => 1 ), |
| 2427 |
'description' => __( 'Optional exact number of equal-width items per row in the grid layout, from 1 through 12.', 'booking' ), |
| 2428 |
), |
| 2429 |
'catalog_list_items_per_row' => array( |
| 2430 |
'section' => 'catalog', 'title' => __( 'List items per row', 'booking' ), 'type' => 'number', 'value_type' => 'positive_integer', 'default' => '', |
| 2431 |
'placeholder' => __( 'One item per row', 'booking' ), 'attr' => array( 'min' => 1, 'max' => 12, 'step' => 1 ), |
| 2432 |
'description' => __( 'Optional number of equal-width items per row in the list layout, from 1 through 12. Empty keeps one item per row.', 'booking' ), |
| 2433 |
), |
| 2434 |
'show_resource_hierarchy' => array( |
| 2435 |
'section' => 'catalog', 'title' => __( 'Show Resource hierarchy', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => true, |
| 2436 |
'description' => __( 'Show parent capacity and child-unit context without exposing administration controls. Independent Resources do not need a hierarchy badge.', 'booking' ), |
| 2437 |
), |
| 2438 |
'show_availability' => array( |
| 2439 |
'section' => 'catalog', 'title' => __( 'Show availability summary', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => true, |
| 2440 |
'description' => __( 'Explain that exact availability is confirmed after dates are selected.', 'booking' ), |
| 2441 |
), |
| 2442 |
'show_starting_price' => array( |
| 2443 |
'section' => 'catalog', 'title' => __( 'Show starting price', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => true, |
| 2444 |
'description' => __( 'Show the Resource base price and charging period when pricing is available in this edition.', 'booking' ), |
| 2445 |
), |
| 2446 |
'nummonths' => array( |
| 2447 |
'section' => 'calendar', 'title' => __( 'Visible months', 'booking' ), 'type' => 'select', 'value_type' => 'positive_integer', 'default' => 1, 'options' => $month_options, |
| 2448 |
'description' => __( 'Number of calendar months from 1 through 24.', 'booking' ), |
| 2449 |
), |
| 2450 |
'startmonth' => array( |
| 2451 |
'section' => 'calendar', 'title' => __( 'Start month', 'booking' ), 'value_type' => 'month', 'default' => '', 'placeholder' => '2026-08', |
| 2452 |
'description' => __( 'Initial calendar month in YYYY-MM, YYYY/MM, or YYYYMM format.', 'booking' ), |
| 2453 |
), |
| 2454 |
'calendar_dates_start' => array( |
| 2455 |
'section' => 'calendar', 'title' => __( 'First calendar date', 'booking' ), 'value_type' => 'date', 'default' => '', 'placeholder' => '2026-08-01', |
| 2456 |
'description' => __( 'Inclusive first displayed date in YYYY-MM-DD format.', 'booking' ), |
| 2457 |
), |
| 2458 |
'calendar_dates_end' => array( |
| 2459 |
'section' => 'calendar', 'title' => __( 'Last calendar date', 'booking' ), 'value_type' => 'date', 'default' => '', 'placeholder' => '2026-12-31', |
| 2460 |
'description' => __( 'Inclusive last displayed date in YYYY-MM-DD format.', 'booking' ), |
| 2461 |
), |
| 2462 |
'selected_dates' => array( |
| 2463 |
'section' => 'calendar', 'title' => __( 'Preselected dates', 'booking' ), 'value_type' => 'text', 'default' => '', 'placeholder' => '01.08.2026', |
| 2464 |
'description' => __( 'Native Booking Calendar preselected-date expression.', 'booking' ), |
| 2465 |
), |
| 2466 |
'options' => array( |
| 2467 |
'section' => 'calendar', 'title' => __( 'Calendar options', 'booking' ), 'value_type' => 'text', 'default' => '', |
| 2468 |
'description' => __( 'Native Booking Calendar options string passed to the selected calendar and form.', 'booking' ), |
| 2469 |
), |
| 2470 |
'form_type' => array( |
| 2471 |
'section' => 'calendar', 'title' => __( 'Booking Form', 'booking' ), 'type' => 'select', 'value_type' => 'text', 'default' => '', |
| 2472 |
'options' => wpbc_shortcode_config__workflow_form_options(), |
| 2473 |
'description' => __( 'Select a published Booking Form override. Automatic uses the Resource form and then the Standard form.', 'booking' ), |
| 2474 |
), |
| 2475 |
'allow_past' => array( |
| 2476 |
'section' => 'calendar', 'title' => __( 'Allow past bookings', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => false, |
| 2477 |
'description' => __( 'Permit any visitor to select and submit past dates inside the signed shortcode range.', 'booking' ), |
| 2478 |
), |
| 2479 |
'show_progress' => array( |
| 2480 |
'section' => 'progress', 'title' => __( 'Show progress', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => true, |
| 2481 |
'description' => __( 'Show the complete two-step Resource selection progress line.', 'booking' ), |
| 2482 |
), |
| 2483 |
'progress_item_1_title' => array( |
| 2484 |
'section' => 'progress', 'title' => __( 'First progress title', 'booking' ), 'default' => __( 'Resource', 'booking' ), |
| 2485 |
'description' => __( 'Title below the first progress number. Clear it to hide the title.', 'booking' ), |
| 2486 |
), |
| 2487 |
'progress_item_1_number' => array( |
| 2488 |
'section' => 'progress', 'title' => __( 'First progress number', 'booking' ), 'default' => '1', |
| 2489 |
'description' => __( 'First displayed progress number. Clear it to hide the number.', 'booking' ), |
| 2490 |
), |
| 2491 |
'progress_item_2_title' => array( |
| 2492 |
'section' => 'progress', 'title' => __( 'Second progress title', 'booking' ), 'default' => __( 'Date & Details', 'booking' ), |
| 2493 |
'description' => __( 'Title below the second progress number. Clear it to hide the title.', 'booking' ), |
| 2494 |
), |
| 2495 |
'progress_item_2_number' => array( |
| 2496 |
'section' => 'progress', 'title' => __( 'Second progress number', 'booking' ), 'default' => '2', |
| 2497 |
'description' => __( 'Second displayed progress number. Clear it to hide the number.', 'booking' ), |
| 2498 |
), |
| 2499 |
'screen_1_title' => array( |
| 2500 |
'section' => 'text', 'title' => __( 'Resource screen title', 'booking' ), 'default' => __( 'Choose a Booking Resource', 'booking' ), |
| 2501 |
'description' => __( 'Heading on the Booking Resource selection screen. Clear it to hide the heading.', 'booking' ), |
| 2502 |
), |
| 2503 |
'screen_1_description' => array( |
| 2504 |
'section' => 'text', 'title' => __( 'Resource screen description', 'booking' ), 'default' => __( 'Select what you would like to book.', 'booking' ), |
| 2505 |
'description' => __( 'Description on the Booking Resource selection screen. Clear it to hide the description.', 'booking' ), |
| 2506 |
), |
| 2507 |
); |
| 2508 |
|
| 2509 |
if ( ! function_exists( 'wpbc_is_11_6_features_enabled' ) || ! wpbc_is_11_6_features_enabled() ) { |
| 2510 |
unset( |
| 2511 |
$parameters['catalog_layout'], |
| 2512 |
$parameters['show_resource_filters'], |
| 2513 |
$parameters['show_resource_image'], |
| 2514 |
$parameters['show_resource_title'], |
| 2515 |
$parameters['show_resource_description'], |
| 2516 |
$parameters['catalog_item_width'], |
| 2517 |
$parameters['catalog_item_max_width'], |
| 2518 |
$parameters['catalog_grid_items_per_row'], |
| 2519 |
$parameters['catalog_list_items_per_row'], |
| 2520 |
$parameters['show_resource_hierarchy'], |
| 2521 |
$parameters['show_availability'], |
| 2522 |
$parameters['show_starting_price'] |
| 2523 |
); |
| 2524 |
} |
| 2525 |
|
| 2526 |
return $parameters; |
| 2527 |
} |
| 2528 |
|
| 2529 |
/** |
| 2530 |
* Get every accepted public Resource Selector shortcode parameter for the reference tab. |
| 2531 |
* |
| 2532 |
* @return array<string,string> Parameter descriptions keyed by public attribute. |
| 2533 |
*/ |
| 2534 |
function wpbc_shortcode_config__booking_resource_selector_parameter_reference() { |
| 2535 |
$parameters = wpbc_shortcode_config__booking_resource_selector_parameters(); |
| 2536 |
$reference = array(); |
| 2537 |
foreach ( $parameters as $parameter_name => $field ) { |
| 2538 |
$reference[ $parameter_name ] = $field['description']; |
| 2539 |
} |
| 2540 |
|
| 2541 |
$reference['type'] = __( 'Compatibility alias for resources. The resources parameter wins when both are present.', 'booking' ); |
| 2542 |
$reference['selected_resource_id'] = __( 'Compatibility fallback that checks one Resource without skipping selection. resource_id wins when both are present.', 'booking' ); |
| 2543 |
$reference['selected_type'] = __( 'Compatibility alias for selected_resource_id.', 'booking' ); |
| 2544 |
$reference['label'] = __( 'Compatibility alias for screen_1_title.', 'booking' ); |
| 2545 |
|
| 2546 |
return $reference; |
| 2547 |
} |
| 2548 |
|
| 2549 |
/** |
| 2550 |
* Render the [booking_resource_selector] configuration section in the shortcode popup. |
| 2551 |
* |
| 2552 |
* @return void |
| 2553 |
*/ |
| 2554 |
function wpbc_shortcode_config__content__booking_resource_selector() { |
| 2555 |
$shortcode_name = 'booking_resource_selector'; |
| 2556 |
$tabs = array( |
| 2557 |
'general' => array( 'title' => __( 'Resource Selection', 'booking' ), 'icon' => 'wpbc-bi-card-checklist', 'default' => true ), |
| 2558 |
'catalog' => array( 'title' => __( 'Catalog', 'booking' ), 'icon' => 'wpbc-bi-grid', 'default' => false ), |
| 2559 |
'calendar' => array( 'title' => __( 'Calendar & Form', 'booking' ), 'icon' => 'wpbc-bi-calendar3', 'default' => false ), |
| 2560 |
'progress' => array( 'title' => __( 'Progress', 'booking' ), 'icon' => 'wpbc-bi-list-ol', 'default' => false ), |
| 2561 |
'text' => array( 'title' => __( 'Screen Text', 'booking' ), 'icon' => 'wpbc-bi-card-text', 'default' => false ), |
| 2562 |
'reference' => array( 'title' => __( 'Parameters', 'booking' ), 'icon' => 'wpbc-bi-code-square', 'default' => false ), |
| 2563 |
); |
| 2564 |
if ( ! function_exists( 'wpbc_is_11_6_features_enabled' ) || ! wpbc_is_11_6_features_enabled() ) { |
| 2565 |
unset( $tabs['catalog'] ); |
| 2566 |
} |
| 2567 |
$parameters = wpbc_shortcode_config__booking_resource_selector_parameters(); |
| 2568 |
?> |
| 2569 |
<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 ); ?>"> |
| 2570 |
<?php wpbc_shortcode_config__workflow_tabs( $shortcode_name, $tabs ); ?> |
| 2571 |
<?php foreach ( array_keys( $tabs ) as $section_id ) : ?> |
| 2572 |
<div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__<?php echo esc_attr( $section_id ); ?>"> |
| 2573 |
<?php if ( 'reference' === $section_id ) : ?> |
| 2574 |
<?php wpbc_shortcode_config__workflow_parameter_reference( wpbc_shortcode_config__booking_resource_selector_parameter_reference() ); ?> |
| 2575 |
<?php else : ?> |
| 2576 |
<table class="form-table"><tbody> |
| 2577 |
<?php foreach ( $parameters as $parameter_name => $field ) : ?> |
| 2578 |
<?php if ( $section_id === $field['section'] ) : ?> |
| 2579 |
<?php wpbc_shortcode_config__workflow_field( $shortcode_name, $parameter_name, $field ); ?> |
| 2580 |
<?php endif; ?> |
| 2581 |
<?php endforeach; ?> |
| 2582 |
</tbody></table> |
| 2583 |
<?php endif; ?> |
| 2584 |
</div> |
| 2585 |
<?php endforeach; ?> |
| 2586 |
<?php wpbc_shortcode_config__workflow_pager(); ?> |
| 2587 |
</div> |
| 2588 |
<?php |
| 2589 |
wpbc_clear_div(); |
| 2590 |
} |
| 2591 |
|