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

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

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