| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | <?php /** |
| 2 | 2 | * @version 1.0 |
| 3 | 3 | * @package Booking Calendar |
| 4 | 4 | * @category Content of Settings page |
| @@ -25,13 +25,14 @@ | ||
| 25 | 25 | * Link to Settings API obj |
| 26 | 26 | * |
| 27 | 27 | * @var bool |
| 28 | 28 | */ |
| 29 | - private $settings_api = false; | |
| 30 | - | |
| 31 | - public function __construct() { | |
| 32 | - | |
| 33 | - 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 | + private $settings_api = false; | |
| 30 | + | |
| 31 | + public function __construct() { | |
| 32 | + $this->normalize_legacy_settings_request(); | |
| 33 | + | |
| 34 | + 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 | |
| 34 | 35 | // If tab was not selected or selected default, then redirect it to the "form" tab. |
| 35 | 36 | // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 36 | 37 | if ( ( isset( $_REQUEST['page'] ) && ( 'wpbc-settings' === $_REQUEST['page'] ) ) && ( ( ! isset( $_REQUEST['tab'] ) ) || ( 'general' === $_REQUEST['tab'] ) ) ) { |
| 37 | 38 | $_REQUEST['tab'] = 'form'; |
| @@ -37,10 +38,43 @@ | ||
| 37 | 38 | $_REQUEST['tab'] = 'form'; |
| 38 | 39 | } |
| 39 | 40 | } else { |
| 40 | 41 | parent::__construct(); |
| 41 | - } | |
| 42 | - } | |
| 42 | + } | |
| 43 | + } | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * Route settings links for sections that were moved into the Advanced group. | |
| 47 | + * | |
| 48 | + * Existing bookmarks and integrations can continue using the former Admin | |
| 49 | + * Panel group and the previous Manage Bookings location of the front-end | |
| 50 | + * Timeline settings. Subtab identifiers remain unchanged. | |
| 51 | + * | |
| 52 | + * @return void | |
| 53 | + */ | |
| 54 | + private function normalize_legacy_settings_request() { | |
| 55 | + $request_page = isset( $_REQUEST['page'] ) && is_scalar( $_REQUEST['page'] ) | |
| 56 | + ? sanitize_key( (string) wp_unslash( $_REQUEST['page'] ) ) | |
| 57 | + : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 58 | + $request_tab = isset( $_REQUEST['tab'] ) && is_scalar( $_REQUEST['tab'] ) | |
| 59 | + ? sanitize_key( (string) wp_unslash( $_REQUEST['tab'] ) ) | |
| 60 | + : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 61 | + $request_subtab = isset( $_REQUEST['subtab'] ) && is_scalar( $_REQUEST['subtab'] ) | |
| 62 | + ? sanitize_key( (string) wp_unslash( $_REQUEST['subtab'] ) ) | |
| 63 | + : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 64 | + | |
| 65 | + $is_legacy_admin_panel = 'admin_panel' === $request_tab; | |
| 66 | + $is_legacy_timeline = 'manage_bookings' === $request_tab && 'booking_timeline' === $request_subtab; | |
| 67 | + | |
| 68 | + if ( 'wpbc-settings' !== $request_page || ( ! $is_legacy_admin_panel && ! $is_legacy_timeline ) ) { | |
| 69 | + return; | |
| 70 | + } | |
| 71 | + | |
| 72 | + $_REQUEST['tab'] = 'advanced'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 73 | + if ( isset( $_GET['tab'] ) ) { | |
| 74 | + $_GET['tab'] = 'advanced'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 75 | + } | |
| 76 | + } | |
| 43 | 77 | |
| 44 | 78 | public function in_page() { |
| 45 | 79 | |
| 46 | 80 | 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. |
| @@ -70,19 +104,18 @@ | ||
| 70 | 104 | |
| 71 | 105 | // Init vars. |
| 72 | 106 | $separator_i = 0; |
| 73 | 107 | $tabs = array(); |
| 74 | - $subtabs = array(); | |
| 75 | 108 | $subtab_default = array( |
| 76 | 109 | 'type' => 'subtab', // Required| Possible values: 'subtab' | 'separator' | 'button' | 'goto-link' | 'html'. |
| 77 | - 'title' => '', // Example: __( 'Dashboard' // Title of TAB. | |
| 78 | - 'page_title' => '', // __( 'Search Availability' // Title of Page. | |
| 79 | - 'hint' => '', // __( 'Configure the layout and functionality of both the search form and search results.' // Hint. | |
| 80 | - 'link' => '', // wpbc_get_settings_url() . '&scroll_to_section=wpbc_general_settings_dashboard_tab', // Link. | |
| 81 | - 'css_classes' => '', // cls CSS . | |
| 110 | + 'title' => '', | |
| 111 | + 'page_title' => '', | |
| 112 | + 'hint' => '', | |
| 113 | + 'link' => '', | |
| 114 | + 'css_classes' => '', | |
| 82 | 115 | 'font_icon' => 'wpbc_icn_dashboard', |
| 83 | - 'font_icon_right' => 'wpbc-bi-question-circle', // 'wpbc-bi-question-circle' . | |
| 84 | - 'default' => false, // Is this sub tab activated by default or not: true || false. | |
| 116 | + 'font_icon_right' => 'wpbc-bi-question-circle', | |
| 117 | + 'default' => false, | |
| 85 | 118 | ); |
| 86 | 119 | |
| 87 | 120 | // ============================================================================================================= |
| 88 | 121 | // == D A S H B O A R D == |
| @@ -104,130 +137,16 @@ | ||
| 104 | 137 | 'css_classes' => 'do_expand__' . 'wpbc_general_settings_dashboard_metabox' . '_link', |
| 105 | 138 | 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . 'wpbc_general_settings_dashboard_metabox' . "' );", |
| 106 | 139 | 'folder_style' => 'order:10;', |
| 107 | 140 | ); |
| 108 | - $tabs[ 'settings' . ( ++$separator_i ) ] = array_merge( $subtab_default, array( 'type' => 'separator' ,'folder_style' => 'order:10;' ) ); | |
| 141 | + // FixIn: 10.12.4.7. $tabs[ 'settings' . ( ++$separator_i ) ] = array_merge( $subtab_default, array( 'type' => 'separator' ,'folder_style' => 'order:10;' ) ); | |
| 109 | 142 | |
| 110 | 143 | |
| 111 | 144 | // ============================================================================================================= |
| 112 | - // == C A L E N D A R + B O O K I N G _ P R O C E S S == | |
| 113 | - // ============================================================================================================= | |
| 114 | - $tabs['calendar_booking_process'] = array( | |
| 115 | - 'page_title' => __( 'Calendar and Form Settings', 'booking' ), // Header - Title. If false, than hidden. | |
| 116 | - // translators: 1: Booking Calendar. | |
| 117 | - 'page_description' => sprintf( __( 'Configure various options and settings in the %s.', 'booking' ), 'Booking Calendar' ), | |
| 118 | - 'title' => __( 'Calendar', 'booking' ), // Left Vertical Menu - Title. + Booking Process. | |
| 119 | - // translators: 1: Booking Calendar. | |
| 120 | - 'hint' => sprintf( __( 'Configure various options and settings in the %s.', 'booking' ), 'Booking Calendar' ), | |
| 121 | - 'font_icon' => 'wpbc-bi-calendar2-range', // Left Vertical Menu - Icon. | |
| 122 | - 'link' => '', // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link. | |
| 123 | - 'css_classes' => '', // CSS. | |
| 124 | - 'default' => false, // Is this tab activated by default or not: true / false. | |
| 125 | - 'folder_style' => 'order:10;', | |
| 126 | - ); | |
| 127 | - | |
| 128 | - $section_id = 'wpbc_general_settings_calendar_metabox'; | |
| 129 | - $subtabs['calendar'] = array_merge( | |
| 130 | - $subtab_default, | |
| 131 | - array( | |
| 132 | - 'title' => __( 'Calendar Settings', 'booking' ), | |
| 133 | - 'page_title' => __( 'General Settings', 'booking' ), | |
| 134 | - 'hint' => __( 'Customize various calendar settings, specify how many months can be scrolled, and defining the legend.', 'booking' ), | |
| 135 | - 'font_icon' => 'wpbc-bi-calendar2-range', | |
| 136 | - 'font_icon_right' => 'wpbc-bi-question-circle', | |
| 137 | - 'css_classes' => 'do_expand__' . $section_id . '_link', // sub_bold', . | |
| 138 | - 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", | |
| 139 | - 'default' => false, | |
| 140 | - ) | |
| 141 | - ); | |
| 142 | - | |
| 143 | - $section_id = 'wpbc_general_settings_calendar_metabox' . '#do_other_actions__' . 'blink_day_selections'; | |
| 144 | - $subtabs['days_selection'] = array_merge( | |
| 145 | - $subtab_default, | |
| 146 | - array( | |
| 147 | - 'title' => __( 'Days Selection', 'booking' ), | |
| 148 | - 'page_title' => __( 'General Settings', 'booking' ), | |
| 149 | - 'hint' => __( 'Choose how users can select days: single day, multiple days, or a date range with minimum and maximum limits.', 'booking' ), | |
| 150 | - 'font_icon' => 'wpbc-bi-calendar3-week', | |
| 151 | - 'font_icon_right' => 'wpbc-bi-question-circle', | |
| 152 | - 'css_classes' => 'do_expand__' . $section_id . '_link', // sub_bold', . | |
| 153 | - 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", | |
| 154 | - 'default' => false, | |
| 155 | - ) | |
| 156 | - ); | |
| 157 | - | |
| 158 | - | |
| 159 | - if ( class_exists('wpdev_bk_biz_s') ) { | |
| 160 | - $section_id = 'wpbc_general_settings_calendar_metabox' . '#do_other_actions__' . 'blink_change_over_days'; | |
| 161 | - $subtabs['change_over_days'] = array_merge( | |
| 162 | - $subtab_default, | |
| 163 | - array( | |
| 164 | - 'title' => __( 'Changeover Days', 'booking' ), | |
| 165 | - 'page_title' => __( 'General Settings', 'booking' ), | |
| 166 | - 'hint' => __( 'Set up check-in and check-out days for multi-day bookings, with visual indicators like diagonal or vertical lines. Ideal for bookings that require split days.', 'booking' ), | |
| 167 | - 'font_icon' => 'wpbc_icn_flip', | |
| 168 | - 'font_icon_right' => 'wpbc-bi-question-circle', | |
| 169 | - 'css_classes' => 'do_expand__' . $section_id . '_link', // sub_bold', . | |
| 170 | - 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", | |
| 171 | - 'default' => false, | |
| 172 | - ) | |
| 173 | - ); | |
| 174 | - } | |
| 175 | - | |
| 176 | - $section_id = 'wpbc_general_settings_days_tooltips_metabox'; | |
| 177 | - $subtabs['days_tooltips'] = array_merge( | |
| 178 | - $subtab_default, | |
| 179 | - array( | |
| 180 | - 'title' => __( 'Tooltips in days', 'booking' ), | |
| 181 | - 'page_title' => __( 'General Settings', 'booking' ), | |
| 182 | - 'hint' => __( 'Configure tooltips to display information like booked times, costs, details, and availability when hovering over calendar days.', 'booking' ), | |
| 183 | - 'font_icon' => 'wpbc-bi-chat-square-dots', | |
| 184 | - 'font_icon_right' => 'wpbc-bi-question-circle', | |
| 185 | - 'css_classes' => 'do_expand__' . $section_id . '_link', | |
| 186 | - 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", | |
| 187 | - 'default' => false, | |
| 188 | - ) | |
| 189 | - ); | |
| 190 | - | |
| 191 | - $section_id = 'wpbc_general_settings_availability_metabox'; | |
| 192 | - $subtabs['availability'] = array_merge( | |
| 193 | - $subtab_default, | |
| 194 | - array( | |
| 195 | - 'title' => __( 'General Availability', 'booking' ), | |
| 196 | - 'page_title' => __( 'General Settings', 'booking' ), | |
| 197 | - 'hint' => __( 'Define unavailable weekdays, add booking buffers, and customize unavailable day options.', 'booking' ), | |
| 198 | - 'font_icon' => 'wpbc-bi-calendar2-day', | |
| 199 | - 'font_icon_right' => 'wpbc-bi-question-circle', | |
| 200 | - 'css_classes' => 'do_expand__' . $section_id . '_link', | |
| 201 | - 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", | |
| 202 | - 'default' => false, | |
| 203 | - ) | |
| 204 | - ); | |
| 205 | - | |
| 206 | - $section_id = 'wpbc_general_settings_capacity_metabox#wpbc_general_settings_capacity_upgrade_metabox'; | |
| 207 | - $subtabs['capacity'] = array_merge( | |
| 208 | - $subtab_default, | |
| 209 | - array( | |
| 210 | - 'title' => __( 'Booking Capacity', 'booking' ), | |
| 211 | - 'page_title' => __( 'General Settings', 'booking' ), | |
| 212 | - 'hint' => __( 'Manage the ability to accept multiple bookings for the same date or time slot.', 'booking' ), | |
| 213 | - 'font_icon' => 'wpbc_icn_filter_none', | |
| 214 | - 'font_icon_right' => 'wpbc-bi-question-circle', | |
| 215 | - 'css_classes' => 'do_expand__' . 'wpbc_general_settings_capacity_metabox' . '_link', | |
| 216 | - 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", | |
| 217 | - 'default' => false, | |
| 218 | - ) | |
| 219 | - ); | |
| 220 | - | |
| 221 | - | |
| 222 | - $tabs['calendar_booking_process']['subtabs'] = $subtabs; | |
| 223 | - | |
| 224 | - | |
| 225 | - // ============================================================================================================= | |
| 226 | 145 | // == C O N F I R M A T I ON == |
| 227 | 146 | // ============================================================================================================= |
| 228 | 147 | $tabs['booking_confirmation'] = array( |
| 229 | - 'is_show_top_path' => false, // true | false. By default value is: false. | |
| 148 | + 'is_show_top_path' => true, // true | false. By default value is: true. | |
| 230 | 149 | 'is_show_top_navigation' => false, // true | false. By default value is: false. |
| 231 | 150 | 'left_navigation__default_view_mode' => '', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''. |
| 232 | 151 | 'page_title' => __( 'General Settings', 'booking' ), // Header - Title. If false, than hidden. |
| 233 | 152 | // translators: 1: Booking Calendar. |
| @@ -244,15 +163,15 @@ | ||
| 244 | 163 | "' );", |
| 245 | 164 | 'folder_style' => 'order:20;', |
| 246 | 165 | ); |
| 247 | 166 | |
| 248 | - $tabs[ 'settings' . ( ++$separator_i ) ] = array_merge( $subtab_default, array( 'type' => 'separator' ,'folder_style' => 'order:20;' ) ); | |
| 167 | + // FixIn: 10.12.4.7. $tabs[ 'settings' . ( ++$separator_i ) ] = array_merge( $subtab_default, array( 'type' => 'separator' ,'folder_style' => 'order:20;' ) ); | |
| 249 | 168 | |
| 250 | 169 | // ============================================================================================================= |
| 251 | 170 | // == Manage Bookings == |
| 252 | 171 | // ============================================================================================================= |
| 253 | 172 | $tabs['manage_bookings'] = array( |
| 254 | - 'is_show_top_path' => false, // true | false. By default value is: false. | |
| 173 | + 'is_show_top_path' => true, // true | false. By default value is: true. | |
| 255 | 174 | 'is_show_top_navigation' => false, // true | false. By default value is: false. |
| 256 | 175 | 'left_navigation__default_view_mode' => '', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''. |
| 257 | 176 | 'page_title' => __( 'General Settings', 'booking' ), // Header - Title. If false, than hidden. |
| 258 | 177 | // translators: 1: Booking Calendar. |
| @@ -269,10 +188,10 @@ | ||
| 269 | 188 | ); |
| 270 | 189 | |
| 271 | 190 | $subtabs = array(); |
| 272 | 191 | |
| 273 | - $section_id = 'wpbc_general_settings_booking_timeline_metabox'; | |
| 274 | - $subtabs['booking_timeline'] = array_merge( | |
| 192 | + $section_id = 'wpbc_general_settings_booking_timeline_metabox'; | |
| 193 | + $booking_timeline_subtab = array_merge( | |
| 275 | 194 | $subtab_default, |
| 276 | 195 | array( |
| 277 | 196 | 'title' => __( 'Timeline (front-end)', 'booking' ), |
| 278 | 197 | 'page_title' => __( 'General Settings', 'booking' ), |
| @@ -326,9 +245,9 @@ | ||
| 326 | 245 | // ============================================================================================================= |
| 327 | 246 | // == Admin Panel == |
| 328 | 247 | // ============================================================================================================= |
| 329 | 248 | $tabs['admin_panel'] = array( |
| 330 | - 'is_show_top_path' => false, // true | false. By default value is: false. | |
| 249 | + 'is_show_top_path' => true, // true | false. By default value is: true. | |
| 331 | 250 | 'is_show_top_navigation' => false, // true | false. By default value is: false. |
| 332 | 251 | 'left_navigation__default_view_mode' => '', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''. |
| 333 | 252 | 'page_title' => __( 'General Settings', 'booking' ), // Header - Title. If false, than hidden. |
| 334 | 253 | 'page_description' => __( 'Configure various options and settings in the admin panel.', 'booking' ), // Header - Title Description. If false, than hidden. |
| @@ -360,9 +279,9 @@ | ||
| 360 | 279 | ) |
| 361 | 280 | ); |
| 362 | 281 | |
| 363 | 282 | $section_id = 'wpbc_general_settings_booking_calendar_overview_metabox'; |
| 364 | - $subtabs['booking_calendar_overview'] = array_merge( | |
| 283 | + $subtabs['booking_calendar_overview'] = array_merge( | |
| 365 | 284 | $subtab_default, |
| 366 | 285 | array( |
| 367 | 286 | 'title' => __( 'Timeline View (Back-End)', 'booking' ), |
| 368 | 287 | 'page_title' => __( 'General Settings', 'booking' ), |
| @@ -372,11 +291,13 @@ | ||
| 372 | 291 | 'css_classes' => 'do_expand__' . $section_id . '_link', |
| 373 | 292 | 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", |
| 374 | 293 | 'default' => false, |
| 375 | 294 | ) |
| 376 | - ); | |
| 377 | - | |
| 378 | - $section_id = 'wpbc_general_settings_datestimes_metabox'; | |
| 295 | + ); | |
| 296 | + | |
| 297 | + $subtabs['booking_timeline'] = $booking_timeline_subtab; | |
| 298 | + | |
| 299 | + $section_id = 'wpbc_general_settings_datestimes_metabox'; | |
| 379 | 300 | $subtabs['datestimes'] = array_merge( |
| 380 | 301 | $subtab_default, |
| 381 | 302 | array( |
| 382 | 303 | 'title' => __( 'Date and Time Formats', 'booking' ), |
| @@ -419,9 +340,11 @@ | ||
| 419 | 340 | 'default' => false, |
| 420 | 341 | ) |
| 421 | 342 | ); |
| 422 | 343 | |
| 423 | - $tabs['admin_panel']['subtabs'] = $subtabs; | |
| 344 | + $tabs['admin_panel']['subtabs'] = $subtabs; | |
| 345 | + $admin_panel_subtabs = $subtabs; | |
| 346 | + unset( $tabs['admin_panel'] ); | |
| 424 | 347 | |
| 425 | 348 | |
| 426 | 349 | // ============================================================================================================= |
| 427 | 350 | // == Advanced == |
| @@ -426,9 +349,9 @@ | ||
| 426 | 349 | // ============================================================================================================= |
| 427 | 350 | // == Advanced == |
| 428 | 351 | // ============================================================================================================= |
| 429 | 352 | $tabs['advanced'] = array( |
| 430 | - 'is_show_top_path' => false, // true | false. By default value is: false. | |
| 353 | + 'is_show_top_path' => true, // true | false. By default value is: true. | |
| 431 | 354 | 'is_show_top_navigation' => false, // true | false. By default value is: false. |
| 432 | 355 | 'left_navigation__default_view_mode' => '', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''. |
| 433 | 356 | 'page_title' => __( 'General Settings', 'booking' ), // Header - Title. If false, than hidden. |
| 434 | 357 | // translators: 1: Booking Calendar. |
| @@ -504,30 +427,13 @@ | ||
| 504 | 427 | 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", |
| 505 | 428 | 'default' => false, |
| 506 | 429 | ) |
| 507 | 430 | ); |
| 508 | - if ( class_exists('wpdev_bk_multiuser') ) { | |
| 509 | - $section_id = 'wpbc_general_settings_multiuser_metabox'; | |
| 510 | - $subtabs['multiuser'] = array_merge( | |
| 511 | - $subtab_default, | |
| 512 | - array( | |
| 513 | - 'title' => __( 'Multiuser Options', 'booking' ), | |
| 514 | - 'page_title' => __( 'General Settings', 'booking' ), | |
| 515 | - 'hint' => __( 'Multiuser Options', 'booking' ), | |
| 516 | - 'font_icon' => 'wpbc_icn_people_alt', | |
| 517 | - 'font_icon_right' => 'wpbc-bi-question-circle', | |
| 518 | - 'css_classes' => 'do_expand__' . $section_id . '_link', | |
| 519 | - 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", | |
| 520 | - 'default' => false, | |
| 521 | - ) | |
| 522 | - ); | |
| 523 | - } | |
| 431 | + $tabs['advanced']['subtabs'] = array_merge( $admin_panel_subtabs, $subtabs ); | |
| 524 | 432 | |
| 525 | - $tabs['advanced']['subtabs'] = $subtabs; | |
| 433 | + // FixIn: 10.12.4.7. $tabs[ 'settings' . ( ++$separator_i ) ] = array_merge( $subtab_default, array( 'type' => 'separator' ,'folder_style' => 'order:900;' ) ); | |
| 434 | + // $tabs[ 'settings' . ( ++$separator_i ) ] = array_merge( $subtab_default, array( 'type' => 'separator' ,'folder_style' => 'order:1000;' ) ); | |
| 526 | 435 | |
| 527 | - $tabs[ 'settings' . ( ++$separator_i ) ] = array_merge( $subtab_default, array( 'type' => 'separator' ,'folder_style' => 'order:900;' ) ); | |
| 528 | - $tabs[ 'settings' . ( ++$separator_i ) ] = array_merge( $subtab_default, array( 'type' => 'separator' ,'folder_style' => 'order:1000;' ) ); | |
| 529 | - | |
| 530 | 436 | return $tabs; |
| 531 | 437 | } |
| 532 | 438 | |
| 533 | 439 | |
| @@ -544,8 +450,29 @@ | ||
| 544 | 450 | if ( ! wpbc_is_mu_user_can_be_here( 'only_super_admin' ) ) { |
| 545 | 451 | return false; |
| 546 | 452 | } // User is not Super admin, so exit. Basically its was already checked at the bottom of the PHP file, just in case. |
| 547 | 453 | |
| 454 | + // Redirect legacy Settings > Calendar links to the dedicated Calendar settings page. | |
| 455 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing | |
| 456 | + if ( ! empty( $_GET['scroll_to_section'] ) ) { | |
| 457 | + $scroll_to_section = sanitize_text_field( wp_unslash( $_GET['scroll_to_section'] ) ); | |
| 458 | + | |
| 459 | + if ( 'wpbc_general_settings_calendar_tab' === $scroll_to_section ) { | |
| 460 | + wpbc_redirect( function_exists( 'wpbc_settings_calendar__get_section_url' ) ? wpbc_settings_calendar__get_section_url( 'general' ) : admin_url( 'admin.php?page=wpbc-settings&tab=calendar_settings' ) ); | |
| 461 | + return; | |
| 462 | + } | |
| 463 | + | |
| 464 | + if ( 'wpbc_general_settings_days_tooltips_tab' === $scroll_to_section ) { | |
| 465 | + wpbc_redirect( function_exists( 'wpbc_settings_calendar__get_section_url' ) ? wpbc_settings_calendar__get_section_url( 'tooltips' ) : admin_url( 'admin.php?page=wpbc-settings&tab=calendar_settings&wpbc_calendar_section=tooltips' ) ); | |
| 466 | + return; | |
| 467 | + } | |
| 468 | + | |
| 469 | + if ( 'wpbc_general_settings_availability_tab' === $scroll_to_section ) { | |
| 470 | + wpbc_redirect( function_exists( 'wpbc_get_general_availability_url' ) ? wpbc_get_general_availability_url() : admin_url( 'admin.php?page=wpbc-availability&tab=general_availability' ) ); | |
| 471 | + return; | |
| 472 | + } | |
| 473 | + } | |
| 474 | + | |
| 548 | 475 | $is_can = apply_bk_filter( 'recheck_version', true ); |
| 549 | 476 | if ( ! $is_can ) { |
| 550 | 477 | ?> |
| 551 | 478 | <script type="text/javascript"> jQuery(document).ready(function () { |
| @@ -612,65 +539,23 @@ | ||
| 612 | 539 | <div class="wpbc_settings_flex_container_left" style="display:none;"> |
| 613 | 540 | |
| 614 | 541 | <div class="wpbc_settings_navigation_column"> |
| 615 | 542 | |
| 616 | - <div id="wpbc_general_settings_dashboard_tab" class="wpbc_settings_navigation_item wpbc_settings_navigation_item_active"> | |
| 617 | - <?php | |
| 618 | - $title = esc_attr__( 'Dashboard', 'booking' ); | |
| 619 | - ?> | |
| 620 | - <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_dashboard_tab a' ,'#wpbc_general_settings_dashboard_metabox', '<?php echo esc_js( $title ); ?>' );" | |
| 621 | - href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> | |
| 622 | - </div> | |
| 623 | - <div id="wpbc_general_settings_calendar_tab" class="wpbc_settings_navigation_item wpbc_navigation_top_border"> | |
| 624 | - <?php | |
| 625 | - $title = esc_attr__( 'Calendar', 'booking' ); | |
| 626 | - ?> | |
| 627 | - <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_calendar_tab a' ,'#wpbc_general_settings_calendar_metabox', '<?php echo esc_js( $title ); ?>' );" href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> | |
| 628 | - </div> | |
| 629 | - <div id="wpbc_general_settings_days_tooltips_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> | |
| 630 | - <?php | |
| 631 | - $title = esc_attr__( 'Tooltips in days', 'booking' ); | |
| 632 | - ?> | |
| 633 | - <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_days_tooltips_tab a' ,'#wpbc_general_settings_days_tooltips_metabox', '<?php echo esc_js( $title ); ?>' );" href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> | |
| 634 | - </div> | |
| 635 | - <div id="wpbc_general_settings_availability_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> | |
| 636 | - <?php | |
| 637 | - $title = esc_attr__( 'Availability', 'booking' ); | |
| 638 | - ?> | |
| 639 | - <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_availability_tab a' ,'#wpbc_general_settings_availability_metabox', '<?php echo esc_js( $title ); ?>' );" href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> | |
| 640 | - </div> | |
| 641 | - <div id="wpbc_general_settings_capacity_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> | |
| 642 | - <?php | |
| 643 | - $title = esc_attr__( 'Capacity', 'booking' ); | |
| 644 | - ?> | |
| 645 | - <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_capacity_tab a' ,'#wpbc_general_settings_capacity_metabox,#wpbc_general_settings_capacity_upgrade_metabox', '<?php echo esc_js( $title ); ?>' );" href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> | |
| 646 | - </div> | |
| 647 | - <div id="wpbc_general_settings_form_tab" class="wpbc_settings_navigation_item"> | |
| 648 | - <?php | |
| 649 | - $title = esc_attr__( 'Form Options', 'booking' ); | |
| 650 | - ?> | |
| 651 | - <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_form_tab a' ,'#wpbc_general_settings_form_metabox', '<?php echo esc_js( $title ); ?>' );" href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> | |
| 652 | - </div> | |
| 653 | - <div id="wpbc_general_settings_time_slots_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> | |
| 654 | - <?php | |
| 655 | - $title = esc_attr__( 'Time Slots', 'booking' ); | |
| 656 | - ?> | |
| 657 | - <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_time_slots_tab a' ,'#wpbc_general_settings_time_slots_metabox', '<?php echo esc_js( $title ); ?>' );" href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> | |
| 658 | - </div> | |
| 659 | - <div id="wpbc_general_settings_booking_confirmation_tab" class="wpbc_settings_navigation_item"> | |
| 660 | - <?php | |
| 661 | - $title = esc_attr__( 'Booking Confirmation', 'booking' ); | |
| 662 | - ?> | |
| 543 | + <div id="wpbc_general_settings_dashboard_tab" class="wpbc_settings_navigation_item wpbc_settings_navigation_item_active"> | |
| 544 | + <?php | |
| 545 | + $title = esc_attr__( 'Dashboard', 'booking' ); | |
| 546 | + ?> | |
| 547 | + <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_dashboard_tab a' ,'#wpbc_general_settings_dashboard_metabox', '<?php echo esc_js( $title ); ?>' );" | |
| 548 | + href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> | |
| 549 | + </div> | |
| 550 | + <div id="wpbc_general_settings_booking_confirmation_tab" class="wpbc_settings_navigation_item"> | |
| 551 | + <?php | |
| 552 | + $title = esc_attr__( 'Booking Confirmation', 'booking' ); | |
| 553 | + ?> | |
| 663 | 554 | <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_booking_confirmation_tab a' ,'#wpbc_general_settings_booking_confirmation_metabox,#wpbc_general_settings_booking_confirmation_left_metabox,#wpbc_general_settings_booking_confirmation_right_metabox,#wpbc_general_settings_booking_confirmation_help_metabox', '<?php echo esc_js( $title ); ?>' );" href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> |
| 664 | 555 | </div> |
| 665 | 556 | |
| 666 | - <div id="wpbc_general_settings_booking_timeline_tab" class="wpbc_settings_navigation_item wpbc_navigation_top_border"> | |
| 667 | - <?php | |
| 668 | - $title = esc_attr__( 'Timeline (front-end)', 'booking' ); | |
| 669 | - ?> | |
| 670 | - <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_booking_timeline_tab a' ,'#wpbc_general_settings_booking_timeline_metabox', '<?php echo esc_js( $title ); ?>' );" href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> | |
| 671 | - </div> | |
| 672 | - <?php if ( class_exists('wpdev_bk_personal') ) { ?> | |
| 557 | + <?php if ( class_exists('wpdev_bk_personal') ) { ?> | |
| 673 | 558 | <div id="wpbc_general_settings_bookings_options_tab" class="wpbc_settings_navigation_item wpbc_navigation_top_border"> |
| 674 | 559 | <?php |
| 675 | 560 | $title = esc_attr__( 'Manage Bookings', 'booking' ); |
| 676 | 561 | ?> |
| @@ -687,17 +572,8 @@ | ||
| 687 | 572 | </div> |
| 688 | 573 | <?php } ?> |
| 689 | 574 | |
| 690 | 575 | |
| 691 | - <?php if ( class_exists('wpdev_bk_multiuser') ) { ?> | |
| 692 | - <div id="wpbc_general_settings_multiuser_tab" class="wpbc_settings_navigation_item"> | |
| 693 | - <?php | |
| 694 | - $title = esc_attr__( 'Multiuser options', 'booking' ); | |
| 695 | - ?> | |
| 696 | - <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_multiuser_tab a' ,'#wpbc_general_settings_multiuser_metabox', '<?php echo esc_js( $title ); ?>' );" href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> | |
| 697 | - </div> | |
| 698 | - <?php } ?> | |
| 699 | - | |
| 700 | 576 | <div id="wpbc_general_settings_booking_listing_tab" class="wpbc_settings_navigation_item wpbc_navigation_top_border"> |
| 701 | 577 | <?php |
| 702 | 578 | $title = esc_attr__( 'Admin Panel', 'booking' ); |
| 703 | 579 | ?> |
| @@ -706,11 +582,17 @@ | ||
| 706 | 582 | <div id="wpbc_general_settings_booking_calendar_overview_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> |
| 707 | 583 | <?php |
| 708 | 584 | $title = esc_attr__( 'Timeline View', 'booking' ); |
| 709 | 585 | ?> |
| 710 | - <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_booking_calendar_overview_tab a' ,'#wpbc_general_settings_booking_calendar_overview_metabox', '<?php echo esc_js( $title ); ?>' );" href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> | |
| 711 | - </div> | |
| 712 | - <div id="wpbc_general_settings_datestimes_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> | |
| 586 | + <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_booking_calendar_overview_tab a' ,'#wpbc_general_settings_booking_calendar_overview_metabox', '<?php echo esc_js( $title ); ?>' );" href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> | |
| 587 | + </div> | |
| 588 | + <div id="wpbc_general_settings_booking_timeline_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> | |
| 589 | + <?php | |
| 590 | + $title = esc_attr__( 'Timeline (front-end)', 'booking' ); | |
| 591 | + ?> | |
| 592 | + <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_booking_timeline_tab a' ,'#wpbc_general_settings_booking_timeline_metabox', '<?php echo esc_js( $title ); ?>' );" href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> | |
| 593 | + </div> | |
| 594 | + <div id="wpbc_general_settings_datestimes_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> | |
| 713 | 595 | <?php |
| 714 | 596 | $title = esc_attr__( 'Date / Time Formats', 'booking' ); |
| 715 | 597 | ?> |
| 716 | 598 | <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_datestimes_tab a' ,'#wpbc_general_settings_datestimes_metabox', '<?php echo esc_js( $title ); ?>' );" href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> |
| @@ -757,9 +639,9 @@ | ||
| 757 | 639 | <div id="wpbc_general_settings_all_tab" class="wpbc_settings_navigation_item wpbc_navigation_top_border"> |
| 758 | 640 | <?php |
| 759 | 641 | $title = esc_attr__( 'Show All Settings', 'booking' ); |
| 760 | 642 | ?> |
| 761 | - <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_all_tab a' ,'.postbox', '<?php echo esc_js( $title ); ?>' );" | |
| 643 | + <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_all_tab a' ,'.postbox', '<?php echo esc_js( $title ); ?>' );" | |
| 762 | 644 | href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> |
| 763 | 645 | </div> |
| 764 | 646 | |
| 765 | 647 | </div> |
| @@ -794,30 +676,8 @@ | ||
| 794 | 676 | wpbc_ui_settings__panel__plugin_version(); |
| 795 | 677 | |
| 796 | 678 | ?></div><?php //wpbc_close_meta_box_section(); ?> |
| 797 | 679 | |
| 798 | - | |
| 799 | - <?php wpbc_open_meta_box_section( 'wpbc_general_settings_calendar', __('Calendar', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> | |
| 800 | - | |
| 801 | - <?php $this->settings_api()->show( 'calendar' ); ?> | |
| 802 | - | |
| 803 | - <?php wpbc_close_meta_box_section(); ?> | |
| 804 | - | |
| 805 | - | |
| 806 | - <?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 ) ); ?> | |
| 807 | - | |
| 808 | - <?php $this->settings_api()->show( 'days_tooltips' ); ?> | |
| 809 | - | |
| 810 | - <?php wpbc_close_meta_box_section(); ?> | |
| 811 | - | |
| 812 | - | |
| 813 | - <?php wpbc_open_meta_box_section( 'wpbc_general_settings_availability', __('Availability', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> | |
| 814 | - | |
| 815 | - <?php $this->settings_api()->show( 'availability' ); ?> | |
| 816 | - | |
| 817 | - <?php wpbc_close_meta_box_section(); ?> | |
| 818 | - | |
| 819 | - | |
| 820 | 680 | <?php |
| 821 | 681 | wpbc_open_meta_box_section( 'wpbc_general_settings_booking_confirmation', |
| 822 | 682 | __( 'Booking Confirmation', 'booking' ), |
| 823 | 683 | array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); |
| @@ -894,51 +754,8 @@ | ||
| 894 | 754 | <?php wpbc_close_meta_box_section(); ?> |
| 895 | 755 | |
| 896 | 756 | <?php } ?> |
| 897 | 757 | |
| 898 | - | |
| 899 | - | |
| 900 | - <?php wpbc_open_meta_box_section( 'wpbc_general_settings_capacity', __('Capacity', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> | |
| 901 | - | |
| 902 | - <?php $this->settings_api()->show( 'capacity' ); ?> | |
| 903 | - | |
| 904 | - <?php wpbc_close_meta_box_section(); ?> | |
| 905 | - | |
| 906 | - | |
| 907 | - <?php | |
| 908 | - if ( ! class_exists( 'wpdev_bk_personal' ) ) { | |
| 909 | - | |
| 910 | - $wpbc_metabox_id = 'wpbc_general_settings_capacity_upgrade'; | |
| 911 | - | |
| 912 | - ob_start(); | |
| 913 | - $is_panel_visible = wpbc_is_dismissed( $wpbc_metabox_id . '_metabox', array( | |
| 914 | - 'title' => '<i class="menu_icon icon-1x wpbc_icn_close"></i> ', | |
| 915 | - 'hint' => __( 'Dismiss', 'booking' ), | |
| 916 | - 'class' => 'wpbc_panel_get_started_dismiss', | |
| 917 | - 'css' => 'background: #fff;border-radius: 7px;' | |
| 918 | - )); | |
| 919 | - ?> | |
| 920 | - <script type="text/javascript"> jQuery('#<?php echo esc_js( $wpbc_metabox_id ); ?>_metabox').hide(); </script> | |
| 921 | - <?php | |
| 922 | - $dismiss_button_content = ob_get_clean(); | |
| 923 | - | |
| 924 | - if ( $is_panel_visible ) { | |
| 925 | - | |
| 926 | - wpbc_open_meta_box_section( $wpbc_metabox_id, | |
| 927 | - __('Booking Quantity Control - Set limits for the number of bookings per day or time slot.', 'booking'), | |
| 928 | - array( 'is_section_visible_after_load' => false, | |
| 929 | - 'is_show_minimize' => false, | |
| 930 | - 'dismiss_button' => $dismiss_button_content | |
| 931 | - ) ); | |
| 932 | - | |
| 933 | - $this->settings_api()->show( 'capacity_upgrade' ); | |
| 934 | - | |
| 935 | - wpbc_close_meta_box_section(); | |
| 936 | - } | |
| 937 | - } | |
| 938 | - ?> | |
| 939 | - | |
| 940 | - | |
| 941 | 758 | <?php wpbc_open_meta_box_section( 'wpbc_general_settings_advanced', __('Advanced', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 942 | 759 | |
| 943 | 760 | <?php $this->settings_api()->show( 'advanced' ); ?> |
| 944 | 761 | |
| @@ -976,11 +793,15 @@ | ||
| 976 | 793 | |
| 977 | 794 | <?php if ( ( class_exists( 'wpdev_bk_personal' ) ) && ( ! wpbc_is_this_demo() ) ) { ?> |
| 978 | 795 | <?php wpbc_open_meta_box_section( 'wpbc_general_settings_help', __( 'Tools', 'booking' ), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 979 | 796 | |
| 980 | - <?php $this->settings_api()->show( 'help' ); ?> | |
| 981 | - | |
| 982 | - <?php wpbc_close_meta_box_section(); ?> | |
| 797 | + <?php $this->settings_api()->show( 'help' ); ?> | |
| 798 | + | |
| 799 | + <?php if ( function_exists( 'wpbc_customer_access_render_rate_limit_reset_tool' ) ) { ?> | |
| 800 | + <?php wpbc_customer_access_render_rate_limit_reset_tool(); ?> | |
| 801 | + <?php } ?> | |
| 802 | + | |
| 803 | + <?php wpbc_close_meta_box_section(); ?> | |
| 983 | 804 | <?php } ?> |
| 984 | 805 | |
| 985 | 806 | <?php wpbc_open_meta_box_section( 'wpbc_general_settings_translations', __( 'Translations', 'booking' ), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 986 | 807 | |
| @@ -989,18 +810,8 @@ | ||
| 989 | 810 | <?php wpbc_translation_buttons_settings_section(); ?> |
| 990 | 811 | |
| 991 | 812 | <?php wpbc_close_meta_box_section(); ?> |
| 992 | 813 | |
| 993 | - <?php if ( class_exists( 'wpdev_bk_multiuser' ) ) { // FixIn: 9.2.3.8. ?> | |
| 994 | - | |
| 995 | - <?php wpbc_open_meta_box_section( 'wpbc_general_settings_multiuser', __( 'Multiuser options', 'booking' ), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> | |
| 996 | - | |
| 997 | - <?php $this->settings_api()->show( 'multiuser' ); ?> | |
| 998 | - | |
| 999 | - <?php wpbc_close_meta_box_section(); ?> | |
| 1000 | - | |
| 1001 | - <?php } ?> | |
| 1002 | - | |
| 1003 | 814 | </div> |
| 1004 | 815 | <div class="clear"></div> |
| 1005 | 816 | <div class="container_for_save_buttons"> |
| 1006 | 817 | <input type="submit" value="<?php esc_attr_e( 'Save Changes', 'booking' ); ?>" class="button button-primary wpbc_submit_button"/> |
| @@ -1058,8 +869,14 @@ | ||
| 1058 | 869 | $validated_fields = $this->settings_api()->validate_post(); // Get Validated Settings fields in $_POST request. |
| 1059 | 870 | |
| 1060 | 871 | $validated_fields = apply_filters( 'wpbc_settings_validate_fields_before_saving', $validated_fields ); // Hook for validated fields. |
| 1061 | 872 | |
| 873 | + foreach ( $this->settings_api()->get_form_fields() as $field_name => $field ) { | |
| 874 | + if ( ! empty( $field['group'] ) && in_array( $field['group'], array( 'calendar', 'days_tooltips', 'availability' ), true ) ) { | |
| 875 | + unset( $validated_fields[ $field_name ] ); | |
| 876 | + } | |
| 877 | + } | |
| 878 | + | |
| 1062 | 879 | /** |
| 1063 | 880 | * Skip saving specific option, for example in Demo mode. |
| 1064 | 881 | * // unset( $validated_fields['booking_start_day_weeek'] ); |
| 1065 | 882 | */ |
| @@ -1106,5 +923,5 @@ | ||
| 1106 | 923 | } |
| 1107 | 924 | */ |
| 1108 | 925 | |
| 1109 | 926 | add_action('wpbc_menu_created', array( new WPBC_Page_SettingsGeneral() , '__construct') ); // Executed after creation of Menu |
| 1110 | - | |
| 927 | + | |