| @@ -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 == |
| @@ -108,127 +141,12 @@ | ||
| 108 | 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:11;', | |
| 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 | - 'link' => function_exists( 'wpbc_get_general_availability_url' ) ? wpbc_get_general_availability_url() : admin_url( 'admin.php?page=wpbc-availability&tab=general_availability' ), | |
| 202 | - 'onclick' => '', | |
| 203 | - 'default' => false, | |
| 204 | - ) | |
| 205 | - ); | |
| 206 | - | |
| 207 | - $section_id = 'wpbc_general_settings_capacity_metabox#wpbc_general_settings_capacity_upgrade_metabox'; | |
| 208 | - $subtabs['capacity'] = array_merge( | |
| 209 | - $subtab_default, | |
| 210 | - array( | |
| 211 | - 'title' => __( 'Booking Capacity', 'booking' ), | |
| 212 | - 'page_title' => __( 'General Settings', 'booking' ), | |
| 213 | - 'hint' => __( 'Manage the ability to accept multiple bookings for the same date or time slot.', 'booking' ), | |
| 214 | - 'font_icon' => 'wpbc_icn_filter_none', | |
| 215 | - 'font_icon_right' => 'wpbc-bi-question-circle', | |
| 216 | - 'css_classes' => 'do_expand__' . 'wpbc_general_settings_capacity_metabox' . '_link', | |
| 217 | - 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", | |
| 218 | - 'default' => false, | |
| 219 | - ) | |
| 220 | - ); | |
| 221 | - | |
| 222 | - | |
| 223 | - $tabs['calendar_booking_process']['subtabs'] = $subtabs; | |
| 224 | - | |
| 225 | - | |
| 226 | - // ============================================================================================================= | |
| 227 | 145 | // == C O N F I R M A T I ON == |
| 228 | 146 | // ============================================================================================================= |
| 229 | 147 | $tabs['booking_confirmation'] = array( |
| 230 | - '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. | |
| 231 | 149 | 'is_show_top_navigation' => false, // true | false. By default value is: false. |
| 232 | 150 | 'left_navigation__default_view_mode' => '', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''. |
| 233 | 151 | 'page_title' => __( 'General Settings', 'booking' ), // Header - Title. If false, than hidden. |
| 234 | 152 | // translators: 1: Booking Calendar. |
| @@ -251,9 +169,9 @@ | ||
| 251 | 169 | // ============================================================================================================= |
| 252 | 170 | // == Manage Bookings == |
| 253 | 171 | // ============================================================================================================= |
| 254 | 172 | $tabs['manage_bookings'] = array( |
| 255 | - '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. | |
| 256 | 174 | 'is_show_top_navigation' => false, // true | false. By default value is: false. |
| 257 | 175 | 'left_navigation__default_view_mode' => '', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''. |
| 258 | 176 | 'page_title' => __( 'General Settings', 'booking' ), // Header - Title. If false, than hidden. |
| 259 | 177 | // translators: 1: Booking Calendar. |
| @@ -270,10 +188,10 @@ | ||
| 270 | 188 | ); |
| 271 | 189 | |
| 272 | 190 | $subtabs = array(); |
| 273 | 191 | |
| 274 | - $section_id = 'wpbc_general_settings_booking_timeline_metabox'; | |
| 275 | - $subtabs['booking_timeline'] = array_merge( | |
| 192 | + $section_id = 'wpbc_general_settings_booking_timeline_metabox'; | |
| 193 | + $booking_timeline_subtab = array_merge( | |
| 276 | 194 | $subtab_default, |
| 277 | 195 | array( |
| 278 | 196 | 'title' => __( 'Timeline (front-end)', 'booking' ), |
| 279 | 197 | 'page_title' => __( 'General Settings', 'booking' ), |
| @@ -327,9 +245,9 @@ | ||
| 327 | 245 | // ============================================================================================================= |
| 328 | 246 | // == Admin Panel == |
| 329 | 247 | // ============================================================================================================= |
| 330 | 248 | $tabs['admin_panel'] = array( |
| 331 | - '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. | |
| 332 | 250 | 'is_show_top_navigation' => false, // true | false. By default value is: false. |
| 333 | 251 | 'left_navigation__default_view_mode' => '', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''. |
| 334 | 252 | 'page_title' => __( 'General Settings', 'booking' ), // Header - Title. If false, than hidden. |
| 335 | 253 | 'page_description' => __( 'Configure various options and settings in the admin panel.', 'booking' ), // Header - Title Description. If false, than hidden. |
| @@ -361,9 +279,9 @@ | ||
| 361 | 279 | ) |
| 362 | 280 | ); |
| 363 | 281 | |
| 364 | 282 | $section_id = 'wpbc_general_settings_booking_calendar_overview_metabox'; |
| 365 | - $subtabs['booking_calendar_overview'] = array_merge( | |
| 283 | + $subtabs['booking_calendar_overview'] = array_merge( | |
| 366 | 284 | $subtab_default, |
| 367 | 285 | array( |
| 368 | 286 | 'title' => __( 'Timeline View (Back-End)', 'booking' ), |
| 369 | 287 | 'page_title' => __( 'General Settings', 'booking' ), |
| @@ -373,11 +291,13 @@ | ||
| 373 | 291 | 'css_classes' => 'do_expand__' . $section_id . '_link', |
| 374 | 292 | 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", |
| 375 | 293 | 'default' => false, |
| 376 | 294 | ) |
| 377 | - ); | |
| 378 | - | |
| 379 | - $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'; | |
| 380 | 300 | $subtabs['datestimes'] = array_merge( |
| 381 | 301 | $subtab_default, |
| 382 | 302 | array( |
| 383 | 303 | 'title' => __( 'Date and Time Formats', 'booking' ), |
| @@ -420,9 +340,11 @@ | ||
| 420 | 340 | 'default' => false, |
| 421 | 341 | ) |
| 422 | 342 | ); |
| 423 | 343 | |
| 424 | - $tabs['admin_panel']['subtabs'] = $subtabs; | |
| 344 | + $tabs['admin_panel']['subtabs'] = $subtabs; | |
| 345 | + $admin_panel_subtabs = $subtabs; | |
| 346 | + unset( $tabs['admin_panel'] ); | |
| 425 | 347 | |
| 426 | 348 | |
| 427 | 349 | // ============================================================================================================= |
| 428 | 350 | // == Advanced == |
| @@ -427,9 +349,9 @@ | ||
| 427 | 349 | // ============================================================================================================= |
| 428 | 350 | // == Advanced == |
| 429 | 351 | // ============================================================================================================= |
| 430 | 352 | $tabs['advanced'] = array( |
| 431 | - '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. | |
| 432 | 354 | 'is_show_top_navigation' => false, // true | false. By default value is: false. |
| 433 | 355 | 'left_navigation__default_view_mode' => '', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''. |
| 434 | 356 | 'page_title' => __( 'General Settings', 'booking' ), // Header - Title. If false, than hidden. |
| 435 | 357 | // translators: 1: Booking Calendar. |
| @@ -505,27 +427,10 @@ | ||
| 505 | 427 | 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", |
| 506 | 428 | 'default' => false, |
| 507 | 429 | ) |
| 508 | 430 | ); |
| 509 | - if ( class_exists('wpdev_bk_multiuser') ) { | |
| 510 | - $section_id = 'wpbc_general_settings_multiuser_metabox'; | |
| 511 | - $subtabs['multiuser'] = array_merge( | |
| 512 | - $subtab_default, | |
| 513 | - array( | |
| 514 | - 'title' => __( 'Multiuser Options', 'booking' ), | |
| 515 | - 'page_title' => __( 'General Settings', 'booking' ), | |
| 516 | - 'hint' => __( 'Multiuser Options', 'booking' ), | |
| 517 | - 'font_icon' => 'wpbc_icn_people_alt', | |
| 518 | - 'font_icon_right' => 'wpbc-bi-question-circle', | |
| 519 | - 'css_classes' => 'do_expand__' . $section_id . '_link', | |
| 520 | - 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", | |
| 521 | - 'default' => false, | |
| 522 | - ) | |
| 523 | - ); | |
| 524 | - } | |
| 431 | + $tabs['advanced']['subtabs'] = array_merge( $admin_panel_subtabs, $subtabs ); | |
| 525 | 432 | |
| 526 | - $tabs['advanced']['subtabs'] = $subtabs; | |
| 527 | - | |
| 528 | 433 | // FixIn: 10.12.4.7. $tabs[ 'settings' . ( ++$separator_i ) ] = array_merge( $subtab_default, array( 'type' => 'separator' ,'folder_style' => 'order:900;' ) ); |
| 529 | 434 | // $tabs[ 'settings' . ( ++$separator_i ) ] = array_merge( $subtab_default, array( 'type' => 'separator' ,'folder_style' => 'order:1000;' ) ); |
| 530 | 435 | |
| 531 | 436 | return $tabs; |
| @@ -545,13 +450,27 @@ | ||
| 545 | 450 | if ( ! wpbc_is_mu_user_can_be_here( 'only_super_admin' ) ) { |
| 546 | 451 | return false; |
| 547 | 452 | } // User is not Super admin, so exit. Basically its was already checked at the bottom of the PHP file, just in case. |
| 548 | 453 | |
| 549 | - // Redirect legacy Settings > Availability links to the dedicated General Availability page. | |
| 454 | + // Redirect legacy Settings > Calendar links to the dedicated Calendar settings page. | |
| 550 | 455 | // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 551 | - if ( ( ! empty( $_GET['scroll_to_section'] ) ) && ( 'wpbc_general_settings_availability_tab' === sanitize_text_field( wp_unslash( $_GET['scroll_to_section'] ) ) ) ) { | |
| 552 | - wpbc_redirect( function_exists( 'wpbc_get_general_availability_url' ) ? wpbc_get_general_availability_url() : admin_url( 'admin.php?page=wpbc-availability&tab=general_availability' ) ); | |
| 553 | - return; | |
| 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 | + } | |
| 554 | 473 | } |
| 555 | 474 | |
| 556 | 475 | $is_can = apply_bk_filter( 'recheck_version', true ); |
| 557 | 476 | if ( ! $is_can ) { |
| @@ -620,65 +539,23 @@ | ||
| 620 | 539 | <div class="wpbc_settings_flex_container_left" style="display:none;"> |
| 621 | 540 | |
| 622 | 541 | <div class="wpbc_settings_navigation_column"> |
| 623 | 542 | |
| 624 | - <div id="wpbc_general_settings_dashboard_tab" class="wpbc_settings_navigation_item wpbc_settings_navigation_item_active"> | |
| 625 | - <?php | |
| 626 | - $title = esc_attr__( 'Dashboard', 'booking' ); | |
| 627 | - ?> | |
| 628 | - <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_dashboard_tab a' ,'#wpbc_general_settings_dashboard_metabox', '<?php echo esc_js( $title ); ?>' );" | |
| 629 | - href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> | |
| 630 | - </div> | |
| 631 | - <div id="wpbc_general_settings_calendar_tab" class="wpbc_settings_navigation_item wpbc_navigation_top_border"> | |
| 632 | - <?php | |
| 633 | - $title = esc_attr__( 'Calendar', 'booking' ); | |
| 634 | - ?> | |
| 635 | - <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> | |
| 636 | - </div> | |
| 637 | - <div id="wpbc_general_settings_days_tooltips_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> | |
| 638 | - <?php | |
| 639 | - $title = esc_attr__( 'Tooltips in days', 'booking' ); | |
| 640 | - ?> | |
| 641 | - <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> | |
| 642 | - </div> | |
| 643 | - <div id="wpbc_general_settings_availability_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> | |
| 644 | - <?php | |
| 645 | - $title = esc_attr__( 'Availability', 'booking' ); | |
| 646 | - ?> | |
| 647 | - <a href="<?php echo esc_url( function_exists( 'wpbc_get_general_availability_url' ) ? wpbc_get_general_availability_url() : admin_url( 'admin.php?page=wpbc-availability&tab=general_availability' ) ); ?>"><span><?php echo esc_html( $title ); ?></span></a> | |
| 648 | - </div> | |
| 649 | - <div id="wpbc_general_settings_capacity_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> | |
| 650 | - <?php | |
| 651 | - $title = esc_attr__( 'Capacity', 'booking' ); | |
| 652 | - ?> | |
| 653 | - <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> | |
| 654 | - </div> | |
| 655 | - <div id="wpbc_general_settings_form_tab" class="wpbc_settings_navigation_item"> | |
| 656 | - <?php | |
| 657 | - $title = esc_attr__( 'Form Options', 'booking' ); | |
| 658 | - ?> | |
| 659 | - <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> | |
| 660 | - </div> | |
| 661 | - <div id="wpbc_general_settings_time_slots_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> | |
| 662 | - <?php | |
| 663 | - $title = esc_attr__( 'Time Slots', 'booking' ); | |
| 664 | - ?> | |
| 665 | - <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> | |
| 666 | - </div> | |
| 667 | - <div id="wpbc_general_settings_booking_confirmation_tab" class="wpbc_settings_navigation_item"> | |
| 668 | - <?php | |
| 669 | - $title = esc_attr__( 'Booking Confirmation', 'booking' ); | |
| 670 | - ?> | |
| 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 | + ?> | |
| 671 | 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> |
| 672 | 555 | </div> |
| 673 | 556 | |
| 674 | - <div id="wpbc_general_settings_booking_timeline_tab" class="wpbc_settings_navigation_item wpbc_navigation_top_border"> | |
| 675 | - <?php | |
| 676 | - $title = esc_attr__( 'Timeline (front-end)', 'booking' ); | |
| 677 | - ?> | |
| 678 | - <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> | |
| 679 | - </div> | |
| 680 | - <?php if ( class_exists('wpdev_bk_personal') ) { ?> | |
| 557 | + <?php if ( class_exists('wpdev_bk_personal') ) { ?> | |
| 681 | 558 | <div id="wpbc_general_settings_bookings_options_tab" class="wpbc_settings_navigation_item wpbc_navigation_top_border"> |
| 682 | 559 | <?php |
| 683 | 560 | $title = esc_attr__( 'Manage Bookings', 'booking' ); |
| 684 | 561 | ?> |
| @@ -695,17 +572,8 @@ | ||
| 695 | 572 | </div> |
| 696 | 573 | <?php } ?> |
| 697 | 574 | |
| 698 | 575 | |
| 699 | - <?php if ( class_exists('wpdev_bk_multiuser') ) { ?> | |
| 700 | - <div id="wpbc_general_settings_multiuser_tab" class="wpbc_settings_navigation_item"> | |
| 701 | - <?php | |
| 702 | - $title = esc_attr__( 'Multiuser options', 'booking' ); | |
| 703 | - ?> | |
| 704 | - <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> | |
| 705 | - </div> | |
| 706 | - <?php } ?> | |
| 707 | - | |
| 708 | 576 | <div id="wpbc_general_settings_booking_listing_tab" class="wpbc_settings_navigation_item wpbc_navigation_top_border"> |
| 709 | 577 | <?php |
| 710 | 578 | $title = esc_attr__( 'Admin Panel', 'booking' ); |
| 711 | 579 | ?> |
| @@ -714,11 +582,17 @@ | ||
| 714 | 582 | <div id="wpbc_general_settings_booking_calendar_overview_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> |
| 715 | 583 | <?php |
| 716 | 584 | $title = esc_attr__( 'Timeline View', 'booking' ); |
| 717 | 585 | ?> |
| 718 | - <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> | |
| 719 | - </div> | |
| 720 | - <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"> | |
| 721 | 595 | <?php |
| 722 | 596 | $title = esc_attr__( 'Date / Time Formats', 'booking' ); |
| 723 | 597 | ?> |
| 724 | 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> |
| @@ -802,30 +676,8 @@ | ||
| 802 | 676 | wpbc_ui_settings__panel__plugin_version(); |
| 803 | 677 | |
| 804 | 678 | ?></div><?php //wpbc_close_meta_box_section(); ?> |
| 805 | 679 | |
| 806 | - | |
| 807 | - <?php wpbc_open_meta_box_section( 'wpbc_general_settings_calendar', __('Calendar', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> | |
| 808 | - | |
| 809 | - <?php $this->settings_api()->show( 'calendar' ); ?> | |
| 810 | - | |
| 811 | - <?php wpbc_close_meta_box_section(); ?> | |
| 812 | - | |
| 813 | - | |
| 814 | - <?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 ) ); ?> | |
| 815 | - | |
| 816 | - <?php $this->settings_api()->show( 'days_tooltips' ); ?> | |
| 817 | - | |
| 818 | - <?php wpbc_close_meta_box_section(); ?> | |
| 819 | - | |
| 820 | - | |
| 821 | - <?php wpbc_open_meta_box_section( 'wpbc_general_settings_availability', __('Availability', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> | |
| 822 | - | |
| 823 | - <?php $this->settings_api()->show( 'availability' ); ?> | |
| 824 | - | |
| 825 | - <?php wpbc_close_meta_box_section(); ?> | |
| 826 | - | |
| 827 | - | |
| 828 | 680 | <?php |
| 829 | 681 | wpbc_open_meta_box_section( 'wpbc_general_settings_booking_confirmation', |
| 830 | 682 | __( 'Booking Confirmation', 'booking' ), |
| 831 | 683 | array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); |
| @@ -902,51 +754,8 @@ | ||
| 902 | 754 | <?php wpbc_close_meta_box_section(); ?> |
| 903 | 755 | |
| 904 | 756 | <?php } ?> |
| 905 | 757 | |
| 906 | - | |
| 907 | - | |
| 908 | - <?php wpbc_open_meta_box_section( 'wpbc_general_settings_capacity', __('Capacity', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> | |
| 909 | - | |
| 910 | - <?php $this->settings_api()->show( 'capacity' ); ?> | |
| 911 | - | |
| 912 | - <?php wpbc_close_meta_box_section(); ?> | |
| 913 | - | |
| 914 | - | |
| 915 | - <?php | |
| 916 | - if ( ! class_exists( 'wpdev_bk_personal' ) ) { | |
| 917 | - | |
| 918 | - $wpbc_metabox_id = 'wpbc_general_settings_capacity_upgrade'; | |
| 919 | - | |
| 920 | - ob_start(); | |
| 921 | - $is_panel_visible = wpbc_is_dismissed( $wpbc_metabox_id . '_metabox', array( | |
| 922 | - 'title' => '<i class="menu_icon icon-1x wpbc_icn_close"></i> ', | |
| 923 | - 'hint' => __( 'Dismiss', 'booking' ), | |
| 924 | - 'class' => 'wpbc_panel_get_started_dismiss', | |
| 925 | - 'css' => 'background: #fff;border-radius: 7px;' | |
| 926 | - )); | |
| 927 | - ?> | |
| 928 | - <script type="text/javascript"> jQuery('#<?php echo esc_js( $wpbc_metabox_id ); ?>_metabox').hide(); </script> | |
| 929 | - <?php | |
| 930 | - $dismiss_button_content = ob_get_clean(); | |
| 931 | - | |
| 932 | - if ( $is_panel_visible ) { | |
| 933 | - | |
| 934 | - wpbc_open_meta_box_section( $wpbc_metabox_id, | |
| 935 | - __('Booking Quantity Control - Set limits for the number of bookings per day or time slot.', 'booking'), | |
| 936 | - array( 'is_section_visible_after_load' => false, | |
| 937 | - 'is_show_minimize' => false, | |
| 938 | - 'dismiss_button' => $dismiss_button_content | |
| 939 | - ) ); | |
| 940 | - | |
| 941 | - $this->settings_api()->show( 'capacity_upgrade' ); | |
| 942 | - | |
| 943 | - wpbc_close_meta_box_section(); | |
| 944 | - } | |
| 945 | - } | |
| 946 | - ?> | |
| 947 | - | |
| 948 | - | |
| 949 | 758 | <?php wpbc_open_meta_box_section( 'wpbc_general_settings_advanced', __('Advanced', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 950 | 759 | |
| 951 | 760 | <?php $this->settings_api()->show( 'advanced' ); ?> |
| 952 | 761 | |
| @@ -984,11 +793,15 @@ | ||
| 984 | 793 | |
| 985 | 794 | <?php if ( ( class_exists( 'wpdev_bk_personal' ) ) && ( ! wpbc_is_this_demo() ) ) { ?> |
| 986 | 795 | <?php wpbc_open_meta_box_section( 'wpbc_general_settings_help', __( 'Tools', 'booking' ), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 987 | 796 | |
| 988 | - <?php $this->settings_api()->show( 'help' ); ?> | |
| 989 | - | |
| 990 | - <?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(); ?> | |
| 991 | 804 | <?php } ?> |
| 992 | 805 | |
| 993 | 806 | <?php wpbc_open_meta_box_section( 'wpbc_general_settings_translations', __( 'Translations', 'booking' ), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 994 | 807 | |
| @@ -997,18 +810,8 @@ | ||
| 997 | 810 | <?php wpbc_translation_buttons_settings_section(); ?> |
| 998 | 811 | |
| 999 | 812 | <?php wpbc_close_meta_box_section(); ?> |
| 1000 | 813 | |
| 1001 | - <?php if ( class_exists( 'wpdev_bk_multiuser' ) ) { // FixIn: 9.2.3.8. ?> | |
| 1002 | - | |
| 1003 | - <?php wpbc_open_meta_box_section( 'wpbc_general_settings_multiuser', __( 'Multiuser options', 'booking' ), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> | |
| 1004 | - | |
| 1005 | - <?php $this->settings_api()->show( 'multiuser' ); ?> | |
| 1006 | - | |
| 1007 | - <?php wpbc_close_meta_box_section(); ?> | |
| 1008 | - | |
| 1009 | - <?php } ?> | |
| 1010 | - | |
| 1011 | 814 | </div> |
| 1012 | 815 | <div class="clear"></div> |
| 1013 | 816 | <div class="container_for_save_buttons"> |
| 1014 | 817 | <input type="submit" value="<?php esc_attr_e( 'Save Changes', 'booking' ); ?>" class="button button-primary wpbc_submit_button"/> |
| @@ -1065,8 +868,14 @@ | ||
| 1065 | 868 | |
| 1066 | 869 | $validated_fields = $this->settings_api()->validate_post(); // Get Validated Settings fields in $_POST request. |
| 1067 | 870 | |
| 1068 | 871 | $validated_fields = apply_filters( 'wpbc_settings_validate_fields_before_saving', $validated_fields ); // Hook for validated fields. |
| 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 | + } | |
| 1069 | 878 | |
| 1070 | 879 | /** |
| 1071 | 880 | * Skip saving specific option, for example in Demo mode. |
| 1072 | 881 | * // unset( $validated_fields['booking_start_day_weeek'] ); |