PluginProbe
Booking Calendar / 11.9
Booking Calendar v11.9
11.9 11.8.4 11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 All 205 releases
booking / core / admin / api-settings.php

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

2,124 lines 138.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @version 1.0
4 * @package General Settings API - Saving different options
5 * @category Settings API
6 * @author wpdevelop
7 *
8 * @web-site https://wpbookingcalendar.com/
9 * @email [email protected]
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 if ( class_exists( 'wpdev_bk_personal' ) ) {
928 $this->fields['booking_admin_edit_booking_mode'] = array(
929 'type' => 'select',
930 'default' => $default_options_values['booking_admin_edit_booking_mode'],
931 'title' => __( 'Edit booking in', 'booking' ),
932 'description' => __( 'Choose whether Edit booking opens in a popup or on the dedicated Add Booking page.', 'booking' ),
933 'options' => array(
934 'popup' => __( 'Popup window (default)', 'booking' ),
935 'add_booking_page' => __( 'Add Booking page', 'booking' ),
936 ),
937 'group' => 'booking_listing',
938 );
939 }
940
941 // Default booking resources.
942 $this->fields = apply_filters( 'wpbc_settings_booking_listing_br_default_count', $this->fields, $default_options_values );
943
944
945 // FixIn: 8.6.1.13.
946
947 // Calendar Default View mode
948 if ( class_exists( 'wpdev_bk_personal' ) )
949 $field_options = array(
950 '1' => __('Day' ,'booking')
951 , '7' => __('Week' ,'booking')
952 , '30' => __('Month' ,'booking')
953 , '60' => __('2 Months' ,'booking')
954 , '90' => __('3 Months' ,'booking')
955 , '365' => __('Year' ,'booking')
956 );
957 else
958 $field_options = array(
959 '30' => __('Month' ,'booking') // Day ?
960 , '90' => __('3 Months' ,'booking') // Week ?
961 , '365' => __('Year' ,'booking') // Month ?
962 );
963 $this->fields['booking_view_days_num'] = array(
964 'type' => 'select'
965 , 'default' => $default_options_values['booking_view_days_num'] //'30'
966 , 'title' => __('Default view mode', 'booking')
967 , 'description' => __('Select your default calendar view mode at booking calendar overview page' ,'booking')
968 , 'options' => $field_options
969 , 'group' => 'booking_calendar_overview' //FixIn: 8.5.2.20 // FixIn: 8.9.4.4.
970 );
971
972 // FixIn: 8.9.4.3.
973 $field_options = array();
974 foreach ( range( 1, 31, 1) as $value ) {
975 $field_options[ $value ] = $value;
976 }
977 $this->fields['booking_calendar_overview__day_mode__days_number_show'] = array(
978 'type' => 'select'
979 , 'default' => $default_options_values['booking_calendar_overview__day_mode__days_number_show'] // 31
980 , 'title' => __('Days number to show in day view mode', 'booking')
981 /* translators: 1: ... */
982 , 'description' => sprintf( __( 'Select number of days to show in %1$sDay%2$s view mode', 'booking' ),'<b>','</b>')
983 . ( ( class_exists( 'wpdev_bk_personal' ) ) ? ' ' . __( 'for one booking resource', 'booking' ) : '' )
984 , 'options' => $field_options
985 , 'group' => 'booking_calendar_overview' // FixIn: 8.9.4.4.
986 );
987 $this->fields['booking_timeline__month_mode__days_number_show'] = array(
988 'type' => 'select'
989 , 'default' => $default_options_values['booking_timeline__month_mode__days_number_show'] //31
990 , 'title' => __('Days number to show in month view mode', 'booking')
991 , 'description' => __('Select number of days to show in month view mode for one booking resource.' ,'booking')
992 , 'options' => $field_options
993 , 'group' => 'booking_timeline'
994 );
995
996
997 //Default Titles in Calendar cells
998 $this->fields = apply_filters( 'wpbc_settings_booking_listing_timeline_title_in_day', $this->fields, $default_options_values );
999
1000
1001 // FixIn: 9.6.3.5.
1002
1003 // <editor-fold defaultstate="collapsed" desc=" == Dates : Time == " >
1004 $timezone_error_message = '';
1005 if ( 'UTC' !== date_default_timezone_get() ) {
1006 $timezone_error_message .= '<div style="line-height: 2em;margin-bottom:2em;" class="wpbc-settings-notice notice-error">';
1007 $timezone_error_message .= '<strong>' . esc_html__( 'PHP default timezone is invalid', 'booking' ) . '</strong>. ';
1008 $timezone_error_message .= '<a href="' . esc_url( admin_url( 'site-health.php' ) ) . '">' . __( 'Read more' , 'booking' ) . '</a>' . '<br/>';
1009 /* translators: 1: ... */
1010 $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>' );
1011 $timezone_error_message .= '</div>';
1012 }
1013
1014 $this->fields['system_timezones'] = array(
1015 'type' => 'html'
1016 , 'html' => $timezone_error_message
1017 . '<div style="line-height: 2em;">'
1018 . __( 'Server Default Timezone', 'booking' ) . ': <strong>' . date_default_timezone_get() . '</strong><br/>'
1019 . __( 'WordPress Timezone', 'booking' ) . ': <strong>' . wp_timezone()->getName() . '</strong>'
1020 . '</div>'
1021
1022 , 'class' => ''
1023 , 'css' => 'margin:0;padding:0;border:0;'
1024 , 'cols' => 2
1025 , 'group' => 'date_time'
1026 );
1027
1028 $this->fields['hr_booking_date_format'] = array( 'type' => 'hr', 'group' => 'date_time' );
1029 // -------------------------------------------------------------------------------------------------------------
1030 // Default Dates View Mode
1031 // -------------------------------------------------------------------------------------------------------------
1032 $this->fields['booking_date_view_type'] = array(
1033 'type' => 'select'
1034 , 'default' => $default_options_values['booking_date_view_type'] //'short'
1035 , 'title' => __('Dates view', 'booking')
1036 , 'description' => __('Select the default view for dates on the booking tables' ,'booking')
1037 , 'options' => array(
1038 'short' => __('Short days view' ,'booking')
1039 , 'wide' => __('Wide days view' ,'booking')
1040 )
1041 , 'group' => 'date_time'
1042 );
1043 $this->fields['hr_booking_time_format'] = array( 'type' => 'hr', 'group' => 'date_time' );
1044 // -------------------------------------------------------------------------------------------------------------
1045 // Dates : Time
1046 // -------------------------------------------------------------------------------------------------------------
1047
1048 $this->fields['booking_date_format_html_prefix'] = array(
1049 'type' => 'pure_html'
1050 , 'group' => 'date_time'
1051 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_date_format">
1052 <th scope="row">'.
1053 WPBC_Settings_API::label_static( 'set_gen_booking_date_format'
1054 , array( 'title'=> __('Date Format' ,'booking'), 'label_css' => 'margin: 0.25em 0 !important;vertical-align: middle;' ) )
1055 .'</th>
1056 <td><fieldset>'
1057 );
1058 $field_options = array();
1059 foreach ( array( 'j M Y', 'F j, Y', 'Y/m/d', 'm/d/Y', 'd/m/Y' ) as $format ) {
1060 $field_options[ esc_attr($format) ] = array( 'title' => date_i18n( $format ) );
1061 }
1062 $field_options['custom'] = array( 'title' => __('Custom' ,'booking') . ':', 'attr' => array( 'id' => 'date_format_selection_custom' ) );
1063
1064 $this->fields['booking_date_format_selection'] = array(
1065 'type' => 'radio'
1066 , 'default' => get_option('date_format')
1067 , 'options' => $field_options
1068 , 'group' => 'date_time'
1069 , 'only_field' => true
1070 , 'is_new_line' => !true
1071 );
1072
1073 $booking_date_format = get_bk_option( 'booking_date_format');
1074 $this->fields['booking_date_format'] = array(
1075 'type' => 'text'
1076 , 'default' => $default_options_values['booking_date_format'] //get_option('date_format')
1077 , 'value' => htmlentities( $booking_date_format ) // Display value of this field in specific way
1078 , 'group' => 'date_time'
1079 , 'placeholder' => get_option('date_format')
1080 , 'css' => 'width:auto;margin: 10px 0;'
1081 , 'only_field' => true
1082 );
1083 $this->fields['booking_date_format_html_sufix'] = array(
1084 'type' => 'pure_html'
1085 , 'group' => 'date_time'
1086 , 'html' => '<span class="description" style="padding:0;"><code>' . date_i18n( $booking_date_format ) . '</code></span>
1087 </fieldset>
1088 </td>
1089 </tr>'
1090 );
1091 $this->fields['booking_date_format_help'] = array(
1092 'type' => 'html'
1093 , 'html' => '<div style="line-height: 2em;">'.
1094 /* translators: 1: ... */
1095 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>')
1096 .'</div>'
1097 , 'class' => ''
1098 , 'css' => 'margin:0;padding:0;border:0;'
1099 , 'description' => ''
1100 , 'cols' => 2
1101 , 'group' => 'date_time'
1102 , 'tr_class' => ''
1103 , 'description_tag' => 'div'
1104 );
1105
1106
1107 // -------------------------------------------------------------------------------------------------------------
1108 // Time Format
1109 // -------------------------------------------------------------------------------------------------------------
1110
1111 $this->fields['booking_time_format_html_prefix'] = array(
1112 'type' => 'pure_html'
1113 , 'group' => 'date_time'
1114 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_time_format">
1115 <th scope="row">'.
1116 WPBC_Settings_API::label_static( 'set_gen_booking_time_format'
1117 , array( 'title'=> __('Time Format' ,'booking'), 'label_css' => 'margin: 0.25em 0 !important;vertical-align: middle;' ) )
1118 .'</th>
1119 <td><fieldset>'
1120 );
1121 $field_options = array();
1122 foreach ( array( 'g:i a', 'g:i A', 'H:i' ) as $format ) {
1123 $field_options[ esc_attr($format) ] = array( 'title' => date_i18n( $format ) );
1124 }
1125 $field_options['custom'] = array( 'title' => __('Custom' ,'booking') . ':', 'attr' => array( 'id' => 'time_format_selection_custom' ) );
1126
1127 $this->fields['booking_time_format_selection'] = array(
1128 'type' => 'radio'
1129 , 'default' => 'H:i'
1130 , 'options' => $field_options
1131 , 'group' => 'date_time'
1132 , 'only_field' => true
1133 , 'is_new_line' => ! true
1134 );
1135
1136 $booking_time_format = get_bk_option( 'booking_time_format');
1137 $this->fields['booking_time_format'] = array(
1138 'type' => 'text'
1139 , 'default' => $default_options_values['booking_time_format'] //'H:i'
1140 , 'value' => htmlentities( $booking_time_format ) // Display value of this field in specific way
1141 , 'group' => 'date_time'
1142 , 'placeholder' => 'H:i'
1143 , 'css' => 'width:auto; margin: 10px 0;'
1144 , 'only_field' => true
1145 );
1146 $this->fields['booking_time_format_html_sufix'] = array(
1147 'type' => 'pure_html'
1148 , 'group' => 'date_time'
1149 , 'html' => '<span class="description" style="padding:0;"><code>' . date_i18n( $booking_time_format ) . '</code></span>
1150 </fieldset>
1151 </td>
1152 </tr>'
1153 );
1154 $this->fields['booking_time_format_help'] = array(
1155 'type' => 'html'
1156 , 'html' => '<div style="line-height: 2em;">'.
1157 /* translators: 1: ... */
1158 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>')
1159 .'</div>'
1160 , 'class' => ''
1161 , 'css' => 'margin:0;padding:0;border:0;'
1162 , 'description' => ''
1163 , 'cols' => 2
1164 , 'group' => 'date_time'
1165 , 'tr_class' => ''
1166 , 'description_tag' => 'div'
1167 );
1168
1169
1170
1171 // </editor-fold>
1172
1173
1174
1175 // Divider ///////////////////////////////////////////////////////////////
1176 $this->fields['hr_booking_listing_before_is_use_hints_at_admin_panel'] = array( 'type' => 'hr', 'group' => 'booking_listing' );
1177
1178
1179 // Show hide Notes
1180 $this->fields = apply_filters( 'wpbc_settings_booking_show_hide_options', $this->fields, $default_options_values ); // FixIn: 8.1.3.32.
1181
1182
1183 // </editor-fold>
1184
1185
1186 // <editor-fold defaultstate="collapsed" desc=" auto_cancelation_approval " >
1187
1188 // auto_cancelation_approval
1189 $this->fields = apply_filters( 'wpbc_settings_auto_cancelation_approval_section', $this->fields, $default_options_values );
1190 // </editor-fold>
1191
1192 // <editor-fold defaultstate="collapsed" desc=" Advanced " >
1193
1194 if ( wpbc_is_11_6_features_enabled() && wpbc_booking_resources_catalog_can_manage_settings() ) {
1195 $is_pro_compatible = wpbc_booking_resources_catalog_is_pro_compatible();
1196 $description = __( 'Choose the new or legacy pages for upgraded administration catalogs, including Seasonal Availability and Searchable Resources when their new catalogs are enabled. Legacy pages remain available for compatibility.', 'booking' );
1197
1198 if ( ! $is_pro_compatible ) {
1199 $pro_version = wpbc_booking_resources_catalog_get_pro_version();
1200 if ( '' === $pro_version ) {
1201 $pro_version = __( 'Unknown', 'booking' );
1202 }
1203
1204 /* translators: 1: Detected Booking Calendar Pro version, 2: Minimum compatible Pro version. */
1205 $description = sprintf( __( 'Legacy catalog mode is required because Booking Calendar Pro %1$s is active. Update Pro to %2$s or newer to use the new catalogs. Legacy pages remain available for compatibility.', 'booking' ), esc_html( $pro_version ), esc_html( wpbc_booking_resources_catalog_get_minimum_pro_version() ) );
1206 }
1207
1208 $this->fields['booking_resources_catalog_renderer'] = array(
1209 'type' => 'select',
1210 'default' => 'new',
1211 'title' => __( 'Use legacy catalog pages', 'booking' ),
1212 'description' => $description,
1213 'options' => array(
1214 'new' => __( 'No — use the new catalogs', 'booking' ),
1215 'legacy' => __( 'Yes — use legacy catalog pages (Deprecated)', 'booking' ),
1216 ),
1217 'group' => 'advanced',
1218 'disabled' => ! $is_pro_compatible,
1219 );
1220
1221 if ( ! $is_pro_compatible ) {
1222 $this->fields['booking_resources_catalog_renderer']['value'] = 'legacy';
1223 }
1224 }
1225
1226
1227 $this->fields = apply_filters( 'wpbc_settings_edit_url_hash', $this->fields, $default_options_values );
1228 // FixIn: 10.10.1.2 $this->fields = apply_filters( 'wpbc_settings_resource_no_update__during_editing', $this->fields, $default_options_values );
1229
1230 // Show advanced settings of JavaScript loading
1231
1232
1233 // //Show | Hide links for Advanced JavaScript section
1234 // $this->fields['booking_advanced_js_loading_settings'] = array(
1235 // 'type' => 'html'
1236 // , 'html' =>
1237 // '<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>'
1238 // . '<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>'
1239 // , 'cols' => 2
1240 // , 'group' => 'advanced'
1241 // );
1242
1243 // FixIn: 9.8.6.2.
1244 $balencer_options = array_combine( range( 1, 5 ), range( 1, 5 ) );
1245 $balencer_options[99] = __( 'All', 'booking' );
1246 $this->fields['booking_load_balancer_max_threads'] = array(
1247 'type' => 'select'
1248 , 'default' => $default_options_values['booking_load_balancer_max_threads']
1249 , 'title' => __('Parallel requests' ,'booking')
1250 , 'description' => __('Select the number of simultaneous requests to load data in multiple calendars.' ,'booking') . ' <sup style="color:#7812bd;"><strong> '.__('Performance','booking').'</strong></sup>'
1251 . '<div class="wpbc-general-settings-notice wpbc-settings-notice notice-info">'
1252 . __('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')
1253 .'</div>'
1254
1255 , 'options' => $balencer_options
1256 , 'group' => 'advanced'
1257 , 'is_demo_safe' => wpbc_is_this_demo()
1258 );
1259
1260
1261 $this->fields['booking_is_load_js_css_on_specific_pages'] = array(
1262 'type' => 'checkbox'
1263 , 'default' => $default_options_values['booking_is_load_js_css_on_specific_pages'] //'Off'
1264 , 'title' => __('Load JS and CSS files only on specific pages' ,'booking')
1265 , 'label' => __('Activate loading of CSS and JavaScript files of plugin only at specific pages.' ,'booking')
1266 , 'description' => ''
1267 , 'group' => 'advanced'
1268 , 'tr_class' => 'wpbc_advanced_js_loading_settings'//wpbc_advanced_js_loading_settings wpbc_sub_settings_grayed hidden_items'
1269 , 'is_demo_safe' => wpbc_is_this_demo()
1270 );
1271 $this->fields['booking_pages_for_load_js_css'] = array(
1272 'type' => 'textarea'
1273 , 'default' => $default_options_values['booking_pages_for_load_js_css'] //''
1274 , 'placeholder' => '/booking-form/'
1275 , 'title' => __('Relative URLs of pages, where to load plugin CSS and JS files' ,'booking')
1276 /* translators: 1: ... */
1277 , '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>')
1278 ,'description_tag' => 'p'
1279 , 'css' => 'width:100%'
1280 , 'rows' => 5
1281 , 'group' => 'advanced'
1282 , 'tr_class' => 'wpbc_advanced_js_loading_settings wpbc_is_load_js_css_on_specific_pages wpbc_sub_settings_grayed'// hidden_items'
1283 , 'is_demo_safe' => wpbc_is_this_demo()
1284 );
1285
1286 $this->fields['booking_form_is_using_bs_css'] = array(
1287 'type' => 'checkbox'
1288 , 'default' => $default_options_values['booking_form_is_using_bs_css'] // 'On'
1289 , 'title' => __('Use CSS BootStrap' ,'booking')
1290 , 'label' => __('Using BootStrap CSS for the form fields' ,'booking'). ' <sup style="color:#bd8212;"><strong> '.__('Deprecated','booking').'</strong></sup>'
1291 , 'description' => ''
1292 , 'description_tag' => 'p'
1293 , 'group' => 'advanced'
1294 );
1295
1296 //$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' );
1297 // FixIn: 7.2.1.15.
1298 $this->fields[ 'booking_is_show_system_debug_log' ] = array(
1299 'type' => 'checkbox'
1300 , 'default' => $default_options_values['booking_is_show_system_debug_log'] //'Off'
1301 , 'title' => __('Show system debugging log for beta features' ,'booking')
1302 , 'label' => __('Activate this option only for testing beta features' ,'booking')
1303 , 'description' => ''
1304 , 'group' => 'advanced'
1305 , 'tr_class' => 'wpbc_advanced_js_loading_settings'// wpbc_sub_settings_grayed hidden_items'
1306 , 'is_demo_safe' => wpbc_is_this_demo()
1307 );
1308
1309 //FixIn: 10.1.1.2 //TODO: Update Text here 2024-06-16 12:57
1310 $this->fields['booking_is_nonce_at_front_end'] = array(
1311 'type' => 'checkbox'
1312 , 'default' => $default_options_values['booking_is_nonce_at_front_end'] //'Off'
1313 , 'title' => __( 'Use Nonce Fields', 'booking' )
1314 , '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' )
1315 , 'description' => ''
1316 , 'group' => 'advanced'
1317 , 'tr_class' => 'wpbc_advanced_is_nonce' //wpbc_advanced_js_loading_settings wpbc_sub_settings_grayed hidden_items'
1318 , 'toggle_class' => 'wpbc_toggle_danger'
1319 , 'is_demo_safe' => wpbc_is_this_demo()
1320 );
1321
1322 if ( wpbc_is_this_demo() ) {
1323 $this->fields['booking_pages_for_load_js_css_demo'] = array( 'group' => 'advanced',
1324 'type' => 'html',
1325 'html' => wpbc_get_warning_text_in_demo_mode(),
1326 'cols' => 2,
1327 'tr_class' => 'wpbc_advanced_js_loading_settings'// wpbc_sub_settings_grayed hidden_items'
1328 );
1329 }
1330
1331 // Divider ///////////////////////////////////////////////////////////////
1332 $this->fields['hr_calendar_before_advanced_js_loading_settings'] = array( 'type' => 'hr', 'group' => 'advanced' );
1333
1334 // Show settings of powered by notice
1335 $this->fields['booking_advanced_powered_by_notice_settings'] = array(
1336 'type' => 'html'
1337 , 'html' =>
1338 '<a id="wpbc_powered_by_link_show" class="wpbc_expand_section_link" href="javascript:void(0)">+ ' . __('Show settings of powered by notice' ,'booking') . '</a>'
1339 . '<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>'
1340 , 'cols' => 2
1341 , 'group' => 'advanced'
1342 );
1343 $this->fields['booking_is_show_powered_by_notice'] = array(
1344 'type' => 'checkbox'
1345 , 'default' => $default_options_values['booking_is_show_powered_by_notice'] //'On'
1346 , 'title' => __('Powered by notice' ,'booking')
1347 , 'label' => sprintf(__(' Turn On/Off powered by "Booking Calendar" notice under the calendar.' ,'booking'),'wpbookingcalendar.com')
1348 , 'description' => ''
1349 , 'group' => 'advanced'
1350 , 'tr_class' => 'wpbc_is_show_powered_by_notice wpbc_sub_settings_grayed hidden_items'
1351 );
1352 $this->fields['booking_wpdev_copyright_adminpanel'] = array(
1353 'type' => 'checkbox'
1354 , 'default' => $default_options_values['booking_wpdev_copyright_adminpanel'] //'On'
1355 , 'title' => __('Help and info notices' ,'booking')
1356 , 'label' => sprintf(__(' Turn On/Off version notice and help info links at booking admin panel.' ,'booking'),'wpbookingcalendar.com')
1357 , 'description' => ''
1358 , 'group' => 'advanced'
1359 , 'tr_class' => 'wpbc_is_show_powered_by_notice wpbc_sub_settings_grayed hidden_items'
1360 , 'is_demo_safe' => wpbc_is_this_demo() // FixIn: 8.1.3.9.
1361 );
1362
1363 // </editor-fold>
1364
1365
1366 // <editor-fold defaultstate="collapsed" desc=" Information " >
1367 if(1){
1368 if ( function_exists( 'wpbc_get_dashboard_info' ) ) {
1369 $this->fields['booking_information'] = array(
1370 'type' => 'html'
1371 , 'html' => wpbc_get_dashboard_info()
1372 , 'cols' => 2
1373 , 'group' => 'information'
1374 );
1375 }
1376 }
1377 // </editor-fold>
1378
1379
1380 // <editor-fold defaultstate="collapsed" desc=" User permissions for plugin menu pages " >
1381
1382
1383 $this->fields['booking_menu_position'] = array(
1384 'type' => 'select'
1385 , 'default' => 'top'
1386 , 'title' => __('Plugin menu position', 'booking')
1387 , 'description' => ''
1388 , 'options' => array(
1389 'top' => __('Top', 'booking')
1390 , 'middle' => __('Middle', 'booking')
1391 , 'bottom' => __('Bottom', 'booking')
1392 )
1393 , 'group' => 'permissions'
1394 , 'is_demo_safe' => wpbc_is_this_demo()
1395 );
1396
1397 $this->fields['booking_user_role_booking_header'] = array(
1398 'type' => 'pure_html'
1399 , 'group' => 'permissions'
1400 , 'html' => '<tr valign="top">
1401 <th scope="row" colspan="2">
1402 <hr/><p><strong>' . wp_kses_post( __('User permissions for plugin menu pages' ,'booking') ) . ':</strong></p>
1403 </th>
1404 </tr>'
1405 );
1406
1407 $field_options = array();
1408 $field_options['subscriber'] = translate_user_role('Subscriber');
1409 $field_options['contributor'] = translate_user_role('Contributor');
1410 $field_options['author'] = translate_user_role('Author');
1411 $field_options['editor'] = translate_user_role('Editor');
1412 $field_options['administrator'] = translate_user_role('Administrator');
1413
1414 $this->fields['booking_user_role_booking'] = array(
1415 'type' => 'select'
1416 , 'default' => $default_options_values['booking_user_role_booking'] //'editor'
1417 , 'title' => __('Bookings', 'booking')
1418 , 'description' => ''
1419 , 'options' => $field_options
1420 , 'group' => 'permissions'
1421 , 'is_demo_safe' => wpbc_is_this_demo()
1422 );
1423 $this->fields['booking_user_role_availability'] = array( // FixIn: 9.5.2.2.
1424 'type' => 'select'
1425 , 'default' => $default_options_values['booking_user_role_availability'] //'editor'
1426 , 'title' => __('Availability', 'booking')
1427 , 'description' => ''
1428 , 'options' => $field_options
1429 , 'group' => 'permissions'
1430 , 'is_demo_safe' => wpbc_is_this_demo()
1431 );
1432 //FixIn: 9.8.15.2.6
1433 if ( class_exists( 'wpdev_bk_biz_m' ) )
1434 $this->fields['booking_user_role_prices'] = array(
1435 'type' => 'select'
1436 , 'default' => $default_options_values['booking_user_role_prices'] //'editor'
1437 , 'title' => __('Prices', 'booking')
1438 , 'description' => ''
1439 , 'options' => $field_options
1440 , 'group' => 'permissions'
1441 , 'is_demo_safe' => wpbc_is_this_demo()
1442 );
1443
1444 $this->fields['booking_user_role_addbooking'] = array(
1445 'type' => 'select'
1446 , 'default' => $default_options_values['booking_user_role_addbooking'] //'editor'
1447 , 'title' => __('Add booking', 'booking')
1448 , 'description' => ''
1449 , 'options' => $field_options
1450 , 'group' => 'permissions'
1451 , 'is_demo_safe' => wpbc_is_this_demo()
1452 );
1453 if ( class_exists( 'wpdev_bk_personal' ) )
1454 $this->fields['booking_user_role_resources'] = array(
1455 'type' => 'select'
1456 , 'default' => $default_options_values['booking_user_role_resources'] //'editor'
1457 , 'title' => __('Resources', 'booking')
1458 , 'description' => ''
1459 , 'options' => $field_options
1460 , 'group' => 'permissions'
1461 , 'is_demo_safe' => wpbc_is_this_demo()
1462 );
1463 $this->fields['booking_user_role_settings'] = array(
1464 'type' => 'select'
1465 , 'default' => $default_options_values['booking_user_role_settings'] //'administrator'
1466 , 'title' => __('Settings', 'booking')
1467 , 'description' => __('Select user access level for the menu pages of plugin' ,'booking')
1468 , 'description_tag' => 'p'
1469 , 'options' => $field_options
1470 , 'group' => 'permissions'
1471 , 'is_demo_safe' => wpbc_is_this_demo()
1472 );
1473
1474 //if ( ! class_exists( 'wpdev_bk_personal' ) )
1475 if ( ! wpbc_is_this_demo() )
1476 $this->fields['booking_menu_go_pro'] = array(
1477 'type' => 'select'
1478 , 'default' => $default_options_values['booking_menu_go_pro'] //'administrator'
1479 , 'title' => __('Premium', 'booking')
1480 , 'description' => __('Show / hide menu' ,'booking')
1481 , 'description_tag' => 'p'
1482 , 'options' => array(
1483 'show' => __('Show', 'booking')
1484 , 'hide' => __('Hide', 'booking')
1485 )
1486 , 'group' => 'permissions'
1487 , 'is_demo_safe' => wpbc_is_this_demo()
1488 );
1489
1490 if ( wpbc_is_this_demo() )
1491 $this->fields['booking_user_role_settings_demo'] = array( 'group' => 'permissions', 'type' => 'html', 'html' => wpbc_get_warning_text_in_demo_mode(), 'cols' => 2 );
1492
1493
1494 // </editor-fold>
1495
1496
1497 // <editor-fold defaultstate="collapsed" desc=" Uninstall " >
1498 $this->fields['booking_is_delete_if_deactive'] = array(
1499 'type' => 'checkbox'
1500 , 'default' => $default_options_values['booking_is_delete_if_deactive'] //'Off'
1501 , 'title' => __('Delete booking data, when plugin deactivated' ,'booking')
1502 , 'label' => __('Turn on to delete all booking data when you uninstall this plugin.' ,'booking')
1503 , 'description' => ''
1504 , 'group' => 'uninstall'
1505 , 'toggle_class' => 'wpbc_toggle_danger'
1506 );
1507 // </editor-fold>
1508
1509
1510 // <editor-fold defaultstate="collapsed" desc=" Tools " >
1511
1512 if ( ( ! wpbc_is_this_demo() ) && ( current_user_can( 'activate_plugins' ) ) ) {
1513
1514 $this->fields['tools_section_buttons'] = array(
1515 'type' => 'help'
1516 , 'value' => array()
1517 , 'class' => ''
1518 , 'css' => 'margin:0;padding:0;border:0;'
1519 , 'description' => ''
1520 , 'cols' => 2
1521 , 'group' => 'help'
1522 , 'tr_class' => ''
1523 , 'description_tag' => 'p'
1524 );
1525
1526 $my_system_buttons = '';
1527
1528 $my_system_buttons .= '<a class="button button" href="'
1529 . esc_url( wpbc_get_settings_url()
1530 . '&system_info=show&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) ) .'&booking_system_info=show#wpbc_general_settings_system_info_metabox">'
1531 . 'Booking System ' . __('Info' ,'booking')
1532 . '</a>';
1533 // FixIn: 8.4.7.19.
1534 $my_system_buttons .= ' <a class="button button" href="'
1535 . wpbc_get_bookings_url()
1536 . '&wh_booking_type=lost">'
1537 . 'Find Lost Bookings'
1538 . '</a>'; // FixIn: 8.5.2.19.
1539
1540
1541 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1542 if ( ( ! empty( $_REQUEST['booking_version_num'] ) ) && ( 'reset' == $_REQUEST['booking_version_num'] ) ) { // FixIn: 8.5.2.19.
1543 delete_bk_option('booking_version_num');
1544 ?>
1545 <div class="wpdvlp-sub-tabs wpbc_redirection_message"
1546 style="margin: 20px 0;padding: 1em;font-size: 14px;">
1547 <a href="<?php
1548 echo esc_url( wpbc_get_settings_url() ); ?>">Redirect</a> after <span
1549 class="wpbc_countdown">1</span> second...
1550 </div>
1551 <?php
1552
1553 wpbc_redirect( wpbc_get_settings_url() );
1554 }
1555
1556 $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.
1557
1558
1559
1560 // FixIn: 9.5.3.1.
1561 $my_system_buttons .= ' <a class="button button" href="'
1562 . wpbc_get_resources_url()
1563 . '&show_all_resources=1">'
1564 . 'Find Lost Resources'
1565 . '</a>';
1566
1567 if ( ( isset( $_SERVER['HTTP_HOST'] ) ) && ( 'beta' === $_SERVER['HTTP_HOST'] ) ) {
1568
1569 $my_system_buttons .= '<div style="width:100%;height:2em;border-bottom:1px dashed #777;margin-bottom:1em;"></div>';
1570
1571 // 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
1572 $my_system_buttons .= ' <a class="button button-secondary" style="background:#fff9e6;" href="'
1573 . esc_url( wpbc_get_settings_url()
1574 . '&system_info=show&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) ) .'&reset=custom_forms#wpbc_general_settings_system_info_metabox">'
1575 . 'Reset custom forms'
1576 . '</a>';
1577
1578
1579 $my_system_buttons .= ' <a class="button button-secondary" style="background:#fff9e6;" href="'
1580 . esc_url( wpbc_get_setup_wizard_page_url() ) . '">'
1581 . 'Open Setup Wizard'
1582 . '</a>';
1583 }
1584
1585 $this->fields['tools_section_buttons']['value'][] =
1586 '<div class="wpbc_booking_system_info_buttons_align">'
1587 . $my_system_buttons
1588 . '</div>';
1589 }
1590
1591 // </editor-fold>
1592
1593
1594 // <editor-fold defaultstate="collapsed" desc=" Transaltions " >
1595
1596 $this->fields['help_translation_section_after_legend_items'] = array(
1597 'type' => 'help'
1598 , 'value' => wpbc_get_help_rows_about_config_in_several_languges()
1599 , 'class' => ''
1600 , 'css' => 'margin:0;padding:0;border:0;'
1601 , 'description' => ''
1602 , 'cols' => 2
1603 , 'group' => 'translations'
1604 , 'tr_class' => ''
1605 , 'description_tag' => 'p'
1606 );
1607 $this->fields['hr_help_translation_section_after_legend_items'] = array( 'type' => 'hr', 'group' => 'translations' );
1608
1609 $this->fields['booking_translation_load_from'] = array(
1610 'type' => 'select'
1611 , 'default' => 'top'
1612 , 'title' => __('Firstly load translation', 'booking')
1613 , 'options' => array(
1614 'wp.org' => 'WordPress.org '
1615 , 'wpbc' => __( 'Local', 'booking' )
1616 )
1617 , 'group' => 'translations'
1618 , 'is_demo_safe' => wpbc_is_this_demo()
1619 );
1620
1621 $this->fields['help_translation_section_after_translation_load_from'] = array(
1622 'type' => 'help'
1623 , 'value' => array(
1624 sprintf(
1625 /* translators: 1: ... */
1626 __( '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')
1627 , '"<strong>../wp-content/languages/plugins/</strong>"'
1628 , '"<strong>../wp-content/plugins/{Booking Calendar Folder}/languages/</strong>"' )
1629 )
1630 , 'class' => ''
1631 , 'css' => 'margin:0;padding:0;border:0;'
1632 , 'description' => ''
1633 , 'cols' => 2
1634 , 'group' => 'translations'
1635 , 'tr_class' => ''
1636 , 'description_tag' => 'p'
1637 );
1638 // </editor-fold>
1639
1640 }
1641
1642
1643 /**
1644 * Add Custon JavaScript - for some specific settings options
1645 * Need to executes after showing of entire settings page (on hook: wpbc_after_settings_content).
1646 * After initial definition of settings, and possible definition after POST request.
1647 *
1648 * @param type $menu_slug
1649 *
1650 */
1651 public function enqueue_js( $menu_slug, $active_page_tab, $active_page_subtab ) {
1652
1653 $js_script = '';
1654
1655 // Hide 'Title of booked timeslot(s)' items //FixIn: 9.5.0.2.2
1656 $js_script .= "
1657 if ( jQuery('#set_gen_booking_disable_timeslots_in_tooltip').is(':checked') ) {
1658 jQuery('.wpbc_booking_timeslots_in_tooltip').addClass('hidden_items');
1659 }
1660 ";
1661 // Hide or Show 'Title of booked timeslot(s)' on click checkbox
1662 $js_script .= " jQuery('#set_gen_booking_disable_timeslots_in_tooltip').on( 'change', function(){
1663 if ( this.checked ) {
1664 jQuery('.wpbc_booking_timeslots_in_tooltip').addClass('hidden_items');
1665 } else {
1666 jQuery('.wpbc_booking_timeslots_in_tooltip').removeClass('hidden_items');
1667 }
1668 } ); ";
1669
1670 // FixIn: 9.6.3.5.
1671
1672 // Hide Legend items
1673 $js_script .= "
1674 if ( ! jQuery('#set_gen_booking_is_show_legend').is(':checked') ) {
1675 jQuery('.wpbc_calendar_legend_items').addClass('hidden_items');
1676 }
1677 ";
1678 // Hide or Show Legend items on click checkbox
1679 $js_script .= " jQuery('#set_gen_booking_is_show_legend').on( 'change', function(){
1680 if ( this.checked ) {
1681 jQuery('.wpbc_calendar_legend_items').removeClass('hidden_items');
1682 } else {
1683 jQuery('.wpbc_calendar_legend_items').addClass('hidden_items');
1684 }
1685 } ); ";
1686 // Thank you Message or Page
1687 $js_script .= "
1688 if ( jQuery('#type_of_thank_you_message_message').is(':checked') ) {
1689 jQuery('.wpbc_calendar_thank_you_page').addClass('hidden_items');
1690 }
1691 if ( jQuery('#type_of_thank_you_message_page').is(':checked') ) {
1692 jQuery('.wpbc_calendar_thank_you_message').addClass('hidden_items');
1693 }
1694 ";
1695 $js_script .= " jQuery('input[name=\"set_gen_booking_type_of_thank_you_message\"]').on( 'change', function(){
1696 if ( jQuery('#type_of_thank_you_message_message').is(':checked') ) {
1697 jQuery('.wpbc_calendar_thank_you_message').removeClass('hidden_items');
1698 jQuery('.wpbc_calendar_thank_you_page').addClass('hidden_items');
1699 } else {
1700 jQuery('.wpbc_calendar_thank_you_message').addClass('hidden_items');
1701 jQuery('.wpbc_calendar_thank_you_page').removeClass('hidden_items');
1702 }
1703 } ); ";
1704
1705 // Default calendar view mode (Booking Listing) - set active / inctive options depend from resource selection.
1706 $js_script .= " jQuery('#set_gen_booking_view_days_num').on( 'focus', function(){
1707 if ( jQuery('#set_gen_booking_default_booking_resource').length > 0 ) {
1708 jQuery('#set_gen_booking_default_booking_resource').on('change', function() {
1709 jQuery('#set_gen_booking_view_days_num option:eq(2)').prop('selected', true);
1710 });
1711 if ( jQuery('#set_gen_booking_default_booking_resource').val() == '' ) {
1712 jQuery('#set_gen_booking_view_days_num option:eq(0)').prop('disabled', false);
1713 jQuery('#set_gen_booking_view_days_num option:eq(1)').prop('disabled', false);
1714 jQuery('#set_gen_booking_view_days_num option:eq(2)').prop('disabled', false);
1715 jQuery('#set_gen_booking_view_days_num option:eq(3)').prop('disabled', false);
1716 jQuery('#set_gen_booking_view_days_num option:eq(4)').prop('disabled', true);
1717 jQuery('#set_gen_booking_view_days_num option:eq(5)').prop('disabled', true);
1718 } else {
1719 jQuery('#set_gen_booking_view_days_num option:eq(0)').prop('disabled', true);
1720 jQuery('#set_gen_booking_view_days_num option:eq(1)').prop('disabled', true);
1721 jQuery('#set_gen_booking_view_days_num option:eq(2)').prop('disabled', false);
1722 jQuery('#set_gen_booking_view_days_num option:eq(3)').prop('disabled', true);
1723 jQuery('#set_gen_booking_view_days_num option:eq(4)').prop('disabled', false);
1724 jQuery('#set_gen_booking_view_days_num option:eq(5)').prop('disabled', false);
1725 }
1726 }
1727 } ); ";
1728
1729 ////////////////////////////////////////////////////////////////////////
1730 // Set correct value for dates format, depend on from selection of radio buttons
1731 $booking_date_format = esc_js( get_bk_option( 'booking_date_format') ); // FixIn: 10.6.1.2.
1732 // On initial Load set correct text value and correct radio button
1733 $js_script .= "
1734 // Select by default Custom value, later check all other predefined values
1735 jQuery( '#date_format_selection_custom' ).prop('checked', true);
1736
1737 jQuery('input[name=\"set_gen_booking_date_format_selection\"]').each(function() {
1738 var radio_button_value = jQuery( this ).val()
1739 var encodedStr = radio_button_value.replace(/[\u00A0-\u9999<>\&]/gim, function(i) {
1740 return '&#'+i.charCodeAt(0)+';';
1741 });
1742 if ( encodedStr == '". $booking_date_format ."' ) {
1743 jQuery( this ).prop('checked', true);
1744 }
1745 });
1746
1747 jQuery('#set_gen_booking_date_format').val('". $booking_date_format ."');
1748 ";
1749 // On click Radio button "Date Format", - set value in custom Text field
1750 $js_script .= " jQuery('input[name=\"set_gen_booking_date_format_selection\"]').on( 'change', function(){
1751 if ( ( this.checked ) && ( jQuery(this).val() != 'custom' ) ){
1752
1753 jQuery('#set_gen_booking_date_format').val( jQuery(this).val().replace(/[\u00A0-\u9999<>\&]/gim,
1754 function(i) {
1755 return '&#'+i.charCodeAt(0)+';';
1756 })
1757 );
1758 }
1759 } ); ";
1760 // If we edit custom "Date Format" Text field - select Custom Radio button.
1761 $js_script .= " jQuery('#set_gen_booking_date_format').on( 'change', function(){
1762 jQuery( '#date_format_selection_custom' ).prop('checked', true);
1763 } ); ";
1764
1765 ////////////////////////////////////////////////////////////////////////
1766 // Set correct value for Time Format, depend on from selection of radio buttons
1767 $booking_time_format = esc_js( get_bk_option( 'booking_time_format') ); // FixIn: 10.6.1.2.
1768 // Function to load on initial stage of page loading, set correct value of text and select correct radio button.
1769 $js_script .= "
1770 // Select by default Custom value, later check all other predefined values
1771 jQuery( '#time_format_selection_custom' ).prop('checked', true);
1772
1773 jQuery('input[name=\"set_gen_booking_time_format_selection\"]').each(function() {
1774 var radio_button_value = jQuery( this ).val()
1775 var encodedStr = radio_button_value.replace(/[\u00A0-\u9999<>\&]/gim, function(i) {
1776 return '&#'+i.charCodeAt(0)+';';
1777 });
1778 if ( encodedStr == '". $booking_time_format ."' ) {
1779 jQuery( this ).prop('checked', true);
1780 }
1781 });
1782
1783 jQuery('#set_gen_booking_time_format').val('". $booking_time_format ."');
1784 ";
1785 // On click Radio button "Time Format", - set value in custom Text field
1786 $js_script .= " jQuery('input[name=\"set_gen_booking_time_format_selection\"]').on( 'change', function(){
1787 if ( ( this.checked ) && ( jQuery(this).val() != 'custom' ) ){
1788
1789 jQuery('#set_gen_booking_time_format').val( jQuery(this).val().replace(/[\u00A0-\u9999<>\&]/gim,
1790 function(i) {
1791 return '&#'+i.charCodeAt(0)+';';
1792 })
1793 );
1794 }
1795 } ); ";
1796 // If we edit custom "Date Format" Text field - select Custom Radio button.
1797 $js_script .= " jQuery('#set_gen_booking_time_format').on( 'change', function(){
1798 jQuery( '#time_format_selection_custom' ).prop('checked', true);
1799 } ); ";
1800
1801 // Click on Show Advanced JavaScript section link
1802 $js_script .= " jQuery('#wpbc_show_advanced_section_link_show').on( 'click', function(){
1803 jQuery('#wpbc_show_advanced_section_link_show').toggle(200);
1804 jQuery('#wpbc_show_advanced_section_link_hide').animate( {opacity: 1}, 200 ).toggle(200);
1805 jQuery('.wpbc_advanced_js_loading_settings').removeClass('hidden_items');
1806
1807 if ( ! jQuery('#set_gen_booking_is_load_js_css_on_specific_pages').is(':checked') ) {
1808 jQuery('.wpbc_is_load_js_css_on_specific_pages').addClass('hidden_items');
1809 }
1810 } ); ";
1811 $js_script .= " jQuery('#wpbc_show_advanced_section_link_hide').on( 'click', function(){
1812 jQuery('#wpbc_show_advanced_section_link_hide').toggle(200);
1813 jQuery('#wpbc_show_advanced_section_link_show').animate( {opacity: 1}, 200 ).toggle(200);
1814 jQuery('.wpbc_advanced_js_loading_settings').addClass('hidden_items');
1815 } ); ";
1816 $js_script .= " jQuery('#set_gen_booking_is_load_js_css_on_specific_pages').on( 'change', function(){
1817 if ( this.checked ) {
1818 var answer = confirm('"
1819 . esc_js( __( 'Warning', 'booking' ) ) . '! '
1820 . 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' ) )
1821 . "' );
1822 if ( answer) {
1823 this.checked = true;
1824 jQuery('.wpbc_is_load_js_css_on_specific_pages').removeClass('hidden_items');
1825 } else {
1826 this.checked = false;
1827 }
1828 } else {
1829 jQuery('.wpbc_is_load_js_css_on_specific_pages').addClass('hidden_items');
1830 }
1831 } );
1832 if ( ! jQuery('#set_gen_booking_is_load_js_css_on_specific_pages').is(':checked') ) {
1833 jQuery('.wpbc_is_load_js_css_on_specific_pages').addClass('hidden_items');
1834 }
1835
1836 ";
1837
1838
1839 // Click on Powered by links
1840 $js_script .= " jQuery('#wpbc_powered_by_link_show').on( 'click', function(){
1841 jQuery('#wpbc_powered_by_link_show').toggle(200);
1842 jQuery('#wpbc_powered_by_link_hide').animate( {opacity: 1}, 200 ).toggle(200);
1843 jQuery('.wpbc_is_show_powered_by_notice').removeClass('hidden_items');
1844 } ); ";
1845 $js_script .= " jQuery('#wpbc_powered_by_link_hide').on( 'click', function(){
1846 jQuery('#wpbc_powered_by_link_hide').toggle(200);
1847 jQuery('#wpbc_powered_by_link_show').animate( {opacity: 1}, 200 ).toggle(200);
1848 jQuery('.wpbc_is_show_powered_by_notice').addClass('hidden_items');
1849 } ); ";
1850
1851
1852 // Show confirmation window, if user activate this checkbox
1853 $js_script .= " jQuery('#set_gen_booking_is_delete_if_deactive').on( 'change', function(){
1854 if ( this.checked ) {
1855 var answer = confirm('"
1856 . esc_js( __( 'Warning', 'booking' ) ) . '! '
1857 . 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' ) )
1858 . "' );
1859 if ( answer) {
1860 this.checked = true;
1861 } else {
1862 this.checked = false;
1863 }
1864 }
1865 } );
1866 ";
1867
1868
1869
1870
1871
1872 // ============================================================================================================= // FixIn: 10.1.5.4.
1873 // 'Dates selection' - some options hide or show
1874 // =============================================================================================================
1875
1876 // Initial Hiding some Sections in settings
1877 $js_script .= " function wpbc_check_showing_range_days_selection_sections() {
1878 // Single selected
1879 if ( jQuery('#type_of_day_selections_single').is(':checked') ) {
1880 jQuery('.wpbc_recurrent_check_in_out_time_slots').addClass('hidden_items'); // Hide Reccurent, Check in/out Sections
1881
1882 jQuery('#set_gen_booking_last_checkout_day_available').prop('checked', false); // Uncheck Recurrent
1883
1884 jQuery('#set_gen_booking_recurrent_time').prop('checked', false); // Uncheck Reccurent
1885 jQuery('#set_gen_booking_range_selection_time_is_active').prop('checked', false); // and Check In/Out
1886
1887 jQuery('.wpbc_range_days_selection').addClass('hidden_items'); // Hide Range section
1888 } // Multiple selected
1889 if ( jQuery('#type_of_day_selections_multiple').is(':checked') ) {
1890 jQuery('.wpbc_recurrent_check_in_out_time_slots').removeClass('hidden_items'); // Show Reccurent, Check in/out Sections
1891
1892 jQuery('.wpbc_range_days_selection').addClass('hidden_items'); // Hide Range section
1893 }
1894 // Range selected
1895 if ( jQuery('#type_of_day_selections_range').is(':checked') ) {
1896
1897 jQuery('.wpbc_recurrent_check_in_out_time_slots').removeClass('hidden_items'); // Show Reccurent, Check in/out Sections
1898
1899 jQuery('.wpbc_range_days_selection').removeClass('hidden_items'); // Show Range section
1900 jQuery('.wpbc_tr_set_gen_booking_range_start_day_week fieldset').removeClass('hidden_items');
1901 jQuery('.wpbc_tr_set_gen_booking_range_start_day_dynamic_week fieldset').removeClass('hidden_items');
1902
1903 // Fixed selected
1904 if ( jQuery('#range_selection_type_fixed').is(':checked') ) {
1905 jQuery('.wpbc_range_dynamic_selection').addClass('hidden_items');
1906 // Any Week Days selected
1907 if ( jQuery('#range_fixed_start_day_any_day').is(':checked') ) {
1908 jQuery('.wpbc_tr_set_gen_booking_range_start_day_week fieldset').addClass('hidden_items');
1909 }
1910 }
1911 // Dynamic selected
1912 if ( jQuery('#range_selection_type_dynamic').is(':checked') ) {
1913 jQuery('.wpbc_range_fixed_selection').addClass('hidden_items');
1914 // Any Week Days selected
1915 if ( jQuery('#range_dynamic_start_day_any_day').is(':checked') ) {
1916 jQuery('.wpbc_tr_set_gen_booking_range_start_day_dynamic_week fieldset').addClass('hidden_items');
1917 }
1918 }
1919 }
1920
1921 if ( jQuery('#set_gen_booking_range_selection_time_is_active').is(':checked') ) { // Check In/Out selected
1922 jQuery('.wpbc_check_in_out_time_slots').removeClass('hidden_items'); // Show Check In/Out times
1923 } else {
1924 jQuery('.wpbc_check_in_out_time_slots').addClass('hidden_items'); // Hide Check In/Out times
1925 }
1926 }
1927 wpbc_check_showing_range_days_selection_sections(); // Run first time to init
1928 ";
1929
1930 // Hiding or showing section based on User Clicks in settings
1931 $list_of_id_to_hook = array(
1932 '#type_of_day_selections_single'
1933 , '#type_of_day_selections_multiple'
1934 , '#type_of_day_selections_range'
1935 , '#range_selection_type_fixed'
1936 , '#range_selection_type_dynamic'
1937 , '#range_fixed_start_day_specific_day'
1938 , '#range_fixed_start_day_any_day'
1939 , '#range_dynamic_start_day_specific_day'
1940 , '#range_dynamic_start_day_any_day'
1941 );
1942 $list_of_id_to_hook = implode( ',', $list_of_id_to_hook );
1943
1944 // Click on "Days Selections", "Type of range", "Start Week days" checkboxes or radioboxes, show/hide sections.
1945 $js_script .= " jQuery('{$list_of_id_to_hook}').on( 'change', function(){
1946 wpbc_check_showing_range_days_selection_sections();
1947 } ); ";
1948
1949 // Click on "Recurrent Time" - then Uncheck "Check In/Out" and hide show sections.
1950 $js_script .= " jQuery('#set_gen_booking_recurrent_time').on( 'change', function(){
1951 if ( this.checked ) {
1952 jQuery('#set_gen_booking_range_selection_time_is_active').prop('checked', false);
1953 }
1954 wpbc_check_showing_range_days_selection_sections();
1955 } ); ";
1956
1957 // Click on "Check In/Out" - then Uncheck "Recurrent Time" and hide show sections.
1958 $js_script .= " jQuery('#set_gen_booking_range_selection_time_is_active').on( 'change', function(){
1959 if ( this.checked ) {
1960 jQuery('#set_gen_booking_recurrent_time').prop('checked', false);
1961 jQuery('#set_gen_booking_last_checkout_day_available').prop('checked', false); // Uncheck Reccurent
1962 }
1963 wpbc_check_showing_range_days_selection_sections();
1964 } ); ";
1965
1966 // Confirmation Section configuration
1967 $js_script .= "
1968 if ( ! jQuery('#set_gen_booking_confirmation__personal_info__header_enabled').is(':checked') ) {
1969 jQuery('.wpbc_booking_confirmation__personal_info__field').addClass('wpbc_field_disabled');
1970 jQuery('.wpbc_booking_confirmation__personal_info__fields').addClass('hidden_items');
1971 }
1972 ";
1973 $js_script .= " jQuery('#set_gen_booking_confirmation__personal_info__header_enabled').on( 'change', function(){
1974 if ( ! this.checked ) {
1975 jQuery('.wpbc_booking_confirmation__personal_info__field').addClass('wpbc_field_disabled');
1976 jQuery('.wpbc_booking_confirmation__personal_info__fields').addClass('hidden_items');
1977 } else {
1978 jQuery('.wpbc_booking_confirmation__personal_info__field').removeClass('wpbc_field_disabled');
1979 jQuery('.wpbc_booking_confirmation__personal_info__fields').removeClass('hidden_items');
1980 }
1981 } ); ";
1982 $js_script .= "
1983 if ( ! jQuery('#set_gen_booking_confirmation__booking_details__header_enabled').is(':checked') ) {
1984 jQuery('.wpbc_booking_confirmation__booking_details__field').addClass('wpbc_field_disabled');
1985 jQuery('.wpbc_booking_confirmation__booking_details__fields').addClass('hidden_items');
1986 }
1987 ";
1988 $js_script .= " jQuery('#set_gen_booking_confirmation__booking_details__header_enabled').on( 'change', function(){
1989 if ( ! this.checked ) {
1990 jQuery('.wpbc_booking_confirmation__booking_details__field').addClass('wpbc_field_disabled');
1991 jQuery('.wpbc_booking_confirmation__booking_details__fields').addClass('hidden_items');
1992 } else {
1993 jQuery('.wpbc_booking_confirmation__booking_details__field').removeClass('wpbc_field_disabled');
1994 jQuery('.wpbc_booking_confirmation__booking_details__fields').removeClass('hidden_items');
1995 }
1996 } ); ";
1997
1998 $js_script .= "
1999 if ( ! jQuery('#set_gen_booking_confirmation_header_enabled').is(':checked') ) {
2000 jQuery('.wpbc_booking_confirmation_header__field').addClass('wpbc_field_disabled');
2001 }
2002 ";
2003 $js_script .= " jQuery('#set_gen_booking_confirmation_header_enabled').on( 'change', function(){
2004 if ( ! this.checked ) {
2005 jQuery('.wpbc_booking_confirmation_header__field').addClass('wpbc_field_disabled');
2006 } else {
2007 jQuery('.wpbc_booking_confirmation_header__field').removeClass('wpbc_field_disabled');
2008 }
2009 } ); ";
2010
2011
2012 // Enqueue JS to the footer of the page
2013 wpbc_enqueue_js( $js_script );
2014 }
2015
2016 /**
2017 * Validate the temporary shared 11.6 catalog renderer preference.
2018 *
2019 * The General Settings form verifies its nonce before invoking the Settings
2020 * API. This field adds an explicit capability boundary and allow list. When
2021 * compatibility forces disabled legacy views, the existing Resources-named
2022 * storage key is preserved instead of being overwritten by a derived value.
2023 *
2024 * @param string $post_key Full Settings API POST key.
2025 *
2026 * @return string Allow-listed stored renderer preference.
2027 */
2028 public function validate_booking_resources_catalog_renderer_post( $post_key ) {
2029 $stored_renderer = wpbc_booking_resources_catalog_get_stored_renderer();
2030
2031 if ( ! wpbc_booking_resources_catalog_can_manage_settings() || ! wpbc_booking_resources_catalog_is_pro_compatible() ) {
2032 return $stored_renderer;
2033 }
2034
2035 $submitted_renderer = self::validate_select_post_static( $post_key );
2036 if ( ! is_string( $submitted_renderer ) || ! in_array( $submitted_renderer, array( 'new', 'legacy' ), true ) ) {
2037 return $stored_renderer;
2038 }
2039
2040 return $submitted_renderer;
2041 }
2042
2043 /**
2044 * Validate the administrator edit-booking destination.
2045 *
2046 * The General Settings page owns nonce and capability checks. This method
2047 * adds an explicit allow list and preserves the current normalized setting
2048 * when a malformed value is submitted.
2049 *
2050 * @param string $post_key Full Settings API POST key.
2051 *
2052 * @return string Allow-listed edit destination.
2053 */
2054 public function validate_booking_admin_edit_booking_mode_post( $post_key ) {
2055 $stored_mode = wpbc_get_booking_admin_edit_mode();
2056 $submitted_mode = self::validate_select_post_static( $post_key );
2057
2058 if ( ! is_string( $submitted_mode ) || ! in_array( $submitted_mode, array( 'popup', 'add_booking_page' ), true ) ) {
2059 return $stored_mode;
2060 }
2061
2062 return $submitted_mode;
2063 }
2064
2065 }
2066
2067
2068 /**
2069 * Override VALIDATED fields BEFORE saving to DB
2070 * Description:
2071 * Check "Thank you page" URL
2072 *
2073 * @param array $validated_fields
2074 */
2075 function wpbc_settings_validate_fields_before_saving__all( $validated_fields ) {
2076
2077
2078 $validated_fields['booking_thank_you_page_URL'] = wpbc_make_link_relative( $validated_fields['booking_thank_you_page_URL'] );
2079
2080 unset( $validated_fields[ 'booking_date_format_selection' ] ); // We do not need to this field, because saving to DB only: "date_format" field
2081 unset( $validated_fields[ 'booking_time_format_selection' ] ); // We do not need to this field, because saving to DB only: "time_format" field
2082
2083 // Unset promote fields
2084 foreach ( $validated_fields as $field_name => $field_value ) {
2085 if ( strpos( $field_name, '__promote_upgrade' ) > 0 ) {
2086 unset( $validated_fields[ $field_name ] );
2087 }
2088 }
2089
2090 return $validated_fields;
2091 }
2092 add_filter( 'wpbc_settings_validate_fields_before_saving', 'wpbc_settings_validate_fields_before_saving__all', 10, 1 ); // Hook for validated fields.
2093
2094
2095 /**
2096 * Load Code mirror highlighter for Booking Confirmation at the WP Booking Calendar > Settings General page in "Booking Confirmation" section
2097 *
2098 * @param $page_name
2099 *
2100 * @return false|void
2101 */
2102 function wpbc_hook_settings_page_footer__define_code_mirror( $page_name ) {
2103
2104 if ( 'general_settings' != $page_name ) {
2105 return false;
2106 }
2107
2108 $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.
2109
2110 if ( $is_use_code_mirror ) {
2111
2112 wpbc_codemirror()->set_codemirror( array(
2113 'textarea_id' => '#set_gen_booking_confirmation__personal_info__content'
2114 // , 'preview_id' => '#wpbc_add_form_html_preview'
2115 ) );
2116 wpbc_codemirror()->set_codemirror( array(
2117 'textarea_id' => '#set_gen_booking_confirmation__booking_details__content'
2118 // , 'preview_id' => '#wpbc_add_form_html_preview'
2119 ) );
2120
2121 }
2122 }
2123 //add_action( 'wpbc_hook_settings_page_footer', 'wpbc_hook_settings_page_footer__define_code_mirror' );
2124