| 1 |
<?php /** |
| 2 |
* @version 1.0 |
| 3 |
* @package Booking Calendar |
| 4 |
* @category Content of Settings page |
| 5 |
* @author wpdevelop |
| 6 |
* |
| 7 |
* @web-site https://wpbookingcalendar.com/ |
| 8 |
* @email info@wpbookingcalendar.com |
| 9 |
* |
| 10 |
* @modified 2015-11-02 |
| 11 |
*/ |
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 14 |
|
| 15 |
|
| 16 |
/** |
| 17 |
* Show Content |
| 18 |
* Update Content |
| 19 |
* Define Slug |
| 20 |
* Define where to show |
| 21 |
*/ |
| 22 |
class WPBC_Page_SettingsGeneral extends WPBC_Page_Structure { |
| 23 |
|
| 24 |
private $settings_api = false; |
| 25 |
|
| 26 |
public function __construct() { |
| 27 |
|
| 28 |
if ( ! wpbc_is_mu_user_can_be_here( 'only_super_admin' ) ) { // If this User not "super admin", then do not load this page at all |
| 29 |
|
| 30 |
if ( |
| 31 |
( isset( $_REQUEST['page'] ) && ( $_REQUEST['page'] == 'wpbc-settings' ) ) // Check if this Settings page |
| 32 |
&& |
| 33 |
( ( ! isset( $_REQUEST['tab'] ) ) || ( $_REQUEST['tab'] == 'general' ) ) |
| 34 |
) { // If tab was not selected or selected default, then redirect it to the "form" tab. |
| 35 |
$_REQUEST['tab'] = 'form'; |
| 36 |
} |
| 37 |
|
| 38 |
} |
| 39 |
else { |
| 40 |
parent::__construct(); |
| 41 |
} |
| 42 |
|
| 43 |
} |
| 44 |
|
| 45 |
public function in_page() { |
| 46 |
|
| 47 |
if ( ! wpbc_is_mu_user_can_be_here( 'only_super_admin' ) ) { // If this User not "super admin", then do not load this page at all |
| 48 |
return (string) rand(100000, 1000000); |
| 49 |
} |
| 50 |
|
| 51 |
return 'wpbc-settings'; |
| 52 |
} |
| 53 |
|
| 54 |
|
| 55 |
/** |
| 56 |
* Get Settings API class - define, show, update "Fields". |
| 57 |
* |
| 58 |
* @return object Settings API |
| 59 |
*/ |
| 60 |
public function settings_api(){ |
| 61 |
|
| 62 |
if ( $this->settings_api === false ) |
| 63 |
$this->settings_api = new WPBC_Settings_API_General(); |
| 64 |
|
| 65 |
return $this->settings_api; |
| 66 |
} |
| 67 |
|
| 68 |
|
| 69 |
public function tabs() { |
| 70 |
|
| 71 |
$tabs = array(); |
| 72 |
|
| 73 |
$tabs[ 'general' ] = array( |
| 74 |
'title' => __( 'General', 'booking') // Title of TAB |
| 75 |
, 'page_title' => __( 'General Settings', 'booking') // Title of Page |
| 76 |
, 'hint' => __( 'General Settings', 'booking') // Hint |
| 77 |
, 'link' => '' // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link |
| 78 |
, 'position' => '' // 'left' || 'right' || '' |
| 79 |
, 'css_classes' => '' // CSS class(es) |
| 80 |
, 'icon' => '' // Icon - link to the real PNG img |
| 81 |
, 'font_icon' => 'wpbc_icn_tune' // CSS definition of forn Icon |
| 82 |
, 'default' => true // Is this tab activated by default or not: true || false. |
| 83 |
); |
| 84 |
|
| 85 |
$subtabs = array(); |
| 86 |
$subtabs['wpbc-settings-info'] = array( 'type' => 'html', 'html' => wpbc_get_flex_dashboard_info() ); |
| 87 |
|
| 88 |
if (0){ |
| 89 |
$subtabs['wpbc-settings-calendar'] = array( 'type' => 'goto-link' |
| 90 |
, 'title' => __('Calendar','booking') |
| 91 |
, 'show_section' => 'wpbc_general_settings_calendar_metabox' |
| 92 |
); |
| 93 |
|
| 94 |
//FixIn: 8.7.11.10 |
| 95 |
$subtabs['wpbc-settings-time-slots'] = array( 'type' => 'goto-link' |
| 96 |
, 'title' => __('Time Slots','booking') |
| 97 |
, 'show_section' => 'wpbc_general_settings_time_slots_metabox' |
| 98 |
); |
| 99 |
|
| 100 |
$subtabs['wpbc-settings-availability'] = array( 'type' => 'goto-link' |
| 101 |
, 'title' => __('Availability','booking') |
| 102 |
, 'show_section' => 'wpbc_general_settings_availability_metabox' |
| 103 |
); |
| 104 |
|
| 105 |
$subtabs['wpbc-settings-form'] = array( 'type' => 'goto-link' |
| 106 |
, 'title' => __('Form','booking') |
| 107 |
, 'show_section' => 'wpbc_general_settings_form_metabox' |
| 108 |
); |
| 109 |
|
| 110 |
$subtabs['wpbc-settings-booking-listing'] = array( 'type' => 'goto-link' |
| 111 |
, 'title' => __('Booking Admin Panel','booking') |
| 112 |
, 'show_section' => 'wpbc_general_settings_booking_listing_metabox' |
| 113 |
); |
| 114 |
|
| 115 |
$subtabs['wpbc-settings-booking-timeline'] = array( 'type' => 'goto-link' |
| 116 |
, 'title' => __('Timeline', 'booking') |
| 117 |
, 'show_section' => 'wpbc_general_settings_booking_timeline_metabox' |
| 118 |
); |
| 119 |
|
| 120 |
if ( class_exists('wpdev_bk_biz_s') ) { |
| 121 |
|
| 122 |
|
| 123 |
$subtabs['wpbc-settings-auto-cancelation-approval'] = array( 'type' => 'goto-link' |
| 124 |
, 'title' => __('Auto cancellation / approval','booking') |
| 125 |
, 'show_section' => 'wpbc_general_settings_auto_cancelation_approval_metabox' |
| 126 |
); |
| 127 |
} |
| 128 |
|
| 129 |
$subtabs['wpbc-settings-capacity'] = array( 'type' => 'goto-link' |
| 130 |
, 'title' => __('Capacity', 'booking') //. ' ' . '<span class="wpbc_new_label">' . __( 'New', 'booking' ) . '</span>' |
| 131 |
, 'show_section' => 'wpbc_general_settings_capacity_metabox' |
| 132 |
); |
| 133 |
$subtabs['wpbc-settings-capacity_new'] = array( |
| 134 |
'type' => 'html' |
| 135 |
, 'html' => '<span class="wpbc_new_label" style="margin-left: -15px;border:none;">' . __( 'New', 'booking' ) . '</span>' |
| 136 |
); |
| 137 |
|
| 138 |
$subtabs['wpbc-settings-advanced'] = array( 'type' => 'goto-link' |
| 139 |
, 'title' => __('Advanced','booking') |
| 140 |
, 'show_section' => 'wpbc_general_settings_advanced_metabox' |
| 141 |
); |
| 142 |
|
| 143 |
$subtabs['wpbc-settings-menu-access'] = array( 'type' => 'goto-link' |
| 144 |
, 'title' => __('Plugin Menu','booking') |
| 145 |
, 'show_section' => 'wpbc_general_settings_permissions_metabox' |
| 146 |
); |
| 147 |
|
| 148 |
$subtabs['wpbc-settings-uninstall'] = array( 'type' => 'goto-link' |
| 149 |
, 'title' => __('Uninstall','booking') |
| 150 |
, 'show_section' => 'wpbc_general_settings_uninstall_metabox' |
| 151 |
); |
| 152 |
|
| 153 |
// $subtabs['wpbc-settings-technical'] = array( 'type' => 'goto-link' |
| 154 |
// , 'title' => __('Help', 'booking') |
| 155 |
// , 'show_section' => 'wpbc_general_settings_help_metabox' |
| 156 |
// ); |
| 157 |
|
| 158 |
$subtabs['form-save'] = array( |
| 159 |
'type' => 'button' |
| 160 |
, 'title' => __('Save Changes','booking') |
| 161 |
, 'form' => 'wpbc_general_settings_form' |
| 162 |
); |
| 163 |
} |
| 164 |
|
| 165 |
$tabs[ 'general' ][ 'subtabs' ] = $subtabs; |
| 166 |
|
| 167 |
return $tabs; |
| 168 |
} |
| 169 |
|
| 170 |
|
| 171 |
public function content() { |
| 172 |
|
| 173 |
// Checking //////////////////////////////////////////////////////////// |
| 174 |
|
| 175 |
do_action( 'wpbc_hook_settings_page_header', 'general_settings'); // Define Notices Section and show some static messages, if needed |
| 176 |
|
| 177 |
if ( ! wpbc_is_mu_user_can_be_here('activated_user') ) return false; // Check if MU user activated, otherwise show Warning message. |
| 178 |
|
| 179 |
if ( ! wpbc_is_mu_user_can_be_here('only_super_admin') ) return false; // User is not Super admin, so exit. Basically its was already checked at the bottom of the PHP file, just in case. |
| 180 |
|
| 181 |
$is_can = apply_bk_filter('recheck_version', true); if ( ! $is_can ) { ?><script type="text/javascript"> jQuery(document).ready(function(){ jQuery( '.wpdvlp-sub-tabs').remove(); }); </script><?php return; } |
| 182 |
|
| 183 |
|
| 184 |
// Init Settings API & Get Data from DB //////////////////////////////// |
| 185 |
$this->settings_api(); // Define all fields and get values from DB |
| 186 |
|
| 187 |
// Submit ///////////////////////////////////////////////////////////// |
| 188 |
|
| 189 |
$submit_form_name = 'wpbc_general_settings_form'; // Define form name |
| 190 |
|
| 191 |
if ( isset( $_POST['is_form_sbmitted_'. $submit_form_name ] ) ) { |
| 192 |
|
| 193 |
// Nonce checking {Return false if invalid, 1 if generated between, 0-12 hours ago, 2 if generated between 12-24 hours ago. } |
| 194 |
$nonce_gen_time = check_admin_referer( 'wpbc_settings_page_' . $submit_form_name ); // Its stop show anything on submiting, if its not refear to the original page |
| 195 |
|
| 196 |
// Save Changes |
| 197 |
$this->update(); |
| 198 |
} |
| 199 |
if ( ! empty( $_GET['scroll_to_section'] ) ) { |
| 200 |
?><script type="text/javascript"> |
| 201 |
jQuery(document).ready(function(){ |
| 202 |
jQuery( '#<?php echo esc_js( $_GET['scroll_to_section'] ); ?> a' ).trigger('click'); |
| 203 |
}); |
| 204 |
</script><?php |
| 205 |
} |
| 206 |
|
| 207 |
// JavaScript: Tooltips, Popover, Datepick (js & css) ////////////////// |
| 208 |
echo '<span class="wpdevelop">'; |
| 209 |
wpbc_js_for_bookings_page(); |
| 210 |
echo '</span>'; |
| 211 |
|
| 212 |
|
| 213 |
// Content //////////////////////////////////////////////////////////// |
| 214 |
?> |
| 215 |
<div class="clear" style="margin-bottom:10px;"></div> |
| 216 |
<div class="wpbc_settings_flex_container"> |
| 217 |
|
| 218 |
<div class="wpbc_settings_flex_container_left"> |
| 219 |
|
| 220 |
<div class="wpbc_settings_navigation_column"> |
| 221 |
|
| 222 |
<div id="wpbc_general_settings_calendar_tab" class="wpbc_settings_navigation_item wpbc_settings_navigation_item_active"> |
| 223 |
<a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_calendar_metabox' );" href="javascript:void(0);"> |
| 224 |
<span><?php _e( 'Calendar', 'booking' ) ?></span> |
| 225 |
</a> |
| 226 |
</div> |
| 227 |
<div id="wpbc_general_settings_days_tooltips_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> |
| 228 |
<a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_days_tooltips_metabox' );" href="javascript:void(0);"> |
| 229 |
<span><?php _e( 'Tooltips in days', 'booking' ) ?></span> |
| 230 |
</a> |
| 231 |
</div> |
| 232 |
<div id="wpbc_general_settings_availability_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> |
| 233 |
<a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_availability_metabox' );" href="javascript:void(0);"> |
| 234 |
<span><?php _e( 'Availability', 'booking' ) ?></span> |
| 235 |
</a> |
| 236 |
</div> |
| 237 |
<div id="wpbc_general_settings_capacity_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> |
| 238 |
<a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_capacity_metabox,#wpbc_general_settings_capacity_upgrade_metabox' );" href="javascript:void(0);"> |
| 239 |
<span><?php _e( 'Capacity', 'booking' ) ?></span> |
| 240 |
</a> |
| 241 |
</div> |
| 242 |
<div id="wpbc_general_settings_form_tab" class="wpbc_settings_navigation_item"> |
| 243 |
<a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_form_metabox' );" href="javascript:void(0);"> |
| 244 |
<span><?php _e( 'Form Options', 'booking' ) ?></span> |
| 245 |
</a> |
| 246 |
</div> |
| 247 |
<div id="wpbc_general_settings_time_slots_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> |
| 248 |
<a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_time_slots_metabox' );" href="javascript:void(0);"> |
| 249 |
<span><?php _e( 'Time Slots', 'booking' ) ?></span> |
| 250 |
</a> |
| 251 |
</div> |
| 252 |
<div id="wpbc_general_settings_booking_confirmation_tab" class="wpbc_settings_navigation_item"> |
| 253 |
<a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_booking_confirmation_metabox' );" href="javascript:void(0);"> |
| 254 |
<span><?php _e( 'Booking Confirmation', 'booking' ) ?></span> |
| 255 |
</a> |
| 256 |
</div> |
| 257 |
|
| 258 |
<div id="wpbc_general_settings_booking_timeline_tab" class="wpbc_settings_navigation_item wpbc_navigation_top_border"> |
| 259 |
<a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_booking_timeline_metabox' );" href="javascript:void(0);"> |
| 260 |
<span><?php _e( 'Timeline (front-end)', 'booking' ) ?></span> |
| 261 |
</a> |
| 262 |
</div> |
| 263 |
<?php if ( class_exists('wpdev_bk_personal') ) { ?> |
| 264 |
<div id="wpbc_general_settings_bookings_options_tab" class="wpbc_settings_navigation_item wpbc_navigation_top_border"> |
| 265 |
<a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_bookings_options_metabox' );" href="javascript:void(0);"> |
| 266 |
<span><?php _e( 'Manage Bookings', 'booking' ) ?></span> |
| 267 |
</a> |
| 268 |
</div> |
| 269 |
<?php } ?> |
| 270 |
|
| 271 |
<?php if ( class_exists('wpdev_bk_biz_s') ) { ?> |
| 272 |
<div id="wpbc_general_settings_auto_cancelation_approval_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> |
| 273 |
<a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_auto_cancelation_approval_metabox' );" href="javascript:void(0);"> |
| 274 |
<span><?php _e( 'Auto Cancellation / Auto Approval', 'booking' ) ?></span> |
| 275 |
</a> |
| 276 |
</div> |
| 277 |
<?php } ?> |
| 278 |
|
| 279 |
|
| 280 |
<?php if ( class_exists('wpdev_bk_multiuser') ) { ?> |
| 281 |
<div id="wpbc_general_settings_multiuser_tab" class="wpbc_settings_navigation_item"> |
| 282 |
<a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_multiuser_metabox' );" href="javascript:void(0);"> |
| 283 |
<span><?php _e( 'Multiuser options', 'booking' ) ?></span> |
| 284 |
</a> |
| 285 |
</div> |
| 286 |
<?php } ?> |
| 287 |
|
| 288 |
<div id="wpbc_general_settings_booking_listing_tab" class="wpbc_settings_navigation_item wpbc_navigation_top_border"> |
| 289 |
<a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_booking_listing_metabox' );" href="javascript:void(0);"> |
| 290 |
<span><?php _e( 'Admin Panel', 'booking' ) ?></span> |
| 291 |
</a> |
| 292 |
</div> |
| 293 |
<div id="wpbc_general_settings_booking_calendar_overview_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> |
| 294 |
<a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_booking_calendar_overview_metabox' );" href="javascript:void(0);"> |
| 295 |
<span><?php _e( 'Calendar Overview', 'booking' ) ?></span> |
| 296 |
</a> |
| 297 |
</div> |
| 298 |
<div id="wpbc_general_settings_datestimes_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> |
| 299 |
<a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_datestimes_metabox' );" href="javascript:void(0);"> |
| 300 |
<span><?php _e( 'Date / Time Formats', 'booking' ) ?></span> |
| 301 |
</a> |
| 302 |
</div> |
| 303 |
<div id="wpbc_general_settings_permissions_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> |
| 304 |
<a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_permissions_metabox' );" href="javascript:void(0);"> |
| 305 |
<span><?php _e( 'Plugin Menu / Permissions', 'booking' ) ?></span> |
| 306 |
</a> |
| 307 |
</div> |
| 308 |
<div id="wpbc_general_settings_translations_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> |
| 309 |
<a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_translations_metabox' );" href="javascript:void(0);"> |
| 310 |
<span><?php _e( 'Translations', 'booking' ) ?></span> |
| 311 |
</a> |
| 312 |
</div> |
| 313 |
<div id="wpbc_general_settings_advanced_tab" class="wpbc_settings_navigation_item"> |
| 314 |
<a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_advanced_metabox' );" href="javascript:void(0);"> |
| 315 |
<span><?php _e( 'Advanced', 'booking' ) ?></span> |
| 316 |
</a> |
| 317 |
</div> |
| 318 |
<div id="wpbc_general_settings_uninstall_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> |
| 319 |
<a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_uninstall_metabox' );" href="javascript:void(0);"> |
| 320 |
<span><?php _e( 'Uninstall / deactivation', 'booking' ) ?></span> |
| 321 |
</a> |
| 322 |
</div> |
| 323 |
<div id="wpbc_general_settings_information_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> |
| 324 |
<a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_information_metabox' );" href="javascript:void(0);"> |
| 325 |
<span><?php _e( 'Info / News', 'booking' ) ?></span> |
| 326 |
</a> |
| 327 |
</div> |
| 328 |
|
| 329 |
<?php if ( ( class_exists('wpdev_bk_personal') ) && ( ! wpbc_is_this_demo() ) ) { ?> |
| 330 |
<div id="wpbc_general_settings_help_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> |
| 331 |
<a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_help_metabox' );" href="javascript:void(0);"> |
| 332 |
<span><?php _e( 'Tools', 'booking' ) ?></span> |
| 333 |
</a> |
| 334 |
</div> |
| 335 |
<?php } ?> |
| 336 |
|
| 337 |
<div id="wpbc_general_settings_all_tab" class="wpbc_settings_navigation_item wpbc_navigation_top_border"> |
| 338 |
<a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'.postbox' );" href="javascript:void(0);"> |
| 339 |
<span><?php _e( 'Show All Settings', 'booking' ) ?></span> |
| 340 |
</a> |
| 341 |
</div> |
| 342 |
|
| 343 |
</div> |
| 344 |
|
| 345 |
</div> |
| 346 |
<div class="wpbc_settings_flex_container_right"> |
| 347 |
|
| 348 |
<span class="metabox-holder"> |
| 349 |
<form name="<?php echo $submit_form_name; ?>" id="<?php echo $submit_form_name; ?>" action="" method="post"> |
| 350 |
<?php |
| 351 |
// N o n c e field, and key for checking S u b m i t |
| 352 |
wp_nonce_field( 'wpbc_settings_page_' . $submit_form_name ); |
| 353 |
?><input type="hidden" name="is_form_sbmitted_<?php echo $submit_form_name; ?>" id="is_form_sbmitted_<?php echo $submit_form_name; ?>" value="1" /> |
| 354 |
<input type="hidden" name="form_visible_section" id="form_visible_section" value="" /> |
| 355 |
|
| 356 |
<?php if ( wpbc_is_show_general_setting_options() ) { //FixIn: 8.9.4.11 ?> |
| 357 |
|
| 358 |
<div class="wpbc_settings_row wpbc_settings_row_full_width" > |
| 359 |
|
| 360 |
<?php wpbc_open_meta_box_section( 'wpbc_general_settings_calendar', __('Calendar', 'booking'), array( 'is_section_visible_after_load' => true, 'is_show_minimize' => false ) ); ?> |
| 361 |
|
| 362 |
<?php $this->settings_api()->show( 'calendar' ); ?> |
| 363 |
|
| 364 |
<?php wpbc_close_meta_box_section(); ?> |
| 365 |
|
| 366 |
|
| 367 |
<?php wpbc_open_meta_box_section( 'wpbc_general_settings_days_tooltips', __('Calendar Dates Tooltips', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 368 |
|
| 369 |
<?php $this->settings_api()->show( 'days_tooltips' ); ?> |
| 370 |
|
| 371 |
<?php wpbc_close_meta_box_section(); ?> |
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
<?php wpbc_open_meta_box_section( 'wpbc_general_settings_time_slots', __('Time Slots', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 376 |
|
| 377 |
<?php $this->settings_api()->show( 'time_slots' ); ?> |
| 378 |
|
| 379 |
<?php wpbc_close_meta_box_section(); ?> |
| 380 |
|
| 381 |
|
| 382 |
<?php wpbc_open_meta_box_section( 'wpbc_general_settings_availability', __('Availability', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 383 |
|
| 384 |
<?php $this->settings_api()->show( 'availability' ); ?> |
| 385 |
|
| 386 |
<?php wpbc_close_meta_box_section(); ?> |
| 387 |
|
| 388 |
|
| 389 |
<?php wpbc_open_meta_box_section( 'wpbc_general_settings_form', __('Form Options', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 390 |
|
| 391 |
<?php $this->settings_api()->show( 'form' ); ?> |
| 392 |
|
| 393 |
<?php wpbc_close_meta_box_section(); ?> |
| 394 |
|
| 395 |
|
| 396 |
<?php wpbc_open_meta_box_section( 'wpbc_general_settings_booking_confirmation', __('Booking Confirmation', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 397 |
|
| 398 |
<?php $this->settings_api()->show( 'booking_confirmation' ); ?> |
| 399 |
|
| 400 |
<?php wpbc_close_meta_box_section(); ?> |
| 401 |
|
| 402 |
|
| 403 |
<?php if ( class_exists('wpdev_bk_personal') ) { ?> |
| 404 |
<?php wpbc_open_meta_box_section( 'wpbc_general_settings_bookings_options', __('Bookings Options', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 405 |
|
| 406 |
<?php $this->settings_api()->show( 'bookings_options' ); ?> |
| 407 |
|
| 408 |
<?php wpbc_close_meta_box_section(); ?> |
| 409 |
<?php } ?> |
| 410 |
|
| 411 |
|
| 412 |
<?php wpbc_open_meta_box_section( 'wpbc_general_settings_booking_listing', __('Booking Admin Panel', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 413 |
|
| 414 |
<?php $this->settings_api()->show( 'booking_listing' ); ?> |
| 415 |
|
| 416 |
<?php wpbc_close_meta_box_section(); ?> |
| 417 |
|
| 418 |
|
| 419 |
<?php wpbc_open_meta_box_section( 'wpbc_general_settings_booking_calendar_overview', __('Calendar Overview (admin panel)', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 420 |
|
| 421 |
<?php //FixIn: 8.5.2.20 |
| 422 |
$this->settings_api()->show( 'booking_calendar_overview' ); |
| 423 |
?> |
| 424 |
|
| 425 |
<?php wpbc_close_meta_box_section(); ?> |
| 426 |
|
| 427 |
|
| 428 |
<?php wpbc_open_meta_box_section( 'wpbc_general_settings_booking_timeline', __('Timeline (front-end)', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 429 |
|
| 430 |
<?php |
| 431 |
$this->settings_api()->show( 'booking_timeline' ); |
| 432 |
?> |
| 433 |
|
| 434 |
<?php wpbc_close_meta_box_section(); ?> |
| 435 |
|
| 436 |
|
| 437 |
<?php if ( class_exists('wpdev_bk_biz_s') ) { ?> |
| 438 |
|
| 439 |
|
| 440 |
<?php wpbc_open_meta_box_section( 'wpbc_general_settings_auto_cancelation_approval', __('Auto cancellation / auto approval of bookings', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 441 |
|
| 442 |
<?php $this->settings_api()->show( 'auto_cancelation_approval' ); ?> |
| 443 |
|
| 444 |
<?php wpbc_close_meta_box_section(); ?> |
| 445 |
|
| 446 |
<?php } ?> |
| 447 |
|
| 448 |
|
| 449 |
|
| 450 |
<?php wpbc_open_meta_box_section( 'wpbc_general_settings_capacity', __('Capacity', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 451 |
|
| 452 |
<?php $this->settings_api()->show( 'capacity' ); ?> |
| 453 |
|
| 454 |
<?php wpbc_close_meta_box_section(); ?> |
| 455 |
|
| 456 |
|
| 457 |
<?php |
| 458 |
if ( ! class_exists( 'wpdev_bk_personal' ) ) { |
| 459 |
|
| 460 |
$wpbc_metabox_id = 'wpbc_general_settings_capacity_upgrade'; |
| 461 |
|
| 462 |
ob_start(); |
| 463 |
$is_panel_visible = wpbc_is_dismissed( $wpbc_metabox_id . '_metabox', array( |
| 464 |
'title' => '<i class="menu_icon icon-1x wpbc_icn_close"></i> ', |
| 465 |
'hint' => __( 'Dismiss', 'booking' ), |
| 466 |
'class' => 'wpbc_panel_get_started_dismiss', |
| 467 |
'css' => 'background: #fff;border-radius: 7px;' |
| 468 |
)); |
| 469 |
?><script type="text/javascript"> jQuery('#<?php echo $wpbc_metabox_id; ?>_metabox').hide(); </script><?php |
| 470 |
$dismiss_button_content = ob_get_clean(); |
| 471 |
|
| 472 |
if ( $is_panel_visible ) { |
| 473 |
|
| 474 |
wpbc_open_meta_box_section( $wpbc_metabox_id, |
| 475 |
__('Booking Quantity Control - Set limits for the number of bookings per day or time slot.', 'booking'), |
| 476 |
array( 'is_section_visible_after_load' => false, |
| 477 |
'is_show_minimize' => false, |
| 478 |
'dismiss_button' => $dismiss_button_content |
| 479 |
) ); |
| 480 |
|
| 481 |
$this->settings_api()->show( 'capacity_upgrade' ); |
| 482 |
|
| 483 |
wpbc_close_meta_box_section(); |
| 484 |
} |
| 485 |
} |
| 486 |
?> |
| 487 |
|
| 488 |
|
| 489 |
<?php wpbc_open_meta_box_section( 'wpbc_general_settings_advanced', __('Advanced', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 490 |
|
| 491 |
<?php $this->settings_api()->show( 'advanced' ); ?> |
| 492 |
|
| 493 |
<?php wpbc_close_meta_box_section(); ?> |
| 494 |
|
| 495 |
|
| 496 |
<?php wpbc_open_meta_box_section( 'wpbc_general_settings_information', __('Information', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 497 |
|
| 498 |
<?php $this->settings_api()->show( 'information' ); ?> |
| 499 |
|
| 500 |
<?php wpbc_close_meta_box_section(); ?> |
| 501 |
|
| 502 |
|
| 503 |
|
| 504 |
<?php wpbc_open_meta_box_section( 'wpbc_general_settings_datestimes', __('Date : Time', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 505 |
|
| 506 |
<?php $this->settings_api()->show( 'date_time' ); ?> |
| 507 |
|
| 508 |
<?php wpbc_close_meta_box_section(); ?> |
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
<?php wpbc_open_meta_box_section( 'wpbc_general_settings_permissions', __('Plugin Menu', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 513 |
|
| 514 |
<?php $this->settings_api()->show( 'permissions' ); ?> |
| 515 |
|
| 516 |
<?php wpbc_close_meta_box_section(); ?> |
| 517 |
|
| 518 |
|
| 519 |
<?php wpbc_open_meta_box_section( 'wpbc_general_settings_uninstall', __('Uninstall / deactivation', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 520 |
|
| 521 |
<?php $this->settings_api()->show( 'uninstall' ); ?> |
| 522 |
|
| 523 |
<?php wpbc_close_meta_box_section(); ?> |
| 524 |
|
| 525 |
<?php if ( ( class_exists( 'wpdev_bk_personal' ) ) && ( ! wpbc_is_this_demo() ) ) { ?> |
| 526 |
<?php wpbc_open_meta_box_section( 'wpbc_general_settings_help', __('Tools', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 527 |
|
| 528 |
<?php $this->settings_api()->show( 'help' ); ?> |
| 529 |
|
| 530 |
<?php wpbc_close_meta_box_section(); ?> |
| 531 |
<?php } ?> |
| 532 |
|
| 533 |
<?php wpbc_open_meta_box_section( 'wpbc_general_settings_translations', __('Translations', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 534 |
|
| 535 |
<?php $this->settings_api()->show( 'translations' ); ?> |
| 536 |
|
| 537 |
<?php wpbc_translation_buttons_settings_section(); ?> |
| 538 |
|
| 539 |
<?php wpbc_close_meta_box_section(); ?> |
| 540 |
|
| 541 |
<?php if ( class_exists('wpdev_bk_multiuser') ) { //FixIn: 9.2.3.8 ?> |
| 542 |
|
| 543 |
<?php wpbc_open_meta_box_section( 'wpbc_general_settings_multiuser', __('Multiuser options', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 544 |
|
| 545 |
<?php $this->settings_api()->show( 'multiuser' ); ?> |
| 546 |
|
| 547 |
<?php wpbc_close_meta_box_section(); ?> |
| 548 |
|
| 549 |
<?php } ?> |
| 550 |
|
| 551 |
</div> |
| 552 |
|
| 553 |
<div class="clear"></div> |
| 554 |
<input type="submit" value="<?php _e('Save Changes','booking'); ?>" class="button button-primary wpbc_submit_button" /> |
| 555 |
<?php |
| 556 |
if ( 'translations_updated_from_wpbc_and_wp' !== get_bk_option( 'booking_translation_update_status' ) ) { |
| 557 |
|
| 558 |
$current_locale = wpbc_get_maybe_reloaded_booking_locale(); |
| 559 |
|
| 560 |
if ( ! in_array( $current_locale, array( 'en_US', 'en_CA', 'en_GB', 'en_AU' ) ) ) { |
| 561 |
|
| 562 |
echo |
| 563 |
'<a class="button button" href="' |
| 564 |
. wpbc_get_settings_url() |
| 565 |
. '&system_info=show&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) .'&update_translations=1#wpbc_general_settings_system_info_metabox">' |
| 566 |
. __( 'Update Translations' ) |
| 567 |
. '</a>'; |
| 568 |
} |
| 569 |
} |
| 570 |
|
| 571 |
if ( ! wpbc_is_this_demo() ) { |
| 572 |
|
| 573 |
echo '<a style="margin:0 2em;" class="button button" href="' . wpbc_get_settings_url() |
| 574 |
. '&system_info=show&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) .'&restore_dismissed=On#wpbc_general_settings_restore_dismissed_metabox">' |
| 575 |
. __('Restore all dismissed windows' ,'booking') |
| 576 |
. '</a>'; |
| 577 |
} |
| 578 |
?> |
| 579 |
|
| 580 |
<?php } ?> |
| 581 |
</form> |
| 582 |
</span> |
| 583 |
|
| 584 |
</div> |
| 585 |
</div> |
| 586 |
|
| 587 |
|
| 588 |
<?php |
| 589 |
|
| 590 |
do_action( 'wpbc_hook_settings_page_footer', 'general_settings' ); |
| 591 |
} |
| 592 |
|
| 593 |
|
| 594 |
public function update() { |
| 595 |
|
| 596 |
$validated_fields = $this->settings_api()->validate_post(); // Get Validated Settings fields in $_POST request. |
| 597 |
|
| 598 |
$validated_fields = apply_filters( 'wpbc_settings_validate_fields_before_saving', $validated_fields ); //Hook for validated fields. |
| 599 |
|
| 600 |
// unset($validated_fields['booking_start_day_weeek']); // Skip saving specific option, for example in Demo mode. |
| 601 |
|
| 602 |
//FixIn: 9.8.6.1 |
| 603 |
if ( ! empty( $_POST['form_visible_section'] ) ) { |
| 604 |
?><script type="text/javascript"> |
| 605 |
jQuery(document).ready(function(){ |
| 606 |
jQuery( '<?php echo esc_js( $_POST['form_visible_section'] ); ?> a' ).trigger('click'); |
| 607 |
}); |
| 608 |
</script><?php |
| 609 |
} |
| 610 |
|
| 611 |
$this->settings_api()->save_to_db( $validated_fields ); // Save fields to DB |
| 612 |
|
| 613 |
wpbc_show_changes_saved_message(); |
| 614 |
|
| 615 |
/** |
| 616 |
// O L D W A Y: Saving Fields Data |
| 617 |
// update_bk_option( 'booking_is_delete_if_deactive' |
| 618 |
// , WPBC_Settings_API::validate_checkbox_post('booking_is_delete_if_deactive') ); |
| 619 |
// ( (isset( $_POST['booking_is_delete_if_deactive'] ))?'On':'Off') ); |
| 620 |
*/ |
| 621 |
} |
| 622 |
} |
| 623 |
|
| 624 |
|
| 625 |
/** |
| 626 |
* |
| 627 |
|
| 628 |
if ( ! wpbc_is_mu_user_can_be_here( 'only_super_admin' ) ) { // If this User not "super admin", then do not load this page at all |
| 629 |
|
| 630 |
if ( ( ! isset( $_GET['tab'] ) ) || ( $_GET['tab'] == 'general' ) ) { // If tab was not selected or selected default, then redirect it to the "form" tab. |
| 631 |
$_GET['tab'] = 'form'; |
| 632 |
} |
| 633 |
} else { |
| 634 |
add_action('wpbc_menu_created', array( new WPBC_Page_SettingsGeneral() , '__construct') ); // Executed after creation of Menu |
| 635 |
} |
| 636 |
*/ |
| 637 |
|
| 638 |
add_action('wpbc_menu_created', array( new WPBC_Page_SettingsGeneral() , '__construct') ); // Executed after creation of Menu |
| 639 |
|