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

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

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