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

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

1,925 lines 129.1 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 // Calendar Skin /////////////////////////////////////////////////////
53 $calendar_skins_options = array();
54
55 // Skins in the Custom User folder (need to create it manually): http://example.com/wp-content/uploads/wpbc_skins/ ( This folder do not owerwrited during update of plugin )
56 $upload_dir = wp_upload_dir();
57 //FixIn: 8.9.4.8
58 $files_in_folder = wpbc_dir_list( array( WPBC_PLUGIN_DIR . '/css/skins/', $upload_dir['basedir'].'/wpbc_skins/' ) ); // Folders where to look about calendar skins
59 foreach ( $files_in_folder as $skin_file ) { // Example: $skin_file['/css/skins/standard.css'] => 'Standard';
60
61 //FixIn: 8.9.4.8 //FixIn: 9.1.2.10
62 $skin_file[1] = str_replace( array( WPBC_PLUGIN_DIR, WPBC_PLUGIN_URL , $upload_dir['basedir'] ), '', $skin_file[1] ); // Get relative path for calendar skin
63 $calendar_skins_options[ $skin_file[1] ] = $skin_file[2];
64 }
65
66 $this->fields['booking_skin'] = array(
67 'type' => 'select'
68 , 'default' => $default_options_values['booking_skin'] // '/css/skins/traditional.css' // Activation|Deactivation of this options in wpbc-activation file. // Default value in wpbc_get_default_options('booking_skin')
69 //, 'value' => '/css/skins/standard.css' //This will override value loaded from DB
70 , 'title' => __('Calendar Skin', 'booking')
71 , 'description' => __('Select the skin of the booking calendar' ,'booking')
72 , 'options' => $calendar_skins_options
73 , 'group' => 'calendar'
74 );
75
76 // //Show | Hide links for Advanced JavaScript section
77 // $this->fields['booking_skin_help'] = array(
78 // 'type' => 'html'
79 // , 'html' =>
80 // '<div class="wpbc-settings-notice notice-info" style="text-align:left;">'
81 // . '<strong>' . __('Note!' ,'booking') . '</strong> '
82 // . sprintf( __( 'If you have customized your own calendar skin, please save it to: %s Its will save your custom skin during future updates of plugin.', 'booking' ), '<code>/wp-content/uploads/wpbc_skins/</code><br/>' )
83 // . '</div>'
84 // , 'cols' => 2
85 // , 'group' => 'calendar'
86 // );
87
88 // Number of months //////////////////////////////////////////////////
89 $months_options = array();
90 for ($mm = 1; $mm < 12; $mm++) { $months_options[ $mm . 'm' ] = $mm . ' ' . __('month(s)' ,'booking'); }
91 $months_options[ 18 . 'm' ] = '18 ' . __('month(s)' ,'booking'); //FixIn: 10.0.0.11
92 for ($yy = 1; $yy < 11; $yy++) { $months_options[ $yy . 'y' ] = $yy . ' ' . __('year(s)' ,'booking'); }
93
94 $this->fields['booking_max_monthes_in_calendar'] = array(
95 'type' => 'select'
96 , 'default' => $default_options_values['booking_max_monthes_in_calendar'] // '1y'
97 , 'title' => __('Number of months to scroll', 'booking')
98 , 'description' => __('Select the maximum number of months to show (scroll)' ,'booking')
99 , 'options' => $months_options
100 , 'group' => 'calendar'
101 );
102
103
104 // Start Day of the week /////////////////////////////////////////////
105 $this->fields['booking_start_day_weeek'] = array(
106 'type' => 'select'
107 , 'default' => $default_options_values['booking_start_day_weeek'] // '2'
108 // , 'value' => false
109 , 'title' => __('Start Day of the week', 'booking')
110 , 'description' => __('Select your start day of the week' ,'booking')
111 , 'options' => array(
112 '0' => __('Sunday' ,'booking')
113 , '1' => __('Monday' ,'booking')
114 , '2' => __('Tuesday' ,'booking')
115 , '3' => __('Wednesday' ,'booking')
116 , '4' => __('Thursday' ,'booking')
117 , '5' => __('Friday' ,'booking')
118 , '6' => __('Saturday' ,'booking')
119 )
120 , 'group' => 'calendar'
121 );
122
123 // Divider ///////////////////////////////////////////////////////////
124 $this->fields['hr_calendar_after_week_day'] = array( 'type' => 'hr', 'group' => 'calendar' );
125
126
127
128 $field_options = array(
129 'single' => array(
130 'title' => __('Single day' ,'booking')
131 , 'attr' => array(
132 'id' => 'type_of_day_selections_single'
133 )
134 )
135 , 'multiple' => array(
136 'title' => __('Multiple days' ,'booking')
137 , 'attr' => array(
138 'id' => 'type_of_day_selections_multiple'
139 )
140 )
141 );
142 // Days ///////////////////////////////////////////////////////////
143 $this->fields['booking_type_of_day_selections'] = array(
144 'type' => 'radio'
145 , 'default' => $default_options_values['booking_type_of_day_selections'] // 'multiple'
146 , 'title' => __('Days selection in calendar', 'booking')
147 , 'description' => ''
148 , 'options' => $field_options
149 , 'group' => 'calendar'
150 );
151
152 ////////////////////////////////////////////////////////////////////////
153
154 $this->fields = apply_filters( 'wpbc_settings_calendar_range_days_selection', $this->fields, $default_options_values ); // Range days
155 $this->fields = apply_filters( 'wpbc_settings_calendar_recurrent_time_slots', $this->fields, $default_options_values ); // Recurent Times
156 $this->fields = apply_filters( 'wpbc_settings_calendar_check_in_out_times', $this->fields, $default_options_values ); // Check In/Out Times
157
158 // </editor-fold>
159
160
161 // <editor-fold defaultstate="collapsed" desc=" Dates Tooltips " >
162 //FixIn: 9.5.0.2.2
163 $this->fields['booking_disable_timeslots_in_tooltip'] = array(
164 'type' => 'checkbox'
165 , 'default' => $default_options_values['booking_disable_timeslots_in_tooltip'] //'Off'
166 , 'title' => __('Disable times in tooltips' ,'booking')
167 , 'label' => __('Disable show booked times in tooltip, when mouse over specific day in calendar' ,'booking')
168 , 'description' => ''
169 , 'group' => 'days_tooltips'
170 , 'tr_class' => ''
171 );
172
173 //FixIn: 9.4.3.1
174 $this->fields['booking_highlight_timeslot_word'] = array(
175 'type' => 'text'
176 , 'default' => $default_options_values['booking_highlight_timeslot_word'] //__('Booked Times:' ,'booking')
177 , 'placeholder' => __('Booked Times:' ,'booking')
178 , 'title' => __('Title of booked timeslot(s)' ,'booking')
179 , 'description' => sprintf(__('Type your %stitle%s, what will show in mouseover tooltip near booked timeslot(s)' ,'booking'),'<b>','</b>')
180 //,'description_tag' => 'span'
181 , 'class' => 'regular-text'
182 , 'group' => 'days_tooltips'
183 , 'tr_class' => 'wpbc_booking_timeslots_in_tooltip wpbc_sub_settings_grayed' //FixIn: 9.5.0.2.2
184 );
185 $this->fields = apply_filters( 'wpbc_settings_calendar_showing_info_in_cal', $this->fields, $default_options_values ); // Availability in calendar...
186 $this->fields = apply_filters( 'wpbc_settings_calendar_show_booking_details', $this->fields, $default_options_values ); // Show Booking details in mouse over tooltips
187 $this->fields = apply_filters( 'wpbc_settings_calendar_showing_cost_in_tooltip', $this->fields, $default_options_values ); // Showing Cost,
188
189 // </editor-fold>
190
191
192 // <editor-fold defaultstate="collapsed" desc=" L e g e n d I t e m s " >
193 // Legend Items ////////////////////////////////////////////////////////
194
195 $this->fields['hr_calendar_before_legend'] = array( 'type' => 'hr', 'group' => 'calendar' );
196
197 $this->fields['booking_is_show_legend'] = array(
198 'type' => 'checkbox'
199 , 'default' => $default_options_values['booking_is_show_legend'] // 'Off'
200 , 'title' => __('Show legend below calendar' ,'booking')
201 , 'label' => __('Check this box to display a legend of dates below the booking calendar.' ,'booking')
202 , 'description' => ''
203 , 'group' => 'calendar'
204 );
205 // Available item
206 $this->fields['booking_legend_is_show_item_available_prefix'] = array(
207 'type' => 'pure_html'
208 , 'group' => 'calendar'
209 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_legend_is_show_item_available
210 wpbc_calendar_legend_items wpbc_sub_settings_grayed">
211 <th scope="row">'.
212 WPBC_Settings_API::label_static( 'set_gen_booking_legend_is_show_item_available'
213 , array( 'title'=> __('Available item' ,'booking'), 'label_css' => '' ) )
214 .'</th>
215 <td><fieldset>'
216 );
217 $this->fields['booking_legend_is_show_item_available'] = array(
218 'type' => 'checkbox'
219 , 'default' => $default_options_values['booking_legend_is_show_item_available'] // 'On'
220 , 'is_new_line' => false
221 , 'group' => 'calendar'
222 , 'only_field' => true
223 );
224 $this->fields['booking_legend_text_for_item_available'] = array(
225 'type' => 'text'
226 , 'default' => $default_options_values['booking_legend_text_for_item_available'] // __('Available' ,'booking')
227 , 'placeholder' => __('Available' ,'booking')
228 , 'css' => '' //'width:8em;'
229 , 'group' => 'calendar'
230 , 'only_field' => true
231 );
232 $this->fields['booking_legend_is_show_item_available_sufix'] = array(
233 'type' => 'pure_html'
234 , 'group' => 'calendar'
235 , 'html' => '<p class="description" style="line-height: 1.7em;margin: 0;">'
236 . sprintf(__('Activate and type your %stitle of available%s item in legend' ,'booking'),'<b>','</b>')
237 . '</p>
238 </fieldset>
239 </td>
240 </tr>'
241 );
242 // Pending item
243 $this->fields['booking_legend_is_show_item_pending_prefix'] = array(
244 'type' => 'pure_html'
245 , 'group' => 'calendar'
246 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_legend_is_show_item_pending
247 wpbc_calendar_legend_items wpbc_sub_settings_grayed">
248 <th scope="row">'.
249 WPBC_Settings_API::label_static( 'set_gen_booking_legend_is_show_item_pending'
250 , array( 'title'=> __('Pending item' ,'booking'), 'label_css' => '' ) )
251 .'</th>
252 <td><fieldset>'
253 );
254 $this->fields['booking_legend_is_show_item_pending'] = array(
255 'type' => 'checkbox'
256 , 'default' => $default_options_values['booking_legend_is_show_item_pending'] // 'On'
257 , 'is_new_line' => false
258 , 'group' => 'calendar'
259 , 'only_field' => true
260 );
261 $this->fields['booking_legend_text_for_item_pending'] = array(
262 'type' => 'text'
263 , 'default' => $default_options_values['booking_legend_text_for_item_pending'] // __('Pending' ,'booking')
264 , 'placeholder' => __('Pending' ,'booking')
265 , 'css' => '' //'width:8em;'
266 , 'group' => 'calendar'
267 , 'only_field' => true
268 );
269 $this->fields['booking_legend_is_show_item_pending_sufix'] = array(
270 'type' => 'pure_html'
271 , 'group' => 'calendar'
272 , 'html' => '<p class="description" style="line-height: 1.7em;margin: 0;">'
273 . sprintf(__('Activate and type your %stitle of pending%s item in legend' ,'booking'),'<b>','</b>')
274 . '</p>
275 </fieldset>
276 </td>
277 </tr>'
278 );
279 // Approved item
280 $this->fields['booking_legend_is_show_item_approved_prefix'] = array(
281 'type' => 'pure_html'
282 , 'group' => 'calendar'
283 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_legend_is_show_item_approved
284 wpbc_calendar_legend_items wpbc_sub_settings_grayed">
285 <th scope="row">'.
286 WPBC_Settings_API::label_static( 'set_gen_booking_legend_is_show_item_approved'
287 , array( 'title'=> __('Approved item' ,'booking'), 'label_css' => '' ) )
288 .'</th>
289 <td><fieldset>'
290 );
291 $this->fields['booking_legend_is_show_item_approved'] = array(
292 'type' => 'checkbox'
293 , 'default' => $default_options_values['booking_legend_is_show_item_approved'] // 'On'
294 , 'is_new_line' => false
295 , 'group' => 'calendar'
296 , 'only_field' => true
297 );
298 $this->fields['booking_legend_text_for_item_approved'] = array(
299 'type' => 'text'
300 , 'default' => $default_options_values['booking_legend_text_for_item_approved'] //__('Booked' ,'booking')
301 , 'placeholder' => __('Booked' ,'booking')
302 , 'css' => '' //'width:8em;'
303 , 'group' => 'calendar'
304 , 'only_field' => true
305 );
306 $this->fields['booking_legend_is_show_item_approved_sufix'] = array(
307 'type' => 'pure_html'
308 , 'group' => 'calendar'
309 , 'html' => '<p class="description" style="line-height: 1.7em;margin: 0;">'
310 . sprintf(__('Activate and type your %stitle of approved%s item in legend' ,'booking'),'<b>','</b>')
311 . '</p>
312 </fieldset>
313 </td>
314 </tr>'
315 );
316 if ( class_exists('wpdev_bk_biz_s') ) {
317 // Partially booked item
318 $this->fields['booking_legend_is_show_item_partially_prefix'] = array(
319 'type' => 'pure_html'
320 , 'group' => 'calendar'
321 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_legend_is_show_item_partially
322 wpbc_calendar_legend_items wpbc_sub_settings_grayed">
323 <th scope="row">'.
324 WPBC_Settings_API::label_static( 'set_gen_booking_legend_is_show_item_partially'
325 , array( 'title'=> __('Partially booked item' ,'booking'), 'label_css' => '' ) )
326 .'</th>
327 <td><fieldset>'
328 );
329 $this->fields['booking_legend_is_show_item_partially'] = array(
330 'type' => 'checkbox'
331 , 'default' => $default_options_values['booking_legend_is_show_item_partially'] //'On'
332 , 'is_new_line' => false
333 , 'group' => 'calendar'
334 , 'only_field' => true
335 );
336 $this->fields['booking_legend_text_for_item_partially'] = array(
337 'type' => 'text'
338 , 'default' => $default_options_values['booking_legend_text_for_item_partially'] //__('Partially booked' ,'booking')
339 , 'placeholder' => __('Partially booked' ,'booking')
340 , 'css' => '' //'width:8em;'
341 , 'group' => 'calendar'
342 , 'only_field' => true
343 );
344 $this->fields['booking_legend_is_show_item_partially_sufix'] = array(
345 'type' => 'pure_html'
346 , 'group' => 'calendar'
347 , 'html' => '<p class="description" style="line-height: 1.7em;margin: 0;">'
348 . sprintf(__('Activate and type your %stitle of partially booked%s item in legend' ,'booking'),'<b>','</b>')
349 . '</p>'
350 . '<p class="description" style="line-height: 1.7em;margin: 0;"><strong>' . __('Note' ,'booking') .':</strong> '
351 . sprintf(__('Partially booked item - day, which is booked for the specific time-slot(s).' ,'booking'),'<b>','</b>')
352 . '</p>'
353 .'</fieldset>
354 </td>
355 </tr>'
356 );
357 }
358
359
360 // Unavailable Legend Item //FixIn: 9.9.0.5
361 $this->fields['booking_legend_is_show_item_unavailable_prefix'] = array(
362 'type' => 'pure_html'
363 , 'group' => 'calendar'
364 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_legend_is_show_item_unavailable
365 wpbc_calendar_legend_items wpbc_sub_settings_grayed">
366 <th scope="row">'.
367 WPBC_Settings_API::label_static( 'set_gen_booking_legend_is_show_item_unavailable'
368 , array( 'title'=> __('Unavailable item' ,'booking'), 'label_css' => '' ) )
369 .'</th>
370 <td><fieldset>'
371 );
372 $this->fields['booking_legend_is_show_item_unavailable'] = array(
373 'type' => 'checkbox'
374 , 'default' => $default_options_values['booking_legend_is_show_item_unavailable'] // 'On'
375 , 'is_new_line' => false
376 , 'group' => 'calendar'
377 , 'only_field' => true
378 );
379 $this->fields['booking_legend_text_for_item_unavailable'] = array(
380 'type' => 'text'
381 , 'default' => $default_options_values['booking_legend_text_for_item_unavailable'] //__('Booked' ,'booking')
382 , 'placeholder' => __('Unavailable' ,'booking')
383 , 'css' => '' //'width:8em;'
384 , 'group' => 'calendar'
385 , 'only_field' => true
386 );
387 $this->fields['booking_legend_is_show_item_unavailable_sufix'] = array(
388 'type' => 'pure_html'
389 , 'group' => 'calendar'
390 , 'html' => '<p class="description" style="line-height: 1.7em;margin: 0;">'
391 . sprintf(__('Activate and type your %stitle of unavailable%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
436 // <editor-fold defaultstate="collapsed" desc=" T i m e S l o t s " >
437
438 $my_close_open_alert_id = 'bk_alert_booking_timeslot_picker__help_tip';
439 $this->fields['booking_timeslot_picker__help_tip'] = array(
440 'type' => 'pure_html'
441 , 'group' => 'time_slots'
442 , 'html' => '<tr><td colspan="2">'
443 .'<div class="wpbc-general-settings-notice wpbc-settings-notice notice-info">'
444 . '<strong class="alert-heading">' . __( 'Note', 'booking' ) . '!</strong> '
445 . sprintf( __( 'You can enable or disable, as well as configure %sTime Slots%s for your booking form on the Settings > %sBooking Form%s page.', 'booking' ),
446 '<strong>', '</strong>',
447 '<strong><a href="' . esc_url( wpbc_get_settings_url( true, false ) . '&tab=form' ) . '">', '</a></strong>'
448 )
449 . '</div>'
450 /*
451 .'<span class="wpdevelop">
452 <div class="wpbc-settings-notice notice-info '
453 . ( ( '1' == get_user_option( 'booking_win_' . $my_close_open_alert_id ) ) ? 'hide' : '' )
454 . '" id="' . $my_close_open_alert_id . '" style="padding: 5px 1em;">
455 <a style="margin-top: 4px;" rel="tooltip" data-dismiss="alert"
456 href="javascript:void(0)"
457 onclick="javascript:wpbc_verify_window_opening(' . wpbc_get_current_user_id()
458 .', \'' . $my_close_open_alert_id
459 .'\');wpbc_hide_window(\'' . $my_close_open_alert_id . '\' );"
460 >&times;</a>
461 <strong class="alert-heading">' . __( 'Note', 'booking' ) . '!</strong> '
462 . sprintf( __( 'You can add %sTime Slots%s to booking form, by activating and configure %sTime Slots%s field in booking form (below) or by adding this field from (above) toolbar.', 'booking' ),
463 '<strong>', '</strong>',
464 '<strong>', '</strong>'
465 ) . '
466 </div>
467 </span>'
468 */
469 .'</td> </tr>'
470 );
471
472
473 //FixIn: 8.7.11.10
474 $this->fields['booking_timeslot_picker'] = array(
475 'type' => 'checkbox'
476 , 'default' => $default_options_values['booking_timeslot_picker'] //'Off'
477 , 'title' => __('Time picker for time slots' ,'booking')
478 , 'label' => __('Show time slots as a time picker instead of a select box.' ,'booking')
479 , 'description' => ''
480
481 , 'group' => 'time_slots'
482 , 'tr_class' => 'wpbc_timeslot_picker'
483 );
484
485 // Time Picker Skin /////////////////////////////////////////////////////
486 $timeslot_picker_skins_options = array();
487
488 // Skins in the Custom User folder (need to create it manually): http://example.com/wp-content/uploads/wpbc_skins/ ( This folder do not owerwrited during update of plugin )
489 $upload_dir = wp_upload_dir();
490 //FixIn: 8.9.4.8
491 $files_in_folder = wpbc_dir_list( array( WPBC_PLUGIN_DIR . '/css/time_picker_skins/', $upload_dir['basedir'].'/wpbc_time_picker_skins/' ) ); // Folders where to look about Time Picker skins
492
493 foreach ( $files_in_folder as $skin_file ) { // Example: $skin_file['/css/skins/standard.css'] => 'Standard';
494 //FixIn: 8.9.4.8 //FixIn: 9.1.2.10
495 $skin_file[1] = str_replace( array( WPBC_PLUGIN_DIR, WPBC_PLUGIN_URL, $upload_dir['basedir'] ), '', $skin_file[1] ); // Get relative path for Time Picker skin
496 $timeslot_picker_skins_options[ $skin_file[1] ] = $skin_file[2];
497 }
498
499 $this->fields['booking_timeslot_picker_skin'] = array(
500 'type' => 'select'
501 , 'default' => $default_options_values['booking_timeslot_picker_skin'] // '/css/skins/traditional.css' // Activation|Deactivation of this options in wpbc-activation file. // Default value in wpbc_get_default_options('booking_skin')
502 //, 'value' => '/css/time_picker_skins/grey.css' //This will override value loaded from DB
503 , 'title' => __('Time Picker Skin', 'booking')
504 , 'description' => __('Select the skin of the time picker' ,'booking')
505 , 'options' => $timeslot_picker_skins_options
506 , 'group' => 'time_slots'
507 );
508
509
510
511 //FixIn: 8.2.1.27
512 $this->fields['booking_timeslot_day_bg_as_available'] = array(
513 'type' => 'checkbox'
514 , 'default' => $default_options_values['booking_timeslot_day_bg_as_available'] //'Off'
515 , 'title' => __('Do not change background color for partially booked days' ,'booking')
516 , 'label' => __('Show partially booked days with same background as in legend item' ,'booking')
517 , 'description' => '<span class="description0" style="line-height: 1.7em;margin: 0 0 0 -10px;"><strong>' . __('Note' ,'booking') .':</strong> '
518 . sprintf(__('Partially booked item - day, which is booked for the specific time-slot(s).' ,'booking'),'<b>','</b>')
519 . '</span>'
520
521 , 'group' => 'time_slots'
522 , 'tr_class' => 'wpbc_timeslot_day_bg_as_available'
523 );
524
525
526 // </editor-fold>
527
528
529 // <editor-fold defaultstate="collapsed" desc=" A v a i l a b i l i t y " >
530
531 // Unavailable week days /////////////////////////////////////////////
532
533 $this->fields['booking_unavailable_day_html_prefix'] = array(
534 'type' => 'pure_html'
535 , 'group' => 'availability'
536 , 'html' => '<tr valign="top">
537 <th scope="row">
538 <label class="wpbc-form-checkbox" for="'
539 // . esc_attr( 'unavailable_day0' )
540 . '">' . wp_kses_post( __('Unavailable week days' ,'booking') )
541 . '</label>
542 </th>
543 <td><fieldset>'
544 );
545 $this->fields['booking_unavailable_day0'] = array( 'label' => __('Sunday' ,'booking')
546 , 'type' => 'checkbox', 'default' => $default_options_values['booking_unavailable_day0'], 'only_field' => true, 'group' => 'availability', 'is_new_line' => false
547 );
548 $this->fields['booking_unavailable_day1'] = array( 'label' => __('Monday' ,'booking')
549 , 'type' => 'checkbox', 'default' => $default_options_values['booking_unavailable_day1'], 'only_field' => true, 'group' => 'availability', 'is_new_line' => false
550 );
551 $this->fields['booking_unavailable_day2'] = array( 'label' => __('Tuesday' ,'booking')
552 , 'type' => 'checkbox', 'default' => $default_options_values['booking_unavailable_day2'], 'only_field' => true, 'group' => 'availability', 'is_new_line' => false
553 );
554 $this->fields['booking_unavailable_day3'] = array( 'label' => __('Wednesday' ,'booking')
555 , 'type' => 'checkbox', 'default' => $default_options_values['booking_unavailable_day3'], 'only_field' => true, 'group' => 'availability', 'is_new_line' => false
556 );
557 $this->fields['booking_unavailable_day4'] = array( 'label' => __('Thursday' ,'booking')
558 , 'type' => 'checkbox', 'default' => $default_options_values['booking_unavailable_day4'], 'only_field' => true, 'group' => 'availability', 'is_new_line' => false
559 );
560 $this->fields['booking_unavailable_day5'] = array( 'label' => __('Friday' ,'booking')
561 , 'type' => 'checkbox', 'default' => $default_options_values['booking_unavailable_day5'], 'only_field' => true, 'group' => 'availability', 'is_new_line' => false
562 );
563 $this->fields['booking_unavailable_day6'] = array( 'label' => __('Saturday' ,'booking')
564 , 'type' => 'checkbox', 'default' => $default_options_values['booking_unavailable_day6'], 'only_field' => true, 'group' => 'availability', 'is_new_line' => false
565 );
566 $this->fields['booking_unavailable_day_html_sufix'] = array(
567 'type' => 'pure_html'
568 , 'group' => 'availability'
569 , 'html' => ' </fieldset><p class="description">'
570 . __('Check unavailable days in calendars. This option will overwrite all other settings.' ,'booking')
571 . '</p>
572 </td>
573 </tr>'
574 );
575
576 // Divider ///////////////////////////////////////////////////////////
577 $this->fields['hr_calendar_after_unavailable_day'] = array( 'type' => 'hr', 'group' => 'availability' );
578
579
580
581 // Unavailable days from today ///////////////////////////////////////
582 $field_options = array();
583 for ($ii = 0; $ii < 92; $ii++) { $field_options[ $ii ] = $ii; }
584
585 $this->fields['booking_unavailable_days_num_from_today'] = array(
586 'type' => 'select'
587 , 'default' => $default_options_values['booking_unavailable_days_num_from_today'] //'0'
588 , 'title' => __('Unavailable days from today', 'booking')
589 , 'description' => __('Select number of unavailable days in calendar start from today.' ,'booking')
590 , 'options' => $field_options
591 , 'group' => 'availability'
592 );
593
594 // Limit available days from today ///////////////////////////////////
595 $this->fields = apply_filters( 'wpbc_settings_calendar_unavailable_days', $this->fields, $default_options_values );
596
597
598 // Extend unavailable booking dates interval - cleaning //////////////
599 $this->fields = apply_filters( 'wpbc_settings_calendar_extend_unavailable_interval', $this->fields, $default_options_values );
600
601 // </editor-fold>
602
603
604 // <editor-fold defaultstate="collapsed" desc=" F o r m S e c t i o n " >
605
606
607 // Start Day of the week /////////////////////////////////////////////
608 /*
609 if ( ! class_exists('wpdev_bk_personal') )
610 $this->fields['booking_form_structure_type'] = array(
611 'type' => 'select'
612 , 'default' => $default_options_values['booking_form_structure_type'] // '2'
613 // , 'value' => false
614 , 'title' => __('Booking form structure', 'booking')
615 , 'description' => __('Select how to show your booking form.' ,'booking')
616 , 'description_tag' => 'p'
617 , 'options' => array(
618 'vertical' => __('Form under calendar' ,'booking')
619 , 'form_right' => __('Form at right side of calendar' ,'booking')
620 )
621 , 'group' => 'form'
622 );
623 */
624 $this->fields['booking_form_theme'] = array(
625 'type' => 'select'
626 , 'default' => $default_options_values['booking_form_theme'] //'Off'
627 , 'title' => __('Color Theme' ,'booking')
628 , 'description' => __('Select a color theme for your booking form that matches the look of your website.' ,'booking') //. ' <sup style="color:#7812bd;"><strong>&#946;eta '.__('feature','booking').'</strong></sup>'
629 . '<div class="wpbc-general-settings-notice wpbc-settings-notice notice-info">'
630 . __('When you select a color theme, it also change the calendar and time-slot picker skins to match your choice. Customize these options separately as needed.' ,'booking')
631 .'</div>'
632
633 , 'options' => array(
634 '' => __( 'Light', 'booking' ),
635 'wpbc_theme_dark_1' => __( 'Dark', 'booking' )
636 )
637 , 'group' => 'form'
638 );
639
640 $this->fields['booking_is_use_captcha'] = array(
641 'type' => 'checkbox'
642 , 'default' => $default_options_values['booking_is_use_captcha'] //'Off'
643 , 'title' => __('CAPTCHA' ,'booking')
644 , 'label' => __('Check the box to activate CAPTCHA inside the booking form.' ,'booking')
645 , 'description' => '<strong>' . __('Note' ,'booking') . '!</strong> ' .
646 __( 'If your website uses a cache plugin or system, exclude pages with booking forms from caching to ensure CAPTCHA functions correctly.', 'booking' )
647 , 'group' => 'form'
648 );
649 $this->fields['booking_is_use_autofill_4_logged_user'] = array(
650 'type' => 'checkbox'
651 , 'default' => $default_options_values['booking_is_use_autofill_4_logged_user'] // 'Off'
652 , 'title' => __('Auto-fill fields' ,'booking')
653 , 'label' => __('Check the box to activate auto-fill form fields for logged in users.' ,'booking')
654 , 'description' => ''
655 , 'group' => 'form'
656 );
657
658 $this->fields['hr_calendar_after_autofill'] = array( 'type' => 'hr', 'group' => 'form' );
659
660 if ( class_exists( 'wpdev_bk_personal' ) ) //FixIn: 8.1.1.12
661 $this->fields['booking_is_use_simple_booking_form'] = array(
662 'type' => 'checkbox'
663 , 'default' => $default_options_values['booking_is_use_simple_booking_form'] //'Off'
664 , 'title' => __('Simple' ,'booking') . ' ' . __('Booking Form', 'booking')
665 , 'label' => __('Check the box, if you want to use simple booking form customization from Free plugin version at Settings - Form page.' ,'booking')
666 , 'description' => ''
667 , 'group' => 'form'
668 );
669 if ( class_exists( 'wpdev_bk_personal' ) ) //FixIn: 8.1.1.12
670 $this->fields['booking_is_use_codehighlighter_booking_form'] = array(
671 'type' => 'checkbox'
672 , 'default' => $default_options_values['booking_is_use_codehighlighter_booking_form'] //'Off'
673 , 'title' => __('Syntax highlighter' ,'booking')
674 , 'label' => __('Check the box, if you want to use syntax highlighter during customization booking form.' ,'booking')
675 , 'description' => ''
676 , 'group' => 'form'
677 );
678
679 $this->fields['booking_form_is_using_bs_css'] = array(
680 'type' => 'checkbox'
681 , 'default' => $default_options_values['booking_form_is_using_bs_css'] // 'On'
682 , 'title' => __('Use CSS BootStrap' ,'booking')
683 , 'label' => __('Using BootStrap CSS for the form fields' ,'booking')
684 , 'description' => ''
685 , 'description_tag' => 'p'
686 , 'group' => 'form'
687 );
688
689 //FixIn: 10.0.0.31
690 if ( class_exists( 'wpdev_bk_biz_m' ) ){
691 $this->fields['booking_number_for_pre_checkin_date_hint'] = array(
692 'type' => 'select'
693 , 'default' => $default_options_values['booking_number_for_pre_checkin_date_hint'] //'0'
694 , 'title' => __( 'Pre-Check-in Display Duration', 'booking' )
695 , 'description' => sprintf( __( 'Select the number of days for the %s shortcode.', 'booking' ), '<strong>[pre_checkin_date_hint]</strong>' )
696 . ' '
697 . sprintf( __( 'This shortcode is used in the booking form to display the date %sN days before%s the selected check-in date.', 'booking' )
698 , '<a href="'.wpbc_get_settings_url() . '&tab=form">', '</a>' )
699 //, '<a href="'.wpbc_get_settings_url( true, false ) . '&scroll_to_section=wpbc_general_settings_form_tab">', '</a>' )
700 , 'options' => array_combine( range( 1, 91 ), range( 1, 91 ) )
701 , 'group' => 'form'
702 );
703 }
704 // if ( class_exists( 'wpdev_bk_personal' ) ){ //FixIn: 8.8.1.14
705 //
706 // $this->fields['booking_send_button_title'] = array(
707 // 'type' => 'text'
708 // , 'default' => $default_options_values['booking_send_button_title'] // 'Send'
709 // , 'placeholder' => __( 'Send', 'booking' )
710 // , 'title' => __( 'Title of send button' ,'booking' )
711 // , 'description' => sprintf(__('Enter %stitle of submit button%s in the booking form' ,'booking'),'<b>','</b>')
712 // , 'description_tag' => 'p'
713 // , 'css' => 'width:100%'
714 // , 'group' => 'form'
715 // , 'tr_class' => 'wpbc_send_button_title'
716 // );
717 // }
718
719
720 // </editor-fold>
721
722
723
724 // <editor-fold defaultstate="collapsed" desc=" B o o k i n g C o n f i r m a t i o n " >
725
726 $field_options = array(
727 'message' => array( 'title' => __('Show booking confirmation message' ,'booking'), 'attr' => array( 'id' => 'type_of_thank_you_message_message' ) )
728 , 'page' => array( 'title' => __('Redirect to thank you page' ,'booking'), 'attr' => array( 'id' => 'type_of_thank_you_message_page' ) )
729 );
730 $description_text = '';
731
732 $this->fields['booking_type_of_thank_you_message'] = array(
733 'type' => 'radio'
734 , 'default' => $default_options_values['booking_type_of_thank_you_message'] //'message'
735 , 'title' => __('After booking action:' ,'booking')
736 , 'description' => $description_text
737 , 'options' => $field_options
738 , 'group' => 'booking_confirmation'
739 );
740
741 $this->fields['booking_title_after_reservation'] = array(
742 'type' => 'textarea'
743 , 'default' => $default_options_values['booking_title_after_reservation']
744 , 'placeholder' => ( ! class_exists( 'wpdev_bk_biz_s' ) )
745 ? __( 'Your booking is received. We will confirm it soon. Many thanks!', 'booking' )
746 : __( 'Your booking is received. Please proceed with payment to confirm it. Many thanks!', 'booking' )
747 , 'title' => __('Message title' ,'booking')
748 , 'description' => sprintf(__('Type title of message %safter booking has done by user%s' ,'booking'),'<b>','</b>')
749 ,'description_tag' => 'p'
750 , 'css' => 'width:100%'
751 , 'rows' => 2
752 , 'group' => 'booking_confirmation'
753 , 'tr_class' => 'wpbc_calendar_thank_you_message wpbc_calendar_thank_you wpbc_sub_settings_grayed'
754 );
755 // $this->fields['booking_title_after_reservation_time'] = array(
756 // 'type' => 'text'
757 // , 'default' => $default_options_values['booking_title_after_reservation_time'] //'7000'
758 // , 'placeholder' => '7000'
759 // , 'title' => __('Time of message showing' ,'booking')
760 // , 'description' => sprintf(__('Set duration of time (milliseconds) to show this message' ,'booking'),'<b>','</b>')
761 // . ' ' . sprintf(__('You can set the value to %s to display the message indefinitely.' ,'booking'),'<b>0</b>') //FixIn: 9.6.2.2
762 // , 'description_tag' => 'span'
763 // , 'css' => 'width:5em'
764 // , 'group' => 'booking_confirmation'
765 // , 'tr_class' => 'wpbc_calendar_thank_you_message wpbc_calendar_thank_you wpbc_sub_settings_grayed'
766 // );
767 // // Help Section ///////////////////////////////////////////////////////
768 // $this->fields['booking_help_translation_section_after_thank_you_message'] = array(
769 // 'type' => 'help'
770 // , 'value' => wpbc_get_help_rows_about_config_in_several_languges()
771 // , 'class' => ''
772 // , 'css' => ''
773 // , 'description' => ''
774 // , 'cols' => 2
775 // , 'group' => 'booking_confirmation'
776 // , 'tr_class' => 'wpbc_calendar_thank_you_message wpbc_calendar_thank_you wpbc_sub_settings_grayed'
777 // , 'description_tag' => 'span'
778 // );
779
780 // URL of "Thank you page"
781 $this->fields['booking_thank_you_page_URL_prefix'] = array(
782 'type' => 'pure_html'
783 , 'group' => 'booking_confirmation'
784 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_thank_you_page_URL
785 wpbc_calendar_thank_you_page wpbc_calendar_thank_you wpbc_sub_settings_grayed">
786 <th scope="row">'.
787 WPBC_Settings_API::label_static( 'set_gen_booking_thank_you_page_URL'
788 , array( 'title'=> __('Confirmation Page URL' ,'booking'), 'label_css' => '' ) )
789 .'</th>
790 <td><fieldset>' . '<code style="font-size:14px;">' . home_url() . '</code>' //FixIn: 7.0.1.20
791 );
792 $this->fields['booking_thank_you_page_URL'] = array(
793 'type' => 'text'
794 , 'default' => $default_options_values['booking_thank_you_page_URL'] //'/thank-you'
795 , 'placeholder' => '/thank-you'
796 , 'css' => 'width:75%'
797 , 'group' => 'booking_confirmation'
798 , 'only_field' => true
799 );
800 $this->fields['booking_thank_you_page_URL_sufix'] = array(
801 'type' => 'pure_html'
802 , 'group' => 'booking_confirmation'
803 , 'html' => '<p class="description" style="line-height: 1.7em;margin: 0;">'
804 . sprintf( __( 'This page should include the shortcode %s to display booking details and confirmation after a successful booking.', 'booking' )
805 , '<strong>[booking_confirm]</strong>' )
806 . '</p>
807 </fieldset>
808 </td>
809 </tr>'
810 );
811 // </editor-fold>
812
813
814 // <editor-fold defaultstate="collapsed" desc=" Booking Admin Panel " >
815
816 $field_options = array(
817 'vm_booking_listing' => __('Bookings Listing' ,'booking') //FixIn: 9.6.3.5
818 , 'vm_calendar' => __('Calendar Overview' ,'booking')
819 );
820 $this->fields['booking_listing_default_view_mode'] = array(
821 'type' => 'select'
822 , 'default' => $default_options_values['booking_listing_default_view_mode'] //'vm_calendar'
823 , 'title' => __('Default booking admin page', 'booking')
824 , 'description' => __('Select your default view mode of bookings at the booking listing page' ,'booking')
825 , 'options' => $field_options
826 , 'group' => 'booking_listing'
827 );
828 // //FixIn: 9.5.5.7
829 // $this->fields['booking_admin_panel_skin'] = array(
830 // 'type' => 'select'
831 // , 'default' => $default_options_values['booking_admin_panel_skin'] // 'modern_1'
832 // , 'title' => __('Theme of booking admin panel', 'booking')
833 // , 'description' => __('Select theme of your booking admin panel' ,'booking')
834 // , 'options' => array(
835 // 'modern_1' => __( 'Modern Theme', 'booking' )
836 // , 'legacy' => __( 'Legacy Theme', 'booking' )
837 // )
838 // , 'group' => 'booking_listing'
839 // );
840 //
841 // //FixIn: 9.6.3.5
842
843 //Default booking resources
844 $this->fields = apply_filters( 'wpbc_settings_booking_listing_br_default_count', $this->fields, $default_options_values );
845
846
847 //FixIn: 8.6.1.13
848
849 // Calendar Default View mode
850 if ( class_exists( 'wpdev_bk_personal' ) )
851 $field_options = array(
852 '1' => __('Day' ,'booking')
853 , '7' => __('Week' ,'booking')
854 , '30' => __('Month' ,'booking')
855 , '60' => __('2 Months' ,'booking')
856 , '90' => __('3 Months' ,'booking')
857 , '365' => __('Year' ,'booking')
858 );
859 else
860 $field_options = array(
861 '30' => __('Month' ,'booking') // Day ?
862 , '90' => __('3 Months' ,'booking') // Week ?
863 , '365' => __('Year' ,'booking') // Month ?
864 );
865 $this->fields['booking_view_days_num'] = array(
866 'type' => 'select'
867 , 'default' => $default_options_values['booking_view_days_num'] //'30'
868 , 'title' => __('Default view mode', 'booking')
869 , 'description' => __('Select your default calendar view mode at booking calendar overview page' ,'booking')
870 , 'options' => $field_options
871 , 'group' => 'booking_calendar_overview' //FixIn: 8.5.2.20 //FixIn: 8.9.4.4
872 );
873
874 //FixIn: 8.9.4.3
875 $field_options = array();
876 foreach ( range( 1, 31, 1) as $value ) {
877 $field_options[ $value ] = $value;
878 }
879 $this->fields['booking_calendar_overview__day_mode__days_number_show'] = array(
880 'type' => 'select'
881 , 'default' => $default_options_values['booking_calendar_overview__day_mode__days_number_show'] // 31
882 , 'title' => __('Days number to show in day view mode', 'booking')
883 , 'description' => sprintf(__('Select number of days to show in %sDay%s view mode' ,'booking'),'<b>','</b>')
884 . ( ( class_exists( 'wpdev_bk_personal' ) ) ? ' ' . __( 'for one booking resource', 'booking' ) : '' )
885 , 'options' => $field_options
886 , 'group' => 'booking_calendar_overview' //FixIn: 8.9.4.4
887 );
888 $this->fields['booking_timeline__month_mode__days_number_show'] = array(
889 'type' => 'select'
890 , 'default' => $default_options_values['booking_timeline__month_mode__days_number_show'] //31
891 , 'title' => __('Days number to show in month view mode', 'booking')
892 , 'description' => __('Select number of days to show in month view mode for one booking resource.' ,'booking')
893 , 'options' => $field_options
894 , 'group' => 'booking_timeline'
895 );
896
897
898 //Default Titles in Calendar cells
899 $this->fields = apply_filters( 'wpbc_settings_booking_listing_timeline_title_in_day', $this->fields, $default_options_values );
900
901
902 //FixIn: 9.6.3.5
903
904 // <editor-fold defaultstate="collapsed" desc=" == Dates : Time == " >
905 $timezone_error_message = '';
906 if ( 'UTC' !== date_default_timezone_get() ) {
907 $timezone_error_message .= '<div style="line-height: 2em;margin-bottom:2em;" class="wpbc-settings-notice notice-error">';
908 $timezone_error_message .= '<strong>' . __( 'PHP default timezone is invalid' ) . '</strong>. ';
909 $timezone_error_message .= '<a href="' . esc_url( admin_url( 'site-health.php' ) ) . '">' . __( 'Read more' ) . '</a>' . '<br/>';
910 $timezone_error_message .= sprintf( __( 'Find additional details %shere%s', 'booking' ), '<a href="https://make.wordpress.org/core/2019/09/23/date-time-improvements-wp-5-3/">', '</a>' );
911 $timezone_error_message .= '</div>';
912 }
913
914 $this->fields['system_timezones'] = array(
915 'type' => 'html'
916 , 'html' => $timezone_error_message
917 . '<div style="line-height: 2em;">'
918 . __( 'Server Default Timezone', 'booking' ) . ': <strong>' . date_default_timezone_get() . '</strong><br/>'
919 . __( 'WordPress Timezone', 'booking' ) . ': <strong>' . wp_timezone()->getName() . '</strong>'
920 . '</div>'
921
922 , 'class' => ''
923 , 'css' => 'margin:0;padding:0;border:0;'
924 , 'cols' => 2
925 , 'group' => 'date_time'
926 );
927
928 $this->fields['hr_booking_date_format'] = array( 'type' => 'hr', 'group' => 'date_time' );
929 // -------------------------------------------------------------------------------------------------------------
930 // Default Dates View Mode
931 // -------------------------------------------------------------------------------------------------------------
932 $this->fields['booking_date_view_type'] = array(
933 'type' => 'select'
934 , 'default' => $default_options_values['booking_date_view_type'] //'short'
935 , 'title' => __('Dates view', 'booking')
936 , 'description' => __('Select the default view for dates on the booking tables' ,'booking')
937 , 'options' => array(
938 'short' => __('Short days view' ,'booking')
939 , 'wide' => __('Wide days view' ,'booking')
940 )
941 , 'group' => 'date_time'
942 );
943 $this->fields['hr_booking_time_format'] = array( 'type' => 'hr', 'group' => 'date_time' );
944 // -------------------------------------------------------------------------------------------------------------
945 // Dates : Time
946 // -------------------------------------------------------------------------------------------------------------
947
948 $this->fields['booking_date_format_html_prefix'] = array(
949 'type' => 'pure_html'
950 , 'group' => 'date_time'
951 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_date_format">
952 <th scope="row">'.
953 WPBC_Settings_API::label_static( 'set_gen_booking_date_format'
954 , array( 'title'=> __('Date Format' ,'booking'), 'label_css' => 'margin: 0.25em 0 !important;vertical-align: middle;' ) )
955 .'</th>
956 <td><fieldset>'
957 );
958 $field_options = array();
959 foreach ( array( 'j M Y', 'F j, Y', 'Y/m/d', 'm/d/Y', 'd/m/Y' ) as $format ) {
960 $field_options[ esc_attr($format) ] = array( 'title' => date_i18n( $format ) );
961 }
962 $field_options['custom'] = array( 'title' => __('Custom' ,'booking') . ':', 'attr' => array( 'id' => 'date_format_selection_custom' ) );
963
964 $this->fields['booking_date_format_selection'] = array(
965 'type' => 'radio'
966 , 'default' => get_option('date_format')
967 , 'options' => $field_options
968 , 'group' => 'date_time'
969 , 'only_field' => true
970 , 'is_new_line' => !true
971 );
972
973 $booking_date_format = get_bk_option( 'booking_date_format');
974 $this->fields['booking_date_format'] = array(
975 'type' => 'text'
976 , 'default' => $default_options_values['booking_date_format'] //get_option('date_format')
977 , 'value' => htmlentities( $booking_date_format ) // Display value of this field in specific way
978 , 'group' => 'date_time'
979 , 'placeholder' => get_option('date_format')
980 , 'css' => 'width:auto;margin: 10px 0;'
981 , 'only_field' => true
982 );
983 $this->fields['booking_date_format_html_sufix'] = array(
984 'type' => 'pure_html'
985 , 'group' => 'date_time'
986 , 'html' => '<span class="description" style="padding:0;"><code>' . date_i18n( $booking_date_format ) . '</code></span>
987 </fieldset>
988 </td>
989 </tr>'
990 );
991 $this->fields['booking_date_format_help'] = array(
992 'type' => 'html'
993 , 'html' => '<div style="line-height: 2em;">'.
994 sprintf(__('Type your date format for emails and the booking table. %sDocumentation on date formatting%s' ,'booking'),'<br/><a href="https://wordpress.org/documentation/article/customize-date-and-time-format/" target="_blank">','</a>')
995 .'</div>'
996 , 'class' => ''
997 , 'css' => 'margin:0;padding:0;border:0;'
998 , 'description' => ''
999 , 'cols' => 2
1000 , 'group' => 'date_time'
1001 , 'tr_class' => ''
1002 , 'description_tag' => 'div'
1003 );
1004
1005
1006 // -------------------------------------------------------------------------------------------------------------
1007 // Time Format
1008 // -------------------------------------------------------------------------------------------------------------
1009
1010 $this->fields['booking_time_format_html_prefix'] = array(
1011 'type' => 'pure_html'
1012 , 'group' => 'date_time'
1013 , 'html' => '<tr valign="top" class="wpbc_tr_set_gen_booking_time_format">
1014 <th scope="row">'.
1015 WPBC_Settings_API::label_static( 'set_gen_booking_time_format'
1016 , array( 'title'=> __('Time Format' ,'booking'), 'label_css' => 'margin: 0.25em 0 !important;vertical-align: middle;' ) )
1017 .'</th>
1018 <td><fieldset>'
1019 );
1020 $field_options = array();
1021 foreach ( array( 'g:i a', 'g:i A', 'H:i' ) as $format ) {
1022 $field_options[ esc_attr($format) ] = array( 'title' => date_i18n( $format ) );
1023 }
1024 $field_options['custom'] = array( 'title' => __('Custom' ,'booking') . ':', 'attr' => array( 'id' => 'time_format_selection_custom' ) );
1025
1026 $this->fields['booking_time_format_selection'] = array(
1027 'type' => 'radio'
1028 , 'default' => 'H:i'
1029 , 'options' => $field_options
1030 , 'group' => 'date_time'
1031 , 'only_field' => true
1032 , 'is_new_line' => ! true
1033 );
1034
1035 $booking_time_format = get_bk_option( 'booking_time_format');
1036 $this->fields['booking_time_format'] = array(
1037 'type' => 'text'
1038 , 'default' => $default_options_values['booking_time_format'] //'H:i'
1039 , 'value' => htmlentities( $booking_time_format ) // Display value of this field in specific way
1040 , 'group' => 'date_time'
1041 , 'placeholder' => 'H:i'
1042 , 'css' => 'width:auto; margin: 10px 0;'
1043 , 'only_field' => true
1044 );
1045 $this->fields['booking_time_format_html_sufix'] = array(
1046 'type' => 'pure_html'
1047 , 'group' => 'date_time'
1048 , 'html' => '<span class="description" style="padding:0;"><code>' . date_i18n( $booking_time_format ) . '</code></span>
1049 </fieldset>
1050 </td>
1051 </tr>'
1052 );
1053 $this->fields['booking_time_format_help'] = array(
1054 'type' => 'html'
1055 , 'html' => '<div style="line-height: 2em;">'.
1056 sprintf(__('Type your time format for emails and the booking table. %sDocumentation on time formatting%s' ,'booking'),'<br/><a href="https://www.php.net/manual/datetime.format.php" target="_blank">','</a>')
1057 .'</div>'
1058 , 'class' => ''
1059 , 'css' => 'margin:0;padding:0;border:0;'
1060 , 'description' => ''
1061 , 'cols' => 2
1062 , 'group' => 'date_time'
1063 , 'tr_class' => ''
1064 , 'description_tag' => 'div'
1065 );
1066
1067
1068
1069 // </editor-fold>
1070
1071
1072
1073 // Divider ///////////////////////////////////////////////////////////////
1074 $this->fields['hr_booking_listing_before_is_use_hints_at_admin_panel'] = array( 'type' => 'hr', 'group' => 'booking_listing' );
1075
1076
1077 // Show hide Notes
1078 $this->fields = apply_filters( 'wpbc_settings_booking_show_hide_options', $this->fields, $default_options_values ); //FixIn: 8.1.3.32
1079
1080 // Is show help hints on the admin panel ///////////////////////////////
1081 $this->fields['booking_is_use_hints_at_admin_panel'] = array(
1082 'type' => 'checkbox'
1083 , 'default' => $default_options_values['booking_is_use_hints_at_admin_panel'] //'On'
1084 , 'title' => __('Show / hide hints' ,'booking')
1085 , 'label' => __('Check this box if you want to show help hints on the admin panel.' ,'booking')
1086 , 'description' => ''
1087 , 'group' => 'booking_listing'
1088 );
1089
1090 // </editor-fold>
1091
1092
1093 // <editor-fold defaultstate="collapsed" desc=" auto_cancelation_approval " >
1094
1095 // auto_cancelation_approval
1096 $this->fields = apply_filters( 'wpbc_settings_auto_cancelation_approval_section', $this->fields, $default_options_values );
1097 // </editor-fold>
1098
1099
1100 // <editor-fold defaultstate="collapsed" desc=" Capacity " >
1101
1102 $this->fields = apply_filters( 'wpbc_settings_capacity_based_on_visitors', $this->fields, $default_options_values );
1103
1104 $this->fields['booking_is_days_always_available'] = array(
1105 'type' => 'checkbox'
1106 , 'default' => $default_options_values['booking_is_days_always_available'] //'On'
1107 , 'title' => __('Allow unlimited bookings per same day(s)' ,'booking')
1108 , 'label' => sprintf(__('Check this box, if you want to %sset any days as available%s in calendar. Your visitors will be able to make %sunlimited bookings per same date(s) in calendar and do not see any booked date(s)%s of other visitors.' ,'booking'), '<strong>', '</strong>' , '<strong>', '</strong>' )
1109 , 'description' => ''
1110 , 'group' => 'capacity'
1111 );
1112
1113
1114 //FixIn: 8.3.2.2
1115 if ( ! class_exists('wpdev_bk_biz_l') )
1116 $this->fields['booking_is_show_pending_days_as_available'] = array(
1117 'type' => 'checkbox'
1118 , 'default' => $default_options_values['booking_is_show_pending_days_as_available'] //_'Off'
1119 , 'title' => __('Use pending days as available' ,'booking')
1120 , 'label' => sprintf(__('Check this box if you want to show the pending days as available in calendars' ,'booking') )
1121 , 'description' => ''
1122 , 'group' => 'capacity'
1123 , 'tr_class' => ''
1124 );
1125
1126 $this->fields = apply_filters( 'wpbc_settings_pending_days_as_available', $this->fields, $default_options_values );
1127
1128
1129
1130 // </editor-fold>
1131
1132 // <editor-fold defaultstate="collapsed" desc=" Capacity Free example " >
1133 if ( ! class_exists('wpdev_bk_personal') ){
1134
1135 // Showing availability in tooltip
1136 $this->fields['booking_quantity_control__promote_upgrade'] = array(
1137 'type' => 'checkbox'
1138 , 'default' => 'On'
1139 , 'value' => 'On'
1140 , 'title' => __('Booking Quantity Control' ,'booking')
1141 , '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')
1142 , 'description' => __('If disabled, visitors can book only one slot within a single reservation.' ,'booking')
1143 , 'description_tag' => 'p'
1144 , 'group' => 'capacity_upgrade'
1145 , 'tr_class' => 'wpbc_blur'
1146 );
1147 $this->fields['booking_capacity_field__promote_upgrade'] = array(
1148 'type' => 'select'
1149 , 'default' => 'items'
1150 , 'value' => 'items'
1151 , 'title' => __('Quantity field name', 'booking')
1152 , 'description' => sprintf( __( 'Select the field that will control how many slots visitors can book during the reservation process.' ,'booking'), '<b>', '</b>' )
1153 , 'description_tag' => 'span'
1154 , 'css' => ''
1155 , 'tr_class' => 'wpbc_booking_capacity_field_settings wpbc_sub_settings_grayed'
1156 , 'options' => array( 'items' => __('Items' ,'booking') )
1157 , 'group' => 'capacity_upgrade'
1158 , 'tr_class' => 'wpbc_blur'
1159 );
1160 $this->fields['booking_is_dissbale_booking_for_different_sub_resources__promote_upgrade'] = array(
1161 'type' => 'checkbox'
1162 , 'default' => 'On'
1163 , 'value' => 'On'
1164 , 'title' => __('Disable bookings in different booking resources' ,'booking')
1165 , 'label' => __('Check this box to disable reservations, which can be stored in different booking resources.' ,'booking')
1166 , 'description' => '<strong>' . __('Note' ,'booking') . '!</strong> ' . __('When checked, all reserved days must be at same booking resource otherwise error message will show.' ,'booking')
1167 , 'group' => 'capacity_upgrade'
1168 , 'tr_class' => 'wpbc_blur'
1169 );
1170 $this->fields['capacity_upgrade__promote_upgrade'] = array(
1171 'type' => 'pure_html'
1172 , 'group' => 'capacity_upgrade'
1173 , 'html' => '<tr><td colspan="2">
1174 <div class="wpbc_widget_content" style="transform: translate(0) translateY(-10em);">
1175 <div class="ui_container ui_container_toolbar ui_container_small" style="background: #fff;position: relative;">
1176 <div class="ui_group ui_group__upgrade">
1177 <div class="wpbc_upgrade_note wpbc_upgrade_theme_green">
1178 <div>This <a target="_blank" href="https://wpbookingcalendar.com/features/#capacity">feature</a>
1179 is available in the <strong>Business Large or MultiUser version</strong>.
1180 <a target="_blank" href="https://wpbookingcalendar.com/prices/#bk_news_section">Upgrade to Pro</a>.
1181 </div>
1182 </div>
1183 </div>
1184 </div>
1185 </div>
1186 </td> </tr>'
1187 );
1188 }
1189 // </editor-fold>
1190
1191
1192 // <editor-fold defaultstate="collapsed" desc=" Advanced " >
1193
1194
1195 $this->fields = apply_filters( 'wpbc_settings_edit_url_hash', $this->fields, $default_options_values );
1196 $this->fields = apply_filters( 'wpbc_settings_resource_no_update__during_editing', $this->fields, $default_options_values );
1197
1198 // Show advanced settings of JavaScript loading
1199
1200
1201 // //Show | Hide links for Advanced JavaScript section
1202 // $this->fields['booking_advanced_js_loading_settings'] = array(
1203 // 'type' => 'html'
1204 // , 'html' =>
1205 // '<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>'
1206 // . '<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>'
1207 // , 'cols' => 2
1208 // , 'group' => 'advanced'
1209 // );
1210
1211 //FixIn: 9.8.6.2
1212 $balencer_options = array_combine( range( 1, 5 ), range( 1, 5 ) );
1213 $balencer_options[99] = __( 'All', 'booking' );
1214 $this->fields['booking_load_balancer_max_threads'] = array(
1215 'type' => 'select'
1216 , 'default' => $default_options_values['booking_load_balancer_max_threads']
1217 , 'title' => __('Parallel requests' ,'booking')
1218 , 'description' => __('Select the number of simultaneous requests to load data in multiple calendars.' ,'booking') . ' <sup style="color:#7812bd;"><strong> '.__('Performance','booking').'</strong></sup>'
1219 . '<div class="wpbc-general-settings-notice wpbc-settings-notice notice-info">'
1220 . __('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')
1221 .'</div>'
1222
1223 , 'options' => $balencer_options
1224 , 'group' => 'advanced'
1225 , 'is_demo_safe' => wpbc_is_this_demo()
1226 );
1227
1228
1229 $this->fields['booking_is_load_js_css_on_specific_pages'] = array(
1230 'type' => 'checkbox'
1231 , 'default' => $default_options_values['booking_is_load_js_css_on_specific_pages'] //'Off'
1232 , 'title' => __('Load JS and CSS files only on specific pages' ,'booking')
1233 , 'label' => __('Activate loading of CSS and JavaScript files of plugin only at specific pages.' ,'booking')
1234 , 'description' => ''
1235 , 'group' => 'advanced'
1236 , 'tr_class' => 'wpbc_advanced_js_loading_settings'//wpbc_advanced_js_loading_settings wpbc_sub_settings_grayed hidden_items'
1237 , 'is_demo_safe' => wpbc_is_this_demo()
1238 );
1239 $this->fields['booking_pages_for_load_js_css'] = array(
1240 'type' => 'textarea'
1241 , 'default' => $default_options_values['booking_pages_for_load_js_css'] //''
1242 , 'placeholder' => '/booking-form/'
1243 , 'title' => __('Relative URLs of pages, where to load plugin CSS and JS files' ,'booking')
1244 , '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>')
1245 ,'description_tag' => 'p'
1246 , 'css' => 'width:100%'
1247 , 'rows' => 5
1248 , 'group' => 'advanced'
1249 , 'tr_class' => 'wpbc_advanced_js_loading_settings wpbc_is_load_js_css_on_specific_pages wpbc_sub_settings_grayed'// hidden_items'
1250 , 'is_demo_safe' => wpbc_is_this_demo()
1251 );
1252
1253 //$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' );
1254 //FixIn: 7.2.1.15
1255 $this->fields[ 'booking_is_show_system_debug_log' ] = array(
1256 'type' => 'checkbox'
1257 , 'default' => $default_options_values['booking_is_show_system_debug_log'] //'Off'
1258 , 'title' => __('Show system debugging log for beta features' ,'booking')
1259 , 'label' => __('Activate this option only for testing beta features' ,'booking')
1260 , 'description' => ''
1261 , 'group' => 'advanced'
1262 , 'tr_class' => 'wpbc_advanced_js_loading_settings'// wpbc_sub_settings_grayed hidden_items'
1263 , 'is_demo_safe' => wpbc_is_this_demo()
1264 );
1265
1266 //FixIn: 10.1.1.2 //TODO: Update Text here 2024-06-16 12:57
1267 $this->fields['booking_is_nonce_at_front_end'] = array(
1268 'type' => 'checkbox'
1269 , 'default' => $default_options_values['booking_is_nonce_at_front_end'] //'Off'
1270 , 'title' => __( 'Use Nonce Fields', 'booking' )
1271 , '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' )
1272 , 'description' => ''
1273 , 'group' => 'advanced'
1274 , 'tr_class' => 'wpbc_advanced_is_nonce' //wpbc_advanced_js_loading_settings wpbc_sub_settings_grayed hidden_items'
1275 , 'toggle_class' => 'wpbc_toggle_danger'
1276 , 'is_demo_safe' => wpbc_is_this_demo()
1277 );
1278
1279 if ( wpbc_is_this_demo() ) {
1280 $this->fields['booking_pages_for_load_js_css_demo'] = array( 'group' => 'advanced',
1281 'type' => 'html',
1282 'html' => wpbc_get_warning_text_in_demo_mode(),
1283 'cols' => 2,
1284 'tr_class' => 'wpbc_advanced_js_loading_settings'// wpbc_sub_settings_grayed hidden_items'
1285 );
1286 }
1287
1288 // Divider ///////////////////////////////////////////////////////////////
1289 $this->fields['hr_calendar_before_advanced_js_loading_settings'] = array( 'type' => 'hr', 'group' => 'advanced' );
1290
1291 // Show settings of powered by notice
1292 $this->fields['booking_advanced_powered_by_notice_settings'] = array(
1293 'type' => 'html'
1294 , 'html' =>
1295 '<a id="wpbc_powered_by_link_show" class="wpbc_expand_section_link" href="javascript:void(0)">+ ' . __('Show settings of powered by notice' ,'booking') . '</a>'
1296 . '<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>'
1297 , 'cols' => 2
1298 , 'group' => 'advanced'
1299 );
1300 $this->fields['booking_is_show_powered_by_notice'] = array(
1301 'type' => 'checkbox'
1302 , 'default' => $default_options_values['booking_is_show_powered_by_notice'] //'On'
1303 , 'title' => __('Powered by notice' ,'booking')
1304 , 'label' => sprintf(__(' Turn On/Off powered by "Booking Calendar" notice under the calendar.' ,'booking'),'wpbookingcalendar.com')
1305 , 'description' => ''
1306 , 'group' => 'advanced'
1307 , 'tr_class' => 'wpbc_is_show_powered_by_notice wpbc_sub_settings_grayed hidden_items'
1308 );
1309 $this->fields['booking_wpdev_copyright_adminpanel'] = array(
1310 'type' => 'checkbox'
1311 , 'default' => $default_options_values['booking_wpdev_copyright_adminpanel'] //'On'
1312 , 'title' => __('Help and info notices' ,'booking')
1313 , 'label' => sprintf(__(' Turn On/Off version notice and help info links at booking admin panel.' ,'booking'),'wpbookingcalendar.com')
1314 , 'description' => ''
1315 , 'group' => 'advanced'
1316 , 'tr_class' => 'wpbc_is_show_powered_by_notice wpbc_sub_settings_grayed hidden_items'
1317 , 'is_demo_safe' => wpbc_is_this_demo() //FixIn: 8.1.3.9
1318 );
1319
1320 // </editor-fold>
1321
1322
1323 // <editor-fold defaultstate="collapsed" desc=" Information " >
1324 if ( function_exists( 'wpbc_get_dashboard_info' ) ) {
1325 $this->fields['booking_information'] = array(
1326 'type' => 'html'
1327 , 'html' => wpbc_get_dashboard_info()
1328 , 'cols' => 2
1329 , 'group' => 'information'
1330 );
1331 }
1332 // </editor-fold>
1333
1334
1335 // <editor-fold defaultstate="collapsed" desc=" User permissions for plugin menu pages " >
1336
1337
1338 $this->fields['booking_menu_position'] = array(
1339 'type' => 'select'
1340 , 'default' => 'top'
1341 , 'title' => __('Plugin menu position', 'booking')
1342 , 'description' => ''
1343 , 'options' => array(
1344 'top' => __('Top', 'booking')
1345 , 'middle' => __('Middle', 'booking')
1346 , 'bottom' => __('Bottom', 'booking')
1347 )
1348 , 'group' => 'permissions'
1349 , 'is_demo_safe' => wpbc_is_this_demo()
1350 );
1351
1352 $this->fields['booking_user_role_booking_header'] = array(
1353 'type' => 'pure_html'
1354 , 'group' => 'permissions'
1355 , 'html' => '<tr valign="top">
1356 <th scope="row" colspan="2">
1357 <hr/><p><strong>' . wp_kses_post( __('User permissions for plugin menu pages' ,'booking') ) . ':</strong></p>
1358 </th>
1359 </tr>'
1360 );
1361
1362 $field_options = array();
1363 $field_options['subscriber'] = translate_user_role('Subscriber');
1364 $field_options['contributor'] = translate_user_role('Contributor');
1365 $field_options['author'] = translate_user_role('Author');
1366 $field_options['editor'] = translate_user_role('Editor');
1367 $field_options['administrator'] = translate_user_role('Administrator');
1368
1369 $this->fields['booking_user_role_booking'] = array(
1370 'type' => 'select'
1371 , 'default' => $default_options_values['booking_user_role_booking'] //'editor'
1372 , 'title' => __('Bookings', 'booking')
1373 , 'description' => ''
1374 , 'options' => $field_options
1375 , 'group' => 'permissions'
1376 , 'is_demo_safe' => wpbc_is_this_demo()
1377 );
1378 $this->fields['booking_user_role_availability'] = array( //FixIn: 9.5.2.2
1379 'type' => 'select'
1380 , 'default' => $default_options_values['booking_user_role_availability'] //'editor'
1381 , 'title' => __('Availability', 'booking')
1382 , 'description' => ''
1383 , 'options' => $field_options
1384 , 'group' => 'permissions'
1385 , 'is_demo_safe' => wpbc_is_this_demo()
1386 );
1387 //FixIn: 9.8.15.2.6
1388 if ( class_exists( 'wpdev_bk_biz_m' ) )
1389 $this->fields['booking_user_role_prices'] = array(
1390 'type' => 'select'
1391 , 'default' => $default_options_values['booking_user_role_prices'] //'editor'
1392 , 'title' => __('Prices', 'booking')
1393 , 'description' => ''
1394 , 'options' => $field_options
1395 , 'group' => 'permissions'
1396 , 'is_demo_safe' => wpbc_is_this_demo()
1397 );
1398 //FixIn: 9.8.15.2.6
1399 if ( WPBC_customize_plugin )
1400 $this->fields['booking_user_role_customize_plugin'] = array(
1401 'type' => 'select'
1402 , 'default' => $default_options_values['booking_user_role_customize_plugin'] //'editor'
1403 , 'title' => __('Customize', 'booking')
1404 , 'description' => ''
1405 , 'options' => $field_options
1406 , 'group' => 'permissions'
1407 , 'is_demo_safe' => wpbc_is_this_demo()
1408 );
1409
1410 $this->fields['booking_user_role_addbooking'] = array(
1411 'type' => 'select'
1412 , 'default' => $default_options_values['booking_user_role_addbooking'] //'editor'
1413 , 'title' => __('Add booking', 'booking')
1414 , 'description' => ''
1415 , 'options' => $field_options
1416 , 'group' => 'permissions'
1417 , 'is_demo_safe' => wpbc_is_this_demo()
1418 );
1419 if ( class_exists( 'wpdev_bk_personal' ) )
1420 $this->fields['booking_user_role_resources'] = array(
1421 'type' => 'select'
1422 , 'default' => $default_options_values['booking_user_role_resources'] //'editor'
1423 , 'title' => __('Resources', 'booking')
1424 , 'description' => ''
1425 , 'options' => $field_options
1426 , 'group' => 'permissions'
1427 , 'is_demo_safe' => wpbc_is_this_demo()
1428 );
1429 $this->fields['booking_user_role_settings'] = array(
1430 'type' => 'select'
1431 , 'default' => $default_options_values['booking_user_role_settings'] //'administrator'
1432 , 'title' => __('Settings', 'booking')
1433 , 'description' => __('Select user access level for the menu pages of plugin' ,'booking')
1434 , 'description_tag' => 'p'
1435 , 'options' => $field_options
1436 , 'group' => 'permissions'
1437 , 'is_demo_safe' => wpbc_is_this_demo()
1438 );
1439
1440 if ( ! class_exists( 'wpdev_bk_personal' ) )
1441 $this->fields['booking_menu_go_pro'] = array(
1442 'type' => 'select'
1443 , 'default' => $default_options_values['booking_menu_go_pro'] //'administrator'
1444 , 'title' => __('Premium', 'booking')
1445 , 'description' => __('Show / hide menu' ,'booking')
1446 , 'description_tag' => 'p'
1447 , 'options' => array(
1448 'show' => __('Show', 'booking')
1449 , 'hide' => __('Hide', 'booking')
1450 )
1451 , 'group' => 'permissions'
1452 , 'is_demo_safe' => wpbc_is_this_demo()
1453 );
1454
1455 if ( wpbc_is_this_demo() )
1456 $this->fields['booking_user_role_settings_demo'] = array( 'group' => 'permissions', 'type' => 'html', 'html' => wpbc_get_warning_text_in_demo_mode(), 'cols' => 2 );
1457
1458
1459 // </editor-fold>
1460
1461
1462 // <editor-fold defaultstate="collapsed" desc=" Uninstall " >
1463 $this->fields['booking_is_delete_if_deactive'] = array(
1464 'type' => 'checkbox'
1465 , 'default' => $default_options_values['booking_is_delete_if_deactive'] //'Off'
1466 , 'title' => __('Delete booking data, when plugin deactivated' ,'booking')
1467 , 'label' => __('Check this box to delete all booking data when you uninstal this plugin.' ,'booking')
1468 , 'description' => ''
1469 , 'group' => 'uninstall'
1470 , 'toggle_class' => 'wpbc_toggle_danger'
1471 );
1472 // </editor-fold>
1473
1474
1475 // <editor-fold defaultstate="collapsed" desc=" Tools " >
1476
1477 if ( ( ! wpbc_is_this_demo() ) && ( current_user_can( 'activate_plugins' ) ) ) {
1478
1479 $this->fields['tools_section_buttons'] = array(
1480 'type' => 'help'
1481 , 'value' => array()
1482 , 'class' => ''
1483 , 'css' => 'margin:0;padding:0;border:0;'
1484 , 'description' => ''
1485 , 'cols' => 2
1486 , 'group' => 'help'
1487 , 'tr_class' => ''
1488 , 'description_tag' => 'p'
1489 );
1490
1491 $my_system_buttons = '';
1492
1493 $my_system_buttons .= '<a class="button button" href="'
1494 . wpbc_get_settings_url()
1495 . '&system_info=show&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) .'&booking_system_info=show#wpbc_general_settings_system_info_metabox">'
1496 . 'Booking System ' . __('Info' ,'booking')
1497 . '</a>';
1498 //FixIn: 8.4.7.19
1499 $my_system_buttons .= ' <a class="button button" href="'
1500 . wpbc_get_bookings_url()
1501 . '&wh_booking_type=lost">'
1502 . 'Find Lost Bookings'
1503 . '</a>'; //FixIn: 8.5.2.19
1504
1505 //FixIn: 9.5.3.1
1506 $my_system_buttons .= ' <a class="button button" href="'
1507 . wpbc_get_resources_url()
1508 . '&show_all_resources=1">'
1509 . 'Find Lost Resources'
1510 . '</a>';
1511
1512 if ( $_SERVER['HTTP_HOST'] === 'beta' ) {
1513
1514 $my_system_buttons .= '<div style="width:100%;height:2em;border-bottom:1px dashed #777;margin-bottom:1em;"></div>';
1515
1516 // 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
1517 $my_system_buttons .= ' <a class="button button-secondary" style="background:#fff9e6;" href="'
1518 . wpbc_get_settings_url()
1519 . '&system_info=show&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) .'&reset=custom_forms#wpbc_general_settings_system_info_metabox">'
1520 . 'Reset custom forms'
1521 . '</a>';
1522 }
1523
1524 $this->fields['tools_section_buttons']['value'][] =
1525 '<div class="wpbc_booking_system_info_buttons_align">'
1526 . $my_system_buttons
1527 . '</div>';
1528 }
1529
1530 // </editor-fold>
1531
1532
1533 // <editor-fold defaultstate="collapsed" desc=" Transaltions " >
1534
1535 $this->fields['help_translation_section_after_legend_items'] = array(
1536 'type' => 'help'
1537 , 'value' => wpbc_get_help_rows_about_config_in_several_languges()
1538 , 'class' => ''
1539 , 'css' => 'margin:0;padding:0;border:0;'
1540 , 'description' => ''
1541 , 'cols' => 2
1542 , 'group' => 'translations'
1543 , 'tr_class' => ''
1544 , 'description_tag' => 'p'
1545 );
1546 $this->fields['hr_help_translation_section_after_legend_items'] = array( 'type' => 'hr', 'group' => 'translations' );
1547
1548 $this->fields['booking_translation_load_from'] = array(
1549 'type' => 'select'
1550 , 'default' => 'top'
1551 , 'title' => __('Firstly load translation', 'booking')
1552 , 'options' => array(
1553 'wp.org' => 'WordPress.org '
1554 , 'wpbc' => __( 'Local', 'booking' )
1555 )
1556 , 'group' => 'translations'
1557 , 'is_demo_safe' => wpbc_is_this_demo()
1558 );
1559
1560 $this->fields['help_translation_section_after_translation_load_from'] = array(
1561 'type' => 'help'
1562 , 'value' => array(
1563 sprintf(
1564 __('The plugin tries to use translations from %s, if failed (doesn\'t exist), try using translations from %s folder. You can change this behavior with this option.', 'booking')
1565 , '"<strong>../wp-content/languages/plugins/</strong>"'
1566 , '"<strong>../wp-content/plugins/{Booking Calendar Folder}/languages/</strong>"' )
1567 )
1568 , 'class' => ''
1569 , 'css' => 'margin:0;padding:0;border:0;'
1570 , 'description' => ''
1571 , 'cols' => 2
1572 , 'group' => 'translations'
1573 , 'tr_class' => ''
1574 , 'description_tag' => 'p'
1575 );
1576 // </editor-fold>
1577
1578 }
1579
1580
1581 /**
1582 * Add Custon JavaScript - for some specific settings options
1583 * Need to executes after showing of entire settings page (on hook: wpbc_after_settings_content).
1584 * After initial definition of settings, and possible definition after POST request.
1585 *
1586 * @param type $menu_slug
1587 *
1588 */
1589 public function enqueue_js( $menu_slug, $active_page_tab, $active_page_subtab ) {
1590
1591 $js_script = '';
1592
1593 // Hide 'Title of booked timeslot(s)' items //FixIn: 9.5.0.2.2
1594 $js_script .= "
1595 if ( jQuery('#set_gen_booking_disable_timeslots_in_tooltip').is(':checked') ) {
1596 jQuery('.wpbc_booking_timeslots_in_tooltip').addClass('hidden_items');
1597 }
1598 ";
1599 // Hide or Show 'Title of booked timeslot(s)' on click checkbox
1600 $js_script .= " jQuery('#set_gen_booking_disable_timeslots_in_tooltip').on( 'change', function(){
1601 if ( this.checked ) {
1602 jQuery('.wpbc_booking_timeslots_in_tooltip').addClass('hidden_items');
1603 } else {
1604 jQuery('.wpbc_booking_timeslots_in_tooltip').removeClass('hidden_items');
1605 }
1606 } ); ";
1607
1608 //FixIn: 9.6.3.5
1609
1610 // Hide Legend items
1611 $js_script .= "
1612 if ( ! jQuery('#set_gen_booking_is_show_legend').is(':checked') ) {
1613 jQuery('.wpbc_calendar_legend_items').addClass('hidden_items');
1614 }
1615 ";
1616 // Hide or Show Legend items on click checkbox
1617 $js_script .= " jQuery('#set_gen_booking_is_show_legend').on( 'change', function(){
1618 if ( this.checked ) {
1619 jQuery('.wpbc_calendar_legend_items').removeClass('hidden_items');
1620 } else {
1621 jQuery('.wpbc_calendar_legend_items').addClass('hidden_items');
1622 }
1623 } ); ";
1624 // Thank you Message or Page
1625 $js_script .= "
1626 if ( jQuery('#type_of_thank_you_message_message').is(':checked') ) {
1627 jQuery('.wpbc_calendar_thank_you_page').addClass('hidden_items');
1628 }
1629 if ( jQuery('#type_of_thank_you_message_page').is(':checked') ) {
1630 jQuery('.wpbc_calendar_thank_you_message').addClass('hidden_items');
1631 }
1632 ";
1633 $js_script .= " jQuery('input[name=\"set_gen_booking_type_of_thank_you_message\"]').on( 'change', function(){
1634 if ( jQuery('#type_of_thank_you_message_message').is(':checked') ) {
1635 jQuery('.wpbc_calendar_thank_you_message').removeClass('hidden_items');
1636 jQuery('.wpbc_calendar_thank_you_page').addClass('hidden_items');
1637 } else {
1638 jQuery('.wpbc_calendar_thank_you_message').addClass('hidden_items');
1639 jQuery('.wpbc_calendar_thank_you_page').removeClass('hidden_items');
1640 }
1641 } ); ";
1642
1643 // Default calendar view mode (Booking Listing) - set active / inctive options depend from resource selection.
1644 $js_script .= " jQuery('#set_gen_booking_view_days_num').on( 'focus', function(){
1645 if ( jQuery('#set_gen_booking_default_booking_resource').length > 0 ) {
1646 jQuery('#set_gen_booking_default_booking_resource').on('change', function() {
1647 jQuery('#set_gen_booking_view_days_num option:eq(2)').prop('selected', true);
1648 });
1649 if ( jQuery('#set_gen_booking_default_booking_resource').val() == '' ) {
1650 jQuery('#set_gen_booking_view_days_num option:eq(0)').prop('disabled', false);
1651 jQuery('#set_gen_booking_view_days_num option:eq(1)').prop('disabled', false);
1652 jQuery('#set_gen_booking_view_days_num option:eq(2)').prop('disabled', false);
1653 jQuery('#set_gen_booking_view_days_num option:eq(3)').prop('disabled', false);
1654 jQuery('#set_gen_booking_view_days_num option:eq(4)').prop('disabled', true);
1655 jQuery('#set_gen_booking_view_days_num option:eq(5)').prop('disabled', true);
1656 } else {
1657 jQuery('#set_gen_booking_view_days_num option:eq(0)').prop('disabled', true);
1658 jQuery('#set_gen_booking_view_days_num option:eq(1)').prop('disabled', true);
1659 jQuery('#set_gen_booking_view_days_num option:eq(2)').prop('disabled', false);
1660 jQuery('#set_gen_booking_view_days_num option:eq(3)').prop('disabled', true);
1661 jQuery('#set_gen_booking_view_days_num option:eq(4)').prop('disabled', false);
1662 jQuery('#set_gen_booking_view_days_num option:eq(5)').prop('disabled', false);
1663 }
1664 }
1665 } ); ";
1666
1667 ////////////////////////////////////////////////////////////////////////
1668 // Set correct value for dates format, depend on from selection of radio buttons
1669 $booking_date_format = get_bk_option( 'booking_date_format');
1670 // On initial Load set correct text value and correct radio button
1671 $js_script .= "
1672 // Select by default Custom value, later check all other predefined values
1673 jQuery( '#date_format_selection_custom' ).prop('checked', true);
1674
1675 jQuery('input[name=\"set_gen_booking_date_format_selection\"]').each(function() {
1676 var radio_button_value = jQuery( this ).val()
1677 var encodedStr = radio_button_value.replace(/[\u00A0-\u9999<>\&]/gim, function(i) {
1678 return '&#'+i.charCodeAt(0)+';';
1679 });
1680 if ( encodedStr == '". $booking_date_format ."' ) {
1681 jQuery( this ).prop('checked', true);
1682 }
1683 });
1684
1685 jQuery('#set_gen_booking_date_format').val('". $booking_date_format ."');
1686 ";
1687 // On click Radio button "Date Format", - set value in custom Text field
1688 $js_script .= " jQuery('input[name=\"set_gen_booking_date_format_selection\"]').on( 'change', function(){
1689 if ( ( this.checked ) && ( jQuery(this).val() != 'custom' ) ){
1690
1691 jQuery('#set_gen_booking_date_format').val( jQuery(this).val().replace(/[\u00A0-\u9999<>\&]/gim,
1692 function(i) {
1693 return '&#'+i.charCodeAt(0)+';';
1694 })
1695 );
1696 }
1697 } ); ";
1698 // If we edit custom "Date Format" Text field - select Custom Radio button.
1699 $js_script .= " jQuery('#set_gen_booking_date_format').on( 'change', function(){
1700 jQuery( '#date_format_selection_custom' ).prop('checked', true);
1701 } ); ";
1702
1703 ////////////////////////////////////////////////////////////////////////
1704 // Set correct value for Time Format, depend on from selection of radio buttons
1705 $booking_time_format = get_bk_option( 'booking_time_format');
1706 // Function to load on initial stage of page loading, set correct value of text and select correct radio button.
1707 $js_script .= "
1708 // Select by default Custom value, later check all other predefined values
1709 jQuery( '#time_format_selection_custom' ).prop('checked', true);
1710
1711 jQuery('input[name=\"set_gen_booking_time_format_selection\"]').each(function() {
1712 var radio_button_value = jQuery( this ).val()
1713 var encodedStr = radio_button_value.replace(/[\u00A0-\u9999<>\&]/gim, function(i) {
1714 return '&#'+i.charCodeAt(0)+';';
1715 });
1716 if ( encodedStr == '". $booking_time_format ."' ) {
1717 jQuery( this ).prop('checked', true);
1718 }
1719 });
1720
1721 jQuery('#set_gen_booking_time_format').val('". $booking_time_format ."');
1722 ";
1723 // On click Radio button "Time Format", - set value in custom Text field
1724 $js_script .= " jQuery('input[name=\"set_gen_booking_time_format_selection\"]').on( 'change', function(){
1725 if ( ( this.checked ) && ( jQuery(this).val() != 'custom' ) ){
1726
1727 jQuery('#set_gen_booking_time_format').val( jQuery(this).val().replace(/[\u00A0-\u9999<>\&]/gim,
1728 function(i) {
1729 return '&#'+i.charCodeAt(0)+';';
1730 })
1731 );
1732 }
1733 } ); ";
1734 // If we edit custom "Date Format" Text field - select Custom Radio button.
1735 $js_script .= " jQuery('#set_gen_booking_time_format').on( 'change', function(){
1736 jQuery( '#time_format_selection_custom' ).prop('checked', true);
1737 } ); ";
1738
1739 ////////////////////////////////////////////////////////////////////////
1740 // Advanced section
1741 ////////////////////////////////////////////////////////////////////////
1742
1743 // Click on "Always available "
1744 $js_script .= " jQuery('#set_gen_booking_is_days_always_available').on( 'change', function(){
1745 if ( this.checked ) {
1746 var answer = confirm('"
1747 . esc_js( __( 'Warning', 'booking' ) ) . '! '
1748 . 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' ) )
1749 . "' );
1750 if ( answer) {
1751 this.checked = true;
1752 jQuery('#set_gen_booking_quantity_control').prop('checked', false ).trigger('change');
1753 jQuery('#set_gen_booking_is_show_pending_days_as_available').prop('checked', false );
1754 jQuery('.wpbc_pending_days_as_available_sub_settings').addClass('hidden_items');
1755 } else {
1756 this.checked = false;
1757 }
1758 }
1759 } ); ";
1760
1761 //FixIn: 8.3.2.2
1762 if ( ! class_exists('wpdev_bk_biz_l') ) {
1763 // Click on "Use pending days as available"
1764 $js_script .= " jQuery('#set_gen_booking_is_show_pending_days_as_available').on( 'change', function(){
1765 if ( this.checked ) {
1766 jQuery('#set_gen_booking_is_days_always_available').prop('checked', false );
1767 } else {
1768
1769 }
1770 } ); ";
1771 }
1772
1773 // Click on Show Advanced JavaScript section link
1774 $js_script .= " jQuery('#wpbc_show_advanced_section_link_show').on( 'click', function(){
1775 jQuery('#wpbc_show_advanced_section_link_show').toggle(200);
1776 jQuery('#wpbc_show_advanced_section_link_hide').animate( {opacity: 1}, 200 ).toggle(200);
1777 jQuery('.wpbc_advanced_js_loading_settings').removeClass('hidden_items');
1778
1779 if ( ! jQuery('#set_gen_booking_is_load_js_css_on_specific_pages').is(':checked') ) {
1780 jQuery('.wpbc_is_load_js_css_on_specific_pages').addClass('hidden_items');
1781 }
1782 } ); ";
1783 $js_script .= " jQuery('#wpbc_show_advanced_section_link_hide').on( 'click', function(){
1784 jQuery('#wpbc_show_advanced_section_link_hide').toggle(200);
1785 jQuery('#wpbc_show_advanced_section_link_show').animate( {opacity: 1}, 200 ).toggle(200);
1786 jQuery('.wpbc_advanced_js_loading_settings').addClass('hidden_items');
1787 } ); ";
1788 $js_script .= " jQuery('#set_gen_booking_is_load_js_css_on_specific_pages').on( 'change', function(){
1789 if ( this.checked ) {
1790 var answer = confirm('"
1791 . esc_js( __( 'Warning', 'booking' ) ) . '! '
1792 . 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' ) )
1793 . "' );
1794 if ( answer) {
1795 this.checked = true;
1796 jQuery('.wpbc_is_load_js_css_on_specific_pages').removeClass('hidden_items');
1797 } else {
1798 this.checked = false;
1799 }
1800 } else {
1801 jQuery('.wpbc_is_load_js_css_on_specific_pages').addClass('hidden_items');
1802 }
1803 } );
1804 if ( ! jQuery('#set_gen_booking_is_load_js_css_on_specific_pages').is(':checked') ) {
1805 jQuery('.wpbc_is_load_js_css_on_specific_pages').addClass('hidden_items');
1806 }
1807
1808 ";
1809
1810
1811 // Click on Powered by links
1812 $js_script .= " jQuery('#wpbc_powered_by_link_show').on( 'click', function(){
1813 jQuery('#wpbc_powered_by_link_show').toggle(200);
1814 jQuery('#wpbc_powered_by_link_hide').animate( {opacity: 1}, 200 ).toggle(200);
1815 jQuery('.wpbc_is_show_powered_by_notice').removeClass('hidden_items');
1816 } ); ";
1817 $js_script .= " jQuery('#wpbc_powered_by_link_hide').on( 'click', function(){
1818 jQuery('#wpbc_powered_by_link_hide').toggle(200);
1819 jQuery('#wpbc_powered_by_link_show').animate( {opacity: 1}, 200 ).toggle(200);
1820 jQuery('.wpbc_is_show_powered_by_notice').addClass('hidden_items');
1821 } ); ";
1822
1823
1824 // Show confirmation window, if user activate this checkbox
1825 $js_script .= " jQuery('#set_gen_booking_is_delete_if_deactive').on( 'change', function(){
1826 if ( this.checked ) {
1827 var answer = confirm('"
1828 . esc_js( __( 'Warning', 'booking' ) ) . '! '
1829 . 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' ) )
1830 . "' );
1831 if ( answer) {
1832 this.checked = true;
1833 } else {
1834 this.checked = false;
1835 }
1836 }
1837 } );
1838 ";
1839
1840
1841 // Select specific Time Picker skin, depending from selection of Calendar skin //FixIn: 8.7.11.10
1842 $js_script .= " jQuery('#set_gen_booking_skin').on( 'change', function(){
1843
1844 var wpbc_selected_skin = jQuery('select[name=\"set_gen_booking_skin\"] option:selected').val();
1845 var wpbc_cal_skin_arr = [
1846 '/css/skins/black-2.css',
1847 '/css/skins/black.css',
1848 '/css/skins/multidays.css',
1849 '/css/skins/premium-black.css',
1850 '/css/skins/premium-light.css',
1851 '/css/skins/premium-marine.css',
1852 '/css/skins/premium-steel.css',
1853 '/css/skins/standard.css',
1854 '/css/skins/traditional-light.css',
1855 '/css/skins/traditional.css',
1856 '/css/skins/green-01.css'
1857 ];
1858 var wpbc_time_skin_arr = [
1859 '/css/time_picker_skins/black.css',
1860 '/css/time_picker_skins/black.css',
1861 '/css/time_picker_skins/green.css',
1862 '/css/time_picker_skins/black.css',
1863 '/css/time_picker_skins/grey.css',
1864 '/css/time_picker_skins/marine.css',
1865 '/css/time_picker_skins/grey.css',
1866 '/css/time_picker_skins/blue.css',
1867 '/css/time_picker_skins/orange.css',
1868 '/css/time_picker_skins/grey.css',
1869 '/css/time_picker_skins/grey.css'
1870 ];
1871 if ( wpbc_cal_skin_arr.indexOf( wpbc_selected_skin ) >= 0 ) {
1872 jQuery( '#set_gen_booking_timeslot_picker_skin' ).find( 'option' ).prop( 'selected', false );
1873 jQuery( '#set_gen_booking_timeslot_picker_skin' ).find( 'option[value=\"'+ wpbc_time_skin_arr[ wpbc_cal_skin_arr.indexOf( wpbc_selected_skin ) ] +'\"]' ).prop( 'selected', true );
1874 }
1875
1876 } ); ";
1877
1878 // If selected Dark theme then select Dark calendar skin, as well.
1879 $js_script .= " jQuery('#set_gen_booking_form_theme').on( 'change', function(){
1880 var wpbc_selected_theme = jQuery('select[name=\"set_gen_booking_form_theme\"] option:selected').val();
1881 var wpbc_cal_dark_skin_path = '/css/skins/black-2.css';
1882 if ( 'wpbc_theme_dark_1' === wpbc_selected_theme ) {
1883 jQuery( '#set_gen_booking_skin' ).find( 'option' ).prop( 'selected', false );
1884 jQuery( '#set_gen_booking_skin' ).find( 'option[value=\"'+ wpbc_cal_dark_skin_path +'\"]' ).prop( 'selected', true ).trigger('change');
1885 }
1886 var wpbc_cal_light_skin_path = '/css/skins/green-01.css';
1887 if ( '' === wpbc_selected_theme ) {
1888 jQuery( '#set_gen_booking_skin' ).find( 'option' ).prop( 'selected', false );
1889 jQuery( '#set_gen_booking_skin' ).find( 'option[value=\"'+ wpbc_cal_light_skin_path +'\"]' ).prop( 'selected', true ).trigger('change');
1890 }
1891
1892 } ); ";
1893
1894 // Enqueue JS to the footer of the page
1895 wpbc_enqueue_js( $js_script );
1896 }
1897
1898 }
1899
1900
1901 /**
1902 * Override VALIDATED fields BEFORE saving to DB
1903 * Description:
1904 * Check "Thank you page" URL
1905 *
1906 * @param array $validated_fields
1907 */
1908 function wpbc_settings_validate_fields_before_saving__all( $validated_fields ) {
1909
1910
1911 $validated_fields['booking_thank_you_page_URL'] = wpbc_make_link_relative( $validated_fields['booking_thank_you_page_URL'] );
1912
1913 unset( $validated_fields[ 'booking_date_format_selection' ] ); // We do not need to this field, because saving to DB only: "date_format" field
1914 unset( $validated_fields[ 'booking_time_format_selection' ] ); // We do not need to this field, because saving to DB only: "time_format" field
1915
1916 // Unset promote fields
1917 foreach ( $validated_fields as $field_name => $field_value ) {
1918 if ( strpos( $field_name, '__promote_upgrade' ) > 0 ) {
1919 unset( $validated_fields[ $field_name ] );
1920 }
1921 }
1922
1923 return $validated_fields;
1924 }
1925 add_filter( 'wpbc_settings_validate_fields_before_saving', 'wpbc_settings_validate_fields_before_saving__all', 10, 1 ); // Hook for validated fields.