| @@ -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. |
| @@ -154,10 +188,10 @@ | ||
| 154 | 188 | ); |
| 155 | 189 | |
| 156 | 190 | $subtabs = array(); |
| 157 | 191 | |
| 158 | - $section_id = 'wpbc_general_settings_booking_timeline_metabox'; | |
| 159 | - $subtabs['booking_timeline'] = array_merge( | |
| 192 | + $section_id = 'wpbc_general_settings_booking_timeline_metabox'; | |
| 193 | + $booking_timeline_subtab = array_merge( | |
| 160 | 194 | $subtab_default, |
| 161 | 195 | array( |
| 162 | 196 | 'title' => __( 'Timeline (front-end)', 'booking' ), |
| 163 | 197 | 'page_title' => __( 'General Settings', 'booking' ), |
| @@ -245,9 +279,9 @@ | ||
| 245 | 279 | ) |
| 246 | 280 | ); |
| 247 | 281 | |
| 248 | 282 | $section_id = 'wpbc_general_settings_booking_calendar_overview_metabox'; |
| 249 | - $subtabs['booking_calendar_overview'] = array_merge( | |
| 283 | + $subtabs['booking_calendar_overview'] = array_merge( | |
| 250 | 284 | $subtab_default, |
| 251 | 285 | array( |
| 252 | 286 | 'title' => __( 'Timeline View (Back-End)', 'booking' ), |
| 253 | 287 | 'page_title' => __( 'General Settings', 'booking' ), |
| @@ -257,11 +291,13 @@ | ||
| 257 | 291 | 'css_classes' => 'do_expand__' . $section_id . '_link', |
| 258 | 292 | 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", |
| 259 | 293 | 'default' => false, |
| 260 | 294 | ) |
| 261 | - ); | |
| 262 | - | |
| 263 | - $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'; | |
| 264 | 300 | $subtabs['datestimes'] = array_merge( |
| 265 | 301 | $subtab_default, |
| 266 | 302 | array( |
| 267 | 303 | 'title' => __( 'Date and Time Formats', 'booking' ), |
| @@ -304,9 +340,11 @@ | ||
| 304 | 340 | 'default' => false, |
| 305 | 341 | ) |
| 306 | 342 | ); |
| 307 | 343 | |
| 308 | - $tabs['admin_panel']['subtabs'] = $subtabs; | |
| 344 | + $tabs['admin_panel']['subtabs'] = $subtabs; | |
| 345 | + $admin_panel_subtabs = $subtabs; | |
| 346 | + unset( $tabs['admin_panel'] ); | |
| 309 | 347 | |
| 310 | 348 | |
| 311 | 349 | // ============================================================================================================= |
| 312 | 350 | // == Advanced == |
| @@ -389,27 +427,10 @@ | ||
| 389 | 427 | 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", |
| 390 | 428 | 'default' => false, |
| 391 | 429 | ) |
| 392 | 430 | ); |
| 393 | - if ( class_exists('wpdev_bk_multiuser') ) { | |
| 394 | - $section_id = 'wpbc_general_settings_multiuser_metabox'; | |
| 395 | - $subtabs['multiuser'] = array_merge( | |
| 396 | - $subtab_default, | |
| 397 | - array( | |
| 398 | - 'title' => __( 'Multiuser Options', 'booking' ), | |
| 399 | - 'page_title' => __( 'General Settings', 'booking' ), | |
| 400 | - 'hint' => __( 'Multiuser Options', 'booking' ), | |
| 401 | - 'font_icon' => 'wpbc_icn_people_alt', | |
| 402 | - 'font_icon_right' => 'wpbc-bi-question-circle', | |
| 403 | - 'css_classes' => 'do_expand__' . $section_id . '_link', | |
| 404 | - 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", | |
| 405 | - 'default' => false, | |
| 406 | - ) | |
| 407 | - ); | |
| 408 | - } | |
| 431 | + $tabs['advanced']['subtabs'] = array_merge( $admin_panel_subtabs, $subtabs ); | |
| 409 | 432 | |
| 410 | - $tabs['advanced']['subtabs'] = $subtabs; | |
| 411 | - | |
| 412 | 433 | // FixIn: 10.12.4.7. $tabs[ 'settings' . ( ++$separator_i ) ] = array_merge( $subtab_default, array( 'type' => 'separator' ,'folder_style' => 'order:900;' ) ); |
| 413 | 434 | // $tabs[ 'settings' . ( ++$separator_i ) ] = array_merge( $subtab_default, array( 'type' => 'separator' ,'folder_style' => 'order:1000;' ) ); |
| 414 | 435 | |
| 415 | 436 | return $tabs; |
| @@ -532,15 +553,9 @@ | ||
| 532 | 553 | ?> |
| 533 | 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> |
| 534 | 555 | </div> |
| 535 | 556 | |
| 536 | - <div id="wpbc_general_settings_booking_timeline_tab" class="wpbc_settings_navigation_item wpbc_navigation_top_border"> | |
| 537 | - <?php | |
| 538 | - $title = esc_attr__( 'Timeline (front-end)', 'booking' ); | |
| 539 | - ?> | |
| 540 | - <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> | |
| 541 | - </div> | |
| 542 | - <?php if ( class_exists('wpdev_bk_personal') ) { ?> | |
| 557 | + <?php if ( class_exists('wpdev_bk_personal') ) { ?> | |
| 543 | 558 | <div id="wpbc_general_settings_bookings_options_tab" class="wpbc_settings_navigation_item wpbc_navigation_top_border"> |
| 544 | 559 | <?php |
| 545 | 560 | $title = esc_attr__( 'Manage Bookings', 'booking' ); |
| 546 | 561 | ?> |
| @@ -557,17 +572,8 @@ | ||
| 557 | 572 | </div> |
| 558 | 573 | <?php } ?> |
| 559 | 574 | |
| 560 | 575 | |
| 561 | - <?php if ( class_exists('wpdev_bk_multiuser') ) { ?> | |
| 562 | - <div id="wpbc_general_settings_multiuser_tab" class="wpbc_settings_navigation_item"> | |
| 563 | - <?php | |
| 564 | - $title = esc_attr__( 'Multiuser options', 'booking' ); | |
| 565 | - ?> | |
| 566 | - <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> | |
| 567 | - </div> | |
| 568 | - <?php } ?> | |
| 569 | - | |
| 570 | 576 | <div id="wpbc_general_settings_booking_listing_tab" class="wpbc_settings_navigation_item wpbc_navigation_top_border"> |
| 571 | 577 | <?php |
| 572 | 578 | $title = esc_attr__( 'Admin Panel', 'booking' ); |
| 573 | 579 | ?> |
| @@ -576,11 +582,17 @@ | ||
| 576 | 582 | <div id="wpbc_general_settings_booking_calendar_overview_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> |
| 577 | 583 | <?php |
| 578 | 584 | $title = esc_attr__( 'Timeline View', 'booking' ); |
| 579 | 585 | ?> |
| 580 | - <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> | |
| 581 | - </div> | |
| 582 | - <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"> | |
| 583 | 595 | <?php |
| 584 | 596 | $title = esc_attr__( 'Date / Time Formats', 'booking' ); |
| 585 | 597 | ?> |
| 586 | 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> |
| @@ -781,11 +793,15 @@ | ||
| 781 | 793 | |
| 782 | 794 | <?php if ( ( class_exists( 'wpdev_bk_personal' ) ) && ( ! wpbc_is_this_demo() ) ) { ?> |
| 783 | 795 | <?php wpbc_open_meta_box_section( 'wpbc_general_settings_help', __( 'Tools', 'booking' ), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 784 | 796 | |
| 785 | - <?php $this->settings_api()->show( 'help' ); ?> | |
| 786 | - | |
| 787 | - <?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(); ?> | |
| 788 | 804 | <?php } ?> |
| 789 | 805 | |
| 790 | 806 | <?php wpbc_open_meta_box_section( 'wpbc_general_settings_translations', __( 'Translations', 'booking' ), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 791 | 807 | |
| @@ -793,18 +809,8 @@ | ||
| 793 | 809 | |
| 794 | 810 | <?php wpbc_translation_buttons_settings_section(); ?> |
| 795 | 811 | |
| 796 | 812 | <?php wpbc_close_meta_box_section(); ?> |
| 797 | - | |
| 798 | - <?php if ( class_exists( 'wpdev_bk_multiuser' ) ) { // FixIn: 9.2.3.8. ?> | |
| 799 | - | |
| 800 | - <?php wpbc_open_meta_box_section( 'wpbc_general_settings_multiuser', __( 'Multiuser options', 'booking' ), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> | |
| 801 | - | |
| 802 | - <?php $this->settings_api()->show( 'multiuser' ); ?> | |
| 803 | - | |
| 804 | - <?php wpbc_close_meta_box_section(); ?> | |
| 805 | - | |
| 806 | - <?php } ?> | |
| 807 | 813 | |
| 808 | 814 | </div> |
| 809 | 815 | <div class="clear"></div> |
| 810 | 816 | <div class="container_for_save_buttons"> |