PluginProbe
Booking Calendar / 10.15.6
Booking Calendar v10.15.6
11.8.4 11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 All 204 releases
booking / includes / page-form-simple / page-form-simple.php

page-form-simple.php in Booking Calendar 10.15.6, at includes/page-form-simple/page-form-simple.php

1,522 lines 79.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php /**
2 * @version 1.0
3 * @package Booking Calendar
4 * @category Booking Form Settings
5 * @author wpdevelop
6 *
7 * @web-site https://wpbookingcalendar.com/
8 * @email [email protected]
9 *
10 * @modified 2016-03-23
11 */
12
13 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
15 require_once( WPBC_PLUGIN_DIR . '/includes/page-form-simple/form_simple__toolbar_free.php' );
16 require_once( WPBC_PLUGIN_DIR . '/includes/page-form-simple/form_simple__submit.php' );
17 require_once( WPBC_PLUGIN_DIR . '/includes/page-form-simple/form_simple__timeslots.php' ); // Timeslots Generator
18 require_once( WPBC_PLUGIN_DIR . '/includes/page-form-simple/form_simple__preview.php' ); // Preview
19 require_once( WPBC_PLUGIN_DIR . '/includes/page-form-simple/form_simple__preview_templates.php' ); // Templates - Simple Booking Form
20 require_once( WPBC_PLUGIN_DIR . '/includes/page-form-simple/form_simple__auto_show_timeslots.php' ); // Auto Load Time Slots -- Editing or Adding form
21
22 /**
23 * Show Content
24 * Update Content
25 * Define Slug
26 * Define where to show
27 */
28 class WPBC_Page_SettingsFormFieldsFree extends WPBC_Page_Structure {
29
30 /** Need define some filters */
31 public function __construct() {
32
33
34
35
36 /**
37 * We need to update these fields after usual update process :
38 * 'booking_form'
39 * 'booking_form_show'
40 * 'booking_form_visual'
41 */
42 add_bk_action( 'wpbc_other_versions_activation', array( $this, 'activate' ) ); // Activate
43 add_bk_action( 'wpbc_other_versions_deactivation', array( $this, 'deactivate' ) ); // Deactivate
44
45 parent::__construct();
46 }
47
48 public function in_page() {
49
50 if ( WPBC_Frontend_Settings::is_bfb_enabled( null ) ) {
51 return 'test' . (string) wp_rand( 100000, 1000000 );
52 }
53
54 if ( class_exists( 'wpdev_bk_personal' ) ) {
55 $is_use_simgple_form = get_bk_option( 'booking_is_use_simple_booking_form' ); // FixIn: 8.1.1.12.
56 if ( 'On' !== $is_use_simgple_form ) {
57 return 'test' . (string) wp_rand( 100000, 1000000 );
58 }
59 }
60 return 'wpbc-settings';
61 }
62
63 public function tabs() {
64
65
66 // Init vars.
67 $separator_i = 0;
68 $tabs = array();
69 $subtabs = array();
70 $subtab_default = array(
71 'type' => 'subtab', // Required| Possible values: 'subtab' | 'separator' | 'button' | 'goto-link' | 'html'.
72 'title' => '', // Example: __( 'Dashboard' // Title of TAB.
73 'page_title' => '', // __( 'Search Availability' // Title of Page.
74 'hint' => '', // __( 'Configure the layout and functionality of both the search form and search results.' // Hint.
75 'link' => '', // wpbc_get_settings_url() . '&scroll_to_section=wpbc_general_settings_dashboard_tab', // Link.
76 'css_classes' => '', // cls CSS .
77 'font_icon' => 'wpbc_icn_dashboard',
78 'font_icon_right' => 'wpbc-bi-question-circle', // 'wpbc-bi-question-circle' .
79 'default' => false, // Is this sub tab activated by default or not: true || false.
80 );
81
82 $tabs[ 'form' ] = array(
83 'is_show_top_path' => false, // true | false. By default value is: false.
84 'left_navigation__default_view_mode' => 'compact', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''.
85 'page_title' => __( 'Booking Form', 'booking'). ' (' . __('legacy','booking') . ')', // Header - Title. If false, than hidden.
86 'page_description' => __('Add, remove, or customize fields in your booking form.','booking'), // Header - Title Description. If false, than hidden.
87 'title' => __( 'Booking Form', 'booking') . ' (' . __('legacy','booking') . ')' // Title of TAB
88 , 'page_title'=> __( 'Booking Form', 'booking') // Title of Page
89 , 'hint' => __( 'Add, remove, or customize fields in your booking form.', 'booking') // Hint
90 //, 'css_classes'=> '' // CSS class(es)
91 , 'font_icon' => 'wpbc_icn_dashboard _customize dashboard rtt draw' // CSS definition of forn Icon
92 , 'default' => false // Is this tab activated by default or not: true || false.
93 , 'subtabs' => array()
94 , 'folder_style' => 'order:15;',
95 );
96
97 $section_id = 'wpbc_general_settings_booking_form_fields_metabox';
98 $subtabs['booking_form_fields'] = array_merge(
99 $subtab_default,
100 array(
101 'title' => __( 'Booking Form Fields', 'booking' ),
102 'page_title' => __( 'Booking Form Fields', 'booking' ),
103 'hint' => __( 'Add, remove, or customize fields in your booking form.', 'booking' ),
104 'font_icon' => 'wpbc-bi-ui-radios',
105 'font_icon_right' => 'wpbc-bi-question-circle',
106 'css_classes' => 'do_expand__' . $section_id . '_link', // sub_bold', .
107 //'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );",
108 'link' => wpbc_get_settings_url() . '&tab=form',
109 'default' => true,
110 )
111 );
112 $tabs[ 'form' ]['subtabs'] = $subtabs;
113
114
115 // if ( ! class_exists( 'wpdev_bk_personal' ) ) // FixIn: 8.1.1.12.
116 // // FixIn: 10.12.4.7. $tabs[ 'settings-upgrade' . ( ++$separator_i ) ] = array_merge( $subtab_default, array( 'type' => 'separator' ,'folder_style' => 'order:1000;' ) );
117 // $tabs[ 'upgrade-link' ] = array(
118 // 'title' => __('Get Pro','booking') // Title of TAB
119 // , 'hint' => __('Upgrade to higher versions', 'booking') // Hint
120 // //, 'page_title' => __('Upgrade', 'booking') // Title of Page
121 // , 'link' => 'https://wpbookingcalendar.com/features/' // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link
122 // , 'position' => 'right' // 'left' || 'right' || ''
123 // //, 'css_classes' => '' // CSS class(es)
124 // //, 'icon' => '' // Icon - link to the real PNG img
125 // , 'font_icon' => 'wpbc_icn_redeem'// CSS definition of forn Icon
126 // //, 'default' => false // Is this tab activated by default or not: true || false.
127 // //, 'subtabs' => array()
128 // , 'folder_style' => 'order:9999;'
129 // );
130
131 return $tabs;
132 }
133
134
135 public function content() {
136 $this->css();
137
138 // Define Notices Section and show some static messages, if needed
139 do_action( 'wpbc_hook_settings_page_header', 'form_field_free_settings');
140
141 if ( ! wpbc_is_mu_user_can_be_here('activated_user') ) return false; // Check if MU user activated, otherwise show Warning message.
142 //if ( ! wpbc_is_mu_user_can_be_here('only_super_admin') ) return false; // User is not Super admin, so exit. Basically its was already checked at the bottom of the PHP file, just in case.
143
144
145 // -------------------------------------------------------------------------------------------------------------
146 // Submit
147 // -------------------------------------------------------------------------------------------------------------
148 $submit_form_name = 'wpbc_form_field_free'; // Define form name
149 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
150 if ( isset( $_POST[ 'is_form_sbmitted_' . $submit_form_name ] ) ) {
151 // Nonce checking {Return false if invalid, 1 if generated between, 0-12 hours ago, 2 if generated between 12-24 hours ago. }
152 $nonce_gen_time = check_admin_referer( 'wpbc_settings_page_' . $submit_form_name ); // Its stop show anything on submitting, if it's not refear to the original page
153
154 wpbc_simple_form__page_save_submit(); // Save Changes
155 }
156
157 echo '<span class="wpdevelop">';
158 wpbc_js_for_bookings_page(); // JavaScript: Tooltips, Popover, Datepick (js & css) //////////////////
159 echo '</span>';
160
161
162 // -------------------------------------------------------------------------------------------------------------
163 // Content
164 // -------------------------------------------------------------------------------------------------------------
165 ?><div class="clear"></div>
166 <div class="wpbc_settings_flex_container"><?php
167
168 $this->left_navigation_menu_template();
169
170 ?><div class="wpbc_settings_flex_container_right"><?php
171
172 // This div required for hiding toolbar, if clicked items in Left Nav Bar.
173 ?><div id="wpbc_settings__custom_booking_forms_fields__toolbar" class="wpbc_container_hide__on_left_nav_click" style="margin:0 0 25px;"><?php
174
175 wpbc_simple_form__toolbar_free();
176
177 ?></div><?php
178
179
180 ?><form name="<?php echo esc_attr( $submit_form_name ); ?>" id="<?php echo esc_attr( $submit_form_name ); ?>" action="" method="post" style="width:100%;"><?php
181 ?><span class="metabox-holder"><?php
182 // N o n c e field, and key for checking S u b m i t
183 wp_nonce_field( 'wpbc_settings_page_' . $submit_form_name );
184
185 ?><input type="hidden" name="is_form_sbmitted_<?php echo esc_attr( $submit_form_name ); ?>" id="is_form_sbmitted_<?php echo esc_attr( $submit_form_name ); ?>" value="1" /><?php
186 ?><input type="hidden" name="form_visible_section" id="form_visible_section" value="" /><?php
187 ?><input type="hidden" name="reset_to_default_form" id="reset_to_default_form" value="" /><?php
188 ?><input type="hidden" name="booking_form_structure_type" id="booking_form_structure_type" value="<?php echo esc_attr( get_bk_option( 'booking_form_structure_type' ) ); ?>" /><?php
189
190 ?><div id="wpbc_settings__form_fields_metabox" class="wpbc_container_hide__on_left_nav_click"><?php
191
192 $this->content_section__form_fields();
193
194 ?></div><?php
195
196 wpbc_open_meta_box_section( 'wpbc_settings__form_layout', __('Form Layout', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false, 'css_class'=>'postbox wpbc_container_hide__on_left_nav_click' ) );
197 $this->content_section__form_layout();
198 wpbc_close_meta_box_section();
199
200 $is_can = apply_bk_filter( 'multiuser_is_user_can_be_here', true, 'only_super_admin' );
201 if ( $is_can ) {
202 wpbc_open_meta_box_section( 'wpbc_settings__form_theme', __('Color Theme', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false, 'css_class'=>'postbox wpbc_container_hide__on_left_nav_click' ) );
203
204 $this->content_section__form_color_theme();
205
206 ?><table class="form-table"><tbody><tr valign="top" class="wpbc_tr_booking_form_skins"><th scope="row"></th><td><fieldset><?php
207
208 ?><div class="wpbc_widget wpbc_widget_color_skins">
209 <div class="wpbc_widget_content wpbc_ajx_toolbar wpbc_no_background" style="margin:0 0 20px;">
210 <div class="ui_container" ><?php
211
212 $this->content_section__calendar_skin();
213
214 $this->content_section__time_picker_skin();
215
216 ?></div></div></div><?php
217
218 ?></fieldset></td></tr></tbody></table><?php
219
220 wpbc_close_meta_box_section();
221
222
223 wpbc_open_meta_box_section( 'wpbc_settings__form_options', __('Form Options', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false, 'css_class'=>'postbox wpbc_container_hide__on_left_nav_click' ) );
224 $this->content_section__form_options();
225 wpbc_close_meta_box_section();
226 }
227 ?></span><?php
228 // -----------------------------------------------------------------------------------------------------
229 // Save button
230 // -----------------------------------------------------------------------------------------------------
231 ?><div class="clear" style="height:5px;"></div>
232 <input type="submit" value="<?php esc_attr_e('Save Changes','booking'); ?>" class="button button-primary wpbc_submit_button wpbc_submit_button_trigger" />
233 </form>
234 <?php
235 //wpbc_show_preview__form();
236 ?>
237 </div>
238 </div><?php
239
240
241 wpbc_show_preview__form();
242
243 // Define templates and write JavaScript for Timeslots in ../generator-timeslots.php
244 do_action( 'wpbc_hook_settings_page_footer', 'form_field_free_settings' );
245
246 }
247
248
249 public function left_navigation_menu_template(){
250
251 ?>
252 <div class="wpbc_settings_flex_container_left wpbc_settings_flex_container_can_collapse">
253
254 <div class="wpbc_settings_navigation_column">
255 <div id="wpbc_settings__form_fields_tab" class="wpbc_settings_navigation_item wpbc_settings_navigation_item_active">
256 <a onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_settings__form_fields_metabox,#wpbc_settings__custom_booking_forms_fields__toolbar', '.wpbc_container_hide__on_left_nav_click' );" href="javascript:void(0);">
257 <span><?php esc_html_e( 'Form Fields', 'booking' ); ?></span>
258 <i class="tooltip_right wpbc_set_nav__right_icon menu_icon icon-1x wpbc_icn_format_align_left" data-original-title="<?php echo esc_attr( __( 'Form Fields', 'booking' ) ); ?>"></i>
259 </a>
260 </div>
261 <div id="wpbc_settings__form_layout_tab" class="wpbc_settings_navigation_item">
262 <a onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_settings__form_layout_metabox', '.wpbc_container_hide__on_left_nav_click' );" href="javascript:void(0);">
263 <span><?php esc_html_e( 'Form Layout', 'booking' ); ?></span>
264 <i class="tooltip_right wpbc_set_nav__right_icon menu_icon icon-1x wpbc_icn_dashboard" data-original-title="<?php echo esc_attr( __( 'Form Layout', 'booking' ) ); ?>"></i>
265 </a>
266 </div><?php
267
268 $is_can = apply_bk_filter( 'multiuser_is_user_can_be_here', true, 'only_super_admin' );
269 if ( $is_can ) {
270
271 ?><div id="wpbc_settings__form_theme_tab" class="wpbc_settings_navigation_item">
272 <a onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_settings__form_theme_metabox', '.wpbc_container_hide__on_left_nav_click' );" href="javascript:void(0);">
273 <span><?php esc_html_e( 'Color Theme', 'booking' ); ?></span>
274 <i class="tooltip_right wpbc_set_nav__right_icon menu_icon icon-1x wpbc_icn_format_color_text 00wpbc-bi-pencil" data-original-title="<?php echo esc_attr( __( 'Color Theme', 'booking' ) ); ?>"></i>
275 </a>
276 </div>
277 <div id="wpbc_settings__form_options_tab" class="wpbc_settings_navigation_item">
278 <a onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_settings__form_options_metabox', '.wpbc_container_hide__on_left_nav_click' );" href="javascript:void(0);">
279 <span><?php esc_html_e( 'Options', 'booking' ); ?></span>
280 <i class="tooltip_right wpbc_set_nav__right_icon menu_icon icon-1x wpbc_icn_tune" data-original-title="<?php echo esc_attr( __( 'Options', 'booking' ) ); ?>"></i>
281 </a>
282 </div><?php
283
284 }
285 ?><div id="wpbc_settings__form_options_tab" class="wpbc_settings_navigation_item wpbc_navigation_top_border0">
286 <a onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_settings__form_preview_metabox', '.wpbc_container_hide__on_left_nav_click000' );" href="javascript:void(0);">
287 <span><?php esc_html_e( 'Preview', 'booking' ); ?></span>
288 <i class="tooltip_right wpbc_set_nav__right_icon menu_icon icon-1x wpbc-bi-eye" data-original-title="<?php echo esc_attr( __( 'Preview', 'booking' ) ); ?>"></i>
289 </a>
290 </div>
291 <div id="wpbc_settings__form_options_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item0 wpbc_navigation_top_border">
292 <a onclick="javascript:jQuery(this).parents('.wpbc_settings_flex_container_can_collapse').toggleClass('wpbc_container_collapsed');
293 jQuery( this ).find('.wpbc_icon_for_collapse').removeClass('wpbc_icn_chevron_left wpbc_icn_chevron_right');
294 if (jQuery(this).parents('.wpbc_settings_flex_container_can_collapse').hasClass('wpbc_container_collapsed')){
295 jQuery( this ).find('.wpbc_icon_for_collapse').addClass('wpbc_icn_chevron_right');
296 } else {
297 jQuery( this ).find('.wpbc_icon_for_collapse').addClass('wpbc_icn_chevron_left');
298 }
299 jQuery( this ).blur();
300 "
301 href="javascript:void(0);" style="font-weight: 400;font-size:0.94em;">
302 <span><?php esc_html_e( 'Collapse menu', 'booking' ); ?></span>
303 <i class="wpbc_set_nav__right_icon menu_icon icon-1x wpbc_icn_chevron_left tooltip_right wpbc_icon_for_collapse"
304 data-original-title="<?php echo esc_attr( __( 'Collapse menu', 'booking' ) ); ?>"
305 style="margin-top:0;"></i>
306 </a>
307 </div>
308 </div>
309 </div>
310 <?php
311 }
312
313
314 public function content_section__form_fields(){
315
316 // Fields Generator
317 ?>
318 <span class="metabox_wpbc_form_field_free_generator" style="display:none;">
319 <div class="clear"></div>
320 <span class="metabox-holder">
321 <div class="wpbc_settings_row " >
322 <?php
323 wpbc_open_meta_box_section( 'wpbc_form_field_free_generator', __('Form Field Configuration', 'booking') );
324
325 $this->fields_generator_section();
326
327 wpbc_close_meta_box_section();
328 ?>
329 </div>
330 </span>
331 </span>
332 <?php
333
334 // Content
335 ?>
336 <div class="clear" style="margin-bottom:10px;"></div>
337 <div class="metabox-holder">
338 <?php
339
340 // Get Form Fields
341 $booking_form_structure = wpbc_simple_form__db__get_visual_form_structure(); // Get saved or Import form fields from OLD Free version
342
343 $this->show_booking_form_fields_table( $booking_form_structure );
344 ?>
345 </div>
346 <div class="clear" style="height:10px;"></div>
347 <?php
348
349 }
350
351
352 public function content_section__form_layout(){
353
354 $default_options_values = wpbc_get_default_options();
355 ?><table class="form-table"><?php
356
357 $field_value_or_default = ( empty( get_bk_option( 'booking_form_structure_type' ) ) ? $default_options_values['booking_form_structure_type'] : get_bk_option( 'booking_form_structure_type' ) );
358
359 $field_options = array( // Associated array of titles and values
360 'optgroup_sf_s' => array(
361 'optgroup' => true
362 , 'close' => false
363 , 'title' => '&nbsp;' . __('Standard Forms' ,'booking')
364 )
365 // FixIn: 10.7.1.7.
366 , 'wizard_2columns' => array(
367 'title' => __('Wizard (several steps)', 'booking')
368 , 'id' => ''
369 , 'name' => ''
370 , 'style' => ''
371 , 'class' => ''
372 , 'disabled' => false
373 , 'selected' => false
374 , 'attr' => array()
375 )
376 , 'wizard_services_a' => array(
377 'title' => __( 'Wizard (Steps Timline)', 'booking' )
378 , 'id' => ''
379 , 'name' => ''
380 , 'style' => ''
381 , 'class' => ''
382 , 'disabled' => false
383 , 'selected' => false
384 , 'attr' => array()
385 )
386 , 'vertical' => array(
387 'title' => __('Form under calendar', 'booking')
388 , 'id' => ''
389 , 'name' => ''
390 , 'style' => ''
391 , 'class' => ''
392 , 'disabled' => false
393 , 'selected' => false
394 , 'attr' => array()
395 )
396 , 'form_right' => array(
397 'title' => __('Form at right side of calendar', 'booking')
398 , 'id' => ''
399 , 'name' => ''
400 , 'style' => ''
401 , 'class' => ''
402 , 'disabled' => false
403 , 'selected' => false
404 , 'attr' => array()
405 )
406 , 'form_center' => array(
407 'title' => __('Form and calendar are centered', 'booking')
408 , 'id' => ''
409 , 'name' => ''
410 , 'style' => ''
411 , 'class' => ''
412 , 'disabled' => false
413 , 'selected' => false
414 , 'attr' => array()
415 )
416
417 , 'optgroup_sf_e' => array( 'optgroup' => true, 'close' => true )
418 // , 'optgroup_help_tips_s' => array(
419 // 'optgroup' => true
420 // , 'close' => false
421 // , 'title' => '&nbsp;' . __('Advanced Forms' ,'booking')
422 // )
423 // , 'form_2_columns' => array(
424 // 'title' => __('2 Columns', 'booking')
425 // , 'id' => ''
426 // , 'name' => ''
427 // , 'style' => ''
428 // , 'class' => ''
429 // , 'disabled' => true
430 // , 'selected' => false
431 // , 'attr' => array()
432 // )
433 // , 'optgroup_help_tips_e' => array( 'optgroup' => true, 'close' => true )
434
435 );
436
437 WPBC_Settings_API::field_select_row_static( 'booking_form_structure_type__select'
438 , array(
439 'type' => 'select'
440 , 'title' => __('Form Layout', 'booking')
441 , 'label' => ''
442 , 'disabled' => false
443 , 'disabled_options' => array()
444 , 'multiple' => false
445
446 , 'description' => ''
447 , 'description_tag' => 'span'
448
449 , 'group' => 'form_layout'
450 , 'tr_class' => ''
451 , 'class' => ''
452 , 'css' => 'width:auto;max-width:100%;'
453 , 'only_field' => false
454 , 'attr' => array()
455
456 , 'value' => $field_value_or_default
457 , 'options' => $field_options
458 , 'attr' => array( 'onchange' => "javascript: if( 'wizard_2columns' === jQuery( this ).val() ) { jQuery( '#booking_form_layout_width' ).val( '100' ); jQuery( '#booking_form_layout_width_px_pr' ).val( '%' ); jQuery( '#booking_form_layout_max_cols' ).val( '2' ); } "
459 . " if( 'wizard_services_a' === jQuery( this ).val() ) { jQuery( '#booking_form_layout_width' ).val( '100' ); jQuery( '#booking_form_layout_width_px_pr' ).val( '%' ); jQuery( '#booking_form_layout_max_cols' ).val( '2' ); } "
460 . " if( 'vertical' === jQuery( this ).val() ) { jQuery( '#booking_form_layout_max_cols' ).val( '2' ); jQuery( '#booking_form_layout_width' ).val( '100' ); jQuery( '#booking_form_layout_width_px_pr' ).val( '%' ); } "
461 . " if( 'form_right' === jQuery( this ).val() ) { jQuery( '#booking_form_layout_max_cols' ).val( '1' ); jQuery( '#booking_form_layout_width' ).val( '440' ); jQuery( '#booking_form_layout_width_px_pr' ).val( 'px' ); } "
462 . " if( 'form_center' === jQuery( this ).val() ) { jQuery( '#booking_form_layout_max_cols' ).val( '1' ); jQuery( '#booking_form_layout_width' ).val( '440' ); jQuery( '#booking_form_layout_width_px_pr' ).val( 'px' ); } "
463 )
464 )
465 );
466
467
468 $field_value_or_default = ( empty( get_bk_option( 'booking_form_layout_max_cols' ) ) ? $default_options_values['booking_form_layout_max_cols'] : get_bk_option( 'booking_form_layout_max_cols' ) );
469 WPBC_Settings_API::field_select_row_static( 'booking_form_layout_max_cols'
470 , array(
471 'type' => 'select'
472 , 'title' => __( 'Columns', 'booking' )
473 , 'label' => ''
474 , 'disabled' => false
475 , 'disabled_options' => array()
476 , 'multiple' => false
477
478 , 'description' => __('Set number of columns in booking form','booking')
479 , 'description_tag' => 'span'
480
481 , 'group' => 'form_layout'
482 , 'tr_class' => ''
483 , 'class' => ''
484 , 'css' => 'width:auto;max-width:100%;'
485 , 'only_field' => false
486 , 'attr' => array()
487
488 , 'value' => $field_value_or_default
489 , 'options' => array( 1 => 1, 2 => 2, 3 => 3 )
490 //, 'attr' => array( 'onchange' => "javascript: if( 'wizard_2columns' === jQuery( this ).val() ) { jQuery( '#booking_form_layout_width' ).val( '100' ); jQuery( '#booking_form_layout_width_px_pr' ).find( 'option' ).prop( 'selected', false ); jQuery( '#booking_form_layout_width_px_pr' ).val( '%' ); } " )
491 )
492 );
493
494
495 $id = 'booking_form_layout';
496 ?><tr class="wpbc_tr_<?php echo esc_attr( $id ); ?>_size__select">
497 <th scope="row" style="vertical-align: middle;">
498 <label for="wpbc_booking_width" class="wpbc-form-text"><?php esc_html_e('Form Width:', 'booking'); ?></label>
499 </th>
500 <td class=""><fieldset style="display: flex;flex-flow: row wrap;justify-content: flex-start;align-items: center;"><?php
501
502 $field_name = $id . '_width'; // 100
503 WPBC_Settings_API::field_text_row_static( $field_name
504 , array(
505 'type' => 'text'
506 , 'placeholder' => '100'
507 , 'class' => ''
508 , 'css' => 'width:5em;'
509 , 'only_field' => true
510 , 'attr' => array()
511 , 'value' => ( empty( get_bk_option( $field_name ) ) ? $default_options_values[ $field_name ] : get_bk_option( $field_name ) )
512 )
513 );
514 $field_name = $id . '_width_px_pr'; // %
515 WPBC_Settings_API::field_select_row_static( $field_name
516 , array(
517 'type' => 'select'
518 , 'multiple' => false
519 , 'class' => ''
520 , 'css' => 'width:4em;'
521 , 'only_field' => true
522 , 'attr' => array()
523 , 'options' => array( 'px' => 'px', '%' => '%' )
524 , 'value' => ( empty( get_bk_option( $field_name ) ) ? $default_options_values[ $field_name ] : get_bk_option( $field_name ) )
525 )
526 );
527 ?><span class="description"> <?php esc_html_e('Set width of calendar' ,'booking'); ?></span></fieldset></td>
528 </tr><?php
529
530
531 ?></table>
532 <script type="text/javascript">
533 jQuery('select[name=\"booking_form_structure_type__select\"]').on( 'change', function(){
534 var selected_val = jQuery('#booking_form_structure_type__select').val();
535 jQuery('#booking_form_structure_type').val( selected_val );
536 } );
537 </script><?php
538 }
539
540
541 public function content_section__form_color_theme(){
542
543 $default_options_values = wpbc_get_default_options();
544
545 ?><table class="form-table"><?php
546
547 $field_name = 'booking_form_theme';
548 $field_params = array(
549 'type' => 'select'
550 , 'default' => $default_options_values[ $field_name ] //'Off'
551 , 'title' => __('Color Theme' ,'booking')
552 , 'description' => __('Select a color theme for your booking form that matches the look of your website.' ,'booking')
553 // . '<div class="wpbc-general-settings-notice wpbc-settings-notice notice-info">'
554 // . __('When you select a color theme, it also change the calendar and time-slot picker skins to match your choice. Customize these options separately as needed.' ,'booking')
555 // .'</div>'
556 , 'options' => array(
557 '' => __( 'Light', 'booking' ),
558 'wpbc_theme_dark_1' => __( 'Dark', 'booking' )
559 )
560 , 'group' => 'form'
561 , 'value' => ( empty( get_bk_option( $field_name ) ) ? $default_options_values[ $field_name ] : get_bk_option( $field_name ) ),
562 'attr' => array( 'onchange' => "javascript: wpbc_on_change__form_color_theme( this );" )
563
564 );
565
566 WPBC_Settings_API::field_select_row_static( $field_name, $field_params );
567
568 ?></table><?php
569 ?><script type="text/javascript">
570 function wpbc_on_change__form_color_theme( _this ){
571 var wpbc_cal_dark_skin_path;
572 if ( 'wpbc_theme_dark_1' == jQuery( _this ).val() ){
573 jQuery( '.wpbc_center_preview,.wpbc_container.wpbc_container_booking_form' ).addClass( 'wpbc_theme_dark_1' );
574 wpbc_cal_dark_skin_path = '<?php echo esc_url( WPBC_PLUGIN_URL ); ?>/css/skins/24_9__dark_1.css';
575 jQuery( '#ui_btn_cstm__set_calendar_skin' ).find( 'option' ).prop( 'selected', false );
576 jQuery( '#ui_btn_cstm__set_calendar_skin' ).find( 'option[value="' + wpbc_cal_dark_skin_path + '"]' ).prop( 'selected', true ).trigger( 'change' );
577 wpbc_cal_dark_skin_path = '<?php echo esc_url( WPBC_PLUGIN_URL ); ?>/css/time_picker_skins/black.css';
578 jQuery( '#ui_btn_cstm__set_time_picker_skin' ).find( 'option' ).prop( 'selected', false );
579 jQuery( '#ui_btn_cstm__set_time_picker_skin' ).find( 'option[value="' + wpbc_cal_dark_skin_path + '"]' ).prop( 'selected', true ).trigger( 'change' );
580 } else {
581 jQuery( '.wpbc_center_preview,.wpbc_container.wpbc_container_booking_form' ).removeClass( 'wpbc_theme_dark_1' );
582 wpbc_cal_dark_skin_path = '<?php echo esc_url( WPBC_PLUGIN_URL ); ?>/css/skins/25_5__square_1.css';
583 jQuery( '#ui_btn_cstm__set_calendar_skin' ).find( 'option' ).prop( 'selected', false );
584 jQuery( '#ui_btn_cstm__set_calendar_skin' ).find( 'option[value="' + wpbc_cal_dark_skin_path + '"]' ).prop( 'selected', true ).trigger( 'change' );
585 wpbc_cal_dark_skin_path = '<?php echo esc_url( WPBC_PLUGIN_URL ); ?>/css/time_picker_skins/light__24_8.css';
586 jQuery( '#ui_btn_cstm__set_time_picker_skin' ).find( 'option' ).prop( 'selected', false );
587 jQuery( '#ui_btn_cstm__set_time_picker_skin' ).find( 'option[value="' + wpbc_cal_dark_skin_path + '"]' ).prop( 'selected', true ).trigger( 'change' );
588 }
589 }
590 </script><?php
591 }
592
593
594 public function content_section__calendar_skin(){
595
596 ?><script type="text/javascript">
597 jQuery( document ).ready( function (){
598
599 // Calendar skin
600 var template__var = wp.template( 'wpbc_ajx_widget_change_calendar_skin' );
601
602 jQuery( '.wpbc_widget_color_skins .ui_container' ).append(
603
604 template__var({ 'ajx_cleaned_params': {
605 'customize_plugin__booking_skin': '<?php echo esc_js( get_bk_option( 'booking_skin' ) ); ?>',
606 }
607 })
608 );
609 } );
610 </script><?php
611 }
612
613
614 public function content_section__time_picker_skin(){
615
616 ?><script type="text/javascript">
617 jQuery( document ).ready( function (){
618 // Time Picker
619 var template__var = wp.template( 'wpbc_ajx_widget_change_time_picker' );
620
621 jQuery( '.wpbc_widget_color_skins .ui_container' ).append(
622
623 template__var({ 'ajx_cleaned_params': {
624 'customize_plugin__time_picker_skin': '<?php echo esc_js( get_bk_option( 'booking_timeslot_picker_skin' ) ); ?>'
625 }
626 })
627 );
628 } );
629 </script><?php
630 }
631
632
633 public function content_section__form_options(){
634
635 $default_options_values = wpbc_get_default_options();
636
637 ?><table class="form-table"><?php
638
639 $field_name = 'booking_is_use_autofill_4_logged_user';
640 $field_params = array(
641 'type' => 'checkbox'
642 , 'default' => $default_options_values[ $field_name ] //'Off'
643 , 'title' => __('Auto-fill fields' ,'booking')
644 , 'label' => __('Check the box to activate auto-fill form fields for logged in users.' ,'booking')
645 , 'description' => ''
646 , 'group' => 'form'
647 , 'value' => ( empty( get_bk_option( $field_name ) ) ? $default_options_values[ $field_name ] : get_bk_option( $field_name ) )
648 );
649 WPBC_Settings_API::field_checkbox_row_static( $field_name, $field_params );
650
651
652 $field_name = 'booking_timeslot_picker';
653 $field_params = array(
654 'type' => 'checkbox'
655 , 'default' => $default_options_values[ $field_name ] //'Off'
656 , 'title' => __('Time picker for time slots' ,'booking')
657 , 'label' => __('Show time slots as a time picker instead of a select box.' ,'booking')
658 , 'description' => ''
659 , 'group' => 'time_slots'
660 , 'tr_class' => 'wpbc_timeslot_picker'
661 , 'value' => ( empty( get_bk_option( $field_name ) ) ? $default_options_values[ $field_name ] : get_bk_option( $field_name ) )
662 );
663 WPBC_Settings_API::field_checkbox_row_static( $field_name, $field_params );
664
665 ?></table><?php
666
667 ?><div style="display: flex;flex-flow: row wrap;justify-content: flex-end;align-items: center;font-size: 10px;">
668 <div style="margin-right: 1em;font-weight: 600;"><?php esc_html_e('Global Settings','booking'); ?>: </div>
669 <i style="margin-right: 5px;<?php echo ( get_bk_option( 'booking_is_use_captcha' ) === 'On' ) ? 'color: var( --wpbc_admin-theme-color, #036aab )' : ''; ?>"
670 class="wpbc_set_nav__right_icon menu_icon icon-1x <?php echo ( get_bk_option( 'booking_is_use_captcha' ) === 'On' ) ? 'wpbc-bi-toggle2-on wpbc_set_nav__icon_on' : 'wpbc-bi-toggle2-off'; ?>"
671 ></i><a href="<?php echo esc_url( wpbc_get_settings_url() ) . '&tab=form&subtab=form_options#do_expand__wpbc_general_settings_form_metabox#do_other_actions__blink_captcha'; ?>">
672 <span ><?php
673 esc_html_e( 'CAPTCHA', 'booking' );
674 echo ' ';
675 echo esc_html( get_bk_option( 'booking_is_use_captcha' ) );
676 ?></span>
677 </a>
678 </div><?php
679 }
680
681
682 private function help_notice__show_time_fields_once() {
683
684 ?>
685 <div class="wpbc-settings-notice notice-error notice-helpful-info0" style="margin: 0 0 30px;">
686 <?php
687 echo '<strong>';
688 esc_html_e( 'Error', 'booking' );
689 echo '!</strong>&nbsp;&nbsp;';
690
691 /* translators: 1: ... */
692 echo wp_kses_post( __( 'You can either use the time slots field or the start time and duration time fields, but not both. If you choose to use the start time and duration time fields, make sure to use them together.', 'booking' ) );
693 ?>
694 </div>
695 <?php
696 }
697
698 private function help_notice__show_missed_time_fields() {
699
700 ?>
701 <div class="wpbc-settings-notice notice-error notice-helpful-info0" style="margin: 0 0 30px;">
702 <?php
703 echo '<strong>';
704 esc_html_e( 'Error', 'booking' );
705 echo '!</strong>&nbsp;&nbsp;';
706
707 /* translators: 1: ... */
708 echo wp_kses_post( __( 'You must use both the start time field and the duration time field together.', 'booking' ) );
709 ?>
710 </div>
711 <?php
712 }
713
714 private function is_exist_duplicated_time_fields( $visual_form_structure ) {
715
716 $time_fields_arr = array();
717 foreach ( $visual_form_structure as $field_arr ) {
718 if (
719 ( isset( $field_arr['active'] ) ) &&
720 ( isset( $field_arr['name'] ) ) &&
721 ( 'on' === strtolower( $field_arr['active'] ) ) &&
722 ( in_array( $field_arr['name'], array(
723 'rangetime',
724 'durationtime',
725 'starttime',
726 'endtime',
727 ), true ) ) ) {
728 $time_fields_arr[] = $field_arr['name'];
729 }
730 }
731
732 if ( in_array( 'rangetime', $time_fields_arr, true ) ) {
733
734 if ( count( $time_fields_arr ) > 1 ) {
735 return 'duplicated_time_fields';
736 }
737
738 } else {
739
740 if ( count( $time_fields_arr ) === 1 ) {
741 return 'missed_time_fields';
742 }
743 }
744
745 return 'ok';
746 }
747
748 /**
749 * Show Fields Table */
750 private function show_booking_form_fields_table( $booking_form_structure ) {
751
752 $booking_form_structure = maybe_unserialize( $booking_form_structure );
753
754 $skip_obligatory_field_types =array();// array( 'calendar', 'submit', 'captcha' );
755
756 $obligatory_field_types = array( 'calendar', 'submit', 'email' );
757 if ( ! wpbc_is_mu_user_can_be_here( 'only_super_admin' ) ) {
758 $obligatory_field_types[] = 'captcha';
759 }
760
761
762 if ( 'duplicated_time_fields' === $this->is_exist_duplicated_time_fields( $booking_form_structure ) ) {
763 $this->help_notice__show_time_fields_once();
764 }
765 if ( 'missed_time_fields' === $this->is_exist_duplicated_time_fields( $booking_form_structure ) ) {
766 $this->help_notice__show_missed_time_fields();
767 }
768
769 ?><table class="widefat wpbc_input_table sortable wpdevelop wpbc_table_form_free" cellspacing="0" cellpadding="0"> <?php //FixIn: 10.1.2.2 style="flex:0 1 49.9%;"> ?>
770 <thead>
771 <tr>
772 <th class="sort"><span class="wpbc_icn_swap_vert" aria-hidden="true"></span></th>
773 <th class="field_active"><?php echo esc_js( __('Active', 'booking') ); ?></th>
774 <th class="field_label"><?php echo esc_js( __('Field Label', 'booking') ); ?></th>
775 <th class="field_required"><?php echo esc_js( __('Required', 'booking') ); ?></th>
776 <!--th class="field_options"><?php echo esc_js( __('Type', 'booking') ) . ' | ' . esc_js( __('Name', 'booking') ); ?></th-->
777 <th class="field_actions"><?php echo esc_js( __('Actions', 'booking') ); ?></th>
778 </tr>
779 </thead>
780 <tbody class="wpbc_form_fields_body">
781 <?php
782
783 $i=0;
784
785 foreach ( $booking_form_structure as $form_field ) {
786
787 $defaults = array(
788 'type' => 'text'
789 , 'name' => 'unique_name'
790 , 'obligatory' => 'Off'
791 , 'active' => 'On'
792 , 'required' => 'Off'
793 , 'label' => ''
794 , 'value' => ''
795 );
796 $form_field = wp_parse_args( $form_field, $defaults );
797
798 if( ! in_array( $form_field['type'], $skip_obligatory_field_types ) ) {
799
800 $i++;
801
802 $row = '<tr class="account">';
803
804 $row .= '<td class="sort"><span class="wpbc_icn_drag_indicator" aria-hidden="true"></span></td>';
805
806 // Flex Toggle
807 if ( 1 ) {
808 ob_start();
809 $is_checked = ( $form_field['active'] === 'On' );
810 $field_id = 'wpbc_on_off_' . 'active_' . intval( microtime( true ) ) . '_' . wp_rand( 1, 1000 );
811 $field_name = 'form_field_active[' . $i . ']';
812 $field_value = esc_attr( $form_field['active'] );
813 $params_checkbox = array(
814 'id' => $field_id // HTML ID of element
815 , 'name' => $field_name
816 , 'label' => array( 'title' => '', 'position' => 'right' )
817 , 'toggle_style' => '' // CSS of select element
818 , 'class' => 'wpbc_visible_but_out_screen ' // CSS Class of select element
819 , 'disabled' => ''
820 , 'attr' => array( 'autocomplete' => 'off' ) // Any additional attributes, if this radio | checkbox element
821 , 'legend' => '' //wp_kses_post( $field_title ) // aria-label parameter
822 , 'value' => $field_value // Some Value from options array that selected by default
823 , 'selected' => $is_checked // Selected or not
824 //, 'onchange' => "jQuery( this ).parents('.wpbc_searchable_on_off').find('.wpbc_label_on_off').hide();jQuery( this ).parents('.wpbc_searchable_on_off').find( jQuery( this ).is(':checked') ? '.wpbc_label_on' : '.wpbc_label_off' ).show();" // JavaScript code
825 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
826 //, 'hint' => array( 'title' => __('Send email notification to customer about this operation' ,'booking') , 'position' => 'top' )
827 );
828 wpbc_flex_toggle( $params_checkbox );
829 $flex_toggle = ob_get_clean();
830 }
831
832 $row .= '<td class="field_active"><div class="wpbc_align_vertically">'
833 . ( ( ( $form_field['obligatory'] != 'On' ) && ( ! in_array( $form_field['type'], $obligatory_field_types ) ) )
834 ? $flex_toggle
835 // ? '<input type="checkbox" name="form_field_active[' . $i . ']" value="' . esc_attr( $form_field['active'] ) . '" ' . checked( $form_field['active'], 'On' , false ) . ' autocomplete="off" />'
836 : '' )
837
838 .'</div></td>';
839 $row .= '<td class="field_label"><div class="wpbc_align_vertically">'
840 . '<legend class="screen-reader-text"><span>' . esc_attr( $form_field['label'] ) . '</span></legend>'
841 .'<input type="text"
842 name="form_field_label[' . $i . ']"
843 value="' . esc_attr( $form_field['label'] ) . '"
844 class="regular-text"
845 placeholder="' . ( ( $form_field['name'] == 'calendar' ) ? __( 'Select date(s)', 'booking' ) : esc_attr( $form_field['label'] ) ) . '"
846 autocomplete="off"
847 /> ';
848 if (
849 ( in_array( $form_field['name'], array( 'calendar', 'submit', 'captcha', 'rangetime', 'durationtime', 'starttime', 'endtime' ), true ) )
850 || ( in_array( $form_field['type'], array( 'calendar' ) ) )
851 ){
852 $css_label = 'wpbc_label_approved';
853 $css_label = (( $form_field['name'] == 'calendar' ) || ( $form_field['type'] == 'calendar' )) ? 'wpbc_label_deleted_resource' : $css_label;
854 $css_label = ( $form_field['name'] == 'submit' ) ? 'wpbc_label_resource' : $css_label;
855 $css_label = ( $form_field['name'] == 'captcha' ) ? 'wpbc_label_pending' : $css_label;
856 $css_label = ( in_array( $form_field['name'], array( 'rangetime', 'durationtime', 'starttime', 'endtime' ), true ) ) ? 'wpbc_label_approved' : $css_label;
857
858 $row .= '<div class="field_type_name_description"><div class="field_type_name_value wpbc_label '.$css_label.'" style="text-transform: uppercase;padding: 0 1em;">';
859
860 if ( ( $form_field['name'] == 'calendar' ) ||
861 ( $form_field['type'] == 'calendar' ) ) { $row .= __( 'Calendar', 'booking' );
862 } else if ( $form_field['name'] == 'rangetime' ) { $row .= __( 'Time Slots', 'booking' );
863 } else if ( $form_field['name'] == 'durationtime' ) { $row .= __( 'Duration Time', 'booking' ) . ' / ' . __( 'Service Duration', 'booking' );
864 } else if ( $form_field['name'] == 'starttime' ) { $row .= __( 'Start Time', 'booking' );
865 } else if ( $form_field['name'] == 'endtime' ) { $row .= __( 'End Time', 'booking' );
866 } else if ( $form_field['name'] == 'submit' ) { $row .= $form_field['name'] . ' ' . __( 'Button', 'booking' );
867 } else { $row .= $form_field['name'];
868 }
869 $row .= '</div></div>';
870 } else {
871 $row .= '<div class="field_type_name_description">
872 ' . __( 'Type', 'booking' ) . ': <div class="field_type_name_value">' . $form_field['type'] . '</div>
873 <span class="field_type_name_separator">|</span>
874 ' . __( 'Name', 'booking' ) . ': <div class="field_type_name_value">' . $form_field['name'] . '</div>
875 </div>';
876 }
877 $row .= '<input type="hidden" value="'. esc_attr( ( 'select' == $form_field['type'] ) ? 'selectbox' : $form_field['type'] ) . '" name="form_field_type[' . $i . ']" autocomplete="off" />'
878 . '<input type="hidden" value="'. esc_attr( $form_field['name'] ) . '" name="form_field_name[' . $i . ']" autocomplete="off" />'
879 . '<input type="hidden" value="'. esc_attr( $form_field['value'] ) . '" name="form_field_value[' . $i . ']" autocomplete="off" />'
880 .'</div></td>';
881
882 //FixIn: TimeFreeGenerator
883 $is_show_required_checkbox = true;
884 if ( ( $form_field['obligatory'] == 'On' ) || ( in_array( $form_field['type'], $obligatory_field_types ) ) ) {
885 $is_show_required_checkbox = false;
886 }
887 if ( isset( $form_field['if_exist_required'] ) && ( $form_field['if_exist_required'] == 'On' ) ) {
888 $is_show_required_checkbox = false;
889 }
890
891 // Flex Toggle
892 if ( 1 ) {
893 ob_start();
894 $is_checked = ( $form_field['required'] === 'On' );
895 $field_id = 'wpbc_on_off_' . 'required_' . intval( microtime( true ) ) . '_' . wp_rand( 1, 1000 );
896 $field_name = 'form_field_required[' . $i . ']';
897 $field_value = esc_attr( $form_field['required'] );
898 $params_checkbox = array(
899 'id' => $field_id // HTML ID of element
900 , 'name' => $field_name
901 , 'label' => array( 'title' => '', 'position' => 'right' )
902 , 'toggle_style' => '' // CSS of select element
903 , 'class' => 'wpbc_visible_but_out_screen ' // CSS Class of select element
904 , 'disabled' => ''
905 , 'attr' => array( 'autocomplete' => 'off' ) // Any additional attributes, if this radio | checkbox element
906 , 'legend' => '' //wp_kses_post( $field_title ) // aria-label parameter
907 , 'value' => $field_value // Some Value from options array that selected by default
908 , 'selected' => $is_checked // Selected or not
909 //, 'onchange' => "jQuery( this ).parents('.wpbc_searchable_on_off').find('.wpbc_label_on_off').hide();jQuery( this ).parents('.wpbc_searchable_on_off').find( jQuery( this ).is(':checked') ? '.wpbc_label_on' : '.wpbc_label_off' ).show();" // JavaScript code
910 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
911 //, 'hint' => array( 'title' => __('Send email notification to customer about this operation' ,'booking') , 'position' => 'top' )
912 );
913 wpbc_flex_toggle( $params_checkbox );
914 $flex_toggle = ob_get_clean();
915 }
916 $row .= '<td class="field_required"><div class="wpbc_align_vertically">'
917 . ( $is_show_required_checkbox ? $flex_toggle : '' )
918 // ( $is_show_required_checkbox ? '<input type="checkbox" name="form_field_required[' . $i . ']" value="' . esc_attr( $form_field['required'] ) . '" ' . checked( $form_field['required'], 'On' , false ) . ' autocomplete="off" />' : '' )
919 .'</div></td>';
920 // $row .= '<td class="field_options"><div class="wpbc_align_vertically">'
921 // . '<input type="text" disabled="DISABLED" value="'. '' . $form_field['type']. ' | ' . $form_field['name'] . '" autocomplete="off" />'
922 // .'</div></td>';
923 $row .= '<td class="field_actions">';
924 if ( ( $form_field['obligatory'] != 'On' ) && ( ! in_array( $form_field['type'], array( 'captcha' ) ) ) ) {
925 //TODO: refactor here: 2024-05-31 23:15
926 $row .= '<a href="javascript:void(0)" onclick="javascript:wpbc_start_edit_form_field(' . $i . ');" class="tooltip_top button-secondary button" title="'.__('Edit' ,'booking').'"><i class="wpbc_icn_draw"></i></a>';
927 $row .= '<a href="javascript:void(0)" class="tooltip_top button-secondary button delete_bk_link" title="'.__('Remove' ,'booking').'"><i class="wpbc_icn_close"></i></a>';
928 //TODO: refactor here: 2024-05-31 23:15
929 /*
930 ob_start();
931 ?>
932 <div class="wpbc_ajx_toolbar wpbc_no_background" style="margin:0;">
933 <div class="ui_container ui_container_small">
934 <div class="ui_group ui_group__search_url">
935 <?php
936 wpbc_ajx__ui__all_or_new( array(), array('wh_what_bookings'=>'new') );
937
938 echo '<div class="ui_element" style="margin:0 5px 0 -10px"><a href="javascript:void(0)" onclick="javascript:wpbc_start_edit_form_field(' . $i . ');" class="wpbc_ui_control wpbc_ui_button wpbc_ui_button tooltip_top " title="'.__('Edit' ,'booking').'"><i class="wpbc_icn_draw"></i></a></div>';
939 echo '<div class="ui_element"><a href="javascript:void(0)" class="wpbc_ui_control wpbc_ui_button wpbc_ui_button tooltip_top button delete_bk_link" title="'.__('Remove' ,'booking').'"><i class="wpbc_icn_close"></i></a></div>';
940
941 ?></div></div></div><?php
942 $elemnt = ob_get_clean();
943 $row .= $elemnt;
944 */
945 }
946 $row .= '</td>';
947
948 $row .= '</tr>';
949 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
950 echo $row;
951 }
952 }
953
954 ?>
955 </tbody>
956 <?php /* ?>
957 <tfoot>
958 <tr>
959 <th colspan="6">
960 <a href="#" class="remove_rows button"><?php esc_html_e( 'Remove selected field' ,'booking'); ?></a>
961 </th>
962 </tr>
963 </tfoot>
964 <?php /**/ ?>
965 </table><?php
966
967
968 }
969
970
971 /** CSS for this page */
972 private function css() {
973 ?>
974 <style type="text/css">
975 /* toolbar fix */
976 .wpdevelop .visibility_container .control-group {
977 margin: 2px 8px 3px 0; /* margin: 0 8px 5px 0; */ /* FixIn: 9.5.4.8 */
978 }
979 /* Selectbox element in toolbar */
980 .visibility_container select optgroup{
981 color:#999;
982 vertical-align: middle;
983 font-style: italic;
984 font-weight: 400;
985 }
986 .visibility_container select option {
987 padding:5px;
988 font-weight: 600;
989 }
990 .visibility_container select optgroup option{
991 padding: 5px 20px;
992 color:#555;
993 font-weight: 600;
994 }
995 #wpbc_create_new_custom_form_name_fields {
996 width: 360px;
997 display:none;
998 }
999 @media (max-width: 399px) {
1000 #wpbc_create_new_custom_form_name_fields {
1001 width: 100%;
1002 }
1003 }
1004 </style>
1005 <?php
1006 wpbc_timeslots_free_css(); //FixIn: TimeFreeGenerator
1007 }
1008
1009
1010 // -----------------------------------------------------------------------------------------------------------------
1011 // Generators
1012 // -----------------------------------------------------------------------------------------------------------------
1013 /** Sections with Add New Fields forms */
1014 private function fields_generator_section() {
1015 ?>
1016 <div class="wpbc_field_generator wpbc_field_generator_info">
1017 <?php
1018
1019 echo
1020 '<p><strong>' . esc_html__('Shortcodes' ,'booking') . '.</strong> '
1021 . wp_kses_post( sprintf(__('You can generate the form fields for your form (at the left side) by selection specific field in the above selectbox.' ,'booking'),'<code><strong>[email* email]</strong></code>'))
1022 /* translators: 1: ... */
1023 .'<br/>' . wp_kses_post( sprintf( __( 'Please read more about the booking form fields configuration %1$shere%2$s.', 'booking' ),'<a href="https://wpbookingcalendar.com/faq/booking-form-fields/" target="_blank">', '</a>') )
1024
1025 . '</p><p><strong>' . esc_html__('Default Form Templates' ,'booking') . '.</strong> ' .
1026 /* translators: 1: ... */
1027 wp_kses_post( sprintf( __( 'You can reset your active form template by selecting default %1$sform template%2$s at the top toolbar. Please select the form template and click on %3$sReset%4$s button for resetting only active form (Booking Form or Content of Booking Fields form). Click on %5$sBoth%6$s button if you want to reset both forms: Booking Form and Content of Booking Fields form.', 'booking' )
1028 ,'<strong>','</strong>'
1029 ,'<strong>','</strong>'
1030 ,'<strong>','</strong>'
1031 ) )
1032 .'</p>';
1033 ?>
1034 </div>
1035 <div class="wpbc_field_generator wpbc_field_generator_text">
1036 <?php
1037
1038 $this->generate_field(
1039 'text_field_generator'
1040 , array(
1041 'active' => true
1042 , 'required' => true
1043 , 'label' => true
1044 , 'name' => true
1045 , 'value' => false
1046 , 'type' => 'text'
1047 )
1048 );
1049 ?>
1050 </div>
1051 <div class="wpbc_field_generator wpbc_field_generator_textarea">
1052 <?php
1053
1054 $this->generate_field(
1055 'textarea_field_generator'
1056 , array(
1057 'active' => true
1058 , 'required' => true
1059 , 'label' => true
1060 , 'name' => true
1061 , 'value' => false
1062 , 'type' => 'textarea'
1063 )
1064 );
1065 ?>
1066 </div>
1067 <div class="wpbc_field_generator wpbc_field_generator_select wpbc_field_generator_selectbox">
1068 <?php
1069 $this->generate_field(
1070 'selectbox_field_generator'
1071 , array(
1072 'active' => true
1073 , 'required' => true
1074 , 'label' => true
1075 , 'name' => true
1076 , 'value' => true
1077 , 'type' => 'selectbox'
1078 )
1079 );
1080 ?>
1081 </div>
1082 <div class="wpbc_field_generator wpbc_field_generator_checkbox">
1083 <?php
1084
1085 $this->generate_field(
1086 'checkbox_field_generator'
1087 , array(
1088 'active' => true
1089 , 'required' => true
1090 , 'label' => true
1091 , 'name' => true
1092 , 'value' => false
1093 , 'type' => 'checkbox'
1094 )
1095 );
1096 ?>
1097 </div>
1098 <?php
1099 //FixIn: TimeFreeGenerator
1100 ?>
1101 <div class="wpbc_field_generator wpbc_field_generator_rangetime">
1102 <?php
1103
1104 $this->generate_field(
1105 'rangetime_field_generator'
1106 , array(
1107 'active' => true
1108 , 'required' => true
1109 , 'label' => true
1110 , 'name' => true
1111 , 'value' => true
1112 , 'type' => 'selectbox'
1113
1114 , 'required_attr' => array( 'disabled' => true
1115 , 'value' => 'On'
1116 )
1117 , 'label_attr' => array( 'placeholder' => __( 'Time Slots', 'booking' )
1118 , 'value' => __( 'Time Slots', 'booking' )
1119 )
1120 , 'name_attr' => array( 'disabled' => true
1121 , 'placeholder' => 'rangetime'
1122 , 'value' => 'rangetime'
1123 )
1124 , 'value_attr' => array( 'value' => "10:00 AM - 12:00 PM@@10:00 - 12:00\n12:00 PM - 02:00 PM@@12:00 - 14:00\n13:00 - 14:00\n11:00 - 15:00\n14:00 - 16:00\n16:00 - 18:00\n18:00 - 20:00"
1125 , 'attr' => array(
1126 'placeholder' => "10:00 AM - 12:00 PM@@10:00 - 12:00\n12:00 PM - 02:00 PM@@12:00 - 14:00\n13:00 - 14:00\n11:00 - 15:00\n14:00 - 16:00\n16:00 - 18:00\n18:00 - 20:00"
1127 )
1128 , 'rows' => 8
1129 , 'cols' => 37
1130 )
1131 )
1132 );
1133 ?>
1134 </div>
1135 <?php
1136
1137 // FixIn: 10.10.1.4.
1138 ?>
1139 <div class="wpbc_field_generator wpbc_field_generator_durationtime">
1140 <?php
1141 // __( 'Start Time', 'booking' ) . ' / ' . __( 'Duration Time', 'booking' ), .
1142 $this->generate_field(
1143 'durationtime_field_generator',
1144 array(
1145 'active' => true,
1146 'required' => true,
1147 'label' => true,
1148 'name' => true,
1149 'value' => true,
1150 'type' => 'selectbox',
1151 'required_attr' => array(
1152 'disabled' => true,
1153 'value' => 'On',
1154 ),
1155 'label_attr' => array(
1156 'placeholder' => __( 'Duration Time', 'booking' ),
1157 'value' => __( 'Duration Time', 'booking' ),
1158 ),
1159 'name_attr' => array(
1160 'disabled' => true,
1161 'placeholder' => 'durationtime',
1162 'value' => 'durationtime',
1163 ),
1164 'value_attr' => array(
1165 'value' => "Service A (15 min)@@00:15\nService B (20 min)@@00:20\nService C (30 min)@@00:30\nService D (1 hour)@@01:00\nService E (2 hours)@@02:00",
1166 'attr' => array(
1167 'placeholder' => "Service A (15 min)@@00:15\nService B (20 min)@@00:20\nService C (30 min)@@00:30\nService D (1 hour)@@01:00\nService E (2 hours)@@02:00",
1168 ),
1169 'rows' => 8,
1170 'cols' => 37,
1171 ),
1172 )
1173 );
1174 ?>
1175 </div>
1176 <?php
1177
1178
1179 // FixIn: 10.10.1.5.
1180 ?>
1181 <div class="wpbc_field_generator wpbc_field_generator_starttime">
1182 <?php
1183 // __( 'Start Time', 'booking' ) . ' / ' . __( 'Duration Time', 'booking' ), .
1184 $this->generate_field(
1185 'starttime_field_generator',
1186 array(
1187 'active' => true,
1188 'required' => true,
1189 'label' => true,
1190 'name' => true,
1191 'value' => true,
1192 'type' => 'selectbox',
1193 'required_attr' => array(
1194 'disabled' => true,
1195 'value' => 'On',
1196 ),
1197 'label_attr' => array(
1198 'placeholder' => __( 'Start Time', 'booking' ),
1199 'value' => __( 'Start Time', 'booking' ),
1200 ),
1201 'name_attr' => array(
1202 'disabled' => true,
1203 'placeholder' => 'starttime',
1204 'value' => 'starttime',
1205 ),
1206 'value_attr' => array(
1207 'value' => "10:00 AM@@10:00\n10:30 AM@@10:30\n11:00 AM@@11:00\n11:30 AM@@11:30\n12:00 PM@@12:00\n12:30 PM@@12:30\n1:00 PM@@13:00\n1:30 PM@@13:30\n2:00 PM@@14:00\n2:30 PM@@14:30\n3:00 PM@@15:00\n3:30 PM@@15:30\n4:00 PM@@16:00\n4:30 PM@@16:30\n5:00 PM@@17:00\n5:30 PM@@17:30\n6:00 PM@@18:00",
1208 'attr' => array(
1209 'placeholder' => "10:00 AM@@10:00\n10:30 AM@@10:30\n11:00 AM@@11:00\n11:30 AM@@11:30\n12:00 PM@@12:00\n12:30 PM@@12:30\n1:00 PM@@13:00\n1:30 PM@@13:30\n2:00 PM@@14:00\n2:30 PM@@14:30\n3:00 PM@@15:00\n3:30 PM@@15:30\n4:00 PM@@16:00\n4:30 PM@@16:30\n5:00 PM@@17:00\n5:30 PM@@17:30\n6:00 PM@@18:00",
1210 ),
1211 'rows' => 8,
1212 'cols' => 37,
1213 ),
1214 )
1215 );
1216 ?>
1217 </div>
1218 <?php
1219
1220
1221 // FixIn: 10.10.1.5.
1222 ?>
1223 <div class="wpbc_field_generator wpbc_field_generator_endtime">
1224 <?php
1225 // __( 'Start Time', 'booking' ) . ' / ' . __( 'Duration Time', 'booking' ), .
1226 $this->generate_field(
1227 'endtime_field_generator',
1228 array(
1229 'active' => true,
1230 'required' => true,
1231 'label' => true,
1232 'name' => true,
1233 'value' => true,
1234 'type' => 'selectbox',
1235 'required_attr' => array(
1236 'disabled' => true,
1237 'value' => 'On',
1238 ),
1239 'label_attr' => array(
1240 'placeholder' => __( 'End Time', 'booking' ),
1241 'value' => __( 'End Time', 'booking' ),
1242 ),
1243 'name_attr' => array(
1244 'disabled' => true,
1245 'placeholder' => 'endtime',
1246 'value' => 'endtime',
1247 ),
1248 'value_attr' => array(
1249 'value' => "10:00 AM@@10:00\n10:30 AM@@10:30\n11:00 AM@@11:00\n11:30 AM@@11:30\n12:00 PM@@12:00\n12:30 PM@@12:30\n1:00 PM@@13:00\n1:30 PM@@13:30\n2:00 PM@@14:00\n2:30 PM@@14:30\n3:00 PM@@15:00\n3:30 PM@@15:30\n4:00 PM@@16:00\n4:30 PM@@16:30\n5:00 PM@@17:00\n5:30 PM@@17:30\n6:00 PM@@18:00",
1250 'attr' => array(
1251 'placeholder' => "10:00 AM@@10:00\n10:30 AM@@10:30\n11:00 AM@@11:00\n11:30 AM@@11:30\n12:00 PM@@12:00\n12:30 PM@@12:30\n1:00 PM@@13:00\n1:30 PM@@13:30\n2:00 PM@@14:00\n2:30 PM@@14:30\n3:00 PM@@15:00\n3:30 PM@@15:30\n4:00 PM@@16:00\n4:30 PM@@16:30\n5:00 PM@@17:00\n5:30 PM@@17:30\n6:00 PM@@18:00",
1252 ),
1253 'rows' => 8,
1254 'cols' => 37,
1255 ),
1256 )
1257 );
1258 ?>
1259 </div>
1260 <?php
1261
1262
1263 // Close button.
1264 ?>
1265 <div class="wpbc_field_generator wpbc_field_generator_info_advanced">
1266 <div class="clear" style="margin-top:20px;"></div>
1267 <a onclick="javascript:wpbc_hide_fields_generators();" href="javascript:void(0)" style="margin: 0 15px;" class="button button"><i class="menu_icon icon-1x wpbc_icn_visibility_off"></i>&nbsp;
1268 <?php
1269 esc_html_e( 'Close', 'booking' );
1270 ?>
1271 </a>
1272 </div>
1273 <?php
1274 }
1275
1276
1277
1278 /**
1279 * General Fields Generator
1280 *
1281 * @param $field_name
1282 * @param $field_options
1283 *
1284 * @return void
1285 */
1286 private function generate_field( $field_name = 'some_field_name', $field_options = array() ) {
1287
1288 $defaults = array(
1289 'active' => true
1290 , 'required' => true
1291 , 'label' => true
1292 , 'name' => true
1293 , 'value' => true
1294 //FixIn: TimeFreeGenerator (inside of form fields edited, as well)
1295 , 'required_attr' => array( 'disabled' => false
1296 , 'value' => 'Off'
1297 )
1298 , 'label_attr' => array( 'placeholder' => __('First Name', 'booking')
1299 , 'value' => ''
1300 )
1301 , 'name_attr' => array( 'disabled' => false
1302 , 'placeholder' => 'first_name'
1303 , 'value' => ''
1304 )
1305 , 'value_attr' => array( 'value' => ''
1306 , 'attr' => array( 'placeholder' => "1\n2\n3\n4" )
1307 , 'rows' => 8
1308 , 'cols' => 37
1309 )
1310 );
1311 $field_options = wp_parse_args( $field_options, $defaults );
1312
1313 ?><table class="form-table"><?php
1314
1315 if ( $field_options['active'] )
1316 WPBC_Settings_API::field_checkbox_row_static( $field_name . '_active'
1317 , array(
1318 'type' => 'checkbox'
1319 , 'title' => __('Active', 'booking')
1320 , 'label' => __('Show / hide field in booking form', 'booking')
1321 , 'disabled' => false
1322 , 'class' => ''
1323 , 'css' => ''
1324 , 'type' => 'checkbox'
1325 , 'description' => ''
1326 , 'attr' => array()
1327 , 'group' => 'general'
1328 , 'tr_class' => ''
1329 , 'only_field' => false
1330 , 'is_new_line' => true
1331 , 'description_tag' => 'span'
1332 , 'value' => 'On'
1333 )
1334 , true
1335 );
1336 if ( $field_options['required'] )
1337 WPBC_Settings_API::field_checkbox_row_static( $field_name . '_required'
1338 , array(
1339 'type' => 'checkbox'
1340 , 'title' => __('Required', 'booking')
1341 , 'label' => __('Set field as required', 'booking')
1342 , 'disabled' => $field_options[ 'required_attr' ][ 'disabled' ] //false
1343 , 'class' => ''
1344 , 'css' => ''
1345 , 'type' => 'checkbox'
1346 , 'description' => ''
1347 , 'attr' => array()
1348 , 'group' => 'general'
1349 , 'tr_class' => ''
1350 , 'only_field' => false
1351 , 'is_new_line' => true
1352 , 'description_tag' => 'span'
1353 , 'value' => $field_options[ 'required_attr' ][ 'value' ] //'Off'
1354 )
1355 , true
1356 );
1357 if ( $field_options['label'] )
1358 WPBC_Settings_API::field_text_row_static( $field_name . '_label'
1359 , array(
1360 'type' => 'text'
1361 , 'title' => __('Label', 'booking')
1362 , 'disabled' => false
1363 , 'class' => ''
1364 , 'css' => ''
1365 , 'placeholder' => $field_options[ 'label_attr' ][ 'placeholder' ] //'First Name'
1366 , 'description' => ''//__('Enter field label', 'booking')
1367 , 'group' => 'general'
1368 , 'tr_class' => ''
1369 , 'only_field' => false
1370 , 'description_tag' => 'p'
1371 , 'value' => $field_options[ 'label_attr' ][ 'value' ] //''
1372 , 'attr' => array(
1373 'oninput' => "javascript:this.onchange();"
1374 , 'onpaste' => "javascript:this.onchange();"
1375 , 'onkeypress'=> "javascript:this.onchange();"
1376 , 'onchange' => "javascript:if ( ! jQuery('#".$field_name . '_name'."').is(':disabled') ) { jQuery('#".$field_name . '_name'."').val(jQuery(this).val() );} wpbc_check_typed_name('".$field_name."');"
1377 )
1378 )
1379 , true
1380 );
1381 if ( $field_options['name'] )
1382 WPBC_Settings_API::field_text_row_static( $field_name . '_name'
1383 , array(
1384 'type' => 'text'
1385 , 'title' => __('Name', 'booking') . ' *'
1386 , 'disabled' => $field_options[ 'name_attr' ][ 'disabled' ] //false
1387 , 'class' => ''
1388 , 'css' => ''
1389 , 'placeholder' => $field_options[ 'name_attr' ][ 'placeholder' ] //'first_name'
1390 /* translators: 1: ... */
1391 , 'description' => sprintf( __( 'Type only %1$sunique field name%2$s, that is not using in form', 'booking' ), '<strong>', '</strong>' )
1392 , 'group' => 'general'
1393 , 'tr_class' => ''
1394 , 'only_field' => false
1395 , 'description_tag' => 'p'
1396 , 'value' => $field_options[ 'name_attr' ][ 'value' ] //''
1397 , 'attr' => array(
1398 'oninput' => "javascript:this.onchange();"
1399 , 'onpaste' => "javascript:this.onchange();"
1400 , 'onkeypress'=> "javascript:this.onchange();"
1401 , 'onchange' => "javascript:wpbc_check_typed_name('".$field_name."');"
1402
1403 )
1404
1405 )
1406 , true
1407 );
1408 if ( $field_options['value'] )
1409 WPBC_Settings_API::field_textarea_row_static( $field_name . '_value'
1410 , array(
1411
1412 'title' => __('Values', 'booking')
1413 , 'disabled' => false
1414 , 'class' => ''
1415 , 'css' => ''
1416 , 'placeholder' => ''
1417 , 'description' => __('Enter dropdown options. One option per line.', 'booking') //. '<br>'
1418 //. (( 'durationtime_field_generator' !== $field_options['name'] ) ? '' : __( 'The option format is "Title@@Time Duration," where "Title" is usually the service name and "Time Duration" is defined in the format HH:MM (HH = hours from 00 to 23, MM = minutes from 00 to 59).', 'booking' ))
1419 //. (( 'starttime_field_generator' !== $field_options['name'] ) ? '' : __( 'The option format is "Title@@Time," where "Title" is any text (typically the time in AM/PM format) and "Time" is defined in the 24-hour format (HH:MM), where HH = hours (00 to 23) and MM = minutes (00 to 59).', 'booking' ))
1420 , 'group' => 'general'
1421 , 'tr_class' => ''
1422 , 'only_field' => false
1423 , 'description_tag' => 'p'
1424 , 'value' => $field_options[ 'value_attr' ][ 'value' ] // ''
1425 , 'attr' => $field_options[ 'value_attr' ][ 'attr' ] //array( 'placeholder' => "1\n2\n3\n4" ) //Override Placeholder value, because of escaping \n symbols
1426 , 'rows' => $field_options[ 'value_attr' ][ 'rows' ] //2
1427 , 'cols' => $field_options[ 'value_attr' ][ 'cols' ] //37
1428 , 'show_in_2_cols' => false
1429 , 'attr' => array(
1430 'oninput' => "javascript:this.onchange();"
1431 , 'onpaste' => "javascript:this.onchange();"
1432 , 'onkeypress'=> "javascript:this.onchange();"
1433 , 'onchange' => "javascript:wpbc_check_typed_values('".$field_name."');"
1434 )
1435 )
1436 , true
1437 );
1438 do_action( 'wpbc_settings_form_page_after_values', $field_name, $field_options ); //FixIn: TimeFreeGenerator
1439
1440 ?>
1441 <tr><th colspan="2" style="border-bottom:1px solid #eee;padding:10px 0 0;"></th></tr>
1442
1443 <tr class="wpbc_add_field_row">
1444 <th colspan="2" class="wpdevelop">
1445 <a onclick="javascript:wpbc_add_field ( '<?php echo esc_attr( $field_name ); ?>', '<?php echo esc_attr( $field_options['type'] ); ?>' );"
1446 href="javascript:void(0)"
1447 style=""
1448 class="button button-primary"><i class="menu_icon icon-1x wpbc_icn_add _circle_outline"></i>&nbsp;&nbsp;<?php esc_html_e( 'Add New Field' ,'booking'); ?></a>
1449 &nbsp;&nbsp;
1450 <a onclick="javascript:wpbc_hide_fields_generators();"
1451 href="javascript:void(0)"
1452 style=""
1453 class="button button"><i class="menu_icon icon-1x wpbc_icn_close"></i>&nbsp;&nbsp;<?php esc_html_e( 'Cancel' ,'booking'); ?></a>
1454 </th>
1455 </tr>
1456
1457 <tr class="wpbc_edit_field_row">
1458 <th colspan="2" class="wpdevelop">
1459 <a onclick="javascript:wpbc_finish_edit_form_field ( '<?php echo esc_attr( $field_name ); ?>', '<?php echo esc_attr( $field_options['type'] ); ?>' );"
1460 href="javascript:void(0)"
1461 style=""
1462 class="button button-primary"><i class="menu_icon icon-1x wpbc_icn_draw"></i>&nbsp;&nbsp;<?php esc_html_e( 'Save Changes' ,'booking'); ?></a>
1463 &nbsp;&nbsp;
1464 <a onclick="javascript:wpbc_hide_fields_generators();"
1465 href="javascript:void(0)"
1466 style=""
1467 class="button button"><i class="menu_icon icon-1x wpbc_icn_close"></i>&nbsp;&nbsp;<?php esc_html_e( 'Cancel' ,'booking'); ?></a>
1468 </th>
1469 </tr>
1470
1471 </table><?php
1472 }
1473
1474
1475 // <editor-fold defaultstate="collapsed" desc=" Activate | Deactivate " >
1476
1477 public function activate() {
1478
1479 add_bk_option( 'booking_form', wpbc_simple_form__get_booking_form__as_shortcodes() );
1480 add_bk_option( 'booking_form_show', wpbc_simple_form__get_form_show__as_shortcodes() );
1481 add_bk_option( 'booking_form_visual', wpbc_simple_form__visual__get_default_form() );
1482 }
1483
1484 public function deactivate() {
1485
1486 delete_bk_option( 'booking_form' );
1487 delete_bk_option( 'booking_form_show' );
1488 delete_bk_option( 'booking_form_visual');
1489 }
1490
1491 // </editor-fold>
1492 }
1493
1494 add_action('wpbc_menu_created', array( new WPBC_Page_SettingsFormFieldsFree() , '__construct') ); // Executed after creation of Menu
1495
1496
1497
1498 // =====================================================================================================================
1499 // Load JS files at specific pages only
1500 // =====================================================================================================================
1501
1502 /**
1503 * Load JS files.
1504 *
1505 * @param $hook 'post.php' | 'wp-booking-calendar3_page_wpbc-resources'
1506 *
1507 * @return void
1508 */
1509 function wpbc_register_js__page_form_simple( $hook ) {
1510
1511 if (
1512 ( isset( $_REQUEST['page'] ) ) && ( 'wpbc-settings' === $_REQUEST['page'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
1513 && ( isset( $_REQUEST['tab'] ) ) && ( 'form' === $_REQUEST['tab'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
1514 ) {
1515 // wpbc_load_js__required_for_modals();
1516 // wpbc_load_js__required_for_media_upload();
1517 wp_enqueue_script( 'wpbc_simple_form', wpbc_plugin_url( '/includes/page-form-simple/_src/wpbc_simple_form.js' ), array( 'wpbc_all' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) );
1518 }
1519 }
1520
1521 add_action( 'admin_enqueue_scripts', 'wpbc_register_js__page_form_simple' );
1522