PluginProbe
Booking Calendar / 11.4
Booking Calendar v11.4
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 10.11.4 10.12.0 All 200 releases
booking / core / admin / api-settings.php

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

2,038 lines 135.7 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
53 // Number of months //////////////////////////////////////////////////
54 $months_options = array();
55 for ($mm = 1; $mm < 12; $mm++) { $months_options[ $mm . 'm' ] = $mm . ' ' . __('month(s)' ,'booking'); }
56 $months_options[ 18 . 'm' ] = '18 ' . __('month(s)' ,'booking'); // FixIn: 10.0.0.11.
57 for ($yy = 1; $yy < 11; $yy++) { $months_options[ $yy . 'y' ] = $yy . ' ' . __('year(s)' ,'booking'); }
58
59 $this->fields['booking_max_monthes_in_calendar'] = array(
60 'type' => 'select'
61 , 'default' => $default_options_values['booking_max_monthes_in_calendar'] // '1y'
62 , 'title' => __('Number of months to scroll', 'booking')
63 , 'description' => __('Select the maximum number of months to show (scroll)' ,'booking')
64 , 'options' => $months_options
65 , 'group' => 'calendar'
66 );
67
68
69 // Start Day of the week /////////////////////////////////////////////
70 $this->fields['booking_start_day_weeek'] = array(
71 'type' => 'select'
72 , 'default' => $default_options_values['booking_start_day_weeek'] // '2'
73 // , 'value' => false
74 , 'title' => __('Start Day of the week', 'booking')
75 , 'description' => __('Select your start day of the week' ,'booking')
76 , 'options' => array(
77 '0' => __('Sunday' ,'booking')
78 , '1' => __('Monday' ,'booking')
79 , '2' => __('Tuesday' ,'booking')
80 , '3' => __('Wednesday' ,'booking')
81 , '4' => __('Thursday' ,'booking')
82 , '5' => __('Friday' ,'booking')
83 , '6' => __('Saturday' ,'booking')
84 )
85 , 'group' => 'calendar'
86 );
87
88 $this->fields['booking_calendar_allow_several_months_on_mobile'] = array(
89 'type' => 'checkbox'
90 , 'default' => $default_options_values['booking_calendar_allow_several_months_on_mobile'] //'Off'
91 , 'title' => __('Allow multiple months to be shown on mobile' ,'booking') //__('Use time selections as recurrent time slots' ,'booking')
92 , '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')
93 //, 'description' => ''
94 , 'group' => 'calendar'
95 , 'tr_class' => ''
96 );
97
98 // Divider ///////////////////////////////////////////////////////////
99 $this->fields['hr_calendar_after_week_day'] = array( 'type' => 'hr', 'group' => 'calendar' );
100
101
102
103 $field_options = array(
104 'single' => array(
105 'title' => __('Single day' ,'booking')
106 , 'attr' => array(
107 'id' => 'type_of_day_selections_single'
108 )
109 )
110 , 'multiple' => array(
111 'title' => __('Multiple days' ,'booking')
112 , 'attr' => array(
113 'id' => 'type_of_day_selections_multiple'
114 )
115 )
116 );
117 // Days ///////////////////////////////////////////////////////////
118 $this->fields['booking_type_of_day_selections'] = array(
119 'type' => 'radio'
120 , 'default' => $default_options_values['booking_type_of_day_selections'] // 'multiple'
121 , 'title' => __('Days selection in calendar', 'booking')
122 , 'description' => ''
123 , 'options' => $field_options
124 , 'group' => 'calendar'
125 );
126
127 ////////////////////////////////////////////////////////////////////////
128
129 $this->fields = apply_filters( 'wpbc_settings_calendar_range_days_selection', $this->fields, $default_options_values ); // Range days
130
131 // FixIn: 10.1.5.4.
132 //$this->fields = apply_filters( 'wpbc_settings_calendar_recurrent_time_slots', $this->fields, $default_options_values ); // Recurent Times
133 /**
134 * Recurrent time - Settings ( Calendar ) page
135 */
136 $this->fields['hr_calendar_before_recurrent_time'] = array( 'type' => 'hr', 'group' => 'calendar' , 'tr_class' => 'wpbc_recurrent_check_in_out_time_slots');
137 $this->fields['booking_recurrent_time'] = array(
138 'type' => 'checkbox'
139 , 'default' => $default_options_values['booking_recurrent_time'] //'Off'
140 , 'title' => __('Use selected times for each booking date' ,'booking') //__('Use time selections as recurrent time slots' ,'booking')
141 , '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')
142 //, 'description' => ''
143 , 'group' => 'calendar'
144 , 'tr_class' => 'wpbc_recurrent_check_in_out_time_slots'
145 );
146
147 $this->fields = apply_filters( 'wpbc_settings_calendar_check_in_out_times', $this->fields, $default_options_values ); // Check In/Out Times
148
149
150 // </editor-fold>
151
152
153 // <editor-fold defaultstate="collapsed" desc=" Dates Tooltips " >
154 //FixIn: 9.5.0.2.2
155 $this->fields['booking_disable_timeslots_in_tooltip'] = array(
156 'type' => 'checkbox'
157 , 'default' => $default_options_values['booking_disable_timeslots_in_tooltip'] //'Off'
158 , 'title' => __('Disable times in tooltips' ,'booking')
159 , 'label' => __('Disable show booked times in tooltip, when mouse over specific day in calendar' ,'booking')
160 , 'description' => ''
161 , 'group' => 'days_tooltips'
162 , 'tr_class' => ''
163 );
164
165 // FixIn: 9.4.3.1.
166 $this->fields['booking_highlight_timeslot_word'] = array(
167 'type' => 'text'
168 , 'default' => $default_options_values['booking_highlight_timeslot_word'] //__('Booked Times:' ,'booking')
169 , 'placeholder' => __('Booked Times:' ,'booking')
170 , 'title' => __('Title of booked timeslot(s)' ,'booking')
171 /* translators: 1: ... */
172 , 'description' => sprintf( __( 'Type your %1$stitle%2$s, what will show in mouseover tooltip near booked timeslot(s)', 'booking' ),'<b>','</b>')
173 //,'description_tag' => 'span'
174 , 'class' => 'regular-text'
175 , 'group' => 'days_tooltips'
176 , 'tr_class' => 'wpbc_booking_timeslots_in_tooltip wpbc_sub_settings_grayed' //FixIn: 9.5.0.2.2
177 );
178 $this->fields = apply_filters( 'wpbc_settings_calendar_showing_info_in_cal', $this->fields, $default_options_values ); // Availability in calendar...
179 $this->fields = apply_filters( 'wpbc_settings_calendar_show_booking_details', $this->fields, $default_options_values ); // Show Booking details in mouse over tooltips
180 $this->fields = apply_filters( 'wpbc_settings_calendar_showing_cost_in_tooltip', $this->fields, $default_options_values ); // Showing Cost,
181
182 // </editor-fold>
183
184
185 // <editor-fold defaultstate="collapsed" desc=" L e g e n d I t e m s " >
186 // Legend Items ////////////////////////////////////////////////////////
187
188 $this->fields['hr_calendar_before_legend'] = array( 'type' => 'hr', 'group' => 'calendar' );
189
190 $this->fields['booking_is_show_legend'] = array(
191 'type' => 'checkbox'
192 , 'default' => $default_options_values['booking_is_show_legend'] // 'Off'
193 , 'title' => __('Show legend below calendar' ,'booking')
194 , 'label' => __('Check this box to display a legend of dates below the booking calendar.' ,'booking')
195 , 'description' => ''
196 , 'group' => 'calendar'
197 );
198 // Available item
199 $this->fields['booking_legend_is_show_item_available_prefix'] = array(
200 'type' => 'pure_html'
201 , 'group' => 'calendar'
202 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_legend_is_show_item_available
203 wpbc_calendar_legend_items wpbc_sub_settings_grayed">
204 <th scope="row">'.
205 WPBC_Settings_API::label_static( 'set_gen_booking_legend_is_show_item_available'
206 , array( 'title'=> __('Available item' ,'booking'), 'label_css' => '' ) )
207 .'</th>
208 <td><fieldset>'
209 );
210 $this->fields['booking_legend_is_show_item_available'] = array(
211 'type' => 'checkbox'
212 , 'default' => $default_options_values['booking_legend_is_show_item_available'] // 'On'
213 , 'is_new_line' => false
214 , 'group' => 'calendar'
215 , 'only_field' => true
216 );
217 $this->fields['booking_legend_text_for_item_available'] = array(
218 'type' => 'text'
219 , 'default' => $default_options_values['booking_legend_text_for_item_available'] // __('Available' ,'booking')
220 , 'placeholder' => __('Available' ,'booking')
221 , 'css' => '' //'width:8em;'
222 , 'group' => 'calendar'
223 , 'only_field' => true
224 );
225 $this->fields['booking_legend_is_show_item_available_sufix'] = array(
226 'type' => 'pure_html'
227 , 'group' => 'calendar'
228 , 'html' => '<p class="description" style="line-height: 1.7em;margin: 0;">'
229 /* translators: 1: ... */
230 . sprintf( __( 'Activate and type your %1$stitle of available%2$s item in legend', 'booking' ),'<b>','</b>')
231 . '</p>
232 </fieldset>
233 </td>
234 </tr>'
235 );
236 // Pending item
237 $this->fields['booking_legend_is_show_item_pending_prefix'] = array(
238 'type' => 'pure_html'
239 , 'group' => 'calendar'
240 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_legend_is_show_item_pending
241 wpbc_calendar_legend_items wpbc_sub_settings_grayed">
242 <th scope="row">'.
243 WPBC_Settings_API::label_static( 'set_gen_booking_legend_is_show_item_pending'
244 , array( 'title'=> __('Pending item' ,'booking'), 'label_css' => '' ) )
245 .'</th>
246 <td><fieldset>'
247 );
248 $this->fields['booking_legend_is_show_item_pending'] = array(
249 'type' => 'checkbox'
250 , 'default' => $default_options_values['booking_legend_is_show_item_pending'] // 'On'
251 , 'is_new_line' => false
252 , 'group' => 'calendar'
253 , 'only_field' => true
254 );
255 $this->fields['booking_legend_text_for_item_pending'] = array(
256 'type' => 'text'
257 , 'default' => $default_options_values['booking_legend_text_for_item_pending'] // __('Pending' ,'booking')
258 , 'placeholder' => __('Pending' ,'booking')
259 , 'css' => '' //'width:8em;'
260 , 'group' => 'calendar'
261 , 'only_field' => true
262 );
263 $this->fields['booking_legend_is_show_item_pending_sufix'] = array(
264 'type' => 'pure_html'
265 , 'group' => 'calendar'
266 , 'html' => '<p class="description" style="line-height: 1.7em;margin: 0;">'
267 /* translators: 1: ... */
268 . sprintf( __( 'Activate and type your %1$stitle of pending%2$s item in legend', 'booking' ),'<b>','</b>')
269 . '</p>
270 </fieldset>
271 </td>
272 </tr>'
273 );
274 // Approved item
275 $this->fields['booking_legend_is_show_item_approved_prefix'] = array(
276 'type' => 'pure_html'
277 , 'group' => 'calendar'
278 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_legend_is_show_item_approved
279 wpbc_calendar_legend_items wpbc_sub_settings_grayed">
280 <th scope="row">'.
281 WPBC_Settings_API::label_static( 'set_gen_booking_legend_is_show_item_approved'
282 , array( 'title'=> __('Approved item' ,'booking'), 'label_css' => '' ) )
283 .'</th>
284 <td><fieldset>'
285 );
286 $this->fields['booking_legend_is_show_item_approved'] = array(
287 'type' => 'checkbox'
288 , 'default' => $default_options_values['booking_legend_is_show_item_approved'] // 'On'
289 , 'is_new_line' => false
290 , 'group' => 'calendar'
291 , 'only_field' => true
292 );
293 $this->fields['booking_legend_text_for_item_approved'] = array(
294 'type' => 'text'
295 , 'default' => $default_options_values['booking_legend_text_for_item_approved'] //__('Booked' ,'booking')
296 , 'placeholder' => __('Booked' ,'booking')
297 , 'css' => '' //'width:8em;'
298 , 'group' => 'calendar'
299 , 'only_field' => true
300 );
301 $this->fields['booking_legend_is_show_item_approved_sufix'] = array(
302 'type' => 'pure_html'
303 , 'group' => 'calendar'
304 , 'html' => '<p class="description" style="line-height: 1.7em;margin: 0;">'
305 /* translators: 1: ... */
306 . sprintf( __( 'Activate and type your %1$stitle of approved%2$s item in legend', 'booking' ),'<b>','</b>')
307 . '</p>
308 </fieldset>
309 </td>
310 </tr>'
311 );
312
313 //FixIn: 10.1.5.5 if ( class_exists('wpdev_bk_biz_s') ) {
314
315 // Partially booked item
316 $this->fields['booking_legend_is_show_item_partially_prefix'] = array(
317 'type' => 'pure_html'
318 , 'group' => 'calendar'
319 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_legend_is_show_item_partially
320 wpbc_calendar_legend_items wpbc_sub_settings_grayed">
321 <th scope="row">'.
322 WPBC_Settings_API::label_static( 'set_gen_booking_legend_is_show_item_partially'
323 , array( 'title'=> __('Partially booked item' ,'booking'), 'label_css' => '' ) )
324 .'</th>
325 <td><fieldset>'
326 );
327 $this->fields['booking_legend_is_show_item_partially'] = array(
328 'type' => 'checkbox'
329 , 'default' => $default_options_values['booking_legend_is_show_item_partially'] //'On'
330 , 'is_new_line' => false
331 , 'group' => 'calendar'
332 , 'only_field' => true
333 );
334 $this->fields['booking_legend_text_for_item_partially'] = array(
335 'type' => 'text'
336 , 'default' => $default_options_values['booking_legend_text_for_item_partially'] //__('Partially booked' ,'booking')
337 , 'placeholder' => __('Partially booked' ,'booking')
338 , 'css' => '' //'width:8em;'
339 , 'group' => 'calendar'
340 , 'only_field' => true
341 );
342 $this->fields['booking_legend_is_show_item_partially_sufix'] = array(
343 'type' => 'pure_html'
344 , 'group' => 'calendar'
345 , 'html' => '<p class="description" style="line-height: 1.7em;margin: 0;">'
346 /* translators: 1: ... */
347 . sprintf( __( 'Activate and type your %1$stitle of partially booked%2$s item in legend', 'booking' ),'<b>','</b>')
348 . '</p>'
349 . '<p class="description" style="line-height: 1.7em;margin: 0;"><strong>' . esc_html__('Note' ,'booking') .':</strong> '
350 . sprintf(__('Partially booked item - day, which is booked for the specific time-slot(s).' ,'booking'),'<b>','</b>')
351 . '</p>'
352 .'</fieldset>
353 </td>
354 </tr>'
355 );
356 //}
357
358
359 // Unavailable Legend Item // FixIn: 9.9.0.5.
360 $this->fields['booking_legend_is_show_item_unavailable_prefix'] = array(
361 'type' => 'pure_html'
362 , 'group' => 'calendar'
363 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_legend_is_show_item_unavailable
364 wpbc_calendar_legend_items wpbc_sub_settings_grayed">
365 <th scope="row">'.
366 WPBC_Settings_API::label_static( 'set_gen_booking_legend_is_show_item_unavailable'
367 , array( 'title'=> __('Unavailable item' ,'booking'), 'label_css' => '' ) )
368 .'</th>
369 <td><fieldset>'
370 );
371 $this->fields['booking_legend_is_show_item_unavailable'] = array(
372 'type' => 'checkbox'
373 , 'default' => $default_options_values['booking_legend_is_show_item_unavailable'] // 'On'
374 , 'is_new_line' => false
375 , 'group' => 'calendar'
376 , 'only_field' => true
377 );
378 $this->fields['booking_legend_text_for_item_unavailable'] = array(
379 'type' => 'text'
380 , 'default' => $default_options_values['booking_legend_text_for_item_unavailable'] //__('Booked' ,'booking')
381 , 'placeholder' => __('Unavailable' ,'booking')
382 , 'css' => '' //'width:8em;'
383 , 'group' => 'calendar'
384 , 'only_field' => true
385 );
386 $this->fields['booking_legend_is_show_item_unavailable_sufix'] = array(
387 'type' => 'pure_html'
388 , 'group' => 'calendar'
389 , 'html' => '<p class="description" style="line-height: 1.7em;margin: 0;">'
390 /* translators: 1: ... */
391 . sprintf( __( 'Activate and type your %1$stitle of unavailable%2$s item in legend', 'booking' ),'<b>','</b>')
392 . '</p>
393 </fieldset>
394 </td>
395 </tr>'
396 );
397
398
399
400
401 // // Help Section ///////////////////////////////////////////////////////
402 // $this->fields['booking_help_translation_section_after_legend_items'] = array(
403 // 'type' => 'help'
404 // , 'value' => wpbc_get_help_rows_about_config_in_several_languges()
405 // , 'class' => ''
406 // , 'css' => ''
407 // , 'description' => ''
408 // , 'cols' => 2
409 // , 'group' => 'calendar'
410 // , 'tr_class' => 'wpbc_calendar_legend_items wpbc_sub_settings_grayed'
411 // , 'description_tag' => 'span'
412 // );
413 $this->fields['booking_legend_is_show_numbers'] = array(
414 'type' => 'checkbox'
415 , 'default' => $default_options_values['booking_legend_is_show_numbers'] //'On'
416 , 'title' => __('Show date number in legend' ,'booking')
417 , 'label' => sprintf(__('Check this box to display today date number in legend cells. ' ,'booking'),'<b>','</b>')
418 , 'description' => ''
419 , 'tr_class' => 'wpbc_calendar_legend_items wpbc_sub_settings_grayed'
420 , 'group' => 'calendar'
421 );
422 // FixIn: 9.4.3.6.
423 $this->fields['booking_legend_is_vertical'] = array(
424 'type' => 'checkbox'
425 , 'default' => $default_options_values['booking_legend_is_vertical'] //'Off'
426 , 'title' => __('Show legend items in a column' ,'booking')
427 , 'label' => sprintf(__('Check this box to display legend items vertically in a column.' ,'booking'),'<b>','</b>')
428 , 'description' => ''
429 , 'tr_class' => 'wpbc_calendar_legend_items wpbc_sub_settings_grayed'
430 , 'group' => 'calendar'
431 );
432 // </editor-fold>
433
434
435 // <editor-fold defaultstate="collapsed" desc=" A v a i l a b i l i t y " >
436
437 // Unavailable Weekdays /////////////////////////////////////////////
438
439 $this->fields['booking_unavailable_day_html_prefix'] = array(
440 'type' => 'pure_html'
441 , 'group' => 'availability'
442 , 'html' => '<tr valign="top">
443 <th scope="row">
444 <label class="wpbc-form-checkbox" for="'
445 // . esc_attr( 'unavailable_day0' )
446 . '">' . wp_kses_post( __('Unavailable Weekdays' ,'booking') )
447 . '</label>
448 </th>
449 <td><fieldset>'
450 );
451 $this->fields['booking_unavailable_day0'] = array( 'label' => __('Sunday' ,'booking')
452 , 'type' => 'checkbox', 'default' => $default_options_values['booking_unavailable_day0'], 'only_field' => true, 'group' => 'availability', 'is_new_line' => false
453 );
454 $this->fields['booking_unavailable_day1'] = array( 'label' => __('Monday' ,'booking')
455 , 'type' => 'checkbox', 'default' => $default_options_values['booking_unavailable_day1'], 'only_field' => true, 'group' => 'availability', 'is_new_line' => false
456 );
457 $this->fields['booking_unavailable_day2'] = array( 'label' => __('Tuesday' ,'booking')
458 , 'type' => 'checkbox', 'default' => $default_options_values['booking_unavailable_day2'], 'only_field' => true, 'group' => 'availability', 'is_new_line' => false
459 );
460 $this->fields['booking_unavailable_day3'] = array( 'label' => __('Wednesday' ,'booking')
461 , 'type' => 'checkbox', 'default' => $default_options_values['booking_unavailable_day3'], 'only_field' => true, 'group' => 'availability', 'is_new_line' => false
462 );
463 $this->fields['booking_unavailable_day4'] = array( 'label' => __('Thursday' ,'booking')
464 , 'type' => 'checkbox', 'default' => $default_options_values['booking_unavailable_day4'], 'only_field' => true, 'group' => 'availability', 'is_new_line' => false
465 );
466 $this->fields['booking_unavailable_day5'] = array( 'label' => __('Friday' ,'booking')
467 , 'type' => 'checkbox', 'default' => $default_options_values['booking_unavailable_day5'], 'only_field' => true, 'group' => 'availability', 'is_new_line' => false
468 );
469 $this->fields['booking_unavailable_day6'] = array( 'label' => __('Saturday' ,'booking')
470 , 'type' => 'checkbox', 'default' => $default_options_values['booking_unavailable_day6'], 'only_field' => true, 'group' => 'availability', 'is_new_line' => false
471 );
472 $this->fields['booking_unavailable_day_html_sufix'] = array(
473 'type' => 'pure_html'
474 , 'group' => 'availability'
475 , 'html' => ' </fieldset><p class="description">'
476 . __('Select weekdays to be marked as unavailable in calendars. This setting will override all other availability settings.' ,'booking')
477 . '</p>
478 </td>
479 </tr>'
480 );
481
482 // Divider ///////////////////////////////////////////////////////////
483 $this->fields['hr_calendar_after_unavailable_day'] = array( 'type' => 'hr', 'group' => 'availability' );
484
485
486
487 // Unavailable days from today ///////////////////////////////////////
488 $field_options = array();
489
490
491 // FixIn: 10.8.1.4.
492 $field_options[0] = ' - ';
493 foreach ( range( 5, 55 , 5 ) as $extra_num) { // Each 5 minutes
494 $field_options[ $extra_num . 'm' ] = $extra_num . ' ' . __( 'minutes', 'booking' );
495 }
496 $field_options[ '60' . 'm' ] = '1 ' . __( 'hour', 'booking' );
497 foreach ( range( 65, 115 , 5 ) as $extra_num) { // 1 hour + Each 5 minutes
498 $field_options[ $extra_num . 'm' ] = '1 ' . __( 'hour', 'booking' ) . ' ' . ($extra_num - 60 ) . ' ' . __( 'minutes', 'booking' );
499 }
500 foreach ( range( 120, 1380 , 60 ) as $extra_num) { // Each Hour based on minutes
501 $field_options[ $extra_num . 'm' ] = ($extra_num / 60) . ' ' . __( 'hours', 'booking' );
502 }
503
504
505 $field_options[ 1 ] = 1 . ' ' . __( 'day', 'booking' );
506 for ( $ii = 2; $ii < 92; $ii ++ ) {
507 $field_options[ $ii ] = $ii . ' ' . __( 'days', 'booking' );
508 }
509
510
511 $unavailable_from_today_arr = wpbc_get_unavailable_from_today_hints_arr();
512
513 $this->fields['booking_unavailable_days_num_from_today'] = array(
514 'type' => 'select'
515 , 'default' => $default_options_values['booking_unavailable_days_num_from_today'] //'0'
516 , 'title' => __('Unavailable time from current time', 'booking')
517 , 'description' => __('Select an unavailable time interval on the calendar, starting from today\'s current time.' ,'booking')
518 . '<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">'
519 . '<span style="color: #cc3a5f;text-transform: uppercase;">' . esc_html( __( 'Unavailable', 'booking' ) ) . '</span>'
520 . $unavailable_from_today_arr['booking_unavailable_days_num_from_today__hint']
521 .'</code>'
522 , 'options' => $field_options
523 , 'group' => 'availability'
524 );
525
526 // Limit available days from today ///////////////////////////////////
527 $this->fields = apply_filters( 'wpbc_settings_calendar_unavailable_days', $this->fields, $default_options_values );
528
529 $this->fields['booking_unavailable_days_num_from_today__warning'] = array(
530 'type' => 'html',
531 'html' => '<div class="wpbc-settings-notice notice-warning notice-helpful-info">' .
532 '<strong>' . esc_html__('Note' ,'booking') . '!</strong> ' .
533 __( 'These options do not apply in the admin panel. These options apply only on the front-end side.', 'booking' ) .
534 '</div>',
535 'class' => '',
536 'css' => 'margin:0;padding:0;border:0;',
537 'description' => '',
538 'cols' => 1,
539 'group' => 'availability',
540 'tr_class' => '',
541 'description_tag' => 'div',
542 );
543
544
545
546 // Extend unavailable booking dates interval - cleaning //////////////
547 $this->fields = apply_filters( 'wpbc_settings_calendar_extend_unavailable_interval', $this->fields, $default_options_values );
548
549 // </editor-fold>
550
551
552 // <editor-fold defaultstate="collapsed" desc=" B o o k i n g C o n f i r m a t i o n " >
553
554 $field_options = array(
555 'message' => array( 'title' => __('Show booking confirmation at same page' ,'booking'), 'attr' => array( 'id' => 'type_of_thank_you_message_message' ) )
556 , 'page' => array( 'title' => __('Redirect to thank you page' ,'booking'), 'attr' => array( 'id' => 'type_of_thank_you_message_page' ) )
557 );
558 $description_text = '';
559
560 $this->fields['booking_type_of_thank_you_message'] = array(
561 'type' => 'radio'
562 , 'default' => $default_options_values['booking_type_of_thank_you_message'] //'message'
563 , 'title' => __('After booking action:' ,'booking')
564 , 'description' => $description_text
565 , 'options' => $field_options
566 , 'group' => 'booking_confirmation'
567 );
568
569 // $this->fields['booking_title_after_reservation_time'] = array(
570 // 'type' => 'text'
571 // , 'default' => $default_options_values['booking_title_after_reservation_time'] //'7000'
572 // , 'placeholder' => '7000'
573 // , 'title' => __('Time of message showing' ,'booking')
574 // , 'description' => sprintf(__('Set duration of time (milliseconds) to show this message' ,'booking'),'<b>','</b>')
575 // . ' ' . sprintf(__('You can set the value to %s to display the message indefinitely.' ,'booking'),'<b>0</b>') // FixIn: 9.6.2.2.
576 // , 'description_tag' => 'span'
577 // , 'css' => 'width:5em'
578 // , 'group' => 'booking_confirmation'
579 // , 'tr_class' => 'wpbc_calendar_thank_you_message wpbc_calendar_thank_you wpbc_sub_settings_grayed'
580 // );
581 // // Help Section ///////////////////////////////////////////////////////
582 // $this->fields['booking_help_translation_section_after_thank_you_message'] = array(
583 // 'type' => 'help'
584 // , 'value' => wpbc_get_help_rows_about_config_in_several_languges()
585 // , 'class' => ''
586 // , 'css' => ''
587 // , 'description' => ''
588 // , 'cols' => 2
589 // , 'group' => 'booking_confirmation'
590 // , 'tr_class' => 'wpbc_calendar_thank_you_message wpbc_calendar_thank_you wpbc_sub_settings_grayed'
591 // , 'description_tag' => 'span'
592 // );
593
594 // URL of "Thank you page"
595 $this->fields['booking_thank_you_page_URL_prefix'] = array(
596 'type' => 'pure_html'
597 , 'group' => 'booking_confirmation'
598 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_thank_you_page_URL
599 wpbc_calendar_thank_you_page wpbc_calendar_thank_you wpbc_sub_settings_grayed">
600 <th scope="row">'.
601 WPBC_Settings_API::label_static( 'set_gen_booking_thank_you_page_URL'
602 , array( 'title'=> __('Confirmation Page URL' ,'booking'), 'label_css' => '' ) )
603 .'</th>
604 <td><fieldset>' . '<code style="font-size:14px;">' . home_url() . '</code>' // FixIn: 7.0.1.20.
605 );
606 $this->fields['booking_thank_you_page_URL'] = array(
607 'type' => 'text'
608 , 'default' => $default_options_values['booking_thank_you_page_URL'] //'/thank-you'
609 , 'placeholder' => '/thank-you'
610 , 'css' => 'width:75%'
611 , 'group' => 'booking_confirmation'
612 , 'only_field' => true
613 );
614 $this->fields['booking_thank_you_page_URL_sufix'] = array(
615 'type' => 'pure_html'
616 , 'group' => 'booking_confirmation'
617 , 'html' => '<p class="description" style="line-height: 1.7em;margin: 0;">'
618 /* translators: 1: ... */
619 . sprintf( __( 'This page should include the shortcode %s to display booking details and confirmation after a successful booking.', 'booking' )
620 , '<strong>[booking_confirm]</strong>' )
621 . '</p>
622 </fieldset>
623 </td>
624 </tr>'
625 );
626 // </editor-fold>
627
628 // FixIn: 10.2.0.1.
629
630 // <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 == " >
631
632 // -------------------------------------------------------------------------------------------------------------
633 // Message title
634 // -------------------------------------------------------------------------------------------------------------
635 $this->fields['booking_title_after_reservation'] = array(
636 'type' => 'text'
637 , 'default' => $default_options_values['booking_title_after_reservation']
638 , 'placeholder' => ( ! class_exists( 'wpdev_bk_biz_s' ) )
639 ? __( 'Your booking is received. We will confirm it soon. Many thanks!', 'booking' )
640 : __( 'Your booking is received. Please proceed with payment to confirm it. Many thanks!', 'booking' )
641 , 'title' => __( 'Message title', 'booking' )
642 /* translators: 1: ... */
643 , 'description' => ''//sprintf( __( 'Type title of message %1$safter booking has done by user%2$s', 'booking' ),'<b>','</b>')
644 ,'description_tag' => 'p'
645 , 'css' => 'width:100%'
646 , 'rows' => 2
647 , 'group' => 'booking_confirmation'
648 , 'tr_class' => ' '
649 );
650 // -------------------------------------------------------------------------------------------------------------
651 // Header
652 // -------------------------------------------------------------------------------------------------------------
653 $this->fields['booking_confirmation_header_prefix'] = array(
654 'type' => 'pure_html'
655 , 'group' => 'booking_confirmation'
656 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_confirmation_header">
657 <th scope="row">'.
658 WPBC_Settings_API::label_static( 'set_gen_booking_confirmation_header'
659 , array( 'title'=> __('Header' ,'booking'), 'label_css' => '' ) )
660 .'</th>
661 <td><fieldset style="display:flex;flex-flow: row wrap;justify-content: flex-start;align-items: center;">'
662 );
663 $this->fields['booking_confirmation_header_enabled'] = array(
664 'type' => 'checkbox'
665 , 'default' => $default_options_values['booking_confirmation_header_enabled']
666 , 'is_new_line' => false
667 , 'group' => 'booking_confirmation'
668 , 'only_field' => true
669 , 'css' => 'flex:0 0 auto;margin-right:10px;'
670 , 'label' => __('Enable', 'booking')
671 );
672
673 $this->fields['booking_confirmation_header'] = array(
674 'type' => 'text'
675 , 'default' => $default_options_values['booking_confirmation_header']
676 /* translators: 1: ... */
677 , 'placeholder' => sprintf( __( 'Your booking id: %s', 'booking' ), '<strong>[booking_id]</strong>' )
678 , 'css' => 'flex:1 1 auto;'
679 , 'group' => 'booking_confirmation'
680 , 'class' => 'wpbc_booking_confirmation_header__field'
681 , 'only_field' => true
682 );
683 $this->fields['booking_confirmation_header_sufix'] = array( 'type' => 'pure_html', 'group' => 'booking_confirmation', 'html' => '</fieldset> </td> </tr>' );
684 // </editor-fold>
685
686
687 //$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 ?
688 $is_use_code_mirror = true;
689
690 // <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 == " >
691 // -------------------------------------------------------------------------------------------------------------
692 // == Personal Information ==
693 // -------------------------------------------------------------------------------------------------------------
694 $this->fields['booking_confirmation__personal_info__prefix'] = array(
695 'type' => 'pure_html'
696 , 'group' => 'booking_confirmation_left'
697 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_confirmation__personal_info__header_enabled">
698 <td colspan="2" style="padding-bottom: 0;" ><fieldset style="display: flex;flex-flow: row wrap;justify-content: flex-start;align-items: center;">'
699 );
700
701 $this->fields['booking_confirmation__personal_info__header_enabled'] = array(
702 'type' => 'checkbox'
703 , 'default' => $default_options_values['booking_confirmation__personal_info__header_enabled']
704 , 'is_new_line' => false
705 , 'only_field' => true
706 , 'label' => __( 'Enable', 'booking' )
707 , 'css' => 'flex:0 0 auto;margin-right:5px;'
708 , 'group' => 'booking_confirmation_left'
709 );
710 $this->fields['booking_confirmation__personal_info__title'] = array(
711 'type' => 'text'
712 , 'default' => $default_options_values['booking_confirmation__personal_info__title']
713 , 'placeholder' => __( 'Example', 'booking' ) . ": '" . __( 'Personal information', 'booking' ) . "'"
714 , 'title' => ''
715 , 'description' => ''
716 , 'css' => 'flex: 1 1 100px;font-size: 16px;line-height: 34px;font-weight: 600;width:auto;'
717 , 'group' => 'booking_confirmation_left'
718 , 'class' => 'wpbc_booking_confirmation__personal_info__field'
719 , 'tr_class' => ''
720 , 'only_field' => true
721 );
722 $this->fields['booking_confirmation__personal_info__sufix'] = array( 'type' => 'pure_html', 'group' => 'booking_confirmation_left',
723 'html' => '<p style="text-align: right;font-size:12px;width:100%;">'
724 /* translators: 1: ... */
725 . sprintf( __( 'Enter %1$stitle%2$s for this section of Booking Confirmation', 'booking' ),'<b>','</b>')
726 . '.</p>' . '</fieldset> </td> </tr>' );
727
728 $wpbc_metabox_id = 'confirmation_left_cont__promote_upgrade';
729
730 $this->fields['booking_confirmation__personal_info__content_before'] = array(
731 'type' => 'pure_html',
732 'group' => 'booking_confirmation_left',
733 'html' => '<tr class="'.$wpbc_metabox_id.'_close_content wpbc_booking_confirmation__personal_info__fields '
734 //. ( ( ! class_exists( 'wpdev_bk_personal' ) ) ? 'wpbc_blur' : '' )
735 .'"><td colspan="2" style="padding-top:0;">'
736 . '<div style="margin: 0 0 10px;font-weight: 600;font-size: 14px;">'
737 . '<label class="wpbc-form-email-content" for="booking_confirmation__personal_info__content">' .
738 __( 'Content', 'booking' )
739 . '</label></div>'
740 );
741 $this->fields['booking_confirmation__personal_info__content'] = array(
742 'type' => ( $is_use_code_mirror ? 'textarea' : 'wp_textarea' ) // FixIn: 8.4.7.18.
743 , 'default' => $default_options_values['booking_confirmation__personal_info__content']
744 // '[content]'
745 //, 'placeholder' => '[content]'
746 , 'title' => __('Content', 'booking')
747 //, 'description' => __('Example', 'booking') . ': ' . '[content]'
748 , 'description_tag' => ''
749 , 'css' => 'width:100%;height:70px;'
750 , 'group' => 'booking_confirmation_left'
751 , 'tr_class' => ''//( class_exists('wpdev_bk_personal') ) ? 'wpbc_blur' : ''
752 , 'rows' => 2
753 , 'show_in_2_cols' => true
754 , 'only_field' => true
755 );
756 $this->fields['booking_confirmation__personal_info__content_after'] = array( 'type' => 'pure_html', 'group' => 'booking_confirmation_left', 'html' => '</td></tr>' );
757
758 /*
759 if ( ! class_exists( 'wpdev_bk_personal' ) ) {
760 ob_start();
761 $is_panel_visible = wpbc_is_dismissed( $wpbc_metabox_id . '_close', array(
762 'title' => '<i class="menu_icon icon-1x wpbc_icn_close"></i> ',
763 'hint' => __( 'Dismiss', 'booking' ),
764 'class' => 'wpbc_panel_get_started_dismiss',
765 'css' => 'background: #fff;border-radius: 7px;',
766 'dismiss_css_class' => '.' . $wpbc_metabox_id . '_close_content'
767 ));
768 if ( ! $is_panel_visible ) {
769 ?><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
770 }
771 $dismiss_button_content = ob_get_clean();
772
773 if ( $is_panel_visible ){
774
775 $this->fields['booking_confirmation_left__promote_upgrade'] = array(
776 'type' => 'pure_html'
777 , 'group' => 'booking_confirmation_left'
778 , 'html' => '<tr id="'.$wpbc_metabox_id.'_close" class="wpbc_booking_confirmation__personal_info__fields"><td colspan="2">
779 <div class="wpbc_widget_content" style="transform: translate(0) translateY(-9em);">
780 <div class="ui_container ui_container_toolbar ui_container_small" style="background: #fff;position: relative;">
781 <div class="ui_group ui_group__upgrade">
782 <div style="transform: translate(0%) translateY(-2.75em);position: relative;z-index:9;width: 85.6%;">'.$dismiss_button_content.'</div>
783 <div class="wpbc_upgrade_note wpbc_upgrade_theme_green">
784 <div>This <a target="_blank" href="https://wpbookingcalendar.com/features/#personal">feature</a>
785 is available in the <strong>Pro</strong> versions.
786 <a target="_blank" href="https://wpbookingcalendar.com/prices/#bk_news_section">Upgrade to Pro</a>.
787 </div>
788 </div>
789 </div>
790 </div>
791 </div>
792 </td> </tr>'
793 );
794 }
795 }
796 */
797 // </editor-fold>
798
799
800 // <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 == " >
801 // -------------------------------------------------------------------------------------------------------------
802 // == Booking details ==
803 // -------------------------------------------------------------------------------------------------------------
804 $this->fields['booking_confirmation__booking_details__prefix'] = array(
805 'type' => 'pure_html'
806 , 'group' => 'booking_confirmation_right'
807 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_confirmation__booking_details__header_enabled">
808 <td colspan="2" style="padding-bottom: 0;" ><fieldset style="display: flex;flex-flow: row wrap;justify-content: flex-start;align-items: center;">'
809 );
810
811 $this->fields['booking_confirmation__booking_details__header_enabled'] = array(
812 'type' => 'checkbox'
813 , 'default' => $default_options_values['booking_confirmation__booking_details__header_enabled']
814 , 'is_new_line' => false
815 , 'only_field' => true
816 , 'label' => __( 'Enable', 'booking' )
817 , 'css' => 'flex:0 0 auto;margin-right:5px;'
818 , 'group' => 'booking_confirmation_right'
819 );
820 $this->fields['booking_confirmation__booking_details__title'] = array(
821 'type' => 'text'
822 , 'default' => $default_options_values['booking_confirmation__booking_details__title']
823 , 'placeholder' => __( 'Example', 'booking' ) . ": '" . __( 'Booking details', 'booking' ) . "'"
824 , 'title' => ''
825 , 'description' => ''
826 , 'css' => 'flex: 1 1 100px;font-size: 16px;line-height: 34px;font-weight: 600;;width:auto;'
827 , 'group' => 'booking_confirmation_right'
828 , 'class' => 'wpbc_booking_confirmation__booking_details__field'
829 , 'tr_class' => ''
830 , 'only_field' => true
831 );
832 $this->fields['booking_confirmation__booking_details__sufix'] = array( 'type' => 'pure_html', 'group' => 'booking_confirmation_right',
833 'html' => '<p style="text-align: right;font-size:12px;width:100%;">'
834 /* translators: 1: ... */
835 . sprintf( __( 'Enter %1$stitle%2$s for this section of Booking Confirmation', 'booking' ),'<b>','</b>')
836 . '.</p>' . '</fieldset> </td> </tr>' );
837 $this->fields['booking_confirmation__booking_details__content_before'] = array(
838 'type' => 'pure_html',
839 'group' => 'booking_confirmation_right',
840 'html' => '<tr class="wpbc_booking_confirmation__booking_details__fields"><td colspan="2" style="padding-top:0;">'
841 . '<div style="margin: 0 0 10px;font-weight: 600;font-size: 14px;">'
842 . '<label class="wpbc-form-email-content" for="booking_confirmation__booking_details__content">' .
843 __( 'Content', 'booking' )
844 . '</label></div>'
845 );
846 $this->fields['booking_confirmation__booking_details__content'] = array(
847 'type' => ( $is_use_code_mirror ? 'textarea' : 'wp_textarea' ) // FixIn: 8.4.7.18.
848 , 'default' => $default_options_values['booking_confirmation__booking_details__content']
849 // ( ( class_exists( 'wpdev_bk_personal' ) ) ? '<h4 class="wpbc_ty__section_text_resource">[resource_title]</h4>' : '' )
850 // . '<div class="wpbc_ty__section_text_dates">' . esc_html__( 'Dates', 'booking' ) . ': <strong>[dates]</strong></div>'
851 // . '<div class="wpbc_ty__section_text_times">' . esc_html__( 'Time', 'booking' ) . ': <strong>[times]</strong></div>'
852 //, 'placeholder' => '[content]'
853 , 'title' => __('Content', 'booking')
854 //, 'description' => __('Example', 'booking') . ': ' . '[content]'
855 , 'description_tag' => ''
856 , 'css' => 'width:100%;height:70px;'
857 , 'group' => 'booking_confirmation_right'
858 , 'tr_class' => ''
859 , 'rows' => 10
860 , 'show_in_2_cols' => true
861 , 'only_field' => true
862 );
863 $this->fields['booking_confirmation__booking_details__content_after'] = array( 'type' => 'pure_html', 'group' => 'booking_confirmation_right', 'html' => '</td></tr>' );
864
865 // </editor-fold>
866
867
868 // <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 == " >
869 ////////////////////////////////////////////////////////////////////
870 // Help
871 ////////////////////////////////////////////////////////////////////
872
873 $this->fields['booking_confirmation_help_shortcodes'] = array(
874 'type' => 'help'
875 , 'value' => array()
876 , 'cols' => 2
877 , 'group' => 'booking_confirmation_help'
878 , 'css' => 'margin:10px 0 0; padding: 0 5px 0 0 !important;overflow: auto;border:none;max-height: 445px;'
879 , 'only_field' => true
880 );
881
882 $skip_shortcodes = array(
883 'denyreason'
884 , 'moderatelink'
885 , 'paymentreason'
886 , 'visitorbookingediturl'
887 , 'visitorbookingslisting'
888 , 'visitorbookingcancelurl'
889 , 'visitorbookingpayurl'
890 );
891 $email_example = '';
892
893 $help_fields = wpbc_get_email_help_shortcodes( $skip_shortcodes, $email_example );
894 if ( class_exists( 'wpdev_bk_personal' ) ) {
895 array_shift( $help_fields );
896 array_shift( $help_fields );
897 }
898 $icn = '<a href="https://wpbookingcalendar.com/faq/#available_shortcodes"
899 class="tooltip_top wpbc-bi-question-circle wpbc_help_tooltip_icon_left"
900 data-original-title="%2$s"></a> %1$s';
901 /* translators: 1: ... */
902 $this->fields['booking_confirmation_help_shortcodes']['value'][] = sprintf( $icn, '<code>[readable_dates]</code>', sprintf( __('%s - dates in readable format' ,'booking'), '[readable_dates]' ) );
903 /* translators: 1: ... */
904 $this->fields['booking_confirmation_help_shortcodes']['value'][] = sprintf( $icn, '<code>[readable_times]</code>', sprintf( __('%s - time in readable format' ,'booking'), '[readable_times]' ) );
905
906 foreach ( $help_fields as $help_fields_key => $help_fields_value ) {
907 $this->fields['booking_confirmation_help_shortcodes']['value'][] = $help_fields_value;
908 }
909
910 // </editor-fold>
911
912 // <editor-fold defaultstate="collapsed" desc=" Booking Admin Panel " >
913
914 $field_options = array(
915 'vm_booking_listing' => __('Bookings Listing' ,'booking') // FixIn: 9.6.3.5.
916 , 'vm_calendar' => __('Timeline View' ,'booking')
917 );
918 $this->fields['booking_listing_default_view_mode'] = array(
919 'type' => 'select'
920 , 'default' => $default_options_values['booking_listing_default_view_mode'] //'vm_calendar'
921 , 'title' => __('Default booking admin page', 'booking')
922 , 'description' => __('Select your default view mode of bookings at the booking listing page' ,'booking')
923 , 'options' => $field_options
924 , 'group' => 'booking_listing'
925 );
926
927 // Default booking resources.
928 $this->fields = apply_filters( 'wpbc_settings_booking_listing_br_default_count', $this->fields, $default_options_values );
929
930
931 // FixIn: 8.6.1.13.
932
933 // Calendar Default View mode
934 if ( class_exists( 'wpdev_bk_personal' ) )
935 $field_options = array(
936 '1' => __('Day' ,'booking')
937 , '7' => __('Week' ,'booking')
938 , '30' => __('Month' ,'booking')
939 , '60' => __('2 Months' ,'booking')
940 , '90' => __('3 Months' ,'booking')
941 , '365' => __('Year' ,'booking')
942 );
943 else
944 $field_options = array(
945 '30' => __('Month' ,'booking') // Day ?
946 , '90' => __('3 Months' ,'booking') // Week ?
947 , '365' => __('Year' ,'booking') // Month ?
948 );
949 $this->fields['booking_view_days_num'] = array(
950 'type' => 'select'
951 , 'default' => $default_options_values['booking_view_days_num'] //'30'
952 , 'title' => __('Default view mode', 'booking')
953 , 'description' => __('Select your default calendar view mode at booking calendar overview page' ,'booking')
954 , 'options' => $field_options
955 , 'group' => 'booking_calendar_overview' //FixIn: 8.5.2.20 // FixIn: 8.9.4.4.
956 );
957
958 // FixIn: 8.9.4.3.
959 $field_options = array();
960 foreach ( range( 1, 31, 1) as $value ) {
961 $field_options[ $value ] = $value;
962 }
963 $this->fields['booking_calendar_overview__day_mode__days_number_show'] = array(
964 'type' => 'select'
965 , 'default' => $default_options_values['booking_calendar_overview__day_mode__days_number_show'] // 31
966 , 'title' => __('Days number to show in day view mode', 'booking')
967 /* translators: 1: ... */
968 , 'description' => sprintf( __( 'Select number of days to show in %1$sDay%2$s view mode', 'booking' ),'<b>','</b>')
969 . ( ( class_exists( 'wpdev_bk_personal' ) ) ? ' ' . __( 'for one booking resource', 'booking' ) : '' )
970 , 'options' => $field_options
971 , 'group' => 'booking_calendar_overview' // FixIn: 8.9.4.4.
972 );
973 $this->fields['booking_timeline__month_mode__days_number_show'] = array(
974 'type' => 'select'
975 , 'default' => $default_options_values['booking_timeline__month_mode__days_number_show'] //31
976 , 'title' => __('Days number to show in month view mode', 'booking')
977 , 'description' => __('Select number of days to show in month view mode for one booking resource.' ,'booking')
978 , 'options' => $field_options
979 , 'group' => 'booking_timeline'
980 );
981
982
983 //Default Titles in Calendar cells
984 $this->fields = apply_filters( 'wpbc_settings_booking_listing_timeline_title_in_day', $this->fields, $default_options_values );
985
986
987 // FixIn: 9.6.3.5.
988
989 // <editor-fold defaultstate="collapsed" desc=" == Dates : Time == " >
990 $timezone_error_message = '';
991 if ( 'UTC' !== date_default_timezone_get() ) {
992 $timezone_error_message .= '<div style="line-height: 2em;margin-bottom:2em;" class="wpbc-settings-notice notice-error">';
993 $timezone_error_message .= '<strong>' . esc_html__( 'PHP default timezone is invalid', 'booking' ) . '</strong>. ';
994 $timezone_error_message .= '<a href="' . esc_url( admin_url( 'site-health.php' ) ) . '">' . __( 'Read more' , 'booking' ) . '</a>' . '<br/>';
995 /* translators: 1: ... */
996 $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>' );
997 $timezone_error_message .= '</div>';
998 }
999
1000 $this->fields['system_timezones'] = array(
1001 'type' => 'html'
1002 , 'html' => $timezone_error_message
1003 . '<div style="line-height: 2em;">'
1004 . __( 'Server Default Timezone', 'booking' ) . ': <strong>' . date_default_timezone_get() . '</strong><br/>'
1005 . __( 'WordPress Timezone', 'booking' ) . ': <strong>' . wp_timezone()->getName() . '</strong>'
1006 . '</div>'
1007
1008 , 'class' => ''
1009 , 'css' => 'margin:0;padding:0;border:0;'
1010 , 'cols' => 2
1011 , 'group' => 'date_time'
1012 );
1013
1014 $this->fields['hr_booking_date_format'] = array( 'type' => 'hr', 'group' => 'date_time' );
1015 // -------------------------------------------------------------------------------------------------------------
1016 // Default Dates View Mode
1017 // -------------------------------------------------------------------------------------------------------------
1018 $this->fields['booking_date_view_type'] = array(
1019 'type' => 'select'
1020 , 'default' => $default_options_values['booking_date_view_type'] //'short'
1021 , 'title' => __('Dates view', 'booking')
1022 , 'description' => __('Select the default view for dates on the booking tables' ,'booking')
1023 , 'options' => array(
1024 'short' => __('Short days view' ,'booking')
1025 , 'wide' => __('Wide days view' ,'booking')
1026 )
1027 , 'group' => 'date_time'
1028 );
1029 $this->fields['hr_booking_time_format'] = array( 'type' => 'hr', 'group' => 'date_time' );
1030 // -------------------------------------------------------------------------------------------------------------
1031 // Dates : Time
1032 // -------------------------------------------------------------------------------------------------------------
1033
1034 $this->fields['booking_date_format_html_prefix'] = array(
1035 'type' => 'pure_html'
1036 , 'group' => 'date_time'
1037 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_date_format">
1038 <th scope="row">'.
1039 WPBC_Settings_API::label_static( 'set_gen_booking_date_format'
1040 , array( 'title'=> __('Date Format' ,'booking'), 'label_css' => 'margin: 0.25em 0 !important;vertical-align: middle;' ) )
1041 .'</th>
1042 <td><fieldset>'
1043 );
1044 $field_options = array();
1045 foreach ( array( 'j M Y', 'F j, Y', 'Y/m/d', 'm/d/Y', 'd/m/Y' ) as $format ) {
1046 $field_options[ esc_attr($format) ] = array( 'title' => date_i18n( $format ) );
1047 }
1048 $field_options['custom'] = array( 'title' => __('Custom' ,'booking') . ':', 'attr' => array( 'id' => 'date_format_selection_custom' ) );
1049
1050 $this->fields['booking_date_format_selection'] = array(
1051 'type' => 'radio'
1052 , 'default' => get_option('date_format')
1053 , 'options' => $field_options
1054 , 'group' => 'date_time'
1055 , 'only_field' => true
1056 , 'is_new_line' => !true
1057 );
1058
1059 $booking_date_format = get_bk_option( 'booking_date_format');
1060 $this->fields['booking_date_format'] = array(
1061 'type' => 'text'
1062 , 'default' => $default_options_values['booking_date_format'] //get_option('date_format')
1063 , 'value' => htmlentities( $booking_date_format ) // Display value of this field in specific way
1064 , 'group' => 'date_time'
1065 , 'placeholder' => get_option('date_format')
1066 , 'css' => 'width:auto;margin: 10px 0;'
1067 , 'only_field' => true
1068 );
1069 $this->fields['booking_date_format_html_sufix'] = array(
1070 'type' => 'pure_html'
1071 , 'group' => 'date_time'
1072 , 'html' => '<span class="description" style="padding:0;"><code>' . date_i18n( $booking_date_format ) . '</code></span>
1073 </fieldset>
1074 </td>
1075 </tr>'
1076 );
1077 $this->fields['booking_date_format_help'] = array(
1078 'type' => 'html'
1079 , 'html' => '<div style="line-height: 2em;">'.
1080 /* translators: 1: ... */
1081 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>')
1082 .'</div>'
1083 , 'class' => ''
1084 , 'css' => 'margin:0;padding:0;border:0;'
1085 , 'description' => ''
1086 , 'cols' => 2
1087 , 'group' => 'date_time'
1088 , 'tr_class' => ''
1089 , 'description_tag' => 'div'
1090 );
1091
1092
1093 // -------------------------------------------------------------------------------------------------------------
1094 // Time Format
1095 // -------------------------------------------------------------------------------------------------------------
1096
1097 $this->fields['booking_time_format_html_prefix'] = array(
1098 'type' => 'pure_html'
1099 , 'group' => 'date_time'
1100 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_time_format">
1101 <th scope="row">'.
1102 WPBC_Settings_API::label_static( 'set_gen_booking_time_format'
1103 , array( 'title'=> __('Time Format' ,'booking'), 'label_css' => 'margin: 0.25em 0 !important;vertical-align: middle;' ) )
1104 .'</th>
1105 <td><fieldset>'
1106 );
1107 $field_options = array();
1108 foreach ( array( 'g:i a', 'g:i A', 'H:i' ) as $format ) {
1109 $field_options[ esc_attr($format) ] = array( 'title' => date_i18n( $format ) );
1110 }
1111 $field_options['custom'] = array( 'title' => __('Custom' ,'booking') . ':', 'attr' => array( 'id' => 'time_format_selection_custom' ) );
1112
1113 $this->fields['booking_time_format_selection'] = array(
1114 'type' => 'radio'
1115 , 'default' => 'H:i'
1116 , 'options' => $field_options
1117 , 'group' => 'date_time'
1118 , 'only_field' => true
1119 , 'is_new_line' => ! true
1120 );
1121
1122 $booking_time_format = get_bk_option( 'booking_time_format');
1123 $this->fields['booking_time_format'] = array(
1124 'type' => 'text'
1125 , 'default' => $default_options_values['booking_time_format'] //'H:i'
1126 , 'value' => htmlentities( $booking_time_format ) // Display value of this field in specific way
1127 , 'group' => 'date_time'
1128 , 'placeholder' => 'H:i'
1129 , 'css' => 'width:auto; margin: 10px 0;'
1130 , 'only_field' => true
1131 );
1132 $this->fields['booking_time_format_html_sufix'] = array(
1133 'type' => 'pure_html'
1134 , 'group' => 'date_time'
1135 , 'html' => '<span class="description" style="padding:0;"><code>' . date_i18n( $booking_time_format ) . '</code></span>
1136 </fieldset>
1137 </td>
1138 </tr>'
1139 );
1140 $this->fields['booking_time_format_help'] = array(
1141 'type' => 'html'
1142 , 'html' => '<div style="line-height: 2em;">'.
1143 /* translators: 1: ... */
1144 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>')
1145 .'</div>'
1146 , 'class' => ''
1147 , 'css' => 'margin:0;padding:0;border:0;'
1148 , 'description' => ''
1149 , 'cols' => 2
1150 , 'group' => 'date_time'
1151 , 'tr_class' => ''
1152 , 'description_tag' => 'div'
1153 );
1154
1155
1156
1157 // </editor-fold>
1158
1159
1160
1161 // Divider ///////////////////////////////////////////////////////////////
1162 $this->fields['hr_booking_listing_before_is_use_hints_at_admin_panel'] = array( 'type' => 'hr', 'group' => 'booking_listing' );
1163
1164
1165 // Show hide Notes
1166 $this->fields = apply_filters( 'wpbc_settings_booking_show_hide_options', $this->fields, $default_options_values ); // FixIn: 8.1.3.32.
1167
1168
1169 // </editor-fold>
1170
1171
1172 // <editor-fold defaultstate="collapsed" desc=" auto_cancelation_approval " >
1173
1174 // auto_cancelation_approval
1175 $this->fields = apply_filters( 'wpbc_settings_auto_cancelation_approval_section', $this->fields, $default_options_values );
1176 // </editor-fold>
1177
1178 // <editor-fold defaultstate="collapsed" desc=" Advanced " >
1179
1180
1181 $this->fields = apply_filters( 'wpbc_settings_edit_url_hash', $this->fields, $default_options_values );
1182 // FixIn: 10.10.1.2 $this->fields = apply_filters( 'wpbc_settings_resource_no_update__during_editing', $this->fields, $default_options_values );
1183
1184 // Show advanced settings of JavaScript loading
1185
1186
1187 // //Show | Hide links for Advanced JavaScript section
1188 // $this->fields['booking_advanced_js_loading_settings'] = array(
1189 // 'type' => 'html'
1190 // , 'html' =>
1191 // '<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>'
1192 // . '<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>'
1193 // , 'cols' => 2
1194 // , 'group' => 'advanced'
1195 // );
1196
1197 // FixIn: 9.8.6.2.
1198 $balencer_options = array_combine( range( 1, 5 ), range( 1, 5 ) );
1199 $balencer_options[99] = __( 'All', 'booking' );
1200 $this->fields['booking_load_balancer_max_threads'] = array(
1201 'type' => 'select'
1202 , 'default' => $default_options_values['booking_load_balancer_max_threads']
1203 , 'title' => __('Parallel requests' ,'booking')
1204 , 'description' => __('Select the number of simultaneous requests to load data in multiple calendars.' ,'booking') . ' <sup style="color:#7812bd;"><strong> '.__('Performance','booking').'</strong></sup>'
1205 . '<div class="wpbc-general-settings-notice wpbc-settings-notice notice-info">'
1206 . __('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')
1207 .'</div>'
1208
1209 , 'options' => $balencer_options
1210 , 'group' => 'advanced'
1211 , 'is_demo_safe' => wpbc_is_this_demo()
1212 );
1213
1214
1215 $this->fields['booking_is_load_js_css_on_specific_pages'] = array(
1216 'type' => 'checkbox'
1217 , 'default' => $default_options_values['booking_is_load_js_css_on_specific_pages'] //'Off'
1218 , 'title' => __('Load JS and CSS files only on specific pages' ,'booking')
1219 , 'label' => __('Activate loading of CSS and JavaScript files of plugin only at specific pages.' ,'booking')
1220 , 'description' => ''
1221 , 'group' => 'advanced'
1222 , 'tr_class' => 'wpbc_advanced_js_loading_settings'//wpbc_advanced_js_loading_settings wpbc_sub_settings_grayed hidden_items'
1223 , 'is_demo_safe' => wpbc_is_this_demo()
1224 );
1225 $this->fields['booking_pages_for_load_js_css'] = array(
1226 'type' => 'textarea'
1227 , 'default' => $default_options_values['booking_pages_for_load_js_css'] //''
1228 , 'placeholder' => '/booking-form/'
1229 , 'title' => __('Relative URLs of pages, where to load plugin CSS and JS files' ,'booking')
1230 /* translators: 1: ... */
1231 , '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>')
1232 ,'description_tag' => 'p'
1233 , 'css' => 'width:100%'
1234 , 'rows' => 5
1235 , 'group' => 'advanced'
1236 , 'tr_class' => 'wpbc_advanced_js_loading_settings wpbc_is_load_js_css_on_specific_pages wpbc_sub_settings_grayed'// hidden_items'
1237 , 'is_demo_safe' => wpbc_is_this_demo()
1238 );
1239
1240 $this->fields['booking_form_is_using_bs_css'] = array(
1241 'type' => 'checkbox'
1242 , 'default' => $default_options_values['booking_form_is_using_bs_css'] // 'On'
1243 , 'title' => __('Use CSS BootStrap' ,'booking')
1244 , 'label' => __('Using BootStrap CSS for the form fields' ,'booking'). ' <sup style="color:#bd8212;"><strong> '.__('Deprecated','booking').'</strong></sup>'
1245 , 'description' => ''
1246 , 'description_tag' => 'p'
1247 , 'group' => 'advanced'
1248 );
1249
1250 //$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' );
1251 // FixIn: 7.2.1.15.
1252 $this->fields[ 'booking_is_show_system_debug_log' ] = array(
1253 'type' => 'checkbox'
1254 , 'default' => $default_options_values['booking_is_show_system_debug_log'] //'Off'
1255 , 'title' => __('Show system debugging log for beta features' ,'booking')
1256 , 'label' => __('Activate this option only for testing beta features' ,'booking')
1257 , 'description' => ''
1258 , 'group' => 'advanced'
1259 , 'tr_class' => 'wpbc_advanced_js_loading_settings'// wpbc_sub_settings_grayed hidden_items'
1260 , 'is_demo_safe' => wpbc_is_this_demo()
1261 );
1262
1263 //FixIn: 10.1.1.2 //TODO: Update Text here 2024-06-16 12:57
1264 $this->fields['booking_is_nonce_at_front_end'] = array(
1265 'type' => 'checkbox'
1266 , 'default' => $default_options_values['booking_is_nonce_at_front_end'] //'Off'
1267 , 'title' => __( 'Use Nonce Fields', 'booking' )
1268 , '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' )
1269 , 'description' => ''
1270 , 'group' => 'advanced'
1271 , 'tr_class' => 'wpbc_advanced_is_nonce' //wpbc_advanced_js_loading_settings wpbc_sub_settings_grayed hidden_items'
1272 , 'toggle_class' => 'wpbc_toggle_danger'
1273 , 'is_demo_safe' => wpbc_is_this_demo()
1274 );
1275
1276 if ( wpbc_is_this_demo() ) {
1277 $this->fields['booking_pages_for_load_js_css_demo'] = array( 'group' => 'advanced',
1278 'type' => 'html',
1279 'html' => wpbc_get_warning_text_in_demo_mode(),
1280 'cols' => 2,
1281 'tr_class' => 'wpbc_advanced_js_loading_settings'// wpbc_sub_settings_grayed hidden_items'
1282 );
1283 }
1284
1285 // Divider ///////////////////////////////////////////////////////////////
1286 $this->fields['hr_calendar_before_advanced_js_loading_settings'] = array( 'type' => 'hr', 'group' => 'advanced' );
1287
1288 // Show settings of powered by notice
1289 $this->fields['booking_advanced_powered_by_notice_settings'] = array(
1290 'type' => 'html'
1291 , 'html' =>
1292 '<a id="wpbc_powered_by_link_show" class="wpbc_expand_section_link" href="javascript:void(0)">+ ' . __('Show settings of powered by notice' ,'booking') . '</a>'
1293 . '<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>'
1294 , 'cols' => 2
1295 , 'group' => 'advanced'
1296 );
1297 $this->fields['booking_is_show_powered_by_notice'] = array(
1298 'type' => 'checkbox'
1299 , 'default' => $default_options_values['booking_is_show_powered_by_notice'] //'On'
1300 , 'title' => __('Powered by notice' ,'booking')
1301 , 'label' => sprintf(__(' Turn On/Off powered by "Booking Calendar" notice under the calendar.' ,'booking'),'wpbookingcalendar.com')
1302 , 'description' => ''
1303 , 'group' => 'advanced'
1304 , 'tr_class' => 'wpbc_is_show_powered_by_notice wpbc_sub_settings_grayed hidden_items'
1305 );
1306 $this->fields['booking_wpdev_copyright_adminpanel'] = array(
1307 'type' => 'checkbox'
1308 , 'default' => $default_options_values['booking_wpdev_copyright_adminpanel'] //'On'
1309 , 'title' => __('Help and info notices' ,'booking')
1310 , 'label' => sprintf(__(' Turn On/Off version notice and help info links at booking admin panel.' ,'booking'),'wpbookingcalendar.com')
1311 , 'description' => ''
1312 , 'group' => 'advanced'
1313 , 'tr_class' => 'wpbc_is_show_powered_by_notice wpbc_sub_settings_grayed hidden_items'
1314 , 'is_demo_safe' => wpbc_is_this_demo() // FixIn: 8.1.3.9.
1315 );
1316
1317 // </editor-fold>
1318
1319
1320 // <editor-fold defaultstate="collapsed" desc=" Information " >
1321 if(1){
1322 if ( function_exists( 'wpbc_get_dashboard_info' ) ) {
1323 $this->fields['booking_information'] = array(
1324 'type' => 'html'
1325 , 'html' => wpbc_get_dashboard_info()
1326 , 'cols' => 2
1327 , 'group' => 'information'
1328 );
1329 }
1330 }
1331 // </editor-fold>
1332
1333
1334 // <editor-fold defaultstate="collapsed" desc=" User permissions for plugin menu pages " >
1335
1336
1337 $this->fields['booking_menu_position'] = array(
1338 'type' => 'select'
1339 , 'default' => 'top'
1340 , 'title' => __('Plugin menu position', 'booking')
1341 , 'description' => ''
1342 , 'options' => array(
1343 'top' => __('Top', 'booking')
1344 , 'middle' => __('Middle', 'booking')
1345 , 'bottom' => __('Bottom', 'booking')
1346 )
1347 , 'group' => 'permissions'
1348 , 'is_demo_safe' => wpbc_is_this_demo()
1349 );
1350
1351 $this->fields['booking_user_role_booking_header'] = array(
1352 'type' => 'pure_html'
1353 , 'group' => 'permissions'
1354 , 'html' => '<tr valign="top">
1355 <th scope="row" colspan="2">
1356 <hr/><p><strong>' . wp_kses_post( __('User permissions for plugin menu pages' ,'booking') ) . ':</strong></p>
1357 </th>
1358 </tr>'
1359 );
1360
1361 $field_options = array();
1362 $field_options['subscriber'] = translate_user_role('Subscriber');
1363 $field_options['contributor'] = translate_user_role('Contributor');
1364 $field_options['author'] = translate_user_role('Author');
1365 $field_options['editor'] = translate_user_role('Editor');
1366 $field_options['administrator'] = translate_user_role('Administrator');
1367
1368 $this->fields['booking_user_role_booking'] = array(
1369 'type' => 'select'
1370 , 'default' => $default_options_values['booking_user_role_booking'] //'editor'
1371 , 'title' => __('Bookings', 'booking')
1372 , 'description' => ''
1373 , 'options' => $field_options
1374 , 'group' => 'permissions'
1375 , 'is_demo_safe' => wpbc_is_this_demo()
1376 );
1377 $this->fields['booking_user_role_availability'] = array( // FixIn: 9.5.2.2.
1378 'type' => 'select'
1379 , 'default' => $default_options_values['booking_user_role_availability'] //'editor'
1380 , 'title' => __('Availability', 'booking')
1381 , 'description' => ''
1382 , 'options' => $field_options
1383 , 'group' => 'permissions'
1384 , 'is_demo_safe' => wpbc_is_this_demo()
1385 );
1386 //FixIn: 9.8.15.2.6
1387 if ( class_exists( 'wpdev_bk_biz_m' ) )
1388 $this->fields['booking_user_role_prices'] = array(
1389 'type' => 'select'
1390 , 'default' => $default_options_values['booking_user_role_prices'] //'editor'
1391 , 'title' => __('Prices', 'booking')
1392 , 'description' => ''
1393 , 'options' => $field_options
1394 , 'group' => 'permissions'
1395 , 'is_demo_safe' => wpbc_is_this_demo()
1396 );
1397
1398 $this->fields['booking_user_role_addbooking'] = array(
1399 'type' => 'select'
1400 , 'default' => $default_options_values['booking_user_role_addbooking'] //'editor'
1401 , 'title' => __('Add booking', 'booking')
1402 , 'description' => ''
1403 , 'options' => $field_options
1404 , 'group' => 'permissions'
1405 , 'is_demo_safe' => wpbc_is_this_demo()
1406 );
1407 if ( class_exists( 'wpdev_bk_personal' ) )
1408 $this->fields['booking_user_role_resources'] = array(
1409 'type' => 'select'
1410 , 'default' => $default_options_values['booking_user_role_resources'] //'editor'
1411 , 'title' => __('Resources', 'booking')
1412 , 'description' => ''
1413 , 'options' => $field_options
1414 , 'group' => 'permissions'
1415 , 'is_demo_safe' => wpbc_is_this_demo()
1416 );
1417 $this->fields['booking_user_role_settings'] = array(
1418 'type' => 'select'
1419 , 'default' => $default_options_values['booking_user_role_settings'] //'administrator'
1420 , 'title' => __('Settings', 'booking')
1421 , 'description' => __('Select user access level for the menu pages of plugin' ,'booking')
1422 , 'description_tag' => 'p'
1423 , 'options' => $field_options
1424 , 'group' => 'permissions'
1425 , 'is_demo_safe' => wpbc_is_this_demo()
1426 );
1427
1428 //if ( ! class_exists( 'wpdev_bk_personal' ) )
1429 if ( ! wpbc_is_this_demo() )
1430 $this->fields['booking_menu_go_pro'] = array(
1431 'type' => 'select'
1432 , 'default' => $default_options_values['booking_menu_go_pro'] //'administrator'
1433 , 'title' => __('Premium', 'booking')
1434 , 'description' => __('Show / hide menu' ,'booking')
1435 , 'description_tag' => 'p'
1436 , 'options' => array(
1437 'show' => __('Show', 'booking')
1438 , 'hide' => __('Hide', 'booking')
1439 )
1440 , 'group' => 'permissions'
1441 , 'is_demo_safe' => wpbc_is_this_demo()
1442 );
1443
1444 if ( wpbc_is_this_demo() )
1445 $this->fields['booking_user_role_settings_demo'] = array( 'group' => 'permissions', 'type' => 'html', 'html' => wpbc_get_warning_text_in_demo_mode(), 'cols' => 2 );
1446
1447
1448 // </editor-fold>
1449
1450
1451 // <editor-fold defaultstate="collapsed" desc=" Uninstall " >
1452 $this->fields['booking_is_delete_if_deactive'] = array(
1453 'type' => 'checkbox'
1454 , 'default' => $default_options_values['booking_is_delete_if_deactive'] //'Off'
1455 , 'title' => __('Delete booking data, when plugin deactivated' ,'booking')
1456 , 'label' => __('Turn on to delete all booking data when you uninstall this plugin.' ,'booking')
1457 , 'description' => ''
1458 , 'group' => 'uninstall'
1459 , 'toggle_class' => 'wpbc_toggle_danger'
1460 );
1461 // </editor-fold>
1462
1463
1464 // <editor-fold defaultstate="collapsed" desc=" Tools " >
1465
1466 if ( ( ! wpbc_is_this_demo() ) && ( current_user_can( 'activate_plugins' ) ) ) {
1467
1468 $this->fields['tools_section_buttons'] = array(
1469 'type' => 'help'
1470 , 'value' => array()
1471 , 'class' => ''
1472 , 'css' => 'margin:0;padding:0;border:0;'
1473 , 'description' => ''
1474 , 'cols' => 2
1475 , 'group' => 'help'
1476 , 'tr_class' => ''
1477 , 'description_tag' => 'p'
1478 );
1479
1480 $my_system_buttons = '';
1481
1482 $my_system_buttons .= '<a class="button button" href="'
1483 . esc_url( wpbc_get_settings_url()
1484 . '&system_info=show&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) ) .'&booking_system_info=show#wpbc_general_settings_system_info_metabox">'
1485 . 'Booking System ' . __('Info' ,'booking')
1486 . '</a>';
1487 // FixIn: 8.4.7.19.
1488 $my_system_buttons .= ' <a class="button button" href="'
1489 . wpbc_get_bookings_url()
1490 . '&wh_booking_type=lost">'
1491 . 'Find Lost Bookings'
1492 . '</a>'; // FixIn: 8.5.2.19.
1493
1494
1495 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1496 if ( ( ! empty( $_REQUEST['booking_version_num'] ) ) && ( 'reset' == $_REQUEST['booking_version_num'] ) ) { // FixIn: 8.5.2.19.
1497 delete_bk_option('booking_version_num');
1498 ?>
1499 <div class="wpdvlp-sub-tabs wpbc_redirection_message"
1500 style="margin: 20px 0;padding: 1em;font-size: 14px;">
1501 <a href="<?php
1502 echo esc_url( wpbc_get_setup_wizard_page_url() ); ?>">Redirect</a> after <span
1503 class="wpbc_countdown">1</span> second...
1504 </div>
1505 <?php
1506
1507 wpbc_redirect( wpbc_get_settings_url() );
1508 }
1509
1510 $my_system_buttons .= ' <a class="button button" href="' . wpbc_get_settings_url() . '&booking_version_num=reset">' . 'Try to Reinstall' . '</a>'; // FixIn: 8.5.2.19.
1511
1512
1513
1514 // FixIn: 9.5.3.1.
1515 $my_system_buttons .= ' <a class="button button" href="'
1516 . wpbc_get_resources_url()
1517 . '&show_all_resources=1">'
1518 . 'Find Lost Resources'
1519 . '</a>';
1520
1521 if ( ( isset( $_SERVER['HTTP_HOST'] ) ) && ( 'beta' === $_SERVER['HTTP_HOST'] ) ) {
1522
1523 $my_system_buttons .= '<div style="width:100%;height:2em;border-bottom:1px dashed #777;margin-bottom:1em;"></div>';
1524
1525 // 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
1526 $my_system_buttons .= ' <a class="button button-secondary" style="background:#fff9e6;" href="'
1527 . esc_url( wpbc_get_settings_url()
1528 . '&system_info=show&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) ) .'&reset=custom_forms#wpbc_general_settings_system_info_metabox">'
1529 . 'Reset custom forms'
1530 . '</a>';
1531
1532
1533 $my_system_buttons .= ' <a class="button button-secondary" style="background:#fff9e6;" href="'
1534 . esc_url( wpbc_get_settings_url()
1535 . '&wpbc_setup_wizard=reset&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) ) .'">'
1536 . 'Reset Setup Wizard'
1537 . '</a>';
1538 // if ( ( isset( $_GET['wpbc_setup_wizard'] ) ) && ( 'reset' === $_GET['wpbc_setup_wizard'] ) ) {
1539 // $my_system_buttons .= '<script type="text/javascript"> window.location.href = "' . esc_url( wpbc_get_setup_wizard_page_url() ) . '"; </script>';
1540 // }
1541 $my_system_buttons .= ' <a class="button button-secondary" style="background:#fff9e6;" href="'
1542 . esc_url( wpbc_get_settings_url()
1543 . '&wpbc_setup_wizard=completed&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) ) .'">'
1544 . 'Set Setup Wizard as Completed'
1545 . '</a>';
1546 }
1547
1548 $this->fields['tools_section_buttons']['value'][] =
1549 '<div class="wpbc_booking_system_info_buttons_align">'
1550 . $my_system_buttons
1551 . '</div>';
1552 }
1553
1554 // </editor-fold>
1555
1556
1557 // <editor-fold defaultstate="collapsed" desc=" Transaltions " >
1558
1559 $this->fields['help_translation_section_after_legend_items'] = array(
1560 'type' => 'help'
1561 , 'value' => wpbc_get_help_rows_about_config_in_several_languges()
1562 , 'class' => ''
1563 , 'css' => 'margin:0;padding:0;border:0;'
1564 , 'description' => ''
1565 , 'cols' => 2
1566 , 'group' => 'translations'
1567 , 'tr_class' => ''
1568 , 'description_tag' => 'p'
1569 );
1570 $this->fields['hr_help_translation_section_after_legend_items'] = array( 'type' => 'hr', 'group' => 'translations' );
1571
1572 $this->fields['booking_translation_load_from'] = array(
1573 'type' => 'select'
1574 , 'default' => 'top'
1575 , 'title' => __('Firstly load translation', 'booking')
1576 , 'options' => array(
1577 'wp.org' => 'WordPress.org '
1578 , 'wpbc' => __( 'Local', 'booking' )
1579 )
1580 , 'group' => 'translations'
1581 , 'is_demo_safe' => wpbc_is_this_demo()
1582 );
1583
1584 $this->fields['help_translation_section_after_translation_load_from'] = array(
1585 'type' => 'help'
1586 , 'value' => array(
1587 sprintf(
1588 /* translators: 1: ... */
1589 __( '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')
1590 , '"<strong>../wp-content/languages/plugins/</strong>"'
1591 , '"<strong>../wp-content/plugins/{Booking Calendar Folder}/languages/</strong>"' )
1592 )
1593 , 'class' => ''
1594 , 'css' => 'margin:0;padding:0;border:0;'
1595 , 'description' => ''
1596 , 'cols' => 2
1597 , 'group' => 'translations'
1598 , 'tr_class' => ''
1599 , 'description_tag' => 'p'
1600 );
1601 // </editor-fold>
1602
1603 }
1604
1605
1606 /**
1607 * Add Custon JavaScript - for some specific settings options
1608 * Need to executes after showing of entire settings page (on hook: wpbc_after_settings_content).
1609 * After initial definition of settings, and possible definition after POST request.
1610 *
1611 * @param type $menu_slug
1612 *
1613 */
1614 public function enqueue_js( $menu_slug, $active_page_tab, $active_page_subtab ) {
1615
1616 $js_script = '';
1617
1618 // Hide 'Title of booked timeslot(s)' items //FixIn: 9.5.0.2.2
1619 $js_script .= "
1620 if ( jQuery('#set_gen_booking_disable_timeslots_in_tooltip').is(':checked') ) {
1621 jQuery('.wpbc_booking_timeslots_in_tooltip').addClass('hidden_items');
1622 }
1623 ";
1624 // Hide or Show 'Title of booked timeslot(s)' on click checkbox
1625 $js_script .= " jQuery('#set_gen_booking_disable_timeslots_in_tooltip').on( 'change', function(){
1626 if ( this.checked ) {
1627 jQuery('.wpbc_booking_timeslots_in_tooltip').addClass('hidden_items');
1628 } else {
1629 jQuery('.wpbc_booking_timeslots_in_tooltip').removeClass('hidden_items');
1630 }
1631 } ); ";
1632
1633 // FixIn: 9.6.3.5.
1634
1635 // Hide Legend items
1636 $js_script .= "
1637 if ( ! jQuery('#set_gen_booking_is_show_legend').is(':checked') ) {
1638 jQuery('.wpbc_calendar_legend_items').addClass('hidden_items');
1639 }
1640 ";
1641 // Hide or Show Legend items on click checkbox
1642 $js_script .= " jQuery('#set_gen_booking_is_show_legend').on( 'change', function(){
1643 if ( this.checked ) {
1644 jQuery('.wpbc_calendar_legend_items').removeClass('hidden_items');
1645 } else {
1646 jQuery('.wpbc_calendar_legend_items').addClass('hidden_items');
1647 }
1648 } ); ";
1649 // Thank you Message or Page
1650 $js_script .= "
1651 if ( jQuery('#type_of_thank_you_message_message').is(':checked') ) {
1652 jQuery('.wpbc_calendar_thank_you_page').addClass('hidden_items');
1653 }
1654 if ( jQuery('#type_of_thank_you_message_page').is(':checked') ) {
1655 jQuery('.wpbc_calendar_thank_you_message').addClass('hidden_items');
1656 }
1657 ";
1658 $js_script .= " jQuery('input[name=\"set_gen_booking_type_of_thank_you_message\"]').on( 'change', function(){
1659 if ( jQuery('#type_of_thank_you_message_message').is(':checked') ) {
1660 jQuery('.wpbc_calendar_thank_you_message').removeClass('hidden_items');
1661 jQuery('.wpbc_calendar_thank_you_page').addClass('hidden_items');
1662 } else {
1663 jQuery('.wpbc_calendar_thank_you_message').addClass('hidden_items');
1664 jQuery('.wpbc_calendar_thank_you_page').removeClass('hidden_items');
1665 }
1666 } ); ";
1667
1668 // Default calendar view mode (Booking Listing) - set active / inctive options depend from resource selection.
1669 $js_script .= " jQuery('#set_gen_booking_view_days_num').on( 'focus', function(){
1670 if ( jQuery('#set_gen_booking_default_booking_resource').length > 0 ) {
1671 jQuery('#set_gen_booking_default_booking_resource').on('change', function() {
1672 jQuery('#set_gen_booking_view_days_num option:eq(2)').prop('selected', true);
1673 });
1674 if ( jQuery('#set_gen_booking_default_booking_resource').val() == '' ) {
1675 jQuery('#set_gen_booking_view_days_num option:eq(0)').prop('disabled', false);
1676 jQuery('#set_gen_booking_view_days_num option:eq(1)').prop('disabled', false);
1677 jQuery('#set_gen_booking_view_days_num option:eq(2)').prop('disabled', false);
1678 jQuery('#set_gen_booking_view_days_num option:eq(3)').prop('disabled', false);
1679 jQuery('#set_gen_booking_view_days_num option:eq(4)').prop('disabled', true);
1680 jQuery('#set_gen_booking_view_days_num option:eq(5)').prop('disabled', true);
1681 } else {
1682 jQuery('#set_gen_booking_view_days_num option:eq(0)').prop('disabled', true);
1683 jQuery('#set_gen_booking_view_days_num option:eq(1)').prop('disabled', true);
1684 jQuery('#set_gen_booking_view_days_num option:eq(2)').prop('disabled', false);
1685 jQuery('#set_gen_booking_view_days_num option:eq(3)').prop('disabled', true);
1686 jQuery('#set_gen_booking_view_days_num option:eq(4)').prop('disabled', false);
1687 jQuery('#set_gen_booking_view_days_num option:eq(5)').prop('disabled', false);
1688 }
1689 }
1690 } ); ";
1691
1692 ////////////////////////////////////////////////////////////////////////
1693 // Set correct value for dates format, depend on from selection of radio buttons
1694 $booking_date_format = esc_js( get_bk_option( 'booking_date_format') ); // FixIn: 10.6.1.2.
1695 // On initial Load set correct text value and correct radio button
1696 $js_script .= "
1697 // Select by default Custom value, later check all other predefined values
1698 jQuery( '#date_format_selection_custom' ).prop('checked', true);
1699
1700 jQuery('input[name=\"set_gen_booking_date_format_selection\"]').each(function() {
1701 var radio_button_value = jQuery( this ).val()
1702 var encodedStr = radio_button_value.replace(/[\u00A0-\u9999<>\&]/gim, function(i) {
1703 return '&#'+i.charCodeAt(0)+';';
1704 });
1705 if ( encodedStr == '". $booking_date_format ."' ) {
1706 jQuery( this ).prop('checked', true);
1707 }
1708 });
1709
1710 jQuery('#set_gen_booking_date_format').val('". $booking_date_format ."');
1711 ";
1712 // On click Radio button "Date Format", - set value in custom Text field
1713 $js_script .= " jQuery('input[name=\"set_gen_booking_date_format_selection\"]').on( 'change', function(){
1714 if ( ( this.checked ) && ( jQuery(this).val() != 'custom' ) ){
1715
1716 jQuery('#set_gen_booking_date_format').val( jQuery(this).val().replace(/[\u00A0-\u9999<>\&]/gim,
1717 function(i) {
1718 return '&#'+i.charCodeAt(0)+';';
1719 })
1720 );
1721 }
1722 } ); ";
1723 // If we edit custom "Date Format" Text field - select Custom Radio button.
1724 $js_script .= " jQuery('#set_gen_booking_date_format').on( 'change', function(){
1725 jQuery( '#date_format_selection_custom' ).prop('checked', true);
1726 } ); ";
1727
1728 ////////////////////////////////////////////////////////////////////////
1729 // Set correct value for Time Format, depend on from selection of radio buttons
1730 $booking_time_format = esc_js( get_bk_option( 'booking_time_format') ); // FixIn: 10.6.1.2.
1731 // Function to load on initial stage of page loading, set correct value of text and select correct radio button.
1732 $js_script .= "
1733 // Select by default Custom value, later check all other predefined values
1734 jQuery( '#time_format_selection_custom' ).prop('checked', true);
1735
1736 jQuery('input[name=\"set_gen_booking_time_format_selection\"]').each(function() {
1737 var radio_button_value = jQuery( this ).val()
1738 var encodedStr = radio_button_value.replace(/[\u00A0-\u9999<>\&]/gim, function(i) {
1739 return '&#'+i.charCodeAt(0)+';';
1740 });
1741 if ( encodedStr == '". $booking_time_format ."' ) {
1742 jQuery( this ).prop('checked', true);
1743 }
1744 });
1745
1746 jQuery('#set_gen_booking_time_format').val('". $booking_time_format ."');
1747 ";
1748 // On click Radio button "Time Format", - set value in custom Text field
1749 $js_script .= " jQuery('input[name=\"set_gen_booking_time_format_selection\"]').on( 'change', function(){
1750 if ( ( this.checked ) && ( jQuery(this).val() != 'custom' ) ){
1751
1752 jQuery('#set_gen_booking_time_format').val( jQuery(this).val().replace(/[\u00A0-\u9999<>\&]/gim,
1753 function(i) {
1754 return '&#'+i.charCodeAt(0)+';';
1755 })
1756 );
1757 }
1758 } ); ";
1759 // If we edit custom "Date Format" Text field - select Custom Radio button.
1760 $js_script .= " jQuery('#set_gen_booking_time_format').on( 'change', function(){
1761 jQuery( '#time_format_selection_custom' ).prop('checked', true);
1762 } ); ";
1763
1764 // Click on Show Advanced JavaScript section link
1765 $js_script .= " jQuery('#wpbc_show_advanced_section_link_show').on( 'click', function(){
1766 jQuery('#wpbc_show_advanced_section_link_show').toggle(200);
1767 jQuery('#wpbc_show_advanced_section_link_hide').animate( {opacity: 1}, 200 ).toggle(200);
1768 jQuery('.wpbc_advanced_js_loading_settings').removeClass('hidden_items');
1769
1770 if ( ! jQuery('#set_gen_booking_is_load_js_css_on_specific_pages').is(':checked') ) {
1771 jQuery('.wpbc_is_load_js_css_on_specific_pages').addClass('hidden_items');
1772 }
1773 } ); ";
1774 $js_script .= " jQuery('#wpbc_show_advanced_section_link_hide').on( 'click', function(){
1775 jQuery('#wpbc_show_advanced_section_link_hide').toggle(200);
1776 jQuery('#wpbc_show_advanced_section_link_show').animate( {opacity: 1}, 200 ).toggle(200);
1777 jQuery('.wpbc_advanced_js_loading_settings').addClass('hidden_items');
1778 } ); ";
1779 $js_script .= " jQuery('#set_gen_booking_is_load_js_css_on_specific_pages').on( 'change', function(){
1780 if ( this.checked ) {
1781 var answer = confirm('"
1782 . esc_js( __( 'Warning', 'booking' ) ) . '! '
1783 . 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' ) )
1784 . "' );
1785 if ( answer) {
1786 this.checked = true;
1787 jQuery('.wpbc_is_load_js_css_on_specific_pages').removeClass('hidden_items');
1788 } else {
1789 this.checked = false;
1790 }
1791 } else {
1792 jQuery('.wpbc_is_load_js_css_on_specific_pages').addClass('hidden_items');
1793 }
1794 } );
1795 if ( ! jQuery('#set_gen_booking_is_load_js_css_on_specific_pages').is(':checked') ) {
1796 jQuery('.wpbc_is_load_js_css_on_specific_pages').addClass('hidden_items');
1797 }
1798
1799 ";
1800
1801
1802 // Click on Powered by links
1803 $js_script .= " jQuery('#wpbc_powered_by_link_show').on( 'click', function(){
1804 jQuery('#wpbc_powered_by_link_show').toggle(200);
1805 jQuery('#wpbc_powered_by_link_hide').animate( {opacity: 1}, 200 ).toggle(200);
1806 jQuery('.wpbc_is_show_powered_by_notice').removeClass('hidden_items');
1807 } ); ";
1808 $js_script .= " jQuery('#wpbc_powered_by_link_hide').on( 'click', function(){
1809 jQuery('#wpbc_powered_by_link_hide').toggle(200);
1810 jQuery('#wpbc_powered_by_link_show').animate( {opacity: 1}, 200 ).toggle(200);
1811 jQuery('.wpbc_is_show_powered_by_notice').addClass('hidden_items');
1812 } ); ";
1813
1814
1815 // Show confirmation window, if user activate this checkbox
1816 $js_script .= " jQuery('#set_gen_booking_is_delete_if_deactive').on( 'change', function(){
1817 if ( this.checked ) {
1818 var answer = confirm('"
1819 . esc_js( __( 'Warning', 'booking' ) ) . '! '
1820 . 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' ) )
1821 . "' );
1822 if ( answer) {
1823 this.checked = true;
1824 } else {
1825 this.checked = false;
1826 }
1827 }
1828 } );
1829 ";
1830
1831
1832
1833
1834
1835 // ============================================================================================================= // FixIn: 10.1.5.4.
1836 // 'Dates selection' - some options hide or show
1837 // =============================================================================================================
1838
1839 // Initial Hiding some Sections in settings
1840 $js_script .= " function wpbc_check_showing_range_days_selection_sections() {
1841 // Single selected
1842 if ( jQuery('#type_of_day_selections_single').is(':checked') ) {
1843 jQuery('.wpbc_recurrent_check_in_out_time_slots').addClass('hidden_items'); // Hide Reccurent, Check in/out Sections
1844
1845 jQuery('#set_gen_booking_last_checkout_day_available').prop('checked', false); // Uncheck Recurrent
1846
1847 jQuery('#set_gen_booking_recurrent_time').prop('checked', false); // Uncheck Reccurent
1848 jQuery('#set_gen_booking_range_selection_time_is_active').prop('checked', false); // and Check In/Out
1849
1850 jQuery('.wpbc_range_days_selection').addClass('hidden_items'); // Hide Range section
1851 } // Multiple selected
1852 if ( jQuery('#type_of_day_selections_multiple').is(':checked') ) {
1853 jQuery('.wpbc_recurrent_check_in_out_time_slots').removeClass('hidden_items'); // Show Reccurent, Check in/out Sections
1854
1855 jQuery('.wpbc_range_days_selection').addClass('hidden_items'); // Hide Range section
1856 }
1857 // Range selected
1858 if ( jQuery('#type_of_day_selections_range').is(':checked') ) {
1859
1860 jQuery('.wpbc_recurrent_check_in_out_time_slots').removeClass('hidden_items'); // Show Reccurent, Check in/out Sections
1861
1862 jQuery('.wpbc_range_days_selection').removeClass('hidden_items'); // Show Range section
1863 jQuery('.wpbc_tr_set_gen_booking_range_start_day_week fieldset').removeClass('hidden_items');
1864 jQuery('.wpbc_tr_set_gen_booking_range_start_day_dynamic_week fieldset').removeClass('hidden_items');
1865
1866 // Fixed selected
1867 if ( jQuery('#range_selection_type_fixed').is(':checked') ) {
1868 jQuery('.wpbc_range_dynamic_selection').addClass('hidden_items');
1869 // Any Week Days selected
1870 if ( jQuery('#range_fixed_start_day_any_day').is(':checked') ) {
1871 jQuery('.wpbc_tr_set_gen_booking_range_start_day_week fieldset').addClass('hidden_items');
1872 }
1873 }
1874 // Dynamic selected
1875 if ( jQuery('#range_selection_type_dynamic').is(':checked') ) {
1876 jQuery('.wpbc_range_fixed_selection').addClass('hidden_items');
1877 // Any Week Days selected
1878 if ( jQuery('#range_dynamic_start_day_any_day').is(':checked') ) {
1879 jQuery('.wpbc_tr_set_gen_booking_range_start_day_dynamic_week fieldset').addClass('hidden_items');
1880 }
1881 }
1882 }
1883
1884 if ( jQuery('#set_gen_booking_range_selection_time_is_active').is(':checked') ) { // Check In/Out selected
1885 jQuery('.wpbc_check_in_out_time_slots').removeClass('hidden_items'); // Show Check In/Out times
1886 } else {
1887 jQuery('.wpbc_check_in_out_time_slots').addClass('hidden_items'); // Hide Check In/Out times
1888 }
1889 }
1890 wpbc_check_showing_range_days_selection_sections(); // Run first time to init
1891 ";
1892
1893 // Hiding or showing section based on User Clicks in settings
1894 $list_of_id_to_hook = array(
1895 '#type_of_day_selections_single'
1896 , '#type_of_day_selections_multiple'
1897 , '#type_of_day_selections_range'
1898 , '#range_selection_type_fixed'
1899 , '#range_selection_type_dynamic'
1900 , '#range_fixed_start_day_specific_day'
1901 , '#range_fixed_start_day_any_day'
1902 , '#range_dynamic_start_day_specific_day'
1903 , '#range_dynamic_start_day_any_day'
1904 );
1905 $list_of_id_to_hook = implode( ',', $list_of_id_to_hook );
1906
1907 // Click on "Days Selections", "Type of range", "Start Week days" checkboxes or radioboxes, show/hide sections.
1908 $js_script .= " jQuery('{$list_of_id_to_hook}').on( 'change', function(){
1909 wpbc_check_showing_range_days_selection_sections();
1910 } ); ";
1911
1912 // Click on "Recurrent Time" - then Uncheck "Check In/Out" and hide show sections.
1913 $js_script .= " jQuery('#set_gen_booking_recurrent_time').on( 'change', function(){
1914 if ( this.checked ) {
1915 jQuery('#set_gen_booking_range_selection_time_is_active').prop('checked', false);
1916 }
1917 wpbc_check_showing_range_days_selection_sections();
1918 } ); ";
1919
1920 // Click on "Check In/Out" - then Uncheck "Recurrent Time" and hide show sections.
1921 $js_script .= " jQuery('#set_gen_booking_range_selection_time_is_active').on( 'change', function(){
1922 if ( this.checked ) {
1923 jQuery('#set_gen_booking_recurrent_time').prop('checked', false);
1924 jQuery('#set_gen_booking_last_checkout_day_available').prop('checked', false); // Uncheck Reccurent
1925 }
1926 wpbc_check_showing_range_days_selection_sections();
1927 } ); ";
1928
1929 // Confirmation Section configuration
1930 $js_script .= "
1931 if ( ! jQuery('#set_gen_booking_confirmation__personal_info__header_enabled').is(':checked') ) {
1932 jQuery('.wpbc_booking_confirmation__personal_info__field').addClass('wpbc_field_disabled');
1933 jQuery('.wpbc_booking_confirmation__personal_info__fields').addClass('hidden_items');
1934 }
1935 ";
1936 $js_script .= " jQuery('#set_gen_booking_confirmation__personal_info__header_enabled').on( 'change', function(){
1937 if ( ! this.checked ) {
1938 jQuery('.wpbc_booking_confirmation__personal_info__field').addClass('wpbc_field_disabled');
1939 jQuery('.wpbc_booking_confirmation__personal_info__fields').addClass('hidden_items');
1940 } else {
1941 jQuery('.wpbc_booking_confirmation__personal_info__field').removeClass('wpbc_field_disabled');
1942 jQuery('.wpbc_booking_confirmation__personal_info__fields').removeClass('hidden_items');
1943 }
1944 } ); ";
1945 $js_script .= "
1946 if ( ! jQuery('#set_gen_booking_confirmation__booking_details__header_enabled').is(':checked') ) {
1947 jQuery('.wpbc_booking_confirmation__booking_details__field').addClass('wpbc_field_disabled');
1948 jQuery('.wpbc_booking_confirmation__booking_details__fields').addClass('hidden_items');
1949 }
1950 ";
1951 $js_script .= " jQuery('#set_gen_booking_confirmation__booking_details__header_enabled').on( 'change', function(){
1952 if ( ! this.checked ) {
1953 jQuery('.wpbc_booking_confirmation__booking_details__field').addClass('wpbc_field_disabled');
1954 jQuery('.wpbc_booking_confirmation__booking_details__fields').addClass('hidden_items');
1955 } else {
1956 jQuery('.wpbc_booking_confirmation__booking_details__field').removeClass('wpbc_field_disabled');
1957 jQuery('.wpbc_booking_confirmation__booking_details__fields').removeClass('hidden_items');
1958 }
1959 } ); ";
1960
1961 $js_script .= "
1962 if ( ! jQuery('#set_gen_booking_confirmation_header_enabled').is(':checked') ) {
1963 jQuery('.wpbc_booking_confirmation_header__field').addClass('wpbc_field_disabled');
1964 }
1965 ";
1966 $js_script .= " jQuery('#set_gen_booking_confirmation_header_enabled').on( 'change', function(){
1967 if ( ! this.checked ) {
1968 jQuery('.wpbc_booking_confirmation_header__field').addClass('wpbc_field_disabled');
1969 } else {
1970 jQuery('.wpbc_booking_confirmation_header__field').removeClass('wpbc_field_disabled');
1971 }
1972 } ); ";
1973
1974
1975 // Enqueue JS to the footer of the page
1976 wpbc_enqueue_js( $js_script );
1977 }
1978
1979 }
1980
1981
1982 /**
1983 * Override VALIDATED fields BEFORE saving to DB
1984 * Description:
1985 * Check "Thank you page" URL
1986 *
1987 * @param array $validated_fields
1988 */
1989 function wpbc_settings_validate_fields_before_saving__all( $validated_fields ) {
1990
1991
1992 $validated_fields['booking_thank_you_page_URL'] = wpbc_make_link_relative( $validated_fields['booking_thank_you_page_URL'] );
1993
1994 unset( $validated_fields[ 'booking_date_format_selection' ] ); // We do not need to this field, because saving to DB only: "date_format" field
1995 unset( $validated_fields[ 'booking_time_format_selection' ] ); // We do not need to this field, because saving to DB only: "time_format" field
1996
1997 // Unset promote fields
1998 foreach ( $validated_fields as $field_name => $field_value ) {
1999 if ( strpos( $field_name, '__promote_upgrade' ) > 0 ) {
2000 unset( $validated_fields[ $field_name ] );
2001 }
2002 }
2003
2004 return $validated_fields;
2005 }
2006 add_filter( 'wpbc_settings_validate_fields_before_saving', 'wpbc_settings_validate_fields_before_saving__all', 10, 1 ); // Hook for validated fields.
2007
2008
2009 /**
2010 * Load Code mirror highlighter for Booking Confirmation at the WP Booking Calendar > Settings General page in "Booking Confirmation" section
2011 *
2012 * @param $page_name
2013 *
2014 * @return false|void
2015 */
2016 function wpbc_hook_settings_page_footer__define_code_mirror( $page_name ) {
2017
2018 if ( 'general_settings' != $page_name ) {
2019 return false;
2020 }
2021
2022 $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.
2023
2024 if ( $is_use_code_mirror ) {
2025
2026 wpbc_codemirror()->set_codemirror( array(
2027 'textarea_id' => '#set_gen_booking_confirmation__personal_info__content'
2028 // , 'preview_id' => '#wpbc_add_form_html_preview'
2029 ) );
2030 wpbc_codemirror()->set_codemirror( array(
2031 'textarea_id' => '#set_gen_booking_confirmation__booking_details__content'
2032 // , 'preview_id' => '#wpbc_add_form_html_preview'
2033 ) );
2034
2035 }
2036 }
2037 //add_action( 'wpbc_hook_settings_page_footer', 'wpbc_hook_settings_page_footer__define_code_mirror' );
2038