PluginProbe
Booking Calendar / 10.10
Booking Calendar v10.10
11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 10.11.2 10.11.3 All 202 releases
booking / core / admin / api-settings.php

api-settings.php in Booking Calendar 10.10, at core/admin/api-settings.php

2,405 lines 161.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @version 1.0
4 * @package General Settings API - Saving different options
5 * @category Settings API
6 * @author wpdevelop
7 *
8 * @web-site https://wpbookingcalendar.com/
9 * @email info@wpbookingcalendar.com
10 * @modified 2016-02-24
11 */
12
13 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
15
16 // General Settings API - Saving different options
17 class WPBC_Settings_API_General extends WPBC_Settings_API {
18
19
20 /**
21 * Override Settings API Constructor
22 * During creation, system try to load values from DB, if exist.
23 *
24 * @param type $id - of Settings
25 */
26 public function __construct( $id = '' ){
27
28 $options = array(
29 'db_prefix_option' => '' // 'booking_'
30 , 'db_saving_type' => 'separate'
31 , 'id' => 'set_gen'
32 );
33
34 $id = empty($id) ? $options['id'] : $id;
35
36 parent::__construct( $id, $options ); // Define ID of Setting page and options
37
38 add_action( 'wpbc_after_settings_content', array($this, 'enqueue_js'), 10, 3 );
39 }
40
41
42 /** Init all fields rows for settings page */
43 public function init_settings_fields() {
44
45 $this->fields = array();
46
47 $default_options_values = wpbc_get_default_options();
48
49
50 // <editor-fold defaultstate="collapsed" desc=" C a l e n d a r S e c t i o n " >
51
52 $this->fields['booking_skin'] = array(
53 'type' => 'select'
54 , 'default' => $default_options_values['booking_skin'] // '/css/skins/traditional.css' // Activation|Deactivation of this options in wpbc-activation file. // Default value in wpbc_get_default_options('booking_skin')
55 //, 'value' => '/css/skins/standard.css' //This will override value loaded from DB
56 , 'title' => __('Calendar Skin', 'booking')
57 , 'description' => __('Select the skin of the booking calendar' ,'booking')
58 , 'options' => wpbc_get_calendar_skin_options()
59 , 'group' => 'calendar'
60 );
61
62 // //Show | Hide links for Advanced JavaScript section
63 // $this->fields['booking_skin_help'] = array(
64 // 'type' => 'html'
65 // , 'html' =>
66 // '<div class="wpbc-settings-notice notice-info" style="text-align:left;">'
67 // . '<strong>' . esc_html__('Note!' ,'booking') . '</strong> '
68 // . sprintf( __( 'If you have customized your own calendar skin, please save it to: %s Its will save your custom skin during future updates of plugin.', 'booking' ), '<code>/wp-content/uploads/wpbc_skins/</code><br/>' )
69 // . '</div>'
70 // , 'cols' => 2
71 // , 'group' => 'calendar'
72 // );
73
74 // Number of months //////////////////////////////////////////////////
75 $months_options = array();
76 for ($mm = 1; $mm < 12; $mm++) { $months_options[ $mm . 'm' ] = $mm . ' ' . __('month(s)' ,'booking'); }
77 $months_options[ 18 . 'm' ] = '18 ' . __('month(s)' ,'booking'); // FixIn: 10.0.0.11.
78 for ($yy = 1; $yy < 11; $yy++) { $months_options[ $yy . 'y' ] = $yy . ' ' . __('year(s)' ,'booking'); }
79
80 $this->fields['booking_max_monthes_in_calendar'] = array(
81 'type' => 'select'
82 , 'default' => $default_options_values['booking_max_monthes_in_calendar'] // '1y'
83 , 'title' => __('Number of months to scroll', 'booking')
84 , 'description' => __('Select the maximum number of months to show (scroll)' ,'booking')
85 , 'options' => $months_options
86 , 'group' => 'calendar'
87 );
88
89
90 // Start Day of the week /////////////////////////////////////////////
91 $this->fields['booking_start_day_weeek'] = array(
92 'type' => 'select'
93 , 'default' => $default_options_values['booking_start_day_weeek'] // '2'
94 // , 'value' => false
95 , 'title' => __('Start Day of the week', 'booking')
96 , 'description' => __('Select your start day of the week' ,'booking')
97 , 'options' => array(
98 '0' => __('Sunday' ,'booking')
99 , '1' => __('Monday' ,'booking')
100 , '2' => __('Tuesday' ,'booking')
101 , '3' => __('Wednesday' ,'booking')
102 , '4' => __('Thursday' ,'booking')
103 , '5' => __('Friday' ,'booking')
104 , '6' => __('Saturday' ,'booking')
105 )
106 , 'group' => 'calendar'
107 );
108
109 // Divider ///////////////////////////////////////////////////////////
110 $this->fields['hr_calendar_after_week_day'] = array( 'type' => 'hr', 'group' => 'calendar' );
111
112
113
114 $field_options = array(
115 'single' => array(
116 'title' => __('Single day' ,'booking')
117 , 'attr' => array(
118 'id' => 'type_of_day_selections_single'
119 )
120 )
121 , 'multiple' => array(
122 'title' => __('Multiple days' ,'booking')
123 , 'attr' => array(
124 'id' => 'type_of_day_selections_multiple'
125 )
126 )
127 );
128 // Days ///////////////////////////////////////////////////////////
129 $this->fields['booking_type_of_day_selections'] = array(
130 'type' => 'radio'
131 , 'default' => $default_options_values['booking_type_of_day_selections'] // 'multiple'
132 , 'title' => __('Days selection in calendar', 'booking')
133 , 'description' => ''
134 , 'options' => $field_options
135 , 'group' => 'calendar'
136 );
137
138 ////////////////////////////////////////////////////////////////////////
139
140 $this->fields = apply_filters( 'wpbc_settings_calendar_range_days_selection', $this->fields, $default_options_values ); // Range days
141
142 // FixIn: 10.1.5.4.
143 //$this->fields = apply_filters( 'wpbc_settings_calendar_recurrent_time_slots', $this->fields, $default_options_values ); // Recurent Times
144 /**
145 * Recurrent time - Settings ( Calendar ) page
146 */
147 $this->fields['hr_calendar_before_recurrent_time'] = array( 'type' => 'hr', 'group' => 'calendar' , 'tr_class' => 'wpbc_recurrent_check_in_out_time_slots');
148 $this->fields['booking_recurrent_time'] = array(
149 'type' => 'checkbox'
150 , 'default' => $default_options_values['booking_recurrent_time'] //'Off'
151 , 'title' => __('Use selected times for each booking date' ,'booking') //__('Use time selections as recurrent time slots' ,'booking')
152 , 'label' => __('Enable this option if you want to use the selected times as booked time slots on each selected date. Otherwise, the selected times will be used as the check-in time for the first date and check-out time for the last date of the reservation.' ,'booking')
153 //, 'description' => ''
154 , 'group' => 'calendar'
155 , 'tr_class' => 'wpbc_recurrent_check_in_out_time_slots'
156 );
157
158 $this->fields = apply_filters( 'wpbc_settings_calendar_check_in_out_times', $this->fields, $default_options_values ); // Check In/Out Times
159
160 $this->fields['booking_calendar_allow_several_months_on_mobile'] = array(
161 'type' => 'checkbox'
162 , 'default' => $default_options_values['booking_calendar_allow_several_months_on_mobile'] //'Off'
163 , 'title' => __('Allow multiple months to be shown on mobile' ,'booking') //__('Use time selections as recurrent time slots' ,'booking')
164 , 'label' => __('Enable this option to allow multiple months to be shown in the calendar on mobile devices. By default, the calendar only shows one month on mobile devices for easy scrolling.' ,'booking')
165 //, 'description' => ''
166 , 'group' => 'calendar'
167 , 'tr_class' => 'wpbc_recurrent_check_in_out_time_slots'
168 );
169
170 // </editor-fold>
171
172
173 // <editor-fold defaultstate="collapsed" desc=" Dates Tooltips " >
174 //FixIn: 9.5.0.2.2
175 $this->fields['booking_disable_timeslots_in_tooltip'] = array(
176 'type' => 'checkbox'
177 , 'default' => $default_options_values['booking_disable_timeslots_in_tooltip'] //'Off'
178 , 'title' => __('Disable times in tooltips' ,'booking')
179 , 'label' => __('Disable show booked times in tooltip, when mouse over specific day in calendar' ,'booking')
180 , 'description' => ''
181 , 'group' => 'days_tooltips'
182 , 'tr_class' => ''
183 );
184
185 // FixIn: 9.4.3.1.
186 $this->fields['booking_highlight_timeslot_word'] = array(
187 'type' => 'text'
188 , 'default' => $default_options_values['booking_highlight_timeslot_word'] //__('Booked Times:' ,'booking')
189 , 'placeholder' => __('Booked Times:' ,'booking')
190 , 'title' => __('Title of booked timeslot(s)' ,'booking')
191 /* translators: 1: ... */
192 , 'description' => sprintf( __( 'Type your %1$stitle%2$s, what will show in mouseover tooltip near booked timeslot(s)', 'booking' ),'<b>','</b>')
193 //,'description_tag' => 'span'
194 , 'class' => 'regular-text'
195 , 'group' => 'days_tooltips'
196 , 'tr_class' => 'wpbc_booking_timeslots_in_tooltip wpbc_sub_settings_grayed' //FixIn: 9.5.0.2.2
197 );
198 $this->fields = apply_filters( 'wpbc_settings_calendar_showing_info_in_cal', $this->fields, $default_options_values ); // Availability in calendar...
199 $this->fields = apply_filters( 'wpbc_settings_calendar_show_booking_details', $this->fields, $default_options_values ); // Show Booking details in mouse over tooltips
200 $this->fields = apply_filters( 'wpbc_settings_calendar_showing_cost_in_tooltip', $this->fields, $default_options_values ); // Showing Cost,
201
202 // </editor-fold>
203
204
205 // <editor-fold defaultstate="collapsed" desc=" L e g e n d I t e m s " >
206 // Legend Items ////////////////////////////////////////////////////////
207
208 $this->fields['hr_calendar_before_legend'] = array( 'type' => 'hr', 'group' => 'calendar' );
209
210 $this->fields['booking_is_show_legend'] = array(
211 'type' => 'checkbox'
212 , 'default' => $default_options_values['booking_is_show_legend'] // 'Off'
213 , 'title' => __('Show legend below calendar' ,'booking')
214 , 'label' => __('Check this box to display a legend of dates below the booking calendar.' ,'booking')
215 , 'description' => ''
216 , 'group' => 'calendar'
217 );
218 // Available item
219 $this->fields['booking_legend_is_show_item_available_prefix'] = array(
220 'type' => 'pure_html'
221 , 'group' => 'calendar'
222 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_legend_is_show_item_available
223 wpbc_calendar_legend_items wpbc_sub_settings_grayed">
224 <th scope="row">'.
225 WPBC_Settings_API::label_static( 'set_gen_booking_legend_is_show_item_available'
226 , array( 'title'=> __('Available item' ,'booking'), 'label_css' => '' ) )
227 .'</th>
228 <td><fieldset>'
229 );
230 $this->fields['booking_legend_is_show_item_available'] = array(
231 'type' => 'checkbox'
232 , 'default' => $default_options_values['booking_legend_is_show_item_available'] // 'On'
233 , 'is_new_line' => false
234 , 'group' => 'calendar'
235 , 'only_field' => true
236 );
237 $this->fields['booking_legend_text_for_item_available'] = array(
238 'type' => 'text'
239 , 'default' => $default_options_values['booking_legend_text_for_item_available'] // __('Available' ,'booking')
240 , 'placeholder' => __('Available' ,'booking')
241 , 'css' => '' //'width:8em;'
242 , 'group' => 'calendar'
243 , 'only_field' => true
244 );
245 $this->fields['booking_legend_is_show_item_available_sufix'] = array(
246 'type' => 'pure_html'
247 , 'group' => 'calendar'
248 , 'html' => '<p class="description" style="line-height: 1.7em;margin: 0;">'
249 /* translators: 1: ... */
250 . sprintf( __( 'Activate and type your %1$stitle of available%2$s item in legend', 'booking' ),'<b>','</b>')
251 . '</p>
252 </fieldset>
253 </td>
254 </tr>'
255 );
256 // Pending item
257 $this->fields['booking_legend_is_show_item_pending_prefix'] = array(
258 'type' => 'pure_html'
259 , 'group' => 'calendar'
260 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_legend_is_show_item_pending
261 wpbc_calendar_legend_items wpbc_sub_settings_grayed">
262 <th scope="row">'.
263 WPBC_Settings_API::label_static( 'set_gen_booking_legend_is_show_item_pending'
264 , array( 'title'=> __('Pending item' ,'booking'), 'label_css' => '' ) )
265 .'</th>
266 <td><fieldset>'
267 );
268 $this->fields['booking_legend_is_show_item_pending'] = array(
269 'type' => 'checkbox'
270 , 'default' => $default_options_values['booking_legend_is_show_item_pending'] // 'On'
271 , 'is_new_line' => false
272 , 'group' => 'calendar'
273 , 'only_field' => true
274 );
275 $this->fields['booking_legend_text_for_item_pending'] = array(
276 'type' => 'text'
277 , 'default' => $default_options_values['booking_legend_text_for_item_pending'] // __('Pending' ,'booking')
278 , 'placeholder' => __('Pending' ,'booking')
279 , 'css' => '' //'width:8em;'
280 , 'group' => 'calendar'
281 , 'only_field' => true
282 );
283 $this->fields['booking_legend_is_show_item_pending_sufix'] = array(
284 'type' => 'pure_html'
285 , 'group' => 'calendar'
286 , 'html' => '<p class="description" style="line-height: 1.7em;margin: 0;">'
287 /* translators: 1: ... */
288 . sprintf( __( 'Activate and type your %1$stitle of pending%2$s item in legend', 'booking' ),'<b>','</b>')
289 . '</p>
290 </fieldset>
291 </td>
292 </tr>'
293 );
294 // Approved item
295 $this->fields['booking_legend_is_show_item_approved_prefix'] = array(
296 'type' => 'pure_html'
297 , 'group' => 'calendar'
298 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_legend_is_show_item_approved
299 wpbc_calendar_legend_items wpbc_sub_settings_grayed">
300 <th scope="row">'.
301 WPBC_Settings_API::label_static( 'set_gen_booking_legend_is_show_item_approved'
302 , array( 'title'=> __('Approved item' ,'booking'), 'label_css' => '' ) )
303 .'</th>
304 <td><fieldset>'
305 );
306 $this->fields['booking_legend_is_show_item_approved'] = array(
307 'type' => 'checkbox'
308 , 'default' => $default_options_values['booking_legend_is_show_item_approved'] // 'On'
309 , 'is_new_line' => false
310 , 'group' => 'calendar'
311 , 'only_field' => true
312 );
313 $this->fields['booking_legend_text_for_item_approved'] = array(
314 'type' => 'text'
315 , 'default' => $default_options_values['booking_legend_text_for_item_approved'] //__('Booked' ,'booking')
316 , 'placeholder' => __('Booked' ,'booking')
317 , 'css' => '' //'width:8em;'
318 , 'group' => 'calendar'
319 , 'only_field' => true
320 );
321 $this->fields['booking_legend_is_show_item_approved_sufix'] = array(
322 'type' => 'pure_html'
323 , 'group' => 'calendar'
324 , 'html' => '<p class="description" style="line-height: 1.7em;margin: 0;">'
325 /* translators: 1: ... */
326 . sprintf( __( 'Activate and type your %1$stitle of approved%2$s item in legend', 'booking' ),'<b>','</b>')
327 . '</p>
328 </fieldset>
329 </td>
330 </tr>'
331 );
332
333 //FixIn: 10.1.5.5 if ( class_exists('wpdev_bk_biz_s') ) {
334
335 // Partially booked item
336 $this->fields['booking_legend_is_show_item_partially_prefix'] = array(
337 'type' => 'pure_html'
338 , 'group' => 'calendar'
339 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_legend_is_show_item_partially
340 wpbc_calendar_legend_items wpbc_sub_settings_grayed">
341 <th scope="row">'.
342 WPBC_Settings_API::label_static( 'set_gen_booking_legend_is_show_item_partially'
343 , array( 'title'=> __('Partially booked item' ,'booking'), 'label_css' => '' ) )
344 .'</th>
345 <td><fieldset>'
346 );
347 $this->fields['booking_legend_is_show_item_partially'] = array(
348 'type' => 'checkbox'
349 , 'default' => $default_options_values['booking_legend_is_show_item_partially'] //'On'
350 , 'is_new_line' => false
351 , 'group' => 'calendar'
352 , 'only_field' => true
353 );
354 $this->fields['booking_legend_text_for_item_partially'] = array(
355 'type' => 'text'
356 , 'default' => $default_options_values['booking_legend_text_for_item_partially'] //__('Partially booked' ,'booking')
357 , 'placeholder' => __('Partially booked' ,'booking')
358 , 'css' => '' //'width:8em;'
359 , 'group' => 'calendar'
360 , 'only_field' => true
361 );
362 $this->fields['booking_legend_is_show_item_partially_sufix'] = array(
363 'type' => 'pure_html'
364 , 'group' => 'calendar'
365 , 'html' => '<p class="description" style="line-height: 1.7em;margin: 0;">'
366 /* translators: 1: ... */
367 . sprintf( __( 'Activate and type your %1$stitle of partially booked%2$s item in legend', 'booking' ),'<b>','</b>')
368 . '</p>'
369 . '<p class="description" style="line-height: 1.7em;margin: 0;"><strong>' . esc_html__('Note' ,'booking') .':</strong> '
370 . sprintf(__('Partially booked item - day, which is booked for the specific time-slot(s).' ,'booking'),'<b>','</b>')
371 . '</p>'
372 .'</fieldset>
373 </td>
374 </tr>'
375 );
376 //}
377
378
379 // Unavailable Legend Item // FixIn: 9.9.0.5.
380 $this->fields['booking_legend_is_show_item_unavailable_prefix'] = array(
381 'type' => 'pure_html'
382 , 'group' => 'calendar'
383 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_legend_is_show_item_unavailable
384 wpbc_calendar_legend_items wpbc_sub_settings_grayed">
385 <th scope="row">'.
386 WPBC_Settings_API::label_static( 'set_gen_booking_legend_is_show_item_unavailable'
387 , array( 'title'=> __('Unavailable item' ,'booking'), 'label_css' => '' ) )
388 .'</th>
389 <td><fieldset>'
390 );
391 $this->fields['booking_legend_is_show_item_unavailable'] = array(
392 'type' => 'checkbox'
393 , 'default' => $default_options_values['booking_legend_is_show_item_unavailable'] // 'On'
394 , 'is_new_line' => false
395 , 'group' => 'calendar'
396 , 'only_field' => true
397 );
398 $this->fields['booking_legend_text_for_item_unavailable'] = array(
399 'type' => 'text'
400 , 'default' => $default_options_values['booking_legend_text_for_item_unavailable'] //__('Booked' ,'booking')
401 , 'placeholder' => __('Unavailable' ,'booking')
402 , 'css' => '' //'width:8em;'
403 , 'group' => 'calendar'
404 , 'only_field' => true
405 );
406 $this->fields['booking_legend_is_show_item_unavailable_sufix'] = array(
407 'type' => 'pure_html'
408 , 'group' => 'calendar'
409 , 'html' => '<p class="description" style="line-height: 1.7em;margin: 0;">'
410 /* translators: 1: ... */
411 . sprintf( __( 'Activate and type your %1$stitle of unavailable%2$s item in legend', 'booking' ),'<b>','</b>')
412 . '</p>
413 </fieldset>
414 </td>
415 </tr>'
416 );
417
418
419
420
421 // // Help Section ///////////////////////////////////////////////////////
422 // $this->fields['booking_help_translation_section_after_legend_items'] = array(
423 // 'type' => 'help'
424 // , 'value' => wpbc_get_help_rows_about_config_in_several_languges()
425 // , 'class' => ''
426 // , 'css' => ''
427 // , 'description' => ''
428 // , 'cols' => 2
429 // , 'group' => 'calendar'
430 // , 'tr_class' => 'wpbc_calendar_legend_items wpbc_sub_settings_grayed'
431 // , 'description_tag' => 'span'
432 // );
433 $this->fields['booking_legend_is_show_numbers'] = array(
434 'type' => 'checkbox'
435 , 'default' => $default_options_values['booking_legend_is_show_numbers'] //'On'
436 , 'title' => __('Show date number in legend' ,'booking')
437 , 'label' => sprintf(__('Check this box to display today date number in legend cells. ' ,'booking'),'<b>','</b>')
438 , 'description' => ''
439 , 'tr_class' => 'wpbc_calendar_legend_items wpbc_sub_settings_grayed'
440 , 'group' => 'calendar'
441 );
442 // FixIn: 9.4.3.6.
443 $this->fields['booking_legend_is_vertical'] = array(
444 'type' => 'checkbox'
445 , 'default' => $default_options_values['booking_legend_is_vertical'] //'Off'
446 , 'title' => __('Show legend items in a column' ,'booking')
447 , 'label' => sprintf(__('Check this box to display legend items vertically in a column.' ,'booking'),'<b>','</b>')
448 , 'description' => ''
449 , 'tr_class' => 'wpbc_calendar_legend_items wpbc_sub_settings_grayed'
450 , 'group' => 'calendar'
451 );
452 // </editor-fold>
453
454
455
456 // <editor-fold defaultstate="collapsed" desc=" T i m e S l o t s " >
457
458 $my_close_open_alert_id = 'bk_alert_booking_timeslot_picker__help_tip';
459 $this->fields['booking_timeslot_picker__help_tip'] = array(
460 'type' => 'pure_html'
461 , 'group' => 'time_slots'
462 , 'html' => '<tr><td colspan="2">'
463 .'<div class="wpbc-general-settings-notice wpbc-settings-notice notice-info">'
464 . '<strong class="alert-heading">' . esc_html__( 'Note', 'booking' ) . '!</strong> '
465 /* translators: 1: ... */
466 . sprintf( __( 'You can enable or disable, as well as configure %1$sTime Slots%2$s for your booking form on the Settings > %3$sBooking Form%4$s page.', 'booking' ),
467 '<strong>', '</strong>',
468 '<strong><a href="' . esc_url( wpbc_get_settings_url( true, false ) . '&tab=form' ) . '">', '</a></strong>'
469 )
470 . '</div>'
471
472 .'</td> </tr>'
473 );
474
475
476 // FixIn: 8.7.11.10.
477 $this->fields['booking_timeslot_picker'] = array(
478 'type' => 'checkbox'
479 , 'default' => $default_options_values['booking_timeslot_picker'] //'Off'
480 , 'title' => __('Time picker for time slots' ,'booking')
481 , 'label' => __('Show time slots as a time picker instead of a select box.' ,'booking')
482 , 'description' => ''
483
484 , 'group' => 'time_slots'
485 , 'tr_class' => 'wpbc_timeslot_picker'
486 );
487
488 // Time Picker Skin /////////////////////////////////////////////////////
489 $timeslot_picker_skins_options = array();
490
491 // Skins in the Custom User folder (need to create it manually): http://example.com/wp-content/uploads/wpbc_skins/ ( This folder do not owerwrited during update of plugin )
492 $upload_dir = wp_upload_dir();
493 // FixIn: 8.9.4.8.
494 $files_in_folder = wpbc_dir_list( array( WPBC_PLUGIN_DIR . '/css/time_picker_skins/', $upload_dir['basedir'].'/wpbc_time_picker_skins/' ) ); // Folders where to look about Time Picker skins
495
496 foreach ( $files_in_folder as $skin_file ) { // Example: $skin_file['/css/skins/standard.css'] => 'Standard';
497 //FixIn: 8.9.4.8 // FixIn: 9.1.2.10.
498 $skin_file[1] = str_replace( array( WPBC_PLUGIN_DIR, WPBC_PLUGIN_URL, $upload_dir['basedir'] ), '', $skin_file[1] ); // Get relative path for Time Picker skin
499 $timeslot_picker_skins_options[ $skin_file[1] ] = $skin_file[2];
500 }
501
502 $this->fields['booking_timeslot_picker_skin'] = array(
503 'type' => 'select'
504 , 'default' => $default_options_values['booking_timeslot_picker_skin'] // '/css/skins/traditional.css' // Activation|Deactivation of this options in wpbc-activation file. // Default value in wpbc_get_default_options('booking_skin')
505 //, 'value' => '/css/time_picker_skins/grey.css' //This will override value loaded from DB
506 , 'title' => __('Time Picker Skin', 'booking')
507 , 'description' => __('Select the skin of the time picker' ,'booking')
508 , 'options' => $timeslot_picker_skins_options
509 , 'group' => 'time_slots'
510 );
511
512
513
514 // FixIn: 8.2.1.27.
515 $this->fields['booking_timeslot_day_bg_as_available'] = array(
516 'type' => 'checkbox'
517 , 'default' => $default_options_values['booking_timeslot_day_bg_as_available'] //'Off'
518 , 'title' => __('Do not change background color for partially booked days' ,'booking')
519 , 'label' => __('Show partially booked days with same background as in legend item' ,'booking')
520 , 'description' => '<span class="description0" style="line-height: 1.7em;margin: 0 0 0 -10px;"><strong>' . esc_html__('Note' ,'booking') .':</strong> '
521 . sprintf(__('Partially booked item - day, which is booked for the specific time-slot(s).' ,'booking'),'<b>','</b>')
522 . '</span>'
523
524 , 'group' => 'time_slots'
525 , 'tr_class' => 'wpbc_timeslot_day_bg_as_available'
526 );
527
528
529 // </editor-fold>
530
531
532 // <editor-fold defaultstate="collapsed" desc=" A v a i l a b i l i t y " >
533
534 // Unavailable Weekdays /////////////////////////////////////////////
535
536 $this->fields['booking_unavailable_day_html_prefix'] = array(
537 'type' => 'pure_html'
538 , 'group' => 'availability'
539 , 'html' => '<tr valign="top">
540 <th scope="row">
541 <label class="wpbc-form-checkbox" for="'
542 // . esc_attr( 'unavailable_day0' )
543 . '">' . wp_kses_post( __('Unavailable Weekdays' ,'booking') )
544 . '</label>
545 </th>
546 <td><fieldset>'
547 );
548 $this->fields['booking_unavailable_day0'] = array( 'label' => __('Sunday' ,'booking')
549 , 'type' => 'checkbox', 'default' => $default_options_values['booking_unavailable_day0'], 'only_field' => true, 'group' => 'availability', 'is_new_line' => false
550 );
551 $this->fields['booking_unavailable_day1'] = array( 'label' => __('Monday' ,'booking')
552 , 'type' => 'checkbox', 'default' => $default_options_values['booking_unavailable_day1'], 'only_field' => true, 'group' => 'availability', 'is_new_line' => false
553 );
554 $this->fields['booking_unavailable_day2'] = array( 'label' => __('Tuesday' ,'booking')
555 , 'type' => 'checkbox', 'default' => $default_options_values['booking_unavailable_day2'], 'only_field' => true, 'group' => 'availability', 'is_new_line' => false
556 );
557 $this->fields['booking_unavailable_day3'] = array( 'label' => __('Wednesday' ,'booking')
558 , 'type' => 'checkbox', 'default' => $default_options_values['booking_unavailable_day3'], 'only_field' => true, 'group' => 'availability', 'is_new_line' => false
559 );
560 $this->fields['booking_unavailable_day4'] = array( 'label' => __('Thursday' ,'booking')
561 , 'type' => 'checkbox', 'default' => $default_options_values['booking_unavailable_day4'], 'only_field' => true, 'group' => 'availability', 'is_new_line' => false
562 );
563 $this->fields['booking_unavailable_day5'] = array( 'label' => __('Friday' ,'booking')
564 , 'type' => 'checkbox', 'default' => $default_options_values['booking_unavailable_day5'], 'only_field' => true, 'group' => 'availability', 'is_new_line' => false
565 );
566 $this->fields['booking_unavailable_day6'] = array( 'label' => __('Saturday' ,'booking')
567 , 'type' => 'checkbox', 'default' => $default_options_values['booking_unavailable_day6'], 'only_field' => true, 'group' => 'availability', 'is_new_line' => false
568 );
569 $this->fields['booking_unavailable_day_html_sufix'] = array(
570 'type' => 'pure_html'
571 , 'group' => 'availability'
572 , 'html' => ' </fieldset><p class="description">'
573 . __('Select weekdays to be marked as unavailable in calendars. This setting will override all other availability settings.' ,'booking')
574 . '</p>
575 </td>
576 </tr>'
577 );
578
579 // Divider ///////////////////////////////////////////////////////////
580 $this->fields['hr_calendar_after_unavailable_day'] = array( 'type' => 'hr', 'group' => 'availability' );
581
582
583
584 // Unavailable days from today ///////////////////////////////////////
585 $field_options = array();
586
587
588 // FixIn: 10.8.1.4.
589 $field_options[0] = ' - ';
590 foreach ( range( 5, 55 , 5 ) as $extra_num) { // Each 5 minutes
591 $field_options[ $extra_num . 'm' ] = $extra_num . ' ' . __( 'minutes', 'booking' );
592 }
593 $field_options[ '60' . 'm' ] = '1 ' . __( 'hour', 'booking' );
594 foreach ( range( 65, 115 , 5 ) as $extra_num) { // 1 hour + Each 5 minutes
595 $field_options[ $extra_num . 'm' ] = '1 ' . __( 'hour', 'booking' ) . ' ' . ($extra_num - 60 ) . ' ' . __( 'minutes', 'booking' );
596 }
597 foreach ( range( 120, 1380 , 60 ) as $extra_num) { // Each Hour based on minutes
598 $field_options[ $extra_num . 'm' ] = ($extra_num / 60) . ' ' . __( 'hours', 'booking' );
599 }
600
601
602 $field_options[ 1 ] = 1 . ' ' . __( 'day', 'booking' );
603 for ( $ii = 2; $ii < 92; $ii ++ ) {
604 $field_options[ $ii ] = $ii . ' ' . __( 'days', 'booking' );
605 }
606
607
608 $unavailable_from_today_arr = wpbc_get_unavailable_from_today_hints_arr();
609
610 $this->fields['booking_unavailable_days_num_from_today'] = array(
611 'type' => 'select'
612 , 'default' => $default_options_values['booking_unavailable_days_num_from_today'] //'0'
613 , 'title' => __('Unavailable time from current time', 'booking')
614 , 'description' => __('Select an unavailable time interval on the calendar, starting from today\'s current time.' ,'booking')
615 . '<br><code id="ui_btn_cstm__set_calendar_unavailable_from_today_hint" style="font-weight: 600;font-size: 10px;padding: 3px 5px;color: #626262;border-radius:2px;background: #f9f2f4">'
616 . '<span style="color: #cc3a5f;text-transform: uppercase;">' . esc_html( __( 'Unavailable', 'booking' ) ) . '</span>'
617 . $unavailable_from_today_arr['booking_unavailable_days_num_from_today__hint']
618 .'</code>'
619 , 'options' => $field_options
620 , 'group' => 'availability'
621 );
622
623 // Limit available days from today ///////////////////////////////////
624 $this->fields = apply_filters( 'wpbc_settings_calendar_unavailable_days', $this->fields, $default_options_values );
625
626
627 // Extend unavailable booking dates interval - cleaning //////////////
628 $this->fields = apply_filters( 'wpbc_settings_calendar_extend_unavailable_interval', $this->fields, $default_options_values );
629
630 // </editor-fold>
631
632
633 // <editor-fold defaultstate="collapsed" desc=" F o r m S e c t i o n " >
634
635
636 // Start Day of the week /////////////////////////////////////////////
637 /*
638 if ( ! class_exists('wpdev_bk_personal') )
639 $this->fields['booking_form_structure_type'] = array(
640 'type' => 'select'
641 , 'default' => $default_options_values['booking_form_structure_type'] // '2'
642 // , 'value' => false
643 , 'title' => __('Booking form structure', 'booking')
644 , 'description' => __('Select how to show your booking form.' ,'booking')
645 , 'description_tag' => 'p'
646 , 'options' => array(
647 'vertical' => __('Form under calendar' ,'booking')
648 , 'form_right' => __('Form at right side of calendar' ,'booking')
649 )
650 , 'group' => 'form'
651 );
652 */
653 $this->fields['booking_form_theme'] = array(
654 'type' => 'select'
655 , 'default' => $default_options_values['booking_form_theme'] //'Off'
656 , 'title' => __('Color Theme' ,'booking')
657 , 'description' => __('Select a color theme for your booking form that matches the look of your website.' ,'booking') //. ' <sup style="color:#7812bd;"><strong>&#946;eta '.__('feature','booking').'</strong></sup>'
658 . '<div class="wpbc-general-settings-notice wpbc-settings-notice notice-info">'
659 . __('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')
660 .'</div>'
661
662 , 'options' => array(
663 '' => __( 'Light', 'booking' ),
664 'wpbc_theme_dark_1' => __( 'Dark', 'booking' )
665 )
666 , 'group' => 'form'
667 );
668
669 $this->fields['booking_is_use_captcha'] = array(
670 'type' => 'checkbox'
671 , 'default' => $default_options_values['booking_is_use_captcha'] //'Off'
672 , 'title' => __('CAPTCHA' ,'booking')
673 , 'label' => __('Check the box to activate CAPTCHA inside the booking form.' ,'booking')
674 , 'description' => '<div class="wpbc-general-settings-notice wpbc-settings-notice notice-warning" style="margin-top:-10px;">'
675 . '<strong>' . esc_html__('Note' ,'booking') . '!</strong> ' .
676 __( 'If your website uses a cache plugin or system, exclude pages with booking forms from caching to ensure CAPTCHA functions correctly.', 'booking' )
677 .'</div>'
678 , 'group' => 'form'
679 );
680 $this->fields['booking_is_use_autofill_4_logged_user'] = array(
681 'type' => 'checkbox'
682 , 'default' => $default_options_values['booking_is_use_autofill_4_logged_user'] // 'Off'
683 , 'title' => __('Auto-fill fields' ,'booking')
684 , 'label' => __('Check the box to activate auto-fill form fields for logged in users.' ,'booking')
685 , 'description' => ''
686 , 'group' => 'form'
687 );
688
689 $this->fields['hr_calendar_after_autofill'] = array( 'type' => 'hr', 'group' => 'form' );
690
691 if ( class_exists( 'wpdev_bk_personal' ) ) // FixIn: 8.1.1.12.
692 $this->fields['booking_is_use_simple_booking_form'] = array(
693 'type' => 'checkbox'
694 , 'default' => $default_options_values['booking_is_use_simple_booking_form'] //'Off'
695 , 'title' => __('Simple' ,'booking') . ' ' . __('Booking Form', 'booking')
696 , 'label' => __('Check the box, if you want to use simple booking form customization from Free plugin version at Settings - Form page.' ,'booking')
697 , 'description' => ''
698 , 'group' => 'form'
699 );
700 if ( class_exists( 'wpdev_bk_personal' ) ) // FixIn: 8.1.1.12.
701 $this->fields['booking_is_use_codehighlighter_booking_form'] = array(
702 'type' => 'checkbox'
703 , 'default' => $default_options_values['booking_is_use_codehighlighter_booking_form'] //'Off'
704 , 'title' => __('Syntax highlighter' ,'booking')
705 , 'label' => __('Check the box, if you want to use syntax highlighter during customization booking form.' ,'booking')
706 , 'description' => ''
707 , 'group' => 'form'
708 );
709
710
711 // FixIn: 10.0.0.31.
712 if ( class_exists( 'wpdev_bk_biz_m' ) ){
713 $this->fields['booking_number_for_pre_checkin_date_hint'] = array(
714 'type' => 'select'
715 , 'default' => $default_options_values['booking_number_for_pre_checkin_date_hint'] //'0'
716 , 'title' => __( 'Pre-Check-in Display Duration', 'booking' )
717 /* translators: 1: ... */
718 , 'description' => sprintf( __( 'Select the number of days for the %s shortcode.', 'booking' ), '<strong>[pre_checkin_date_hint]</strong>' )
719 . ' '
720 /* translators: 1: ... */
721 . sprintf( __( 'This shortcode is used in the booking form to display the date %1$sN days before%2$s the selected check-in date.', 'booking' )
722 , '<a href="'. esc_url( wpbc_get_settings_url() ) . '&tab=form">', '</a>' )
723 //, '<a href="'.wpbc_get_settings_url( true, false ) . '&scroll_to_section=wpbc_general_settings_form_tab">', '</a>' )
724 , 'options' => array_combine( range( 1, 91 ), range( 1, 91 ) )
725 , 'group' => 'form'
726 );
727 }
728 // if ( class_exists( 'wpdev_bk_personal' ) ){ // FixIn: 8.8.1.14.
729 //
730 // $this->fields['booking_send_button_title'] = array(
731 // 'type' => 'text'
732 // , 'default' => $default_options_values['booking_send_button_title'] // 'Send'
733 // , 'placeholder' => __( 'Send', 'booking' )
734 // , 'title' => __( 'Title of send button' ,'booking' )
735 // , 'description' => sprintf( __( 'Enter %1$stitle of submit button%2$s in the booking form', 'booking' ),'<b>','</b>')
736 // , 'description_tag' => 'p'
737 // , 'css' => 'width:100%'
738 // , 'group' => 'form'
739 // , 'tr_class' => 'wpbc_send_button_title'
740 // );
741 // }
742
743
744 // </editor-fold>
745
746
747
748 // <editor-fold defaultstate="collapsed" desc=" B o o k i n g C o n f i r m a t i o n " >
749
750 $field_options = array(
751 'message' => array( 'title' => __('Show booking confirmation at same page' ,'booking'), 'attr' => array( 'id' => 'type_of_thank_you_message_message' ) )
752 , 'page' => array( 'title' => __('Redirect to thank you page' ,'booking'), 'attr' => array( 'id' => 'type_of_thank_you_message_page' ) )
753 );
754 $description_text = '';
755
756 $this->fields['booking_type_of_thank_you_message'] = array(
757 'type' => 'radio'
758 , 'default' => $default_options_values['booking_type_of_thank_you_message'] //'message'
759 , 'title' => __('After booking action:' ,'booking')
760 , 'description' => $description_text
761 , 'options' => $field_options
762 , 'group' => 'booking_confirmation'
763 );
764
765 // $this->fields['booking_title_after_reservation_time'] = array(
766 // 'type' => 'text'
767 // , 'default' => $default_options_values['booking_title_after_reservation_time'] //'7000'
768 // , 'placeholder' => '7000'
769 // , 'title' => __('Time of message showing' ,'booking')
770 // , 'description' => sprintf(__('Set duration of time (milliseconds) to show this message' ,'booking'),'<b>','</b>')
771 // . ' ' . sprintf(__('You can set the value to %s to display the message indefinitely.' ,'booking'),'<b>0</b>') // FixIn: 9.6.2.2.
772 // , 'description_tag' => 'span'
773 // , 'css' => 'width:5em'
774 // , 'group' => 'booking_confirmation'
775 // , 'tr_class' => 'wpbc_calendar_thank_you_message wpbc_calendar_thank_you wpbc_sub_settings_grayed'
776 // );
777 // // Help Section ///////////////////////////////////////////////////////
778 // $this->fields['booking_help_translation_section_after_thank_you_message'] = array(
779 // 'type' => 'help'
780 // , 'value' => wpbc_get_help_rows_about_config_in_several_languges()
781 // , 'class' => ''
782 // , 'css' => ''
783 // , 'description' => ''
784 // , 'cols' => 2
785 // , 'group' => 'booking_confirmation'
786 // , 'tr_class' => 'wpbc_calendar_thank_you_message wpbc_calendar_thank_you wpbc_sub_settings_grayed'
787 // , 'description_tag' => 'span'
788 // );
789
790 // URL of "Thank you page"
791 $this->fields['booking_thank_you_page_URL_prefix'] = array(
792 'type' => 'pure_html'
793 , 'group' => 'booking_confirmation'
794 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_thank_you_page_URL
795 wpbc_calendar_thank_you_page wpbc_calendar_thank_you wpbc_sub_settings_grayed">
796 <th scope="row">'.
797 WPBC_Settings_API::label_static( 'set_gen_booking_thank_you_page_URL'
798 , array( 'title'=> __('Confirmation Page URL' ,'booking'), 'label_css' => '' ) )
799 .'</th>
800 <td><fieldset>' . '<code style="font-size:14px;">' . home_url() . '</code>' // FixIn: 7.0.1.20.
801 );
802 $this->fields['booking_thank_you_page_URL'] = array(
803 'type' => 'text'
804 , 'default' => $default_options_values['booking_thank_you_page_URL'] //'/thank-you'
805 , 'placeholder' => '/thank-you'
806 , 'css' => 'width:75%'
807 , 'group' => 'booking_confirmation'
808 , 'only_field' => true
809 );
810 $this->fields['booking_thank_you_page_URL_sufix'] = array(
811 'type' => 'pure_html'
812 , 'group' => 'booking_confirmation'
813 , 'html' => '<p class="description" style="line-height: 1.7em;margin: 0;">'
814 /* translators: 1: ... */
815 . sprintf( __( 'This page should include the shortcode %s to display booking details and confirmation after a successful booking.', 'booking' )
816 , '<strong>[booking_confirm]</strong>' )
817 . '</p>
818 </fieldset>
819 </td>
820 </tr>'
821 );
822 // </editor-fold>
823
824 // FixIn: 10.2.0.1.
825
826 // <editor-fold defaultstate="collapsed" desc=" == B o o k i n g C o n f i r m a t i o n - CONFIG == " >
827
828 // -------------------------------------------------------------------------------------------------------------
829 // Message title
830 // -------------------------------------------------------------------------------------------------------------
831 $this->fields['booking_title_after_reservation'] = array(
832 'type' => 'text'
833 , 'default' => $default_options_values['booking_title_after_reservation']
834 , 'placeholder' => ( ! class_exists( 'wpdev_bk_biz_s' ) )
835 ? __( 'Your booking is received. We will confirm it soon. Many thanks!', 'booking' )
836 : __( 'Your booking is received. Please proceed with payment to confirm it. Many thanks!', 'booking' )
837 , 'title' => __( 'Message title', 'booking' )
838 /* translators: 1: ... */
839 , 'description' => ''//sprintf( __( 'Type title of message %1$safter booking has done by user%2$s', 'booking' ),'<b>','</b>')
840 ,'description_tag' => 'p'
841 , 'css' => 'width:100%'
842 , 'rows' => 2
843 , 'group' => 'booking_confirmation'
844 , 'tr_class' => ' '
845 );
846 // -------------------------------------------------------------------------------------------------------------
847 // Header
848 // -------------------------------------------------------------------------------------------------------------
849 $this->fields['booking_confirmation_header_prefix'] = array(
850 'type' => 'pure_html'
851 , 'group' => 'booking_confirmation'
852 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_confirmation_header">
853 <th scope="row">'.
854 WPBC_Settings_API::label_static( 'set_gen_booking_confirmation_header'
855 , array( 'title'=> __('Header' ,'booking'), 'label_css' => '' ) )
856 .'</th>
857 <td><fieldset style="display:flex;flex-flow: row wrap;justify-content: flex-start;align-items: center;">'
858 );
859 $this->fields['booking_confirmation_header_enabled'] = array(
860 'type' => 'checkbox'
861 , 'default' => $default_options_values['booking_confirmation_header_enabled']
862 , 'is_new_line' => false
863 , 'group' => 'booking_confirmation'
864 , 'only_field' => true
865 , 'css' => 'flex:0 0 auto;margin-right:10px;'
866 , 'label' => __('Enable', 'booking')
867 );
868
869 $this->fields['booking_confirmation_header'] = array(
870 'type' => 'text'
871 , 'default' => $default_options_values['booking_confirmation_header']
872 /* translators: 1: ... */
873 , 'placeholder' => sprintf( __( 'Your booking id: %s', 'booking' ), '<strong>[booking_id]</strong>' )
874 , 'css' => 'flex:1 1 auto;'
875 , 'group' => 'booking_confirmation'
876 , 'class' => 'wpbc_booking_confirmation_header__field'
877 , 'only_field' => true
878 );
879 $this->fields['booking_confirmation_header_sufix'] = array( 'type' => 'pure_html', 'group' => 'booking_confirmation', 'html' => '</fieldset> </td> </tr>' );
880 // </editor-fold>
881
882
883 //$is_use_code_mirror =((function_exists( 'wpbc_codemirror') ) && ( is_user_logged_in() && 'false' !== (wp_get_current_user()->syntax_highlighting))) ? true : false; //FixIn: 8.4.7.18 it does not work ?
884 $is_use_code_mirror = true;
885
886 // <editor-fold defaultstate="collapsed" desc=" == B o o k i n g C o n f i r m a t i o n - == Personal Information == " >
887 // -------------------------------------------------------------------------------------------------------------
888 // == Personal Information ==
889 // -------------------------------------------------------------------------------------------------------------
890 $this->fields['booking_confirmation__personal_info__prefix'] = array(
891 'type' => 'pure_html'
892 , 'group' => 'booking_confirmation_left'
893 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_confirmation__personal_info__header_enabled">
894 <td colspan="2" style="padding-bottom: 0;" ><fieldset style="display: flex;flex-flow: row wrap;justify-content: flex-start;align-items: center;">'
895 );
896
897 $this->fields['booking_confirmation__personal_info__header_enabled'] = array(
898 'type' => 'checkbox'
899 , 'default' => $default_options_values['booking_confirmation__personal_info__header_enabled']
900 , 'is_new_line' => false
901 , 'only_field' => true
902 , 'label' => __( 'Enable', 'booking' )
903 , 'css' => 'flex:0 0 auto;margin-right:5px;'
904 , 'group' => 'booking_confirmation_left'
905 );
906 $this->fields['booking_confirmation__personal_info__title'] = array(
907 'type' => 'text'
908 , 'default' => $default_options_values['booking_confirmation__personal_info__title']
909 , 'placeholder' => __( 'Example', 'booking' ) . ": '" . __( 'Personal information', 'booking' ) . "'"
910 , 'title' => ''
911 , 'description' => ''
912 , 'css' => 'flex: 1 1 100px;font-size: 16px;line-height: 34px;font-weight: 600;width:auto;'
913 , 'group' => 'booking_confirmation_left'
914 , 'class' => 'wpbc_booking_confirmation__personal_info__field'
915 , 'tr_class' => ''
916 , 'only_field' => true
917 );
918 $this->fields['booking_confirmation__personal_info__sufix'] = array( 'type' => 'pure_html', 'group' => 'booking_confirmation_left',
919 'html' => '<p style="text-align: right;font-size:12px;width:100%;">'
920 /* translators: 1: ... */
921 . sprintf( __( 'Enter %1$stitle%2$s for this section of Booking Confirmation', 'booking' ),'<b>','</b>')
922 . '.</p>' . '</fieldset> </td> </tr>' );
923
924 $wpbc_metabox_id = 'confirmation_left_cont__promote_upgrade';
925
926 $this->fields['booking_confirmation__personal_info__content_before'] = array(
927 'type' => 'pure_html',
928 'group' => 'booking_confirmation_left',
929 'html' => '<tr class="'.$wpbc_metabox_id.'_close_content wpbc_booking_confirmation__personal_info__fields '
930 //. ( ( ! class_exists( 'wpdev_bk_personal' ) ) ? 'wpbc_blur' : '' )
931 .'"><td colspan="2" style="padding-top:0;">'
932 . '<div style="margin: 0 0 10px;font-weight: 600;font-size: 14px;">'
933 . '<label class="wpbc-form-email-content" for="booking_confirmation__personal_info__content">' .
934 __( 'Content', 'booking' )
935 . '</label></div>'
936 );
937 $this->fields['booking_confirmation__personal_info__content'] = array(
938 'type' => ( $is_use_code_mirror ? 'textarea' : 'wp_textarea' ) // FixIn: 8.4.7.18.
939 , 'default' => $default_options_values['booking_confirmation__personal_info__content']
940 // '[content]'
941 //, 'placeholder' => '[content]'
942 , 'title' => __('Content', 'booking')
943 //, 'description' => __('Example', 'booking') . ': ' . '[content]'
944 , 'description_tag' => ''
945 , 'css' => 'width:100%;height:70px;'
946 , 'group' => 'booking_confirmation_left'
947 , 'tr_class' => ''//( class_exists('wpdev_bk_personal') ) ? 'wpbc_blur' : ''
948 , 'rows' => 2
949 , 'show_in_2_cols' => true
950 , 'only_field' => true
951 );
952 $this->fields['booking_confirmation__personal_info__content_after'] = array( 'type' => 'pure_html', 'group' => 'booking_confirmation_left', 'html' => '</td></tr>' );
953
954 /*
955 if ( ! class_exists( 'wpdev_bk_personal' ) ) {
956 ob_start();
957 $is_panel_visible = wpbc_is_dismissed( $wpbc_metabox_id . '_close', array(
958 'title' => '<i class="menu_icon icon-1x wpbc_icn_close"></i> ',
959 'hint' => __( 'Dismiss', 'booking' ),
960 'class' => 'wpbc_panel_get_started_dismiss',
961 'css' => 'background: #fff;border-radius: 7px;',
962 'dismiss_css_class' => '.' . $wpbc_metabox_id . '_close_content'
963 ));
964 if ( ! $is_panel_visible ) {
965 ?><script type="text/javascript"> jQuery('#<?php echo esc_attr( $wpbc_metabox_id ); ?>_close,.<?php echo esc_attr( $wpbc_metabox_id ); ?>_close_content').hide(); </script><?php
966 }
967 $dismiss_button_content = ob_get_clean();
968
969 if ( $is_panel_visible ){
970
971 $this->fields['booking_confirmation_left__promote_upgrade'] = array(
972 'type' => 'pure_html'
973 , 'group' => 'booking_confirmation_left'
974 , 'html' => '<tr id="'.$wpbc_metabox_id.'_close" class="wpbc_booking_confirmation__personal_info__fields"><td colspan="2">
975 <div class="wpbc_widget_content" style="transform: translate(0) translateY(-9em);">
976 <div class="ui_container ui_container_toolbar ui_container_small" style="background: #fff;position: relative;">
977 <div class="ui_group ui_group__upgrade">
978 <div style="transform: translate(0%) translateY(-2.75em);position: relative;z-index:9;width: 85.6%;">'.$dismiss_button_content.'</div>
979 <div class="wpbc_upgrade_note wpbc_upgrade_theme_green">
980 <div>This <a target="_blank" href="https://wpbookingcalendar.com/features/#personal">feature</a>
981 is available in the <strong>Pro</strong> versions.
982 <a target="_blank" href="https://wpbookingcalendar.com/prices/#bk_news_section">Upgrade to Pro</a>.
983 </div>
984 </div>
985 </div>
986 </div>
987 </div>
988 </td> </tr>'
989 );
990 }
991 }
992 */
993 // </editor-fold>
994
995
996 // <editor-fold defaultstate="collapsed" desc=" == B o o k i n g C o n f i r m a t i o n - == Booking details == " >
997 // -------------------------------------------------------------------------------------------------------------
998 // == Booking details ==
999 // -------------------------------------------------------------------------------------------------------------
1000 $this->fields['booking_confirmation__booking_details__prefix'] = array(
1001 'type' => 'pure_html'
1002 , 'group' => 'booking_confirmation_right'
1003 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_confirmation__booking_details__header_enabled">
1004 <td colspan="2" style="padding-bottom: 0;" ><fieldset style="display: flex;flex-flow: row wrap;justify-content: flex-start;align-items: center;">'
1005 );
1006
1007 $this->fields['booking_confirmation__booking_details__header_enabled'] = array(
1008 'type' => 'checkbox'
1009 , 'default' => $default_options_values['booking_confirmation__booking_details__header_enabled']
1010 , 'is_new_line' => false
1011 , 'only_field' => true
1012 , 'label' => __( 'Enable', 'booking' )
1013 , 'css' => 'flex:0 0 auto;margin-right:5px;'
1014 , 'group' => 'booking_confirmation_right'
1015 );
1016 $this->fields['booking_confirmation__booking_details__title'] = array(
1017 'type' => 'text'
1018 , 'default' => $default_options_values['booking_confirmation__booking_details__title']
1019 , 'placeholder' => __( 'Example', 'booking' ) . ": '" . __( 'Booking details', 'booking' ) . "'"
1020 , 'title' => ''
1021 , 'description' => ''
1022 , 'css' => 'flex: 1 1 100px;font-size: 16px;line-height: 34px;font-weight: 600;;width:auto;'
1023 , 'group' => 'booking_confirmation_right'
1024 , 'class' => 'wpbc_booking_confirmation__booking_details__field'
1025 , 'tr_class' => ''
1026 , 'only_field' => true
1027 );
1028 $this->fields['booking_confirmation__booking_details__sufix'] = array( 'type' => 'pure_html', 'group' => 'booking_confirmation_right',
1029 'html' => '<p style="text-align: right;font-size:12px;width:100%;">'
1030 /* translators: 1: ... */
1031 . sprintf( __( 'Enter %1$stitle%2$s for this section of Booking Confirmation', 'booking' ),'<b>','</b>')
1032 . '.</p>' . '</fieldset> </td> </tr>' );
1033 $this->fields['booking_confirmation__booking_details__content_before'] = array(
1034 'type' => 'pure_html',
1035 'group' => 'booking_confirmation_right',
1036 'html' => '<tr class="wpbc_booking_confirmation__booking_details__fields"><td colspan="2" style="padding-top:0;">'
1037 . '<div style="margin: 0 0 10px;font-weight: 600;font-size: 14px;">'
1038 . '<label class="wpbc-form-email-content" for="booking_confirmation__booking_details__content">' .
1039 __( 'Content', 'booking' )
1040 . '</label></div>'
1041 );
1042 $this->fields['booking_confirmation__booking_details__content'] = array(
1043 'type' => ( $is_use_code_mirror ? 'textarea' : 'wp_textarea' ) // FixIn: 8.4.7.18.
1044 , 'default' => $default_options_values['booking_confirmation__booking_details__content']
1045 // ( ( class_exists( 'wpdev_bk_personal' ) ) ? '<h4 class="wpbc_ty__section_text_resource">[resource_title]</h4>' : '' )
1046 // . '<div class="wpbc_ty__section_text_dates">' . esc_html__( 'Dates', 'booking' ) . ': <strong>[dates]</strong></div>'
1047 // . '<div class="wpbc_ty__section_text_times">' . esc_html__( 'Time', 'booking' ) . ': <strong>[times]</strong></div>'
1048 //, 'placeholder' => '[content]'
1049 , 'title' => __('Content', 'booking')
1050 //, 'description' => __('Example', 'booking') . ': ' . '[content]'
1051 , 'description_tag' => ''
1052 , 'css' => 'width:100%;height:70px;'
1053 , 'group' => 'booking_confirmation_right'
1054 , 'tr_class' => ''
1055 , 'rows' => 10
1056 , 'show_in_2_cols' => true
1057 , 'only_field' => true
1058 );
1059 $this->fields['booking_confirmation__booking_details__content_after'] = array( 'type' => 'pure_html', 'group' => 'booking_confirmation_right', 'html' => '</td></tr>' );
1060
1061 // </editor-fold>
1062
1063
1064 // <editor-fold defaultstate="collapsed" desc=" == B o o k i n g C o n f i r m a t i o n - == Help Shortcodes == " >
1065 ////////////////////////////////////////////////////////////////////
1066 // Help
1067 ////////////////////////////////////////////////////////////////////
1068
1069 $this->fields['booking_confirmation_help_shortcodes'] = array(
1070 'type' => 'help'
1071 , 'value' => array()
1072 , 'cols' => 2
1073 , 'group' => 'booking_confirmation_help'
1074 , 'css' => 'margin:10px 0 0; padding: 0 5px 0 0 !important;overflow: auto;border:none;max-height: 445px;'
1075 , 'only_field' => true
1076 );
1077
1078 $skip_shortcodes = array(
1079 'denyreason'
1080 , 'moderatelink'
1081 , 'paymentreason'
1082 , 'visitorbookingediturl'
1083 , 'visitorbookingslisting'
1084 , 'visitorbookingcancelurl'
1085 , 'visitorbookingpayurl'
1086 );
1087 $email_example = '';
1088
1089 $help_fields = wpbc_get_email_help_shortcodes( $skip_shortcodes, $email_example );
1090 if ( class_exists( 'wpdev_bk_personal' ) ) {
1091 array_shift( $help_fields );
1092 array_shift( $help_fields );
1093 }
1094 $icn = '<a href="https://wpbookingcalendar.com/faq/#available_shortcodes"
1095 class="tooltip_top wpbc-bi-question-circle wpbc_help_tooltip_icon_left"
1096 data-original-title="%2$s"></a> %1$s';
1097 /* translators: 1: ... */
1098 $this->fields['booking_confirmation_help_shortcodes']['value'][] = sprintf( $icn, '<code>[readable_dates]</code>', sprintf( __('%s - dates in readable format' ,'booking'), '[readable_dates]' ) );
1099 /* translators: 1: ... */
1100 $this->fields['booking_confirmation_help_shortcodes']['value'][] = sprintf( $icn, '<code>[readable_times]</code>', sprintf( __('%s - time in readable format' ,'booking'), '[readable_times]' ) );
1101
1102 foreach ( $help_fields as $help_fields_key => $help_fields_value ) {
1103 $this->fields['booking_confirmation_help_shortcodes']['value'][] = $help_fields_value;
1104 }
1105
1106 // </editor-fold>
1107
1108 // <editor-fold defaultstate="collapsed" desc=" Booking Admin Panel " >
1109
1110 $field_options = array(
1111 'vm_booking_listing' => __('Bookings Listing' ,'booking') // FixIn: 9.6.3.5.
1112 , 'vm_calendar' => __('Timeline View' ,'booking')
1113 );
1114 $this->fields['booking_listing_default_view_mode'] = array(
1115 'type' => 'select'
1116 , 'default' => $default_options_values['booking_listing_default_view_mode'] //'vm_calendar'
1117 , 'title' => __('Default booking admin page', 'booking')
1118 , 'description' => __('Select your default view mode of bookings at the booking listing page' ,'booking')
1119 , 'options' => $field_options
1120 , 'group' => 'booking_listing'
1121 );
1122 // // FixIn: 9.5.5.7.
1123 // $this->fields['booking_admin_panel_skin'] = array(
1124 // 'type' => 'select'
1125 // , 'default' => $default_options_values['booking_admin_panel_skin'] // 'modern_1'
1126 // , 'title' => __('Theme of booking admin panel', 'booking')
1127 // , 'description' => __('Select theme of your booking admin panel' ,'booking')
1128 // , 'options' => array(
1129 // 'modern_1' => __( 'Modern Theme', 'booking' )
1130 // , 'legacy' => __( 'Legacy Theme', 'booking' )
1131 // )
1132 // , 'group' => 'booking_listing'
1133 // );
1134 //
1135 // // FixIn: 9.6.3.5.
1136
1137 //Default booking resources
1138 $this->fields = apply_filters( 'wpbc_settings_booking_listing_br_default_count', $this->fields, $default_options_values );
1139
1140
1141 // FixIn: 8.6.1.13.
1142
1143 // Calendar Default View mode
1144 if ( class_exists( 'wpdev_bk_personal' ) )
1145 $field_options = array(
1146 '1' => __('Day' ,'booking')
1147 , '7' => __('Week' ,'booking')
1148 , '30' => __('Month' ,'booking')
1149 , '60' => __('2 Months' ,'booking')
1150 , '90' => __('3 Months' ,'booking')
1151 , '365' => __('Year' ,'booking')
1152 );
1153 else
1154 $field_options = array(
1155 '30' => __('Month' ,'booking') // Day ?
1156 , '90' => __('3 Months' ,'booking') // Week ?
1157 , '365' => __('Year' ,'booking') // Month ?
1158 );
1159 $this->fields['booking_view_days_num'] = array(
1160 'type' => 'select'
1161 , 'default' => $default_options_values['booking_view_days_num'] //'30'
1162 , 'title' => __('Default view mode', 'booking')
1163 , 'description' => __('Select your default calendar view mode at booking calendar overview page' ,'booking')
1164 , 'options' => $field_options
1165 , 'group' => 'booking_calendar_overview' //FixIn: 8.5.2.20 // FixIn: 8.9.4.4.
1166 );
1167
1168 // FixIn: 8.9.4.3.
1169 $field_options = array();
1170 foreach ( range( 1, 31, 1) as $value ) {
1171 $field_options[ $value ] = $value;
1172 }
1173 $this->fields['booking_calendar_overview__day_mode__days_number_show'] = array(
1174 'type' => 'select'
1175 , 'default' => $default_options_values['booking_calendar_overview__day_mode__days_number_show'] // 31
1176 , 'title' => __('Days number to show in day view mode', 'booking')
1177 /* translators: 1: ... */
1178 , 'description' => sprintf( __( 'Select number of days to show in %1$sDay%2$s view mode', 'booking' ),'<b>','</b>')
1179 . ( ( class_exists( 'wpdev_bk_personal' ) ) ? ' ' . __( 'for one booking resource', 'booking' ) : '' )
1180 , 'options' => $field_options
1181 , 'group' => 'booking_calendar_overview' // FixIn: 8.9.4.4.
1182 );
1183 $this->fields['booking_timeline__month_mode__days_number_show'] = array(
1184 'type' => 'select'
1185 , 'default' => $default_options_values['booking_timeline__month_mode__days_number_show'] //31
1186 , 'title' => __('Days number to show in month view mode', 'booking')
1187 , 'description' => __('Select number of days to show in month view mode for one booking resource.' ,'booking')
1188 , 'options' => $field_options
1189 , 'group' => 'booking_timeline'
1190 );
1191
1192
1193 //Default Titles in Calendar cells
1194 $this->fields = apply_filters( 'wpbc_settings_booking_listing_timeline_title_in_day', $this->fields, $default_options_values );
1195
1196
1197 // FixIn: 9.6.3.5.
1198
1199 // <editor-fold defaultstate="collapsed" desc=" == Dates : Time == " >
1200 $timezone_error_message = '';
1201 if ( 'UTC' !== date_default_timezone_get() ) {
1202 $timezone_error_message .= '<div style="line-height: 2em;margin-bottom:2em;" class="wpbc-settings-notice notice-error">';
1203 $timezone_error_message .= '<strong>' . esc_html__( 'PHP default timezone is invalid', 'booking' ) . '</strong>. ';
1204 $timezone_error_message .= '<a href="' . esc_url( admin_url( 'site-health.php' ) ) . '">' . __( 'Read more' , 'booking' ) . '</a>' . '<br/>';
1205 /* translators: 1: ... */
1206 $timezone_error_message .= sprintf( __( 'Find additional details %1$shere%2$s', 'booking' ), '<a href="https://make.wordpress.org/core/2019/09/23/date-time-improvements-wp-5-3/">', '</a>' );
1207 $timezone_error_message .= '</div>';
1208 }
1209
1210 $this->fields['system_timezones'] = array(
1211 'type' => 'html'
1212 , 'html' => $timezone_error_message
1213 . '<div style="line-height: 2em;">'
1214 . __( 'Server Default Timezone', 'booking' ) . ': <strong>' . date_default_timezone_get() . '</strong><br/>'
1215 . __( 'WordPress Timezone', 'booking' ) . ': <strong>' . wp_timezone()->getName() . '</strong>'
1216 . '</div>'
1217
1218 , 'class' => ''
1219 , 'css' => 'margin:0;padding:0;border:0;'
1220 , 'cols' => 2
1221 , 'group' => 'date_time'
1222 );
1223
1224 $this->fields['hr_booking_date_format'] = array( 'type' => 'hr', 'group' => 'date_time' );
1225 // -------------------------------------------------------------------------------------------------------------
1226 // Default Dates View Mode
1227 // -------------------------------------------------------------------------------------------------------------
1228 $this->fields['booking_date_view_type'] = array(
1229 'type' => 'select'
1230 , 'default' => $default_options_values['booking_date_view_type'] //'short'
1231 , 'title' => __('Dates view', 'booking')
1232 , 'description' => __('Select the default view for dates on the booking tables' ,'booking')
1233 , 'options' => array(
1234 'short' => __('Short days view' ,'booking')
1235 , 'wide' => __('Wide days view' ,'booking')
1236 )
1237 , 'group' => 'date_time'
1238 );
1239 $this->fields['hr_booking_time_format'] = array( 'type' => 'hr', 'group' => 'date_time' );
1240 // -------------------------------------------------------------------------------------------------------------
1241 // Dates : Time
1242 // -------------------------------------------------------------------------------------------------------------
1243
1244 $this->fields['booking_date_format_html_prefix'] = array(
1245 'type' => 'pure_html'
1246 , 'group' => 'date_time'
1247 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_date_format">
1248 <th scope="row">'.
1249 WPBC_Settings_API::label_static( 'set_gen_booking_date_format'
1250 , array( 'title'=> __('Date Format' ,'booking'), 'label_css' => 'margin: 0.25em 0 !important;vertical-align: middle;' ) )
1251 .'</th>
1252 <td><fieldset>'
1253 );
1254 $field_options = array();
1255 foreach ( array( 'j M Y', 'F j, Y', 'Y/m/d', 'm/d/Y', 'd/m/Y' ) as $format ) {
1256 $field_options[ esc_attr($format) ] = array( 'title' => date_i18n( $format ) );
1257 }
1258 $field_options['custom'] = array( 'title' => __('Custom' ,'booking') . ':', 'attr' => array( 'id' => 'date_format_selection_custom' ) );
1259
1260 $this->fields['booking_date_format_selection'] = array(
1261 'type' => 'radio'
1262 , 'default' => get_option('date_format')
1263 , 'options' => $field_options
1264 , 'group' => 'date_time'
1265 , 'only_field' => true
1266 , 'is_new_line' => !true
1267 );
1268
1269 $booking_date_format = get_bk_option( 'booking_date_format');
1270 $this->fields['booking_date_format'] = array(
1271 'type' => 'text'
1272 , 'default' => $default_options_values['booking_date_format'] //get_option('date_format')
1273 , 'value' => htmlentities( $booking_date_format ) // Display value of this field in specific way
1274 , 'group' => 'date_time'
1275 , 'placeholder' => get_option('date_format')
1276 , 'css' => 'width:auto;margin: 10px 0;'
1277 , 'only_field' => true
1278 );
1279 $this->fields['booking_date_format_html_sufix'] = array(
1280 'type' => 'pure_html'
1281 , 'group' => 'date_time'
1282 , 'html' => '<span class="description" style="padding:0;"><code>' . date_i18n( $booking_date_format ) . '</code></span>
1283 </fieldset>
1284 </td>
1285 </tr>'
1286 );
1287 $this->fields['booking_date_format_help'] = array(
1288 'type' => 'html'
1289 , 'html' => '<div style="line-height: 2em;">'.
1290 /* translators: 1: ... */
1291 sprintf( __( 'Type your date format for emails and the booking table. %1$sDocumentation on date formatting%2$s', 'booking' ),'<br/><a href="https://wordpress.org/documentation/article/customize-date-and-time-format/" target="_blank">','</a>')
1292 .'</div>'
1293 , 'class' => ''
1294 , 'css' => 'margin:0;padding:0;border:0;'
1295 , 'description' => ''
1296 , 'cols' => 2
1297 , 'group' => 'date_time'
1298 , 'tr_class' => ''
1299 , 'description_tag' => 'div'
1300 );
1301
1302
1303 // -------------------------------------------------------------------------------------------------------------
1304 // Time Format
1305 // -------------------------------------------------------------------------------------------------------------
1306
1307 $this->fields['booking_time_format_html_prefix'] = array(
1308 'type' => 'pure_html'
1309 , 'group' => 'date_time'
1310 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_time_format">
1311 <th scope="row">'.
1312 WPBC_Settings_API::label_static( 'set_gen_booking_time_format'
1313 , array( 'title'=> __('Time Format' ,'booking'), 'label_css' => 'margin: 0.25em 0 !important;vertical-align: middle;' ) )
1314 .'</th>
1315 <td><fieldset>'
1316 );
1317 $field_options = array();
1318 foreach ( array( 'g:i a', 'g:i A', 'H:i' ) as $format ) {
1319 $field_options[ esc_attr($format) ] = array( 'title' => date_i18n( $format ) );
1320 }
1321 $field_options['custom'] = array( 'title' => __('Custom' ,'booking') . ':', 'attr' => array( 'id' => 'time_format_selection_custom' ) );
1322
1323 $this->fields['booking_time_format_selection'] = array(
1324 'type' => 'radio'
1325 , 'default' => 'H:i'
1326 , 'options' => $field_options
1327 , 'group' => 'date_time'
1328 , 'only_field' => true
1329 , 'is_new_line' => ! true
1330 );
1331
1332 $booking_time_format = get_bk_option( 'booking_time_format');
1333 $this->fields['booking_time_format'] = array(
1334 'type' => 'text'
1335 , 'default' => $default_options_values['booking_time_format'] //'H:i'
1336 , 'value' => htmlentities( $booking_time_format ) // Display value of this field in specific way
1337 , 'group' => 'date_time'
1338 , 'placeholder' => 'H:i'
1339 , 'css' => 'width:auto; margin: 10px 0;'
1340 , 'only_field' => true
1341 );
1342 $this->fields['booking_time_format_html_sufix'] = array(
1343 'type' => 'pure_html'
1344 , 'group' => 'date_time'
1345 , 'html' => '<span class="description" style="padding:0;"><code>' . date_i18n( $booking_time_format ) . '</code></span>
1346 </fieldset>
1347 </td>
1348 </tr>'
1349 );
1350 $this->fields['booking_time_format_help'] = array(
1351 'type' => 'html'
1352 , 'html' => '<div style="line-height: 2em;">'.
1353 /* translators: 1: ... */
1354 sprintf( __( 'Type your time format for emails and the booking table. %1$sDocumentation on time formatting%2$s', 'booking' ),'<br/><a href="https://www.php.net/manual/datetime.format.php" target="_blank">','</a>')
1355 .'</div>'
1356 , 'class' => ''
1357 , 'css' => 'margin:0;padding:0;border:0;'
1358 , 'description' => ''
1359 , 'cols' => 2
1360 , 'group' => 'date_time'
1361 , 'tr_class' => ''
1362 , 'description_tag' => 'div'
1363 );
1364
1365
1366
1367 // </editor-fold>
1368
1369
1370
1371 // Divider ///////////////////////////////////////////////////////////////
1372 $this->fields['hr_booking_listing_before_is_use_hints_at_admin_panel'] = array( 'type' => 'hr', 'group' => 'booking_listing' );
1373
1374
1375 // Show hide Notes
1376 $this->fields = apply_filters( 'wpbc_settings_booking_show_hide_options', $this->fields, $default_options_values ); // FixIn: 8.1.3.32.
1377
1378
1379 // </editor-fold>
1380
1381
1382 // <editor-fold defaultstate="collapsed" desc=" auto_cancelation_approval " >
1383
1384 // auto_cancelation_approval
1385 $this->fields = apply_filters( 'wpbc_settings_auto_cancelation_approval_section', $this->fields, $default_options_values );
1386 // </editor-fold>
1387
1388
1389 // <editor-fold defaultstate="collapsed" desc=" Capacity " >
1390
1391 $this->fields = apply_filters( 'wpbc_settings_capacity_based_on_visitors', $this->fields, $default_options_values );
1392
1393 $this->fields['booking_is_days_always_available'] = array(
1394 'type' => 'checkbox'
1395 , 'default' => $default_options_values['booking_is_days_always_available'] //'On'
1396 , 'title' => __('Allow unlimited bookings per same day(s)' ,'booking')
1397 /* translators: 1: ... */
1398 , 'label' => sprintf( __( 'Check this box, if you want to %1$sset any days as available%2$s in calendar. Your visitors will be able to make %3$sunlimited bookings per same date(s) in calendar and do not see any booked date(s)%4$s of other visitors.', 'booking' ), '<strong>', '</strong>' , '<strong>', '</strong>' )
1399 , 'description' => ''
1400 , 'group' => 'capacity'
1401 );
1402
1403
1404 // FixIn: 8.3.2.2.
1405 if ( ! class_exists('wpdev_bk_biz_l') )
1406 $this->fields['booking_is_show_pending_days_as_available'] = array(
1407 'type' => 'checkbox'
1408 , 'default' => $default_options_values['booking_is_show_pending_days_as_available'] //_'Off'
1409 , 'title' => __('Use pending days as available' ,'booking')
1410 , 'label' => sprintf(__('Check this box if you want to show the pending days as available in calendars' ,'booking') )
1411 , 'description' => ''
1412 , 'group' => 'capacity'
1413 , 'tr_class' => ''
1414 );
1415
1416 $this->fields = apply_filters( 'wpbc_settings_pending_days_as_available', $this->fields, $default_options_values );
1417
1418
1419
1420 // </editor-fold>
1421
1422 // <editor-fold defaultstate="collapsed" desc=" Capacity Free example " >
1423 if ( ! class_exists('wpdev_bk_personal') ){
1424
1425 // Showing availability in tooltip
1426 $this->fields['booking_quantity_control__promote_upgrade'] = array(
1427 'type' => 'checkbox'
1428 , 'default' => 'On'
1429 , 'value' => 'On'
1430 , 'title' => __('Booking Quantity Control' ,'booking')
1431 , 'label' => __('Enable this option to allow visitors to define the number of items they can book for specific dates or times within a single reservation. ' ,'booking')
1432 , 'description' => __('If disabled, visitors can book only one slot within a single reservation.' ,'booking')
1433 , 'description_tag' => 'p'
1434 , 'group' => 'capacity_upgrade'
1435 , 'tr_class' => 'wpbc_blur'
1436 );
1437 $this->fields['booking_capacity_field__promote_upgrade'] = array(
1438 'type' => 'select'
1439 , 'default' => 'items'
1440 , 'value' => 'items'
1441 , 'title' => __('Quantity field name', 'booking')
1442 , 'description' => sprintf( __( 'Select the field that will control how many slots visitors can book during the reservation process.' ,'booking'), '<b>', '</b>' )
1443 , 'description_tag' => 'span'
1444 , 'css' => ''
1445 , 'tr_class' => 'wpbc_booking_capacity_field_settings wpbc_sub_settings_grayed'
1446 , 'options' => array( 'items' => __('Items' ,'booking') )
1447 , 'group' => 'capacity_upgrade'
1448 , 'tr_class' => 'wpbc_blur'
1449 );
1450 $this->fields['booking_is_dissbale_booking_for_different_sub_resources__promote_upgrade'] = array(
1451 'type' => 'checkbox'
1452 , 'default' => 'On'
1453 , 'value' => 'On'
1454 , 'title' => __('Disable bookings in different booking resources' ,'booking')
1455 , 'label' => __('Check this box to disable reservations, which can be stored in different booking resources.' ,'booking')
1456 , 'description' => '<strong>' . esc_html__('Note' ,'booking') . '!</strong> ' . __('When checked, all reserved days must be at same booking resource otherwise error message will show.' ,'booking')
1457 , 'group' => 'capacity_upgrade'
1458 , 'tr_class' => 'wpbc_blur'
1459 );
1460 $this->fields['capacity_upgrade__promote_upgrade'] = array(
1461 'type' => 'pure_html'
1462 , 'group' => 'capacity_upgrade'
1463 , 'html' => '<tr><td colspan="2">
1464 <div class="wpbc_widget_content" style="transform: translate(0) translateY(-10em);">
1465 <div class="ui_container ui_container_toolbar ui_container_small" style="background: #fff;position: relative;">
1466 <div class="ui_group ui_group__upgrade">
1467 <div class="wpbc_upgrade_note wpbc_upgrade_theme_green">
1468 <div>This <a target="_blank" href="https://wpbookingcalendar.com/features/#capacity">feature</a>
1469 is available in the <strong>Business Large or MultiUser version</strong>.
1470 <a target="_blank" href="https://wpbookingcalendar.com/prices/#bk_news_section">Upgrade to Pro</a>.
1471 </div>
1472 </div>
1473 </div>
1474 </div>
1475 </div>
1476 </td> </tr>'
1477 );
1478 }
1479 // </editor-fold>
1480
1481
1482 // <editor-fold defaultstate="collapsed" desc=" Advanced " >
1483
1484
1485 $this->fields = apply_filters( 'wpbc_settings_edit_url_hash', $this->fields, $default_options_values );
1486 $this->fields = apply_filters( 'wpbc_settings_resource_no_update__during_editing', $this->fields, $default_options_values );
1487
1488 // Show advanced settings of JavaScript loading
1489
1490
1491 // //Show | Hide links for Advanced JavaScript section
1492 // $this->fields['booking_advanced_js_loading_settings'] = array(
1493 // 'type' => 'html'
1494 // , 'html' =>
1495 // '<a id="wpbc_show_advanced_section_link_show" class="wpbc_expand_section_link" href="javascript:void(0)">+ ' . __('Show advanced settings of JavaScript loading' ,'booking') . '</a>'
1496 // . '<a id="wpbc_show_advanced_section_link_hide" class="wpbc_expand_section_link" href="javascript:void(0)" style="display:none;">- ' . __('Hide advanced settings of JavaScript loading' ,'booking') . '</a>'
1497 // , 'cols' => 2
1498 // , 'group' => 'advanced'
1499 // );
1500
1501 // FixIn: 9.8.6.2.
1502 $balencer_options = array_combine( range( 1, 5 ), range( 1, 5 ) );
1503 $balencer_options[99] = __( 'All', 'booking' );
1504 $this->fields['booking_load_balancer_max_threads'] = array(
1505 'type' => 'select'
1506 , 'default' => $default_options_values['booking_load_balancer_max_threads']
1507 , 'title' => __('Parallel requests' ,'booking')
1508 , 'description' => __('Select the number of simultaneous requests to load data in multiple calendars.' ,'booking') . ' <sup style="color:#7812bd;"><strong> '.__('Performance','booking').'</strong></sup>'
1509 . '<div class="wpbc-general-settings-notice wpbc-settings-notice notice-info">'
1510 . __('This Server Balancer control how many parallel requests for loading calendar data can be sent at the same time. A lower number minimizes server impact but may increase the total time for loading all calendars.' ,'booking')
1511 .'</div>'
1512
1513 , 'options' => $balencer_options
1514 , 'group' => 'advanced'
1515 , 'is_demo_safe' => wpbc_is_this_demo()
1516 );
1517
1518
1519 $this->fields['booking_is_load_js_css_on_specific_pages'] = array(
1520 'type' => 'checkbox'
1521 , 'default' => $default_options_values['booking_is_load_js_css_on_specific_pages'] //'Off'
1522 , 'title' => __('Load JS and CSS files only on specific pages' ,'booking')
1523 , 'label' => __('Activate loading of CSS and JavaScript files of plugin only at specific pages.' ,'booking')
1524 , 'description' => ''
1525 , 'group' => 'advanced'
1526 , 'tr_class' => 'wpbc_advanced_js_loading_settings'//wpbc_advanced_js_loading_settings wpbc_sub_settings_grayed hidden_items'
1527 , 'is_demo_safe' => wpbc_is_this_demo()
1528 );
1529 $this->fields['booking_pages_for_load_js_css'] = array(
1530 'type' => 'textarea'
1531 , 'default' => $default_options_values['booking_pages_for_load_js_css'] //''
1532 , 'placeholder' => '/booking-form/'
1533 , 'title' => __('Relative URLs of pages, where to load plugin CSS and JS files' ,'booking')
1534 /* translators: 1: ... */
1535 , 'description' => sprintf(__( 'Enter relative URLs of pages, where you have Booking Calendar elements (booking forms or availability calendars). Please enter one URL per line. Example: %s' ,'booking'),'<code>/booking-form/</code>')
1536 ,'description_tag' => 'p'
1537 , 'css' => 'width:100%'
1538 , 'rows' => 5
1539 , 'group' => 'advanced'
1540 , 'tr_class' => 'wpbc_advanced_js_loading_settings wpbc_is_load_js_css_on_specific_pages wpbc_sub_settings_grayed'// hidden_items'
1541 , 'is_demo_safe' => wpbc_is_this_demo()
1542 );
1543
1544 $this->fields['booking_form_is_using_bs_css'] = array(
1545 'type' => 'checkbox'
1546 , 'default' => $default_options_values['booking_form_is_using_bs_css'] // 'On'
1547 , 'title' => __('Use CSS BootStrap' ,'booking')
1548 , 'label' => __('Using BootStrap CSS for the form fields' ,'booking'). ' <sup style="color:#bd8212;"><strong> '.__('Deprecated','booking').'</strong></sup>'
1549 , 'description' => ''
1550 , 'description_tag' => 'p'
1551 , 'group' => 'advanced'
1552 );
1553
1554 //$this->fields['hr_booking_is_show_system_debug_log'] = array( 'type' => 'hr', 'group' => 'advanced', 'tr_class' => 'wpbc_advanced_js_loading_settings' ); // wpbc_sub_settings_grayed hidden_items' );
1555 // FixIn: 7.2.1.15.
1556 $this->fields[ 'booking_is_show_system_debug_log' ] = array(
1557 'type' => 'checkbox'
1558 , 'default' => $default_options_values['booking_is_show_system_debug_log'] //'Off'
1559 , 'title' => __('Show system debugging log for beta features' ,'booking')
1560 , 'label' => __('Activate this option only for testing beta features' ,'booking')
1561 , 'description' => ''
1562 , 'group' => 'advanced'
1563 , 'tr_class' => 'wpbc_advanced_js_loading_settings'// wpbc_sub_settings_grayed hidden_items'
1564 , 'is_demo_safe' => wpbc_is_this_demo()
1565 );
1566
1567 //FixIn: 10.1.1.2 //TODO: Update Text here 2024-06-16 12:57
1568 $this->fields['booking_is_nonce_at_front_end'] = array(
1569 'type' => 'checkbox'
1570 , 'default' => $default_options_values['booking_is_nonce_at_front_end'] //'Off'
1571 , 'title' => __( 'Use Nonce Fields', 'booking' )
1572 , 'label' => __( 'Activate this option to add security tokens (nonce fields) to booking forms on the front-end. Please note that this may cause issues if you are using cache plugins or caching software.', 'booking' )
1573 , 'description' => ''
1574 , 'group' => 'advanced'
1575 , 'tr_class' => 'wpbc_advanced_is_nonce' //wpbc_advanced_js_loading_settings wpbc_sub_settings_grayed hidden_items'
1576 , 'toggle_class' => 'wpbc_toggle_danger'
1577 , 'is_demo_safe' => wpbc_is_this_demo()
1578 );
1579
1580 if ( wpbc_is_this_demo() ) {
1581 $this->fields['booking_pages_for_load_js_css_demo'] = array( 'group' => 'advanced',
1582 'type' => 'html',
1583 'html' => wpbc_get_warning_text_in_demo_mode(),
1584 'cols' => 2,
1585 'tr_class' => 'wpbc_advanced_js_loading_settings'// wpbc_sub_settings_grayed hidden_items'
1586 );
1587 }
1588
1589 // Divider ///////////////////////////////////////////////////////////////
1590 $this->fields['hr_calendar_before_advanced_js_loading_settings'] = array( 'type' => 'hr', 'group' => 'advanced' );
1591
1592 // Show settings of powered by notice
1593 $this->fields['booking_advanced_powered_by_notice_settings'] = array(
1594 'type' => 'html'
1595 , 'html' =>
1596 '<a id="wpbc_powered_by_link_show" class="wpbc_expand_section_link" href="javascript:void(0)">+ ' . __('Show settings of powered by notice' ,'booking') . '</a>'
1597 . '<a id="wpbc_powered_by_link_hide" class="wpbc_expand_section_link" href="javascript:void(0)" style="display:none;">- ' . __('Hide settings of powered by notice' ,'booking') . '</a>'
1598 , 'cols' => 2
1599 , 'group' => 'advanced'
1600 );
1601 $this->fields['booking_is_show_powered_by_notice'] = array(
1602 'type' => 'checkbox'
1603 , 'default' => $default_options_values['booking_is_show_powered_by_notice'] //'On'
1604 , 'title' => __('Powered by notice' ,'booking')
1605 , 'label' => sprintf(__(' Turn On/Off powered by "Booking Calendar" notice under the calendar.' ,'booking'),'wpbookingcalendar.com')
1606 , 'description' => ''
1607 , 'group' => 'advanced'
1608 , 'tr_class' => 'wpbc_is_show_powered_by_notice wpbc_sub_settings_grayed hidden_items'
1609 );
1610 $this->fields['booking_wpdev_copyright_adminpanel'] = array(
1611 'type' => 'checkbox'
1612 , 'default' => $default_options_values['booking_wpdev_copyright_adminpanel'] //'On'
1613 , 'title' => __('Help and info notices' ,'booking')
1614 , 'label' => sprintf(__(' Turn On/Off version notice and help info links at booking admin panel.' ,'booking'),'wpbookingcalendar.com')
1615 , 'description' => ''
1616 , 'group' => 'advanced'
1617 , 'tr_class' => 'wpbc_is_show_powered_by_notice wpbc_sub_settings_grayed hidden_items'
1618 , 'is_demo_safe' => wpbc_is_this_demo() // FixIn: 8.1.3.9.
1619 );
1620
1621 // </editor-fold>
1622
1623
1624 // <editor-fold defaultstate="collapsed" desc=" Information " >
1625 if(1){
1626 if ( function_exists( 'wpbc_get_dashboard_info' ) ) {
1627 $this->fields['booking_information'] = array(
1628 'type' => 'html'
1629 , 'html' => wpbc_get_dashboard_info()
1630 , 'cols' => 2
1631 , 'group' => 'information'
1632 );
1633 }
1634 }
1635 // </editor-fold>
1636
1637
1638 // <editor-fold defaultstate="collapsed" desc=" User permissions for plugin menu pages " >
1639
1640
1641 $this->fields['booking_menu_position'] = array(
1642 'type' => 'select'
1643 , 'default' => 'top'
1644 , 'title' => __('Plugin menu position', 'booking')
1645 , 'description' => ''
1646 , 'options' => array(
1647 'top' => __('Top', 'booking')
1648 , 'middle' => __('Middle', 'booking')
1649 , 'bottom' => __('Bottom', 'booking')
1650 )
1651 , 'group' => 'permissions'
1652 , 'is_demo_safe' => wpbc_is_this_demo()
1653 );
1654
1655 $this->fields['booking_user_role_booking_header'] = array(
1656 'type' => 'pure_html'
1657 , 'group' => 'permissions'
1658 , 'html' => '<tr valign="top">
1659 <th scope="row" colspan="2">
1660 <hr/><p><strong>' . wp_kses_post( __('User permissions for plugin menu pages' ,'booking') ) . ':</strong></p>
1661 </th>
1662 </tr>'
1663 );
1664
1665 $field_options = array();
1666 $field_options['subscriber'] = translate_user_role('Subscriber');
1667 $field_options['contributor'] = translate_user_role('Contributor');
1668 $field_options['author'] = translate_user_role('Author');
1669 $field_options['editor'] = translate_user_role('Editor');
1670 $field_options['administrator'] = translate_user_role('Administrator');
1671
1672 $this->fields['booking_user_role_booking'] = array(
1673 'type' => 'select'
1674 , 'default' => $default_options_values['booking_user_role_booking'] //'editor'
1675 , 'title' => __('Bookings', 'booking')
1676 , 'description' => ''
1677 , 'options' => $field_options
1678 , 'group' => 'permissions'
1679 , 'is_demo_safe' => wpbc_is_this_demo()
1680 );
1681 $this->fields['booking_user_role_availability'] = array( // FixIn: 9.5.2.2.
1682 'type' => 'select'
1683 , 'default' => $default_options_values['booking_user_role_availability'] //'editor'
1684 , 'title' => __('Availability', 'booking')
1685 , 'description' => ''
1686 , 'options' => $field_options
1687 , 'group' => 'permissions'
1688 , 'is_demo_safe' => wpbc_is_this_demo()
1689 );
1690 //FixIn: 9.8.15.2.6
1691 if ( class_exists( 'wpdev_bk_biz_m' ) )
1692 $this->fields['booking_user_role_prices'] = array(
1693 'type' => 'select'
1694 , 'default' => $default_options_values['booking_user_role_prices'] //'editor'
1695 , 'title' => __('Prices', 'booking')
1696 , 'description' => ''
1697 , 'options' => $field_options
1698 , 'group' => 'permissions'
1699 , 'is_demo_safe' => wpbc_is_this_demo()
1700 );
1701
1702 $this->fields['booking_user_role_addbooking'] = array(
1703 'type' => 'select'
1704 , 'default' => $default_options_values['booking_user_role_addbooking'] //'editor'
1705 , 'title' => __('Add booking', 'booking')
1706 , 'description' => ''
1707 , 'options' => $field_options
1708 , 'group' => 'permissions'
1709 , 'is_demo_safe' => wpbc_is_this_demo()
1710 );
1711 if ( class_exists( 'wpdev_bk_personal' ) )
1712 $this->fields['booking_user_role_resources'] = array(
1713 'type' => 'select'
1714 , 'default' => $default_options_values['booking_user_role_resources'] //'editor'
1715 , 'title' => __('Resources', 'booking')
1716 , 'description' => ''
1717 , 'options' => $field_options
1718 , 'group' => 'permissions'
1719 , 'is_demo_safe' => wpbc_is_this_demo()
1720 );
1721 $this->fields['booking_user_role_settings'] = array(
1722 'type' => 'select'
1723 , 'default' => $default_options_values['booking_user_role_settings'] //'administrator'
1724 , 'title' => __('Settings', 'booking')
1725 , 'description' => __('Select user access level for the menu pages of plugin' ,'booking')
1726 , 'description_tag' => 'p'
1727 , 'options' => $field_options
1728 , 'group' => 'permissions'
1729 , 'is_demo_safe' => wpbc_is_this_demo()
1730 );
1731
1732 if ( ! class_exists( 'wpdev_bk_personal' ) )
1733 $this->fields['booking_menu_go_pro'] = array(
1734 'type' => 'select'
1735 , 'default' => $default_options_values['booking_menu_go_pro'] //'administrator'
1736 , 'title' => __('Premium', 'booking')
1737 , 'description' => __('Show / hide menu' ,'booking')
1738 , 'description_tag' => 'p'
1739 , 'options' => array(
1740 'show' => __('Show', 'booking')
1741 , 'hide' => __('Hide', 'booking')
1742 )
1743 , 'group' => 'permissions'
1744 , 'is_demo_safe' => wpbc_is_this_demo()
1745 );
1746
1747 if ( wpbc_is_this_demo() )
1748 $this->fields['booking_user_role_settings_demo'] = array( 'group' => 'permissions', 'type' => 'html', 'html' => wpbc_get_warning_text_in_demo_mode(), 'cols' => 2 );
1749
1750
1751 // </editor-fold>
1752
1753
1754 // <editor-fold defaultstate="collapsed" desc=" Uninstall " >
1755 $this->fields['booking_is_delete_if_deactive'] = array(
1756 'type' => 'checkbox'
1757 , 'default' => $default_options_values['booking_is_delete_if_deactive'] //'Off'
1758 , 'title' => __('Delete booking data, when plugin deactivated' ,'booking')
1759 , 'label' => __('Check this box to delete all booking data when you uninstal this plugin.' ,'booking')
1760 , 'description' => ''
1761 , 'group' => 'uninstall'
1762 , 'toggle_class' => 'wpbc_toggle_danger'
1763 );
1764 // </editor-fold>
1765
1766
1767 // <editor-fold defaultstate="collapsed" desc=" Tools " >
1768
1769 if ( ( ! wpbc_is_this_demo() ) && ( current_user_can( 'activate_plugins' ) ) ) {
1770
1771 $this->fields['tools_section_buttons'] = array(
1772 'type' => 'help'
1773 , 'value' => array()
1774 , 'class' => ''
1775 , 'css' => 'margin:0;padding:0;border:0;'
1776 , 'description' => ''
1777 , 'cols' => 2
1778 , 'group' => 'help'
1779 , 'tr_class' => ''
1780 , 'description_tag' => 'p'
1781 );
1782
1783 $my_system_buttons = '';
1784
1785 $my_system_buttons .= '<a class="button button" href="'
1786 . esc_url( wpbc_get_settings_url()
1787 . '&system_info=show&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) ) .'&booking_system_info=show#wpbc_general_settings_system_info_metabox">'
1788 . 'Booking System ' . __('Info' ,'booking')
1789 . '</a>';
1790 // FixIn: 8.4.7.19.
1791 $my_system_buttons .= ' <a class="button button" href="'
1792 . wpbc_get_bookings_url()
1793 . '&wh_booking_type=lost">'
1794 . 'Find Lost Bookings'
1795 . '</a>'; // FixIn: 8.5.2.19.
1796
1797 // FixIn: 9.5.3.1.
1798 $my_system_buttons .= ' <a class="button button" href="'
1799 . wpbc_get_resources_url()
1800 . '&show_all_resources=1">'
1801 . 'Find Lost Resources'
1802 . '</a>';
1803
1804 if ( ( isset( $_SERVER['HTTP_HOST'] ) ) && ( 'beta' === $_SERVER['HTTP_HOST'] ) ) {
1805
1806 $my_system_buttons .= '<div style="width:100%;height:2em;border-bottom:1px dashed #777;margin-bottom:1em;"></div>';
1807
1808 // Link: http://server.com/wp-admin/admin.php?page=wpbc-settings&system_info=show&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) .' &reset=custom_forms#wpbc_general_settings_system_info_metabox
1809 $my_system_buttons .= ' <a class="button button-secondary" style="background:#fff9e6;" href="'
1810 . esc_url( wpbc_get_settings_url()
1811 . '&system_info=show&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) ) .'&reset=custom_forms#wpbc_general_settings_system_info_metabox">'
1812 . 'Reset custom forms'
1813 . '</a>';
1814
1815
1816 $my_system_buttons .= ' <a class="button button-secondary" style="background:#fff9e6;" href="'
1817 . esc_url( wpbc_get_settings_url()
1818 . '&wpbc_setup_wizard=reset&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) ) .'">'
1819 . 'Reset Setup Wizard'
1820 . '</a>';
1821 // if ( ( isset( $_GET['wpbc_setup_wizard'] ) ) && ( 'reset' === $_GET['wpbc_setup_wizard'] ) ) {
1822 // $my_system_buttons .= '<script type="text/javascript"> window.location.href = "' . esc_url( wpbc_get_setup_wizard_page_url() ) . '"; </script>';
1823 // }
1824 $my_system_buttons .= ' <a class="button button-secondary" style="background:#fff9e6;" href="'
1825 . esc_url( wpbc_get_settings_url()
1826 . '&wpbc_setup_wizard=completed&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) ) .'">'
1827 . 'Set Setup Wizard as Completed'
1828 . '</a>';
1829 }
1830
1831 $this->fields['tools_section_buttons']['value'][] =
1832 '<div class="wpbc_booking_system_info_buttons_align">'
1833 . $my_system_buttons
1834 . '</div>';
1835 }
1836
1837 // </editor-fold>
1838
1839
1840 // <editor-fold defaultstate="collapsed" desc=" Transaltions " >
1841
1842 $this->fields['help_translation_section_after_legend_items'] = array(
1843 'type' => 'help'
1844 , 'value' => wpbc_get_help_rows_about_config_in_several_languges()
1845 , 'class' => ''
1846 , 'css' => 'margin:0;padding:0;border:0;'
1847 , 'description' => ''
1848 , 'cols' => 2
1849 , 'group' => 'translations'
1850 , 'tr_class' => ''
1851 , 'description_tag' => 'p'
1852 );
1853 $this->fields['hr_help_translation_section_after_legend_items'] = array( 'type' => 'hr', 'group' => 'translations' );
1854
1855 $this->fields['booking_translation_load_from'] = array(
1856 'type' => 'select'
1857 , 'default' => 'top'
1858 , 'title' => __('Firstly load translation', 'booking')
1859 , 'options' => array(
1860 'wp.org' => 'WordPress.org '
1861 , 'wpbc' => __( 'Local', 'booking' )
1862 )
1863 , 'group' => 'translations'
1864 , 'is_demo_safe' => wpbc_is_this_demo()
1865 );
1866
1867 $this->fields['help_translation_section_after_translation_load_from'] = array(
1868 'type' => 'help'
1869 , 'value' => array(
1870 sprintf(
1871 /* translators: 1: ... */
1872 __( 'The plugin tries to use translations from %1$s, if failed (doesn\'t exist), try using translations from %2$s folder. You can change this behavior with this option.', 'booking')
1873 , '"<strong>../wp-content/languages/plugins/</strong>"'
1874 , '"<strong>../wp-content/plugins/{Booking Calendar Folder}/languages/</strong>"' )
1875 )
1876 , 'class' => ''
1877 , 'css' => 'margin:0;padding:0;border:0;'
1878 , 'description' => ''
1879 , 'cols' => 2
1880 , 'group' => 'translations'
1881 , 'tr_class' => ''
1882 , 'description_tag' => 'p'
1883 );
1884 // </editor-fold>
1885
1886 }
1887
1888
1889 /**
1890 * Add Custon JavaScript - for some specific settings options
1891 * Need to executes after showing of entire settings page (on hook: wpbc_after_settings_content).
1892 * After initial definition of settings, and possible definition after POST request.
1893 *
1894 * @param type $menu_slug
1895 *
1896 */
1897 public function enqueue_js( $menu_slug, $active_page_tab, $active_page_subtab ) {
1898
1899 $js_script = '';
1900
1901 // Hide 'Title of booked timeslot(s)' items //FixIn: 9.5.0.2.2
1902 $js_script .= "
1903 if ( jQuery('#set_gen_booking_disable_timeslots_in_tooltip').is(':checked') ) {
1904 jQuery('.wpbc_booking_timeslots_in_tooltip').addClass('hidden_items');
1905 }
1906 ";
1907 // Hide or Show 'Title of booked timeslot(s)' on click checkbox
1908 $js_script .= " jQuery('#set_gen_booking_disable_timeslots_in_tooltip').on( 'change', function(){
1909 if ( this.checked ) {
1910 jQuery('.wpbc_booking_timeslots_in_tooltip').addClass('hidden_items');
1911 } else {
1912 jQuery('.wpbc_booking_timeslots_in_tooltip').removeClass('hidden_items');
1913 }
1914 } ); ";
1915
1916 // FixIn: 9.6.3.5.
1917
1918 // Hide Legend items
1919 $js_script .= "
1920 if ( ! jQuery('#set_gen_booking_is_show_legend').is(':checked') ) {
1921 jQuery('.wpbc_calendar_legend_items').addClass('hidden_items');
1922 }
1923 ";
1924 // Hide or Show Legend items on click checkbox
1925 $js_script .= " jQuery('#set_gen_booking_is_show_legend').on( 'change', function(){
1926 if ( this.checked ) {
1927 jQuery('.wpbc_calendar_legend_items').removeClass('hidden_items');
1928 } else {
1929 jQuery('.wpbc_calendar_legend_items').addClass('hidden_items');
1930 }
1931 } ); ";
1932 // Thank you Message or Page
1933 $js_script .= "
1934 if ( jQuery('#type_of_thank_you_message_message').is(':checked') ) {
1935 jQuery('.wpbc_calendar_thank_you_page').addClass('hidden_items');
1936 }
1937 if ( jQuery('#type_of_thank_you_message_page').is(':checked') ) {
1938 jQuery('.wpbc_calendar_thank_you_message').addClass('hidden_items');
1939 }
1940 ";
1941 $js_script .= " jQuery('input[name=\"set_gen_booking_type_of_thank_you_message\"]').on( 'change', function(){
1942 if ( jQuery('#type_of_thank_you_message_message').is(':checked') ) {
1943 jQuery('.wpbc_calendar_thank_you_message').removeClass('hidden_items');
1944 jQuery('.wpbc_calendar_thank_you_page').addClass('hidden_items');
1945 } else {
1946 jQuery('.wpbc_calendar_thank_you_message').addClass('hidden_items');
1947 jQuery('.wpbc_calendar_thank_you_page').removeClass('hidden_items');
1948 }
1949 } ); ";
1950
1951 // Default calendar view mode (Booking Listing) - set active / inctive options depend from resource selection.
1952 $js_script .= " jQuery('#set_gen_booking_view_days_num').on( 'focus', function(){
1953 if ( jQuery('#set_gen_booking_default_booking_resource').length > 0 ) {
1954 jQuery('#set_gen_booking_default_booking_resource').on('change', function() {
1955 jQuery('#set_gen_booking_view_days_num option:eq(2)').prop('selected', true);
1956 });
1957 if ( jQuery('#set_gen_booking_default_booking_resource').val() == '' ) {
1958 jQuery('#set_gen_booking_view_days_num option:eq(0)').prop('disabled', false);
1959 jQuery('#set_gen_booking_view_days_num option:eq(1)').prop('disabled', false);
1960 jQuery('#set_gen_booking_view_days_num option:eq(2)').prop('disabled', false);
1961 jQuery('#set_gen_booking_view_days_num option:eq(3)').prop('disabled', false);
1962 jQuery('#set_gen_booking_view_days_num option:eq(4)').prop('disabled', true);
1963 jQuery('#set_gen_booking_view_days_num option:eq(5)').prop('disabled', true);
1964 } else {
1965 jQuery('#set_gen_booking_view_days_num option:eq(0)').prop('disabled', true);
1966 jQuery('#set_gen_booking_view_days_num option:eq(1)').prop('disabled', true);
1967 jQuery('#set_gen_booking_view_days_num option:eq(2)').prop('disabled', false);
1968 jQuery('#set_gen_booking_view_days_num option:eq(3)').prop('disabled', true);
1969 jQuery('#set_gen_booking_view_days_num option:eq(4)').prop('disabled', false);
1970 jQuery('#set_gen_booking_view_days_num option:eq(5)').prop('disabled', false);
1971 }
1972 }
1973 } ); ";
1974
1975 ////////////////////////////////////////////////////////////////////////
1976 // Set correct value for dates format, depend on from selection of radio buttons
1977 $booking_date_format = esc_js( get_bk_option( 'booking_date_format') ); // FixIn: 10.6.1.2.
1978 // On initial Load set correct text value and correct radio button
1979 $js_script .= "
1980 // Select by default Custom value, later check all other predefined values
1981 jQuery( '#date_format_selection_custom' ).prop('checked', true);
1982
1983 jQuery('input[name=\"set_gen_booking_date_format_selection\"]').each(function() {
1984 var radio_button_value = jQuery( this ).val()
1985 var encodedStr = radio_button_value.replace(/[\u00A0-\u9999<>\&]/gim, function(i) {
1986 return '&#'+i.charCodeAt(0)+';';
1987 });
1988 if ( encodedStr == '". $booking_date_format ."' ) {
1989 jQuery( this ).prop('checked', true);
1990 }
1991 });
1992
1993 jQuery('#set_gen_booking_date_format').val('". $booking_date_format ."');
1994 ";
1995 // On click Radio button "Date Format", - set value in custom Text field
1996 $js_script .= " jQuery('input[name=\"set_gen_booking_date_format_selection\"]').on( 'change', function(){
1997 if ( ( this.checked ) && ( jQuery(this).val() != 'custom' ) ){
1998
1999 jQuery('#set_gen_booking_date_format').val( jQuery(this).val().replace(/[\u00A0-\u9999<>\&]/gim,
2000 function(i) {
2001 return '&#'+i.charCodeAt(0)+';';
2002 })
2003 );
2004 }
2005 } ); ";
2006 // If we edit custom "Date Format" Text field - select Custom Radio button.
2007 $js_script .= " jQuery('#set_gen_booking_date_format').on( 'change', function(){
2008 jQuery( '#date_format_selection_custom' ).prop('checked', true);
2009 } ); ";
2010
2011 ////////////////////////////////////////////////////////////////////////
2012 // Set correct value for Time Format, depend on from selection of radio buttons
2013 $booking_time_format = esc_js( get_bk_option( 'booking_time_format') ); // FixIn: 10.6.1.2.
2014 // Function to load on initial stage of page loading, set correct value of text and select correct radio button.
2015 $js_script .= "
2016 // Select by default Custom value, later check all other predefined values
2017 jQuery( '#time_format_selection_custom' ).prop('checked', true);
2018
2019 jQuery('input[name=\"set_gen_booking_time_format_selection\"]').each(function() {
2020 var radio_button_value = jQuery( this ).val()
2021 var encodedStr = radio_button_value.replace(/[\u00A0-\u9999<>\&]/gim, function(i) {
2022 return '&#'+i.charCodeAt(0)+';';
2023 });
2024 if ( encodedStr == '". $booking_time_format ."' ) {
2025 jQuery( this ).prop('checked', true);
2026 }
2027 });
2028
2029 jQuery('#set_gen_booking_time_format').val('". $booking_time_format ."');
2030 ";
2031 // On click Radio button "Time Format", - set value in custom Text field
2032 $js_script .= " jQuery('input[name=\"set_gen_booking_time_format_selection\"]').on( 'change', function(){
2033 if ( ( this.checked ) && ( jQuery(this).val() != 'custom' ) ){
2034
2035 jQuery('#set_gen_booking_time_format').val( jQuery(this).val().replace(/[\u00A0-\u9999<>\&]/gim,
2036 function(i) {
2037 return '&#'+i.charCodeAt(0)+';';
2038 })
2039 );
2040 }
2041 } ); ";
2042 // If we edit custom "Date Format" Text field - select Custom Radio button.
2043 $js_script .= " jQuery('#set_gen_booking_time_format').on( 'change', function(){
2044 jQuery( '#time_format_selection_custom' ).prop('checked', true);
2045 } ); ";
2046
2047 ////////////////////////////////////////////////////////////////////////
2048 // Advanced section
2049 ////////////////////////////////////////////////////////////////////////
2050
2051 // Click on "Always available "
2052 $js_script .= " jQuery('#set_gen_booking_is_days_always_available').on( 'change', function(){
2053 if ( this.checked ) {
2054 var answer = confirm('"
2055 . esc_js( __( 'Warning', 'booking' ) ) . '! '
2056 . esc_js( __( 'You allow unlimited number of bookings per same dates, its can be a reason of double bookings on the same date. Do you really want to do this?', 'booking' ) )
2057 . "' );
2058 if ( answer) {
2059 this.checked = true;
2060 jQuery('#set_gen_booking_quantity_control').prop('checked', false ).trigger('change');
2061 jQuery('#set_gen_booking_is_show_pending_days_as_available').prop('checked', false );
2062 jQuery('.wpbc_pending_days_as_available_sub_settings').addClass('hidden_items');
2063 } else {
2064 this.checked = false;
2065 }
2066 }
2067 } ); ";
2068
2069 // FixIn: 8.3.2.2.
2070 if ( ! class_exists('wpdev_bk_biz_l') ) {
2071 // Click on "Use pending days as available"
2072 $js_script .= " jQuery('#set_gen_booking_is_show_pending_days_as_available').on( 'change', function(){
2073 if ( this.checked ) {
2074 jQuery('#set_gen_booking_is_days_always_available').prop('checked', false );
2075 } else {
2076
2077 }
2078 } ); ";
2079 }
2080
2081 // Click on Show Advanced JavaScript section link
2082 $js_script .= " jQuery('#wpbc_show_advanced_section_link_show').on( 'click', function(){
2083 jQuery('#wpbc_show_advanced_section_link_show').toggle(200);
2084 jQuery('#wpbc_show_advanced_section_link_hide').animate( {opacity: 1}, 200 ).toggle(200);
2085 jQuery('.wpbc_advanced_js_loading_settings').removeClass('hidden_items');
2086
2087 if ( ! jQuery('#set_gen_booking_is_load_js_css_on_specific_pages').is(':checked') ) {
2088 jQuery('.wpbc_is_load_js_css_on_specific_pages').addClass('hidden_items');
2089 }
2090 } ); ";
2091 $js_script .= " jQuery('#wpbc_show_advanced_section_link_hide').on( 'click', function(){
2092 jQuery('#wpbc_show_advanced_section_link_hide').toggle(200);
2093 jQuery('#wpbc_show_advanced_section_link_show').animate( {opacity: 1}, 200 ).toggle(200);
2094 jQuery('.wpbc_advanced_js_loading_settings').addClass('hidden_items');
2095 } ); ";
2096 $js_script .= " jQuery('#set_gen_booking_is_load_js_css_on_specific_pages').on( 'change', function(){
2097 if ( this.checked ) {
2098 var answer = confirm('"
2099 . esc_js( __( 'Warning', 'booking' ) ) . '! '
2100 . esc_js( __( 'You are need to be sure what you are doing. You are disable of loading some JavaScripts Do you really want to do this?', 'booking' ) )
2101 . "' );
2102 if ( answer) {
2103 this.checked = true;
2104 jQuery('.wpbc_is_load_js_css_on_specific_pages').removeClass('hidden_items');
2105 } else {
2106 this.checked = false;
2107 }
2108 } else {
2109 jQuery('.wpbc_is_load_js_css_on_specific_pages').addClass('hidden_items');
2110 }
2111 } );
2112 if ( ! jQuery('#set_gen_booking_is_load_js_css_on_specific_pages').is(':checked') ) {
2113 jQuery('.wpbc_is_load_js_css_on_specific_pages').addClass('hidden_items');
2114 }
2115
2116 ";
2117
2118
2119 // Click on Powered by links
2120 $js_script .= " jQuery('#wpbc_powered_by_link_show').on( 'click', function(){
2121 jQuery('#wpbc_powered_by_link_show').toggle(200);
2122 jQuery('#wpbc_powered_by_link_hide').animate( {opacity: 1}, 200 ).toggle(200);
2123 jQuery('.wpbc_is_show_powered_by_notice').removeClass('hidden_items');
2124 } ); ";
2125 $js_script .= " jQuery('#wpbc_powered_by_link_hide').on( 'click', function(){
2126 jQuery('#wpbc_powered_by_link_hide').toggle(200);
2127 jQuery('#wpbc_powered_by_link_show').animate( {opacity: 1}, 200 ).toggle(200);
2128 jQuery('.wpbc_is_show_powered_by_notice').addClass('hidden_items');
2129 } ); ";
2130
2131
2132 // Show confirmation window, if user activate this checkbox
2133 $js_script .= " jQuery('#set_gen_booking_is_delete_if_deactive').on( 'change', function(){
2134 if ( this.checked ) {
2135 var answer = confirm('"
2136 . esc_js( __( 'Warning', 'booking' ) ) . '! '
2137 . esc_js( __( 'If you check this option, all booking data will be deleted when you uninstall this plugin. Do you really want to do this?', 'booking' ) )
2138 . "' );
2139 if ( answer) {
2140 this.checked = true;
2141 } else {
2142 this.checked = false;
2143 }
2144 }
2145 } );
2146 ";
2147
2148
2149 // Select specific Time Picker skin, depending from selection of Calendar skin // FixIn: 8.7.11.10.
2150 $js_script .= " jQuery('#set_gen_booking_skin').on( 'change', function(){
2151
2152 var wpbc_selected_skin = jQuery('select[name=\"set_gen_booking_skin\"] option:selected').val();
2153 var wpbc_cal_skin_arr = [
2154 '/css/skins/black-2.css',
2155 '/css/skins/black.css',
2156 '/css/skins/multidays.css',
2157 '/css/skins/premium-black.css',
2158 '/css/skins/premium-light.css',
2159 '/css/skins/premium-marine.css',
2160 '/css/skins/premium-steel.css',
2161 '/css/skins/standard.css',
2162 '/css/skins/traditional-light.css',
2163 '/css/skins/traditional.css',
2164 '/css/skins/green-01.css'
2165 ];
2166 var wpbc_time_skin_arr = [
2167 '/css/time_picker_skins/black.css',
2168 '/css/time_picker_skins/black.css',
2169 '/css/time_picker_skins/green.css',
2170 '/css/time_picker_skins/black.css',
2171 '/css/time_picker_skins/light__24_8.css',
2172 '/css/time_picker_skins/marine.css',
2173 '/css/time_picker_skins/light__24_8.css',
2174 '/css/time_picker_skins/blue.css',
2175 '/css/time_picker_skins/orange.css',
2176 '/css/time_picker_skins/light__24_8.css',
2177 '/css/time_picker_skins/light__24_8.css'
2178 ];
2179 if ( wpbc_cal_skin_arr.indexOf( wpbc_selected_skin ) >= 0 ) {
2180 jQuery( '#set_gen_booking_timeslot_picker_skin' ).find( 'option' ).prop( 'selected', false );
2181 jQuery( '#set_gen_booking_timeslot_picker_skin' ).find( 'option[value=\"'+ wpbc_time_skin_arr[ wpbc_cal_skin_arr.indexOf( wpbc_selected_skin ) ] +'\"]' ).prop( 'selected', true );
2182 }
2183
2184 } ); ";
2185
2186 // If selected Dark theme then select Dark calendar skin, as well.
2187 $js_script .= " jQuery('#set_gen_booking_form_theme').on( 'change', function(){
2188 var wpbc_selected_theme = jQuery('select[name=\"set_gen_booking_form_theme\"] option:selected').val();
2189 var wpbc_cal_dark_skin_path = '/css/skins/24_9__dark_1.css';
2190 if ( 'wpbc_theme_dark_1' === wpbc_selected_theme ) {
2191 jQuery( '#set_gen_booking_skin' ).find( 'option' ).prop( 'selected', false );
2192 jQuery( '#set_gen_booking_skin' ).find( 'option[value=\"'+ wpbc_cal_dark_skin_path +'\"]' ).prop( 'selected', true ).trigger('change');
2193 }
2194 var wpbc_cal_light_skin_path = '/css/skins/24_9__light_square_1.css';
2195 if ( '' === wpbc_selected_theme ) {
2196 jQuery( '#set_gen_booking_skin' ).find( 'option' ).prop( 'selected', false );
2197 jQuery( '#set_gen_booking_skin' ).find( 'option[value=\"'+ wpbc_cal_light_skin_path +'\"]' ).prop( 'selected', true ).trigger('change');
2198 }
2199
2200 } ); ";
2201
2202
2203 // ============================================================================================================= // FixIn: 10.1.5.4.
2204 // 'Dates selection' - some options hide or show
2205 // =============================================================================================================
2206
2207 // Initial Hiding some Sections in settings
2208 $js_script .= " function wpbc_check_showing_range_days_selection_sections() {
2209 // Single selected
2210 if ( jQuery('#type_of_day_selections_single').is(':checked') ) {
2211 jQuery('.wpbc_recurrent_check_in_out_time_slots').addClass('hidden_items'); // Hide Reccurent, Check in/out Sections
2212
2213 jQuery('#set_gen_booking_last_checkout_day_available').prop('checked', false); // Uncheck Recurrent
2214
2215 jQuery('#set_gen_booking_recurrent_time').prop('checked', false); // Uncheck Reccurent
2216 jQuery('#set_gen_booking_range_selection_time_is_active').prop('checked', false); // and Check In/Out
2217
2218 jQuery('.wpbc_range_days_selection').addClass('hidden_items'); // Hide Range section
2219 } // Multiple selected
2220 if ( jQuery('#type_of_day_selections_multiple').is(':checked') ) {
2221 jQuery('.wpbc_recurrent_check_in_out_time_slots').removeClass('hidden_items'); // Show Reccurent, Check in/out Sections
2222
2223 jQuery('.wpbc_range_days_selection').addClass('hidden_items'); // Hide Range section
2224 }
2225 // Range selected
2226 if ( jQuery('#type_of_day_selections_range').is(':checked') ) {
2227
2228 jQuery('.wpbc_recurrent_check_in_out_time_slots').removeClass('hidden_items'); // Show Reccurent, Check in/out Sections
2229
2230 jQuery('.wpbc_range_days_selection').removeClass('hidden_items'); // Show Range section
2231 jQuery('.wpbc_tr_set_gen_booking_range_start_day_week fieldset').removeClass('hidden_items');
2232 jQuery('.wpbc_tr_set_gen_booking_range_start_day_dynamic_week fieldset').removeClass('hidden_items');
2233
2234 // Fixed selected
2235 if ( jQuery('#range_selection_type_fixed').is(':checked') ) {
2236 jQuery('.wpbc_range_dynamic_selection').addClass('hidden_items');
2237 // Any Week Days selected
2238 if ( jQuery('#range_fixed_start_day_any_day').is(':checked') ) {
2239 jQuery('.wpbc_tr_set_gen_booking_range_start_day_week fieldset').addClass('hidden_items');
2240 }
2241 }
2242 // Dynamic selected
2243 if ( jQuery('#range_selection_type_dynamic').is(':checked') ) {
2244 jQuery('.wpbc_range_fixed_selection').addClass('hidden_items');
2245 // Any Week Days selected
2246 if ( jQuery('#range_dynamic_start_day_any_day').is(':checked') ) {
2247 jQuery('.wpbc_tr_set_gen_booking_range_start_day_dynamic_week fieldset').addClass('hidden_items');
2248 }
2249 }
2250 }
2251
2252 if ( jQuery('#set_gen_booking_range_selection_time_is_active').is(':checked') ) { // Check In/Out selected
2253 jQuery('.wpbc_check_in_out_time_slots').removeClass('hidden_items'); // Show Check In/Out times
2254 } else {
2255 jQuery('.wpbc_check_in_out_time_slots').addClass('hidden_items'); // Hide Check In/Out times
2256 }
2257 }
2258 wpbc_check_showing_range_days_selection_sections(); // Run first time to init
2259 ";
2260
2261 // Hiding or showing section based on User Clicks in settings
2262 $list_of_id_to_hook = array(
2263 '#type_of_day_selections_single'
2264 , '#type_of_day_selections_multiple'
2265 , '#type_of_day_selections_range'
2266 , '#range_selection_type_fixed'
2267 , '#range_selection_type_dynamic'
2268 , '#range_fixed_start_day_specific_day'
2269 , '#range_fixed_start_day_any_day'
2270 , '#range_dynamic_start_day_specific_day'
2271 , '#range_dynamic_start_day_any_day'
2272 );
2273 $list_of_id_to_hook = implode( ',', $list_of_id_to_hook );
2274
2275 // Click on "Days Selections", "Type of range", "Start Week days" checkboxes or radioboxes, show/hide sections.
2276 $js_script .= " jQuery('{$list_of_id_to_hook}').on( 'change', function(){
2277 wpbc_check_showing_range_days_selection_sections();
2278 } ); ";
2279
2280 // Click on "Recurrent Time" - then Uncheck "Check In/Out" and hide show sections.
2281 $js_script .= " jQuery('#set_gen_booking_recurrent_time').on( 'change', function(){
2282 if ( this.checked ) {
2283 jQuery('#set_gen_booking_range_selection_time_is_active').prop('checked', false);
2284 }
2285 wpbc_check_showing_range_days_selection_sections();
2286 } ); ";
2287
2288 // Click on "Check In/Out" - then Uncheck "Recurrent Time" and hide show sections.
2289 $js_script .= " jQuery('#set_gen_booking_range_selection_time_is_active').on( 'change', function(){
2290 if ( this.checked ) {
2291 jQuery('#set_gen_booking_recurrent_time').prop('checked', false);
2292 jQuery('#set_gen_booking_last_checkout_day_available').prop('checked', false); // Uncheck Reccurent
2293 }
2294 wpbc_check_showing_range_days_selection_sections();
2295 } ); ";
2296
2297 // Confirmation Section configuration
2298 $js_script .= "
2299 if ( ! jQuery('#set_gen_booking_confirmation__personal_info__header_enabled').is(':checked') ) {
2300 jQuery('.wpbc_booking_confirmation__personal_info__field').addClass('wpbc_field_disabled');
2301 jQuery('.wpbc_booking_confirmation__personal_info__fields').addClass('hidden_items');
2302 }
2303 ";
2304 $js_script .= " jQuery('#set_gen_booking_confirmation__personal_info__header_enabled').on( 'change', function(){
2305 if ( ! this.checked ) {
2306 jQuery('.wpbc_booking_confirmation__personal_info__field').addClass('wpbc_field_disabled');
2307 jQuery('.wpbc_booking_confirmation__personal_info__fields').addClass('hidden_items');
2308 } else {
2309 jQuery('.wpbc_booking_confirmation__personal_info__field').removeClass('wpbc_field_disabled');
2310 jQuery('.wpbc_booking_confirmation__personal_info__fields').removeClass('hidden_items');
2311 }
2312 } ); ";
2313 $js_script .= "
2314 if ( ! jQuery('#set_gen_booking_confirmation__booking_details__header_enabled').is(':checked') ) {
2315 jQuery('.wpbc_booking_confirmation__booking_details__field').addClass('wpbc_field_disabled');
2316 jQuery('.wpbc_booking_confirmation__booking_details__fields').addClass('hidden_items');
2317 }
2318 ";
2319 $js_script .= " jQuery('#set_gen_booking_confirmation__booking_details__header_enabled').on( 'change', function(){
2320 if ( ! this.checked ) {
2321 jQuery('.wpbc_booking_confirmation__booking_details__field').addClass('wpbc_field_disabled');
2322 jQuery('.wpbc_booking_confirmation__booking_details__fields').addClass('hidden_items');
2323 } else {
2324 jQuery('.wpbc_booking_confirmation__booking_details__field').removeClass('wpbc_field_disabled');
2325 jQuery('.wpbc_booking_confirmation__booking_details__fields').removeClass('hidden_items');
2326 }
2327 } ); ";
2328
2329 $js_script .= "
2330 if ( ! jQuery('#set_gen_booking_confirmation_header_enabled').is(':checked') ) {
2331 jQuery('.wpbc_booking_confirmation_header__field').addClass('wpbc_field_disabled');
2332 }
2333 ";
2334 $js_script .= " jQuery('#set_gen_booking_confirmation_header_enabled').on( 'change', function(){
2335 if ( ! this.checked ) {
2336 jQuery('.wpbc_booking_confirmation_header__field').addClass('wpbc_field_disabled');
2337 } else {
2338 jQuery('.wpbc_booking_confirmation_header__field').removeClass('wpbc_field_disabled');
2339 }
2340 } ); ";
2341
2342
2343 // Enqueue JS to the footer of the page
2344 wpbc_enqueue_js( $js_script );
2345 }
2346
2347 }
2348
2349
2350 /**
2351 * Override VALIDATED fields BEFORE saving to DB
2352 * Description:
2353 * Check "Thank you page" URL
2354 *
2355 * @param array $validated_fields
2356 */
2357 function wpbc_settings_validate_fields_before_saving__all( $validated_fields ) {
2358
2359
2360 $validated_fields['booking_thank_you_page_URL'] = wpbc_make_link_relative( $validated_fields['booking_thank_you_page_URL'] );
2361
2362 unset( $validated_fields[ 'booking_date_format_selection' ] ); // We do not need to this field, because saving to DB only: "date_format" field
2363 unset( $validated_fields[ 'booking_time_format_selection' ] ); // We do not need to this field, because saving to DB only: "time_format" field
2364
2365 // Unset promote fields
2366 foreach ( $validated_fields as $field_name => $field_value ) {
2367 if ( strpos( $field_name, '__promote_upgrade' ) > 0 ) {
2368 unset( $validated_fields[ $field_name ] );
2369 }
2370 }
2371
2372 return $validated_fields;
2373 }
2374 add_filter( 'wpbc_settings_validate_fields_before_saving', 'wpbc_settings_validate_fields_before_saving__all', 10, 1 ); // Hook for validated fields.
2375
2376
2377 /**
2378 * Load Code mirror highlighter for Booking Confirmation at the WP Booking Calendar > Settings General page in "Booking Confirmation" section
2379 *
2380 * @param $page_name
2381 *
2382 * @return false|void
2383 */
2384 function wpbc_hook_settings_page_footer__define_code_mirror( $page_name ) {
2385
2386 if ( 'general_settings' != $page_name ) {
2387 return false;
2388 }
2389
2390 $is_use_code_mirror = ( ( function_exists( 'wpbc_codemirror') ) && ( is_user_logged_in() && 'false' !== (wp_get_current_user()->syntax_highlighting) ) ) ? true : false; // FixIn: 8.4.7.18.
2391
2392 if ( $is_use_code_mirror ) {
2393
2394 wpbc_codemirror()->set_codemirror( array(
2395 'textarea_id' => '#set_gen_booking_confirmation__personal_info__content'
2396 , 'preview_id' => '#wpbc_add_form_html_preview'
2397 ) );
2398 wpbc_codemirror()->set_codemirror( array(
2399 'textarea_id' => '#set_gen_booking_confirmation__booking_details__content'
2400 // , 'preview_id' => '#wpbc_add_form_html_preview'
2401 ) );
2402
2403 }
2404 }
2405 //add_action( 'wpbc_hook_settings_page_footer', 'wpbc_hook_settings_page_footer__define_code_mirror' );