PluginProbe
Booking Calendar / 11.2
Booking Calendar v11.2
11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 10.11.2 10.11.3 10.11.4 10.12.0 10.12.1 All 199 releases
booking / core / admin / api-settings.php

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

2,165 lines 144.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
1179 // <editor-fold defaultstate="collapsed" desc=" Capacity " >
1180
1181 $this->fields = apply_filters( 'wpbc_settings_capacity_based_on_visitors', $this->fields, $default_options_values );
1182
1183 $this->fields['booking_is_days_always_available'] = array(
1184 'type' => 'checkbox'
1185 , 'default' => $default_options_values['booking_is_days_always_available'] //'On'
1186 , 'title' => __('Allow unlimited bookings per same day(s)' ,'booking')
1187 /* translators: 1: ... */
1188 , 'label' => sprintf( __( 'Check this box, if you want to %1$sset any days as available%2$s in calendar. Your visitors will be able to make %3$sunlimited bookings per same date(s) in calendar and do not see any booked date(s)%4$s of other visitors.', 'booking' ), '<strong>', '</strong>' , '<strong>', '</strong>' )
1189 , 'description' => ''
1190 , 'group' => 'capacity'
1191 );
1192
1193
1194 // FixIn: 8.3.2.2.
1195 if ( ! class_exists('wpdev_bk_biz_l') )
1196 $this->fields['booking_is_show_pending_days_as_available'] = array(
1197 'type' => 'checkbox'
1198 , 'default' => $default_options_values['booking_is_show_pending_days_as_available'] //_'Off'
1199 , 'title' => __('Use pending days as available' ,'booking')
1200 , 'label' => sprintf(__('Check this box if you want to show the pending days as available in calendars' ,'booking') )
1201 , 'description' => ''
1202 , 'group' => 'capacity'
1203 , 'tr_class' => ''
1204 );
1205
1206 $this->fields = apply_filters( 'wpbc_settings_pending_days_as_available', $this->fields, $default_options_values );
1207
1208
1209
1210 // </editor-fold>
1211
1212 // <editor-fold defaultstate="collapsed" desc=" Capacity Free example " >
1213 if ( ! class_exists('wpdev_bk_personal') ){
1214
1215 // Showing availability in tooltip
1216 $this->fields['booking_quantity_control__promote_upgrade'] = array(
1217 'type' => 'checkbox'
1218 , 'default' => 'On'
1219 , 'value' => 'On'
1220 , 'title' => __('Booking Quantity Control' ,'booking')
1221 , 'label' => __('Enable this option to allow visitors to define the number of items they can book for specific dates or times within a single reservation. ' ,'booking')
1222 , 'description' => __('If disabled, visitors can book only one slot within a single reservation.' ,'booking')
1223 , 'description_tag' => 'p'
1224 , 'group' => 'capacity_upgrade'
1225 , 'tr_class' => 'wpbc_blur'
1226 );
1227 $this->fields['booking_capacity_field__promote_upgrade'] = array(
1228 'type' => 'select'
1229 , 'default' => 'items'
1230 , 'value' => 'items'
1231 , 'title' => __('Quantity field name', 'booking')
1232 , 'description' => sprintf( __( 'Select the field that will control how many slots visitors can book during the reservation process.' ,'booking'), '<b>', '</b>' )
1233 , 'description_tag' => 'span'
1234 , 'css' => ''
1235 , 'tr_class' => 'wpbc_booking_capacity_field_settings wpbc_sub_settings_grayed'
1236 , 'options' => array( 'items' => __('Items' ,'booking') )
1237 , 'group' => 'capacity_upgrade'
1238 , 'tr_class' => 'wpbc_blur'
1239 );
1240 $this->fields['booking_is_dissbale_booking_for_different_sub_resources__promote_upgrade'] = array(
1241 'type' => 'checkbox'
1242 , 'default' => 'On'
1243 , 'value' => 'On'
1244 , 'title' => __('Disable bookings in different booking resources' ,'booking')
1245 , 'label' => __('Check this box to disable reservations, which can be stored in different booking resources.' ,'booking')
1246 , 'description' => '<strong>' . esc_html__('Note' ,'booking') . '!</strong> ' . __('When checked, all reserved days must be at same booking resource otherwise error message will show.' ,'booking')
1247 , 'group' => 'capacity_upgrade'
1248 , 'tr_class' => 'wpbc_blur'
1249 );
1250 $this->fields['capacity_upgrade__promote_upgrade'] = array(
1251 'type' => 'pure_html'
1252 , 'group' => 'capacity_upgrade'
1253 , 'html' => '<tr><td colspan="2">
1254 <div class="wpbc_widget_content" style="transform: translate(0) translateY(-10em);">
1255 <div class="ui_container ui_container_toolbar ui_container_small" style="background: #fff;position: relative;">
1256 <div class="ui_group ui_group__upgrade">
1257 <div class="wpbc_upgrade_note wpbc_upgrade_theme_green">
1258 <div>This <a target="_blank" href="https://wpbookingcalendar.com/features/#capacity">feature</a>
1259 is available in the <strong>Business Large or MultiUser version</strong>.
1260 <a target="_blank" href="https://wpbookingcalendar.com/prices/#bk_news_section">Upgrade to Pro</a>.
1261 </div>
1262 </div>
1263 </div>
1264 </div>
1265 </div>
1266 </td> </tr>'
1267 );
1268 }
1269 // </editor-fold>
1270
1271
1272 // <editor-fold defaultstate="collapsed" desc=" Advanced " >
1273
1274
1275 $this->fields = apply_filters( 'wpbc_settings_edit_url_hash', $this->fields, $default_options_values );
1276 // FixIn: 10.10.1.2 $this->fields = apply_filters( 'wpbc_settings_resource_no_update__during_editing', $this->fields, $default_options_values );
1277
1278 // Show advanced settings of JavaScript loading
1279
1280
1281 // //Show | Hide links for Advanced JavaScript section
1282 // $this->fields['booking_advanced_js_loading_settings'] = array(
1283 // 'type' => 'html'
1284 // , 'html' =>
1285 // '<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>'
1286 // . '<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>'
1287 // , 'cols' => 2
1288 // , 'group' => 'advanced'
1289 // );
1290
1291 // FixIn: 9.8.6.2.
1292 $balencer_options = array_combine( range( 1, 5 ), range( 1, 5 ) );
1293 $balencer_options[99] = __( 'All', 'booking' );
1294 $this->fields['booking_load_balancer_max_threads'] = array(
1295 'type' => 'select'
1296 , 'default' => $default_options_values['booking_load_balancer_max_threads']
1297 , 'title' => __('Parallel requests' ,'booking')
1298 , 'description' => __('Select the number of simultaneous requests to load data in multiple calendars.' ,'booking') . ' <sup style="color:#7812bd;"><strong> '.__('Performance','booking').'</strong></sup>'
1299 . '<div class="wpbc-general-settings-notice wpbc-settings-notice notice-info">'
1300 . __('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')
1301 .'</div>'
1302
1303 , 'options' => $balencer_options
1304 , 'group' => 'advanced'
1305 , 'is_demo_safe' => wpbc_is_this_demo()
1306 );
1307
1308
1309 $this->fields['booking_is_load_js_css_on_specific_pages'] = array(
1310 'type' => 'checkbox'
1311 , 'default' => $default_options_values['booking_is_load_js_css_on_specific_pages'] //'Off'
1312 , 'title' => __('Load JS and CSS files only on specific pages' ,'booking')
1313 , 'label' => __('Activate loading of CSS and JavaScript files of plugin only at specific pages.' ,'booking')
1314 , 'description' => ''
1315 , 'group' => 'advanced'
1316 , 'tr_class' => 'wpbc_advanced_js_loading_settings'//wpbc_advanced_js_loading_settings wpbc_sub_settings_grayed hidden_items'
1317 , 'is_demo_safe' => wpbc_is_this_demo()
1318 );
1319 $this->fields['booking_pages_for_load_js_css'] = array(
1320 'type' => 'textarea'
1321 , 'default' => $default_options_values['booking_pages_for_load_js_css'] //''
1322 , 'placeholder' => '/booking-form/'
1323 , 'title' => __('Relative URLs of pages, where to load plugin CSS and JS files' ,'booking')
1324 /* translators: 1: ... */
1325 , '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>')
1326 ,'description_tag' => 'p'
1327 , 'css' => 'width:100%'
1328 , 'rows' => 5
1329 , 'group' => 'advanced'
1330 , 'tr_class' => 'wpbc_advanced_js_loading_settings wpbc_is_load_js_css_on_specific_pages wpbc_sub_settings_grayed'// hidden_items'
1331 , 'is_demo_safe' => wpbc_is_this_demo()
1332 );
1333
1334 $this->fields['booking_form_is_using_bs_css'] = array(
1335 'type' => 'checkbox'
1336 , 'default' => $default_options_values['booking_form_is_using_bs_css'] // 'On'
1337 , 'title' => __('Use CSS BootStrap' ,'booking')
1338 , 'label' => __('Using BootStrap CSS for the form fields' ,'booking'). ' <sup style="color:#bd8212;"><strong> '.__('Deprecated','booking').'</strong></sup>'
1339 , 'description' => ''
1340 , 'description_tag' => 'p'
1341 , 'group' => 'advanced'
1342 );
1343
1344 //$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' );
1345 // FixIn: 7.2.1.15.
1346 $this->fields[ 'booking_is_show_system_debug_log' ] = array(
1347 'type' => 'checkbox'
1348 , 'default' => $default_options_values['booking_is_show_system_debug_log'] //'Off'
1349 , 'title' => __('Show system debugging log for beta features' ,'booking')
1350 , 'label' => __('Activate this option only for testing beta features' ,'booking')
1351 , 'description' => ''
1352 , 'group' => 'advanced'
1353 , 'tr_class' => 'wpbc_advanced_js_loading_settings'// wpbc_sub_settings_grayed hidden_items'
1354 , 'is_demo_safe' => wpbc_is_this_demo()
1355 );
1356
1357 //FixIn: 10.1.1.2 //TODO: Update Text here 2024-06-16 12:57
1358 $this->fields['booking_is_nonce_at_front_end'] = array(
1359 'type' => 'checkbox'
1360 , 'default' => $default_options_values['booking_is_nonce_at_front_end'] //'Off'
1361 , 'title' => __( 'Use Nonce Fields', 'booking' )
1362 , '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' )
1363 , 'description' => ''
1364 , 'group' => 'advanced'
1365 , 'tr_class' => 'wpbc_advanced_is_nonce' //wpbc_advanced_js_loading_settings wpbc_sub_settings_grayed hidden_items'
1366 , 'toggle_class' => 'wpbc_toggle_danger'
1367 , 'is_demo_safe' => wpbc_is_this_demo()
1368 );
1369
1370 if ( wpbc_is_this_demo() ) {
1371 $this->fields['booking_pages_for_load_js_css_demo'] = array( 'group' => 'advanced',
1372 'type' => 'html',
1373 'html' => wpbc_get_warning_text_in_demo_mode(),
1374 'cols' => 2,
1375 'tr_class' => 'wpbc_advanced_js_loading_settings'// wpbc_sub_settings_grayed hidden_items'
1376 );
1377 }
1378
1379 // Divider ///////////////////////////////////////////////////////////////
1380 $this->fields['hr_calendar_before_advanced_js_loading_settings'] = array( 'type' => 'hr', 'group' => 'advanced' );
1381
1382 // Show settings of powered by notice
1383 $this->fields['booking_advanced_powered_by_notice_settings'] = array(
1384 'type' => 'html'
1385 , 'html' =>
1386 '<a id="wpbc_powered_by_link_show" class="wpbc_expand_section_link" href="javascript:void(0)">+ ' . __('Show settings of powered by notice' ,'booking') . '</a>'
1387 . '<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>'
1388 , 'cols' => 2
1389 , 'group' => 'advanced'
1390 );
1391 $this->fields['booking_is_show_powered_by_notice'] = array(
1392 'type' => 'checkbox'
1393 , 'default' => $default_options_values['booking_is_show_powered_by_notice'] //'On'
1394 , 'title' => __('Powered by notice' ,'booking')
1395 , 'label' => sprintf(__(' Turn On/Off powered by "Booking Calendar" notice under the calendar.' ,'booking'),'wpbookingcalendar.com')
1396 , 'description' => ''
1397 , 'group' => 'advanced'
1398 , 'tr_class' => 'wpbc_is_show_powered_by_notice wpbc_sub_settings_grayed hidden_items'
1399 );
1400 $this->fields['booking_wpdev_copyright_adminpanel'] = array(
1401 'type' => 'checkbox'
1402 , 'default' => $default_options_values['booking_wpdev_copyright_adminpanel'] //'On'
1403 , 'title' => __('Help and info notices' ,'booking')
1404 , 'label' => sprintf(__(' Turn On/Off version notice and help info links at booking admin panel.' ,'booking'),'wpbookingcalendar.com')
1405 , 'description' => ''
1406 , 'group' => 'advanced'
1407 , 'tr_class' => 'wpbc_is_show_powered_by_notice wpbc_sub_settings_grayed hidden_items'
1408 , 'is_demo_safe' => wpbc_is_this_demo() // FixIn: 8.1.3.9.
1409 );
1410
1411 // </editor-fold>
1412
1413
1414 // <editor-fold defaultstate="collapsed" desc=" Information " >
1415 if(1){
1416 if ( function_exists( 'wpbc_get_dashboard_info' ) ) {
1417 $this->fields['booking_information'] = array(
1418 'type' => 'html'
1419 , 'html' => wpbc_get_dashboard_info()
1420 , 'cols' => 2
1421 , 'group' => 'information'
1422 );
1423 }
1424 }
1425 // </editor-fold>
1426
1427
1428 // <editor-fold defaultstate="collapsed" desc=" User permissions for plugin menu pages " >
1429
1430
1431 $this->fields['booking_menu_position'] = array(
1432 'type' => 'select'
1433 , 'default' => 'top'
1434 , 'title' => __('Plugin menu position', 'booking')
1435 , 'description' => ''
1436 , 'options' => array(
1437 'top' => __('Top', 'booking')
1438 , 'middle' => __('Middle', 'booking')
1439 , 'bottom' => __('Bottom', 'booking')
1440 )
1441 , 'group' => 'permissions'
1442 , 'is_demo_safe' => wpbc_is_this_demo()
1443 );
1444
1445 $this->fields['booking_user_role_booking_header'] = array(
1446 'type' => 'pure_html'
1447 , 'group' => 'permissions'
1448 , 'html' => '<tr valign="top">
1449 <th scope="row" colspan="2">
1450 <hr/><p><strong>' . wp_kses_post( __('User permissions for plugin menu pages' ,'booking') ) . ':</strong></p>
1451 </th>
1452 </tr>'
1453 );
1454
1455 $field_options = array();
1456 $field_options['subscriber'] = translate_user_role('Subscriber');
1457 $field_options['contributor'] = translate_user_role('Contributor');
1458 $field_options['author'] = translate_user_role('Author');
1459 $field_options['editor'] = translate_user_role('Editor');
1460 $field_options['administrator'] = translate_user_role('Administrator');
1461
1462 $this->fields['booking_user_role_booking'] = array(
1463 'type' => 'select'
1464 , 'default' => $default_options_values['booking_user_role_booking'] //'editor'
1465 , 'title' => __('Bookings', 'booking')
1466 , 'description' => ''
1467 , 'options' => $field_options
1468 , 'group' => 'permissions'
1469 , 'is_demo_safe' => wpbc_is_this_demo()
1470 );
1471 $this->fields['booking_user_role_availability'] = array( // FixIn: 9.5.2.2.
1472 'type' => 'select'
1473 , 'default' => $default_options_values['booking_user_role_availability'] //'editor'
1474 , 'title' => __('Availability', 'booking')
1475 , 'description' => ''
1476 , 'options' => $field_options
1477 , 'group' => 'permissions'
1478 , 'is_demo_safe' => wpbc_is_this_demo()
1479 );
1480 //FixIn: 9.8.15.2.6
1481 if ( class_exists( 'wpdev_bk_biz_m' ) )
1482 $this->fields['booking_user_role_prices'] = array(
1483 'type' => 'select'
1484 , 'default' => $default_options_values['booking_user_role_prices'] //'editor'
1485 , 'title' => __('Prices', 'booking')
1486 , 'description' => ''
1487 , 'options' => $field_options
1488 , 'group' => 'permissions'
1489 , 'is_demo_safe' => wpbc_is_this_demo()
1490 );
1491
1492 $this->fields['booking_user_role_addbooking'] = array(
1493 'type' => 'select'
1494 , 'default' => $default_options_values['booking_user_role_addbooking'] //'editor'
1495 , 'title' => __('Add booking', 'booking')
1496 , 'description' => ''
1497 , 'options' => $field_options
1498 , 'group' => 'permissions'
1499 , 'is_demo_safe' => wpbc_is_this_demo()
1500 );
1501 if ( class_exists( 'wpdev_bk_personal' ) )
1502 $this->fields['booking_user_role_resources'] = array(
1503 'type' => 'select'
1504 , 'default' => $default_options_values['booking_user_role_resources'] //'editor'
1505 , 'title' => __('Resources', 'booking')
1506 , 'description' => ''
1507 , 'options' => $field_options
1508 , 'group' => 'permissions'
1509 , 'is_demo_safe' => wpbc_is_this_demo()
1510 );
1511 $this->fields['booking_user_role_settings'] = array(
1512 'type' => 'select'
1513 , 'default' => $default_options_values['booking_user_role_settings'] //'administrator'
1514 , 'title' => __('Settings', 'booking')
1515 , 'description' => __('Select user access level for the menu pages of plugin' ,'booking')
1516 , 'description_tag' => 'p'
1517 , 'options' => $field_options
1518 , 'group' => 'permissions'
1519 , 'is_demo_safe' => wpbc_is_this_demo()
1520 );
1521
1522 //if ( ! class_exists( 'wpdev_bk_personal' ) )
1523 if ( ! wpbc_is_this_demo() )
1524 $this->fields['booking_menu_go_pro'] = array(
1525 'type' => 'select'
1526 , 'default' => $default_options_values['booking_menu_go_pro'] //'administrator'
1527 , 'title' => __('Premium', 'booking')
1528 , 'description' => __('Show / hide menu' ,'booking')
1529 , 'description_tag' => 'p'
1530 , 'options' => array(
1531 'show' => __('Show', 'booking')
1532 , 'hide' => __('Hide', 'booking')
1533 )
1534 , 'group' => 'permissions'
1535 , 'is_demo_safe' => wpbc_is_this_demo()
1536 );
1537
1538 if ( wpbc_is_this_demo() )
1539 $this->fields['booking_user_role_settings_demo'] = array( 'group' => 'permissions', 'type' => 'html', 'html' => wpbc_get_warning_text_in_demo_mode(), 'cols' => 2 );
1540
1541
1542 // </editor-fold>
1543
1544
1545 // <editor-fold defaultstate="collapsed" desc=" Uninstall " >
1546 $this->fields['booking_is_delete_if_deactive'] = array(
1547 'type' => 'checkbox'
1548 , 'default' => $default_options_values['booking_is_delete_if_deactive'] //'Off'
1549 , 'title' => __('Delete booking data, when plugin deactivated' ,'booking')
1550 , 'label' => __('Turn on to delete all booking data when you uninstall this plugin.' ,'booking')
1551 , 'description' => ''
1552 , 'group' => 'uninstall'
1553 , 'toggle_class' => 'wpbc_toggle_danger'
1554 );
1555 // </editor-fold>
1556
1557
1558 // <editor-fold defaultstate="collapsed" desc=" Tools " >
1559
1560 if ( ( ! wpbc_is_this_demo() ) && ( current_user_can( 'activate_plugins' ) ) ) {
1561
1562 $this->fields['tools_section_buttons'] = array(
1563 'type' => 'help'
1564 , 'value' => array()
1565 , 'class' => ''
1566 , 'css' => 'margin:0;padding:0;border:0;'
1567 , 'description' => ''
1568 , 'cols' => 2
1569 , 'group' => 'help'
1570 , 'tr_class' => ''
1571 , 'description_tag' => 'p'
1572 );
1573
1574 $my_system_buttons = '';
1575
1576 $my_system_buttons .= '<a class="button button" href="'
1577 . esc_url( wpbc_get_settings_url()
1578 . '&system_info=show&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) ) .'&booking_system_info=show#wpbc_general_settings_system_info_metabox">'
1579 . 'Booking System ' . __('Info' ,'booking')
1580 . '</a>';
1581 // FixIn: 8.4.7.19.
1582 $my_system_buttons .= ' <a class="button button" href="'
1583 . wpbc_get_bookings_url()
1584 . '&wh_booking_type=lost">'
1585 . 'Find Lost Bookings'
1586 . '</a>'; // FixIn: 8.5.2.19.
1587
1588
1589 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1590 if ( ( ! empty( $_REQUEST['booking_version_num'] ) ) && ( 'reset' == $_REQUEST['booking_version_num'] ) ) { // FixIn: 8.5.2.19.
1591 delete_bk_option('booking_version_num');
1592 ?>
1593 <div class="wpdvlp-sub-tabs wpbc_redirection_message"
1594 style="margin: 20px 0;padding: 1em;font-size: 14px;">
1595 <a href="<?php
1596 echo esc_url( wpbc_get_setup_wizard_page_url() ); ?>">Redirect</a> after <span
1597 class="wpbc_countdown">1</span> second...
1598 </div>
1599 <?php
1600
1601 wpbc_redirect( wpbc_get_settings_url() );
1602 }
1603
1604 $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.
1605
1606
1607
1608 // FixIn: 9.5.3.1.
1609 $my_system_buttons .= ' <a class="button button" href="'
1610 . wpbc_get_resources_url()
1611 . '&show_all_resources=1">'
1612 . 'Find Lost Resources'
1613 . '</a>';
1614
1615 if ( ( isset( $_SERVER['HTTP_HOST'] ) ) && ( 'beta' === $_SERVER['HTTP_HOST'] ) ) {
1616
1617 $my_system_buttons .= '<div style="width:100%;height:2em;border-bottom:1px dashed #777;margin-bottom:1em;"></div>';
1618
1619 // 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
1620 $my_system_buttons .= ' <a class="button button-secondary" style="background:#fff9e6;" href="'
1621 . esc_url( wpbc_get_settings_url()
1622 . '&system_info=show&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) ) .'&reset=custom_forms#wpbc_general_settings_system_info_metabox">'
1623 . 'Reset custom forms'
1624 . '</a>';
1625
1626
1627 $my_system_buttons .= ' <a class="button button-secondary" style="background:#fff9e6;" href="'
1628 . esc_url( wpbc_get_settings_url()
1629 . '&wpbc_setup_wizard=reset&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) ) .'">'
1630 . 'Reset Setup Wizard'
1631 . '</a>';
1632 // if ( ( isset( $_GET['wpbc_setup_wizard'] ) ) && ( 'reset' === $_GET['wpbc_setup_wizard'] ) ) {
1633 // $my_system_buttons .= '<script type="text/javascript"> window.location.href = "' . esc_url( wpbc_get_setup_wizard_page_url() ) . '"; </script>';
1634 // }
1635 $my_system_buttons .= ' <a class="button button-secondary" style="background:#fff9e6;" href="'
1636 . esc_url( wpbc_get_settings_url()
1637 . '&wpbc_setup_wizard=completed&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) ) .'">'
1638 . 'Set Setup Wizard as Completed'
1639 . '</a>';
1640 }
1641
1642 $this->fields['tools_section_buttons']['value'][] =
1643 '<div class="wpbc_booking_system_info_buttons_align">'
1644 . $my_system_buttons
1645 . '</div>';
1646 }
1647
1648 // </editor-fold>
1649
1650
1651 // <editor-fold defaultstate="collapsed" desc=" Transaltions " >
1652
1653 $this->fields['help_translation_section_after_legend_items'] = array(
1654 'type' => 'help'
1655 , 'value' => wpbc_get_help_rows_about_config_in_several_languges()
1656 , 'class' => ''
1657 , 'css' => 'margin:0;padding:0;border:0;'
1658 , 'description' => ''
1659 , 'cols' => 2
1660 , 'group' => 'translations'
1661 , 'tr_class' => ''
1662 , 'description_tag' => 'p'
1663 );
1664 $this->fields['hr_help_translation_section_after_legend_items'] = array( 'type' => 'hr', 'group' => 'translations' );
1665
1666 $this->fields['booking_translation_load_from'] = array(
1667 'type' => 'select'
1668 , 'default' => 'top'
1669 , 'title' => __('Firstly load translation', 'booking')
1670 , 'options' => array(
1671 'wp.org' => 'WordPress.org '
1672 , 'wpbc' => __( 'Local', 'booking' )
1673 )
1674 , 'group' => 'translations'
1675 , 'is_demo_safe' => wpbc_is_this_demo()
1676 );
1677
1678 $this->fields['help_translation_section_after_translation_load_from'] = array(
1679 'type' => 'help'
1680 , 'value' => array(
1681 sprintf(
1682 /* translators: 1: ... */
1683 __( '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')
1684 , '"<strong>../wp-content/languages/plugins/</strong>"'
1685 , '"<strong>../wp-content/plugins/{Booking Calendar Folder}/languages/</strong>"' )
1686 )
1687 , 'class' => ''
1688 , 'css' => 'margin:0;padding:0;border:0;'
1689 , 'description' => ''
1690 , 'cols' => 2
1691 , 'group' => 'translations'
1692 , 'tr_class' => ''
1693 , 'description_tag' => 'p'
1694 );
1695 // </editor-fold>
1696
1697 }
1698
1699
1700 /**
1701 * Add Custon JavaScript - for some specific settings options
1702 * Need to executes after showing of entire settings page (on hook: wpbc_after_settings_content).
1703 * After initial definition of settings, and possible definition after POST request.
1704 *
1705 * @param type $menu_slug
1706 *
1707 */
1708 public function enqueue_js( $menu_slug, $active_page_tab, $active_page_subtab ) {
1709
1710 $js_script = '';
1711
1712 // Hide 'Title of booked timeslot(s)' items //FixIn: 9.5.0.2.2
1713 $js_script .= "
1714 if ( jQuery('#set_gen_booking_disable_timeslots_in_tooltip').is(':checked') ) {
1715 jQuery('.wpbc_booking_timeslots_in_tooltip').addClass('hidden_items');
1716 }
1717 ";
1718 // Hide or Show 'Title of booked timeslot(s)' on click checkbox
1719 $js_script .= " jQuery('#set_gen_booking_disable_timeslots_in_tooltip').on( 'change', function(){
1720 if ( this.checked ) {
1721 jQuery('.wpbc_booking_timeslots_in_tooltip').addClass('hidden_items');
1722 } else {
1723 jQuery('.wpbc_booking_timeslots_in_tooltip').removeClass('hidden_items');
1724 }
1725 } ); ";
1726
1727 // FixIn: 9.6.3.5.
1728
1729 // Hide Legend items
1730 $js_script .= "
1731 if ( ! jQuery('#set_gen_booking_is_show_legend').is(':checked') ) {
1732 jQuery('.wpbc_calendar_legend_items').addClass('hidden_items');
1733 }
1734 ";
1735 // Hide or Show Legend items on click checkbox
1736 $js_script .= " jQuery('#set_gen_booking_is_show_legend').on( 'change', function(){
1737 if ( this.checked ) {
1738 jQuery('.wpbc_calendar_legend_items').removeClass('hidden_items');
1739 } else {
1740 jQuery('.wpbc_calendar_legend_items').addClass('hidden_items');
1741 }
1742 } ); ";
1743 // Thank you Message or Page
1744 $js_script .= "
1745 if ( jQuery('#type_of_thank_you_message_message').is(':checked') ) {
1746 jQuery('.wpbc_calendar_thank_you_page').addClass('hidden_items');
1747 }
1748 if ( jQuery('#type_of_thank_you_message_page').is(':checked') ) {
1749 jQuery('.wpbc_calendar_thank_you_message').addClass('hidden_items');
1750 }
1751 ";
1752 $js_script .= " jQuery('input[name=\"set_gen_booking_type_of_thank_you_message\"]').on( 'change', function(){
1753 if ( jQuery('#type_of_thank_you_message_message').is(':checked') ) {
1754 jQuery('.wpbc_calendar_thank_you_message').removeClass('hidden_items');
1755 jQuery('.wpbc_calendar_thank_you_page').addClass('hidden_items');
1756 } else {
1757 jQuery('.wpbc_calendar_thank_you_message').addClass('hidden_items');
1758 jQuery('.wpbc_calendar_thank_you_page').removeClass('hidden_items');
1759 }
1760 } ); ";
1761
1762 // Default calendar view mode (Booking Listing) - set active / inctive options depend from resource selection.
1763 $js_script .= " jQuery('#set_gen_booking_view_days_num').on( 'focus', function(){
1764 if ( jQuery('#set_gen_booking_default_booking_resource').length > 0 ) {
1765 jQuery('#set_gen_booking_default_booking_resource').on('change', function() {
1766 jQuery('#set_gen_booking_view_days_num option:eq(2)').prop('selected', true);
1767 });
1768 if ( jQuery('#set_gen_booking_default_booking_resource').val() == '' ) {
1769 jQuery('#set_gen_booking_view_days_num option:eq(0)').prop('disabled', false);
1770 jQuery('#set_gen_booking_view_days_num option:eq(1)').prop('disabled', false);
1771 jQuery('#set_gen_booking_view_days_num option:eq(2)').prop('disabled', false);
1772 jQuery('#set_gen_booking_view_days_num option:eq(3)').prop('disabled', false);
1773 jQuery('#set_gen_booking_view_days_num option:eq(4)').prop('disabled', true);
1774 jQuery('#set_gen_booking_view_days_num option:eq(5)').prop('disabled', true);
1775 } else {
1776 jQuery('#set_gen_booking_view_days_num option:eq(0)').prop('disabled', true);
1777 jQuery('#set_gen_booking_view_days_num option:eq(1)').prop('disabled', true);
1778 jQuery('#set_gen_booking_view_days_num option:eq(2)').prop('disabled', false);
1779 jQuery('#set_gen_booking_view_days_num option:eq(3)').prop('disabled', true);
1780 jQuery('#set_gen_booking_view_days_num option:eq(4)').prop('disabled', false);
1781 jQuery('#set_gen_booking_view_days_num option:eq(5)').prop('disabled', false);
1782 }
1783 }
1784 } ); ";
1785
1786 ////////////////////////////////////////////////////////////////////////
1787 // Set correct value for dates format, depend on from selection of radio buttons
1788 $booking_date_format = esc_js( get_bk_option( 'booking_date_format') ); // FixIn: 10.6.1.2.
1789 // On initial Load set correct text value and correct radio button
1790 $js_script .= "
1791 // Select by default Custom value, later check all other predefined values
1792 jQuery( '#date_format_selection_custom' ).prop('checked', true);
1793
1794 jQuery('input[name=\"set_gen_booking_date_format_selection\"]').each(function() {
1795 var radio_button_value = jQuery( this ).val()
1796 var encodedStr = radio_button_value.replace(/[\u00A0-\u9999<>\&]/gim, function(i) {
1797 return '&#'+i.charCodeAt(0)+';';
1798 });
1799 if ( encodedStr == '". $booking_date_format ."' ) {
1800 jQuery( this ).prop('checked', true);
1801 }
1802 });
1803
1804 jQuery('#set_gen_booking_date_format').val('". $booking_date_format ."');
1805 ";
1806 // On click Radio button "Date Format", - set value in custom Text field
1807 $js_script .= " jQuery('input[name=\"set_gen_booking_date_format_selection\"]').on( 'change', function(){
1808 if ( ( this.checked ) && ( jQuery(this).val() != 'custom' ) ){
1809
1810 jQuery('#set_gen_booking_date_format').val( jQuery(this).val().replace(/[\u00A0-\u9999<>\&]/gim,
1811 function(i) {
1812 return '&#'+i.charCodeAt(0)+';';
1813 })
1814 );
1815 }
1816 } ); ";
1817 // If we edit custom "Date Format" Text field - select Custom Radio button.
1818 $js_script .= " jQuery('#set_gen_booking_date_format').on( 'change', function(){
1819 jQuery( '#date_format_selection_custom' ).prop('checked', true);
1820 } ); ";
1821
1822 ////////////////////////////////////////////////////////////////////////
1823 // Set correct value for Time Format, depend on from selection of radio buttons
1824 $booking_time_format = esc_js( get_bk_option( 'booking_time_format') ); // FixIn: 10.6.1.2.
1825 // Function to load on initial stage of page loading, set correct value of text and select correct radio button.
1826 $js_script .= "
1827 // Select by default Custom value, later check all other predefined values
1828 jQuery( '#time_format_selection_custom' ).prop('checked', true);
1829
1830 jQuery('input[name=\"set_gen_booking_time_format_selection\"]').each(function() {
1831 var radio_button_value = jQuery( this ).val()
1832 var encodedStr = radio_button_value.replace(/[\u00A0-\u9999<>\&]/gim, function(i) {
1833 return '&#'+i.charCodeAt(0)+';';
1834 });
1835 if ( encodedStr == '". $booking_time_format ."' ) {
1836 jQuery( this ).prop('checked', true);
1837 }
1838 });
1839
1840 jQuery('#set_gen_booking_time_format').val('". $booking_time_format ."');
1841 ";
1842 // On click Radio button "Time Format", - set value in custom Text field
1843 $js_script .= " jQuery('input[name=\"set_gen_booking_time_format_selection\"]').on( 'change', function(){
1844 if ( ( this.checked ) && ( jQuery(this).val() != 'custom' ) ){
1845
1846 jQuery('#set_gen_booking_time_format').val( jQuery(this).val().replace(/[\u00A0-\u9999<>\&]/gim,
1847 function(i) {
1848 return '&#'+i.charCodeAt(0)+';';
1849 })
1850 );
1851 }
1852 } ); ";
1853 // If we edit custom "Date Format" Text field - select Custom Radio button.
1854 $js_script .= " jQuery('#set_gen_booking_time_format').on( 'change', function(){
1855 jQuery( '#time_format_selection_custom' ).prop('checked', true);
1856 } ); ";
1857
1858 ////////////////////////////////////////////////////////////////////////
1859 // Advanced section
1860 ////////////////////////////////////////////////////////////////////////
1861
1862 // Click on "Always available "
1863 $js_script .= " jQuery('#set_gen_booking_is_days_always_available').on( 'change', function(){
1864 if ( this.checked ) {
1865 var answer = confirm('"
1866 . esc_js( __( 'Warning', 'booking' ) ) . '! '
1867 . esc_js( __( 'You allow unlimited number of bookings per same dates, its can be a reason of double bookings on the same date. Do you really want to do this?', 'booking' ) )
1868 . "' );
1869 if ( answer) {
1870 this.checked = true;
1871 jQuery('#set_gen_booking_quantity_control').prop('checked', false ).trigger('change');
1872 jQuery('#set_gen_booking_is_show_pending_days_as_available').prop('checked', false );
1873 jQuery('.wpbc_pending_days_as_available_sub_settings').addClass('hidden_items');
1874 } else {
1875 this.checked = false;
1876 }
1877 }
1878 } ); ";
1879
1880 // FixIn: 8.3.2.2.
1881 if ( ! class_exists('wpdev_bk_biz_l') ) {
1882 // Click on "Use pending days as available"
1883 $js_script .= " jQuery('#set_gen_booking_is_show_pending_days_as_available').on( 'change', function(){
1884 if ( this.checked ) {
1885 jQuery('#set_gen_booking_is_days_always_available').prop('checked', false );
1886 } else {
1887
1888 }
1889 } ); ";
1890 }
1891
1892 // Click on Show Advanced JavaScript section link
1893 $js_script .= " jQuery('#wpbc_show_advanced_section_link_show').on( 'click', function(){
1894 jQuery('#wpbc_show_advanced_section_link_show').toggle(200);
1895 jQuery('#wpbc_show_advanced_section_link_hide').animate( {opacity: 1}, 200 ).toggle(200);
1896 jQuery('.wpbc_advanced_js_loading_settings').removeClass('hidden_items');
1897
1898 if ( ! jQuery('#set_gen_booking_is_load_js_css_on_specific_pages').is(':checked') ) {
1899 jQuery('.wpbc_is_load_js_css_on_specific_pages').addClass('hidden_items');
1900 }
1901 } ); ";
1902 $js_script .= " jQuery('#wpbc_show_advanced_section_link_hide').on( 'click', function(){
1903 jQuery('#wpbc_show_advanced_section_link_hide').toggle(200);
1904 jQuery('#wpbc_show_advanced_section_link_show').animate( {opacity: 1}, 200 ).toggle(200);
1905 jQuery('.wpbc_advanced_js_loading_settings').addClass('hidden_items');
1906 } ); ";
1907 $js_script .= " jQuery('#set_gen_booking_is_load_js_css_on_specific_pages').on( 'change', function(){
1908 if ( this.checked ) {
1909 var answer = confirm('"
1910 . esc_js( __( 'Warning', 'booking' ) ) . '! '
1911 . 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' ) )
1912 . "' );
1913 if ( answer) {
1914 this.checked = true;
1915 jQuery('.wpbc_is_load_js_css_on_specific_pages').removeClass('hidden_items');
1916 } else {
1917 this.checked = false;
1918 }
1919 } else {
1920 jQuery('.wpbc_is_load_js_css_on_specific_pages').addClass('hidden_items');
1921 }
1922 } );
1923 if ( ! jQuery('#set_gen_booking_is_load_js_css_on_specific_pages').is(':checked') ) {
1924 jQuery('.wpbc_is_load_js_css_on_specific_pages').addClass('hidden_items');
1925 }
1926
1927 ";
1928
1929
1930 // Click on Powered by links
1931 $js_script .= " jQuery('#wpbc_powered_by_link_show').on( 'click', function(){
1932 jQuery('#wpbc_powered_by_link_show').toggle(200);
1933 jQuery('#wpbc_powered_by_link_hide').animate( {opacity: 1}, 200 ).toggle(200);
1934 jQuery('.wpbc_is_show_powered_by_notice').removeClass('hidden_items');
1935 } ); ";
1936 $js_script .= " jQuery('#wpbc_powered_by_link_hide').on( 'click', function(){
1937 jQuery('#wpbc_powered_by_link_hide').toggle(200);
1938 jQuery('#wpbc_powered_by_link_show').animate( {opacity: 1}, 200 ).toggle(200);
1939 jQuery('.wpbc_is_show_powered_by_notice').addClass('hidden_items');
1940 } ); ";
1941
1942
1943 // Show confirmation window, if user activate this checkbox
1944 $js_script .= " jQuery('#set_gen_booking_is_delete_if_deactive').on( 'change', function(){
1945 if ( this.checked ) {
1946 var answer = confirm('"
1947 . esc_js( __( 'Warning', 'booking' ) ) . '! '
1948 . 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' ) )
1949 . "' );
1950 if ( answer) {
1951 this.checked = true;
1952 } else {
1953 this.checked = false;
1954 }
1955 }
1956 } );
1957 ";
1958
1959
1960
1961
1962
1963 // ============================================================================================================= // FixIn: 10.1.5.4.
1964 // 'Dates selection' - some options hide or show
1965 // =============================================================================================================
1966
1967 // Initial Hiding some Sections in settings
1968 $js_script .= " function wpbc_check_showing_range_days_selection_sections() {
1969 // Single selected
1970 if ( jQuery('#type_of_day_selections_single').is(':checked') ) {
1971 jQuery('.wpbc_recurrent_check_in_out_time_slots').addClass('hidden_items'); // Hide Reccurent, Check in/out Sections
1972
1973 jQuery('#set_gen_booking_last_checkout_day_available').prop('checked', false); // Uncheck Recurrent
1974
1975 jQuery('#set_gen_booking_recurrent_time').prop('checked', false); // Uncheck Reccurent
1976 jQuery('#set_gen_booking_range_selection_time_is_active').prop('checked', false); // and Check In/Out
1977
1978 jQuery('.wpbc_range_days_selection').addClass('hidden_items'); // Hide Range section
1979 } // Multiple selected
1980 if ( jQuery('#type_of_day_selections_multiple').is(':checked') ) {
1981 jQuery('.wpbc_recurrent_check_in_out_time_slots').removeClass('hidden_items'); // Show Reccurent, Check in/out Sections
1982
1983 jQuery('.wpbc_range_days_selection').addClass('hidden_items'); // Hide Range section
1984 }
1985 // Range selected
1986 if ( jQuery('#type_of_day_selections_range').is(':checked') ) {
1987
1988 jQuery('.wpbc_recurrent_check_in_out_time_slots').removeClass('hidden_items'); // Show Reccurent, Check in/out Sections
1989
1990 jQuery('.wpbc_range_days_selection').removeClass('hidden_items'); // Show Range section
1991 jQuery('.wpbc_tr_set_gen_booking_range_start_day_week fieldset').removeClass('hidden_items');
1992 jQuery('.wpbc_tr_set_gen_booking_range_start_day_dynamic_week fieldset').removeClass('hidden_items');
1993
1994 // Fixed selected
1995 if ( jQuery('#range_selection_type_fixed').is(':checked') ) {
1996 jQuery('.wpbc_range_dynamic_selection').addClass('hidden_items');
1997 // Any Week Days selected
1998 if ( jQuery('#range_fixed_start_day_any_day').is(':checked') ) {
1999 jQuery('.wpbc_tr_set_gen_booking_range_start_day_week fieldset').addClass('hidden_items');
2000 }
2001 }
2002 // Dynamic selected
2003 if ( jQuery('#range_selection_type_dynamic').is(':checked') ) {
2004 jQuery('.wpbc_range_fixed_selection').addClass('hidden_items');
2005 // Any Week Days selected
2006 if ( jQuery('#range_dynamic_start_day_any_day').is(':checked') ) {
2007 jQuery('.wpbc_tr_set_gen_booking_range_start_day_dynamic_week fieldset').addClass('hidden_items');
2008 }
2009 }
2010 }
2011
2012 if ( jQuery('#set_gen_booking_range_selection_time_is_active').is(':checked') ) { // Check In/Out selected
2013 jQuery('.wpbc_check_in_out_time_slots').removeClass('hidden_items'); // Show Check In/Out times
2014 } else {
2015 jQuery('.wpbc_check_in_out_time_slots').addClass('hidden_items'); // Hide Check In/Out times
2016 }
2017 }
2018 wpbc_check_showing_range_days_selection_sections(); // Run first time to init
2019 ";
2020
2021 // Hiding or showing section based on User Clicks in settings
2022 $list_of_id_to_hook = array(
2023 '#type_of_day_selections_single'
2024 , '#type_of_day_selections_multiple'
2025 , '#type_of_day_selections_range'
2026 , '#range_selection_type_fixed'
2027 , '#range_selection_type_dynamic'
2028 , '#range_fixed_start_day_specific_day'
2029 , '#range_fixed_start_day_any_day'
2030 , '#range_dynamic_start_day_specific_day'
2031 , '#range_dynamic_start_day_any_day'
2032 );
2033 $list_of_id_to_hook = implode( ',', $list_of_id_to_hook );
2034
2035 // Click on "Days Selections", "Type of range", "Start Week days" checkboxes or radioboxes, show/hide sections.
2036 $js_script .= " jQuery('{$list_of_id_to_hook}').on( 'change', function(){
2037 wpbc_check_showing_range_days_selection_sections();
2038 } ); ";
2039
2040 // Click on "Recurrent Time" - then Uncheck "Check In/Out" and hide show sections.
2041 $js_script .= " jQuery('#set_gen_booking_recurrent_time').on( 'change', function(){
2042 if ( this.checked ) {
2043 jQuery('#set_gen_booking_range_selection_time_is_active').prop('checked', false);
2044 }
2045 wpbc_check_showing_range_days_selection_sections();
2046 } ); ";
2047
2048 // Click on "Check In/Out" - then Uncheck "Recurrent Time" and hide show sections.
2049 $js_script .= " jQuery('#set_gen_booking_range_selection_time_is_active').on( 'change', function(){
2050 if ( this.checked ) {
2051 jQuery('#set_gen_booking_recurrent_time').prop('checked', false);
2052 jQuery('#set_gen_booking_last_checkout_day_available').prop('checked', false); // Uncheck Reccurent
2053 }
2054 wpbc_check_showing_range_days_selection_sections();
2055 } ); ";
2056
2057 // Confirmation Section configuration
2058 $js_script .= "
2059 if ( ! jQuery('#set_gen_booking_confirmation__personal_info__header_enabled').is(':checked') ) {
2060 jQuery('.wpbc_booking_confirmation__personal_info__field').addClass('wpbc_field_disabled');
2061 jQuery('.wpbc_booking_confirmation__personal_info__fields').addClass('hidden_items');
2062 }
2063 ";
2064 $js_script .= " jQuery('#set_gen_booking_confirmation__personal_info__header_enabled').on( 'change', function(){
2065 if ( ! this.checked ) {
2066 jQuery('.wpbc_booking_confirmation__personal_info__field').addClass('wpbc_field_disabled');
2067 jQuery('.wpbc_booking_confirmation__personal_info__fields').addClass('hidden_items');
2068 } else {
2069 jQuery('.wpbc_booking_confirmation__personal_info__field').removeClass('wpbc_field_disabled');
2070 jQuery('.wpbc_booking_confirmation__personal_info__fields').removeClass('hidden_items');
2071 }
2072 } ); ";
2073 $js_script .= "
2074 if ( ! jQuery('#set_gen_booking_confirmation__booking_details__header_enabled').is(':checked') ) {
2075 jQuery('.wpbc_booking_confirmation__booking_details__field').addClass('wpbc_field_disabled');
2076 jQuery('.wpbc_booking_confirmation__booking_details__fields').addClass('hidden_items');
2077 }
2078 ";
2079 $js_script .= " jQuery('#set_gen_booking_confirmation__booking_details__header_enabled').on( 'change', function(){
2080 if ( ! this.checked ) {
2081 jQuery('.wpbc_booking_confirmation__booking_details__field').addClass('wpbc_field_disabled');
2082 jQuery('.wpbc_booking_confirmation__booking_details__fields').addClass('hidden_items');
2083 } else {
2084 jQuery('.wpbc_booking_confirmation__booking_details__field').removeClass('wpbc_field_disabled');
2085 jQuery('.wpbc_booking_confirmation__booking_details__fields').removeClass('hidden_items');
2086 }
2087 } ); ";
2088
2089 $js_script .= "
2090 if ( ! jQuery('#set_gen_booking_confirmation_header_enabled').is(':checked') ) {
2091 jQuery('.wpbc_booking_confirmation_header__field').addClass('wpbc_field_disabled');
2092 }
2093 ";
2094 $js_script .= " jQuery('#set_gen_booking_confirmation_header_enabled').on( 'change', function(){
2095 if ( ! this.checked ) {
2096 jQuery('.wpbc_booking_confirmation_header__field').addClass('wpbc_field_disabled');
2097 } else {
2098 jQuery('.wpbc_booking_confirmation_header__field').removeClass('wpbc_field_disabled');
2099 }
2100 } ); ";
2101
2102
2103 // Enqueue JS to the footer of the page
2104 wpbc_enqueue_js( $js_script );
2105 }
2106
2107 }
2108
2109
2110 /**
2111 * Override VALIDATED fields BEFORE saving to DB
2112 * Description:
2113 * Check "Thank you page" URL
2114 *
2115 * @param array $validated_fields
2116 */
2117 function wpbc_settings_validate_fields_before_saving__all( $validated_fields ) {
2118
2119
2120 $validated_fields['booking_thank_you_page_URL'] = wpbc_make_link_relative( $validated_fields['booking_thank_you_page_URL'] );
2121
2122 unset( $validated_fields[ 'booking_date_format_selection' ] ); // We do not need to this field, because saving to DB only: "date_format" field
2123 unset( $validated_fields[ 'booking_time_format_selection' ] ); // We do not need to this field, because saving to DB only: "time_format" field
2124
2125 // Unset promote fields
2126 foreach ( $validated_fields as $field_name => $field_value ) {
2127 if ( strpos( $field_name, '__promote_upgrade' ) > 0 ) {
2128 unset( $validated_fields[ $field_name ] );
2129 }
2130 }
2131
2132 return $validated_fields;
2133 }
2134 add_filter( 'wpbc_settings_validate_fields_before_saving', 'wpbc_settings_validate_fields_before_saving__all', 10, 1 ); // Hook for validated fields.
2135
2136
2137 /**
2138 * Load Code mirror highlighter for Booking Confirmation at the WP Booking Calendar > Settings General page in "Booking Confirmation" section
2139 *
2140 * @param $page_name
2141 *
2142 * @return false|void
2143 */
2144 function wpbc_hook_settings_page_footer__define_code_mirror( $page_name ) {
2145
2146 if ( 'general_settings' != $page_name ) {
2147 return false;
2148 }
2149
2150 $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.
2151
2152 if ( $is_use_code_mirror ) {
2153
2154 wpbc_codemirror()->set_codemirror( array(
2155 'textarea_id' => '#set_gen_booking_confirmation__personal_info__content'
2156 // , 'preview_id' => '#wpbc_add_form_html_preview'
2157 ) );
2158 wpbc_codemirror()->set_codemirror( array(
2159 'textarea_id' => '#set_gen_booking_confirmation__booking_details__content'
2160 // , 'preview_id' => '#wpbc_add_form_html_preview'
2161 ) );
2162
2163 }
2164 }
2165 //add_action( 'wpbc_hook_settings_page_footer', 'wpbc_hook_settings_page_footer__define_code_mirror' );