| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | <?php /** |
| 2 | 2 | * @version 1.0 |
| 3 | 3 | * @package Booking Calendar |
| 4 | 4 | * @category Content of Settings page |
| @@ -13,332 +13,636 @@ | ||
| 13 | 13 | if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | - * Show Content | |
| 17 | + * Show Content | |
| 18 | 18 | * Update Content |
| 19 | 19 | * Define Slug |
| 20 | 20 | * Define where to show |
| 21 | 21 | */ |
| 22 | 22 | class WPBC_Page_SettingsGeneral extends WPBC_Page_Structure { |
| 23 | - | |
| 24 | - private $settings_api = false; | |
| 25 | - | |
| 26 | - public function __construct() { | |
| 27 | - | |
| 28 | - if ( ! wpbc_is_mu_user_can_be_here( 'only_super_admin' ) ) { // If this User not "super admin", then do not load this page at all | |
| 29 | 23 | |
| 30 | - if ( | |
| 31 | - ( isset( $_REQUEST['page'] ) && ( $_REQUEST['page'] == 'wpbc-settings' ) ) // Check if this Settings page | |
| 32 | - && | |
| 33 | - ( ( ! isset( $_REQUEST['tab'] ) ) || ( $_REQUEST['tab'] == 'general' ) ) | |
| 34 | - ) { // If tab was not selected or selected default, then redirect it to the "form" tab. | |
| 35 | - $_REQUEST['tab'] = 'form'; | |
| 36 | - } | |
| 24 | + /** | |
| 25 | + * Link to Settings API obj | |
| 26 | + * | |
| 27 | + * @var bool | |
| 28 | + */ | |
| 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 | |
| 35 | + // If tab was not selected or selected default, then redirect it to the "form" tab. | |
| 36 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing | |
| 37 | + if ( ( isset( $_REQUEST['page'] ) && ( 'wpbc-settings' === $_REQUEST['page'] ) ) && ( ( ! isset( $_REQUEST['tab'] ) ) || ( 'general' === $_REQUEST['tab'] ) ) ) { | |
| 38 | + $_REQUEST['tab'] = 'form'; | |
| 39 | + } | |
| 40 | + } else { | |
| 41 | + parent::__construct(); | |
| 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 | + } | |
| 37 | 77 | |
| 38 | - } | |
| 39 | - else { | |
| 40 | - parent::__construct(); | |
| 41 | - } | |
| 42 | - | |
| 43 | - } | |
| 44 | - | |
| 45 | - public function in_page() { | |
| 46 | - | |
| 47 | - if ( ! wpbc_is_mu_user_can_be_here( 'only_super_admin' ) ) { // If this User not "super admin", then do not load this page at all | |
| 48 | - return (string) rand(100000, 1000000); | |
| 49 | - } | |
| 50 | - | |
| 51 | - return 'wpbc-settings'; | |
| 52 | - } | |
| 53 | - | |
| 78 | + public function in_page() { | |
| 54 | 79 | |
| 55 | - /** | |
| 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. | |
| 81 | + return (string) wp_rand( 100000, 1000000 ); | |
| 82 | + } | |
| 83 | + | |
| 84 | + return 'wpbc-settings'; | |
| 85 | + } | |
| 86 | + | |
| 87 | + | |
| 88 | + /** | |
| 56 | 89 | * Get Settings API class - define, show, update "Fields". |
| 57 | - * | |
| 58 | - * @return object Settings API | |
| 59 | - */ | |
| 60 | - public function settings_api(){ | |
| 61 | - | |
| 62 | - if ( $this->settings_api === false ) | |
| 63 | - $this->settings_api = new WPBC_Settings_API_General(); | |
| 64 | - | |
| 65 | - return $this->settings_api; | |
| 66 | - } | |
| 67 | - | |
| 68 | - | |
| 69 | - public function tabs() { | |
| 70 | - | |
| 71 | - $tabs = array(); | |
| 72 | - | |
| 73 | - $tabs[ 'general' ] = array( | |
| 74 | - 'title' => __( 'General', 'booking') // Title of TAB | |
| 75 | - , 'page_title' => __( 'General Settings', 'booking') // Title of Page | |
| 76 | - , 'hint' => __( 'General Settings', 'booking') // Hint | |
| 77 | - , 'link' => '' // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link | |
| 78 | - , 'position' => '' // 'left' || 'right' || '' | |
| 79 | - , 'css_classes' => '' // CSS class(es) | |
| 80 | - , 'icon' => '' // Icon - link to the real PNG img | |
| 81 | - , 'font_icon' => 'wpbc_icn_tune' // CSS definition of forn Icon | |
| 82 | - , 'default' => true // Is this tab activated by default or not: true || false. | |
| 83 | - ); | |
| 90 | + * | |
| 91 | + * @return object Settings API | |
| 92 | + */ | |
| 93 | + public function settings_api() { | |
| 84 | 94 | |
| 85 | - $subtabs = array(); | |
| 86 | - $subtabs['wpbc-settings-info'] = array( 'type' => 'html', 'html' => wpbc_get_flex_dashboard_info() ); | |
| 95 | + if ( false === $this->settings_api ) { | |
| 96 | + $this->settings_api = new WPBC_Settings_API_General(); | |
| 97 | + } | |
| 87 | 98 | |
| 88 | -if (0){ | |
| 89 | - $subtabs['wpbc-settings-calendar'] = array( 'type' => 'goto-link' | |
| 90 | - , 'title' => __('Calendar','booking') | |
| 91 | - , 'show_section' => 'wpbc_general_settings_calendar_metabox' | |
| 92 | - ); | |
| 99 | + return $this->settings_api; | |
| 100 | + } | |
| 93 | 101 | |
| 94 | - //FixIn: 8.7.11.10 | |
| 95 | - $subtabs['wpbc-settings-time-slots'] = array( 'type' => 'goto-link' | |
| 96 | - , 'title' => __('Time Slots','booking') | |
| 97 | - , 'show_section' => 'wpbc_general_settings_time_slots_metabox' | |
| 98 | - ); | |
| 99 | 102 | |
| 100 | - $subtabs['wpbc-settings-availability'] = array( 'type' => 'goto-link' | |
| 101 | - , 'title' => __('Availability','booking') | |
| 102 | - , 'show_section' => 'wpbc_general_settings_availability_metabox' | |
| 103 | - ); | |
| 103 | + public function tabs() { | |
| 104 | 104 | |
| 105 | - $subtabs['wpbc-settings-form'] = array( 'type' => 'goto-link' | |
| 106 | - , 'title' => __('Form','booking') | |
| 107 | - , 'show_section' => 'wpbc_general_settings_form_metabox' | |
| 108 | - ); | |
| 105 | + // Init vars. | |
| 106 | + $separator_i = 0; | |
| 107 | + $tabs = array(); | |
| 108 | + $subtab_default = array( | |
| 109 | + 'type' => 'subtab', // Required| Possible values: 'subtab' | 'separator' | 'button' | 'goto-link' | 'html'. | |
| 110 | + 'title' => '', | |
| 111 | + 'page_title' => '', | |
| 112 | + 'hint' => '', | |
| 113 | + 'link' => '', | |
| 114 | + 'css_classes' => '', | |
| 115 | + 'font_icon' => 'wpbc_icn_dashboard', | |
| 116 | + 'font_icon_right' => 'wpbc-bi-question-circle', | |
| 117 | + 'default' => false, | |
| 118 | + ); | |
| 109 | 119 | |
| 110 | - $subtabs['wpbc-settings-booking-listing'] = array( 'type' => 'goto-link' | |
| 111 | - , 'title' => __('Booking Admin Panel','booking') | |
| 112 | - , 'show_section' => 'wpbc_general_settings_booking_listing_metabox' | |
| 113 | - ); | |
| 120 | + // ============================================================================================================= | |
| 121 | + // == D A S H B O A R D == | |
| 122 | + // ============================================================================================================= | |
| 123 | + $tabs['general'] = array( | |
| 124 | + 'is_show_top_path' => true, // true | false. By default value is: false. | |
| 125 | + 'is_show_top_navigation' => false, // true | false. By default value is: false. | |
| 126 | + 'left_navigation__default_view_mode' => '', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''. | |
| 127 | + 'page_title' => __( 'General Settings', 'booking' ), // Header - Title. If false, than hidden. | |
| 128 | + // translators: 1: Booking Calendar. | |
| 129 | + 'page_description' => sprintf( __( 'Configure various options and settings in the %s.', 'booking' ), 'Booking Calendar' ), | |
| 130 | + 'title' => __( 'Dashboard', 'booking' ), // Left Vertical Menu - Title. | |
| 131 | + // translators: 1: Booking Calendar. | |
| 132 | + 'hint' => sprintf( __( 'Configure various options and settings in the %s.', 'booking' ), 'Booking Calendar' ), | |
| 133 | + 'link' => '', // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link. | |
| 134 | + 'default' => true, // Is this tab activated by default or not: true / false. | |
| 135 | + 'font_icon' => 'wpbc-bi-speedometer2', | |
| 136 | + // 'font_icon_right' => 'wpbc-bi-question-circle', | |
| 137 | + 'css_classes' => 'do_expand__' . 'wpbc_general_settings_dashboard_metabox' . '_link', | |
| 138 | + 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . 'wpbc_general_settings_dashboard_metabox' . "' );", | |
| 139 | + 'folder_style' => 'order:10;', | |
| 140 | + ); | |
| 141 | + // FixIn: 10.12.4.7. $tabs[ 'settings' . ( ++$separator_i ) ] = array_merge( $subtab_default, array( 'type' => 'separator' ,'folder_style' => 'order:10;' ) ); | |
| 114 | 142 | |
| 115 | - $subtabs['wpbc-settings-booking-timeline'] = array( 'type' => 'goto-link' | |
| 116 | - , 'title' => __('Timeline', 'booking') | |
| 117 | - , 'show_section' => 'wpbc_general_settings_booking_timeline_metabox' | |
| 118 | - ); | |
| 119 | 143 | |
| 120 | - if ( class_exists('wpdev_bk_biz_s') ) { | |
| 144 | + // ============================================================================================================= | |
| 145 | + // == C O N F I R M A T I ON == | |
| 146 | + // ============================================================================================================= | |
| 147 | + $tabs['booking_confirmation'] = array( | |
| 148 | + 'is_show_top_path' => true, // true | false. By default value is: true. | |
| 149 | + 'is_show_top_navigation' => false, // true | false. By default value is: false. | |
| 150 | + 'left_navigation__default_view_mode' => '', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''. | |
| 151 | + 'page_title' => __( 'General Settings', 'booking' ), // Header - Title. If false, than hidden. | |
| 152 | + // translators: 1: Booking Calendar. | |
| 153 | + 'page_description' => sprintf( __( 'Configure various options and settings in the %s.', 'booking' ), 'Booking Calendar' ), | |
| 154 | + 'title' => __( 'Booking Confirmation', 'booking' ), // Left Vertical Menu - Title. | |
| 155 | + 'hint' => __( 'Customize how the booking summary is displayed after a booking is created', 'booking' ), | |
| 156 | + 'link' => '', // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link. | |
| 157 | + 'default' => false, // Is this tab activated by default or not: true / false. | |
| 158 | + 'font_icon' => 'wpbc-bi-card-checklist', | |
| 159 | + 'font_icon_right' => 'wpbc-bi-question-circle', | |
| 160 | + 'css_classes' => 'do_expand__' . 'wpbc_general_settings_booking_confirmation_metabox' . '_link', | |
| 161 | + 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . | |
| 162 | + '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' . | |
| 163 | + "' );", | |
| 164 | + 'folder_style' => 'order:20;', | |
| 165 | + ); | |
| 121 | 166 | |
| 167 | + // FixIn: 10.12.4.7. $tabs[ 'settings' . ( ++$separator_i ) ] = array_merge( $subtab_default, array( 'type' => 'separator' ,'folder_style' => 'order:20;' ) ); | |
| 122 | 168 | |
| 123 | - $subtabs['wpbc-settings-auto-cancelation-approval'] = array( 'type' => 'goto-link' | |
| 124 | - , 'title' => __('Auto cancellation / approval','booking') | |
| 125 | - , 'show_section' => 'wpbc_general_settings_auto_cancelation_approval_metabox' | |
| 126 | - ); | |
| 127 | - } | |
| 169 | + // ============================================================================================================= | |
| 170 | + // == Manage Bookings == | |
| 171 | + // ============================================================================================================= | |
| 172 | + $tabs['manage_bookings'] = array( | |
| 173 | + 'is_show_top_path' => true, // true | false. By default value is: true. | |
| 174 | + 'is_show_top_navigation' => false, // true | false. By default value is: false. | |
| 175 | + 'left_navigation__default_view_mode' => '', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''. | |
| 176 | + 'page_title' => __( 'General Settings', 'booking' ), // Header - Title. If false, than hidden. | |
| 177 | + // translators: 1: Booking Calendar. | |
| 178 | + 'page_description' => sprintf( __( 'Configure various options and settings in the %s.', 'booking' ), 'Booking Calendar' ), | |
| 179 | + 'title' => __( 'Manage Bookings', 'booking' ), // Left Vertical Menu - Title. | |
| 180 | + // translators: 1: Booking Calendar. | |
| 181 | + 'hint' => sprintf( __( 'Configure various options and settings in the %s.', 'booking' ), 'Booking Calendar' ), | |
| 182 | + 'font_icon' => 'wpbc_icn_app_registration', // Left Vertical Menu - Icon. | |
| 183 | + 'link' => '', // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link. | |
| 184 | + 'css_classes' => '', // CSS. | |
| 185 | + 'icon' => '', // Icon - link to the real PNG img. | |
| 186 | + 'default' => false, // Is this tab activated by default or not: true / false. | |
| 187 | + 'folder_style' => 'order:1000', | |
| 188 | + ); | |
| 128 | 189 | |
| 129 | - $subtabs['wpbc-settings-capacity'] = array( 'type' => 'goto-link' | |
| 130 | - , 'title' => __('Capacity', 'booking') //. ' ' . '<span class="wpbc_new_label">' . __( 'New', 'booking' ) . '</span>' | |
| 131 | - , 'show_section' => 'wpbc_general_settings_capacity_metabox' | |
| 132 | - ); | |
| 133 | - $subtabs['wpbc-settings-capacity_new'] = array( | |
| 134 | - 'type' => 'html' | |
| 135 | - , 'html' => '<span class="wpbc_new_label" style="margin-left: -15px;border:none;">' . __( 'New', 'booking' ) . '</span>' | |
| 136 | - ); | |
| 190 | + $subtabs = array(); | |
| 137 | 191 | |
| 138 | - $subtabs['wpbc-settings-advanced'] = array( 'type' => 'goto-link' | |
| 139 | - , 'title' => __('Advanced','booking') | |
| 140 | - , 'show_section' => 'wpbc_general_settings_advanced_metabox' | |
| 141 | - ); | |
| 192 | + $section_id = 'wpbc_general_settings_booking_timeline_metabox'; | |
| 193 | + $booking_timeline_subtab = array_merge( | |
| 194 | + $subtab_default, | |
| 195 | + array( | |
| 196 | + 'title' => __( 'Timeline (front-end)', 'booking' ), | |
| 197 | + 'page_title' => __( 'General Settings', 'booking' ), | |
| 198 | + 'hint' => __( 'Customize timeline options, including the display of booking details.', 'booking' ), | |
| 199 | + 'font_icon' => 'wpbc_icn_align_vertical_bottom wpbc_icn_rotate_90', | |
| 200 | + 'font_icon_right' => 'wpbc-bi-question-circle', | |
| 201 | + 'css_classes' => 'do_expand__' . $section_id . '_link ', | |
| 202 | + 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", | |
| 203 | + 'default' => false, | |
| 204 | + ) | |
| 205 | + ); | |
| 142 | 206 | |
| 143 | - $subtabs['wpbc-settings-menu-access'] = array( 'type' => 'goto-link' | |
| 144 | - , 'title' => __('Plugin Menu','booking') | |
| 145 | - , 'show_section' => 'wpbc_general_settings_permissions_metabox' | |
| 146 | - ); | |
| 207 | + if ( class_exists('wpdev_bk_personal') ) { | |
| 208 | + $section_id = 'wpbc_general_settings_bookings_options_metabox'; | |
| 209 | + $subtabs['bookings_options'] = array_merge( | |
| 210 | + $subtab_default, | |
| 211 | + array( | |
| 212 | + 'title' => __( 'Manage Bookings', 'booking' ), | |
| 213 | + 'page_title' => __( 'General Settings', 'booking' ), | |
| 214 | + 'hint' => __( 'Allow customers to edit or cancel their own bookings.', 'booking' ), | |
| 215 | + 'font_icon' => 'wpbc_icn_app_registration mode_edit_outline edit_calendar', | |
| 216 | + 'font_icon_right' => 'wpbc-bi-question-circle', | |
| 217 | + 'css_classes' => 'do_expand__' . $section_id . '_link ', | |
| 218 | + 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", | |
| 219 | + 'default' => false, | |
| 220 | + ) | |
| 221 | + ); | |
| 222 | + } | |
| 147 | 223 | |
| 148 | - $subtabs['wpbc-settings-uninstall'] = array( 'type' => 'goto-link' | |
| 149 | - , 'title' => __('Uninstall','booking') | |
| 150 | - , 'show_section' => 'wpbc_general_settings_uninstall_metabox' | |
| 151 | - ); | |
| 152 | 224 | |
| 153 | -// $subtabs['wpbc-settings-technical'] = array( 'type' => 'goto-link' | |
| 154 | -// , 'title' => __('Help', 'booking') | |
| 155 | -// , 'show_section' => 'wpbc_general_settings_help_metabox' | |
| 156 | -// ); | |
| 225 | + if ( class_exists('wpdev_bk_biz_s') ) { | |
| 226 | + $section_id = 'wpbc_general_settings_auto_cancelation_approval_metabox'; | |
| 227 | + $subtabs['auto_cancelation_approval'] = array_merge( | |
| 228 | + $subtab_default, | |
| 229 | + array( | |
| 230 | + 'title' => __( 'Auto Cancellation / Auto Approval', 'booking' ), | |
| 231 | + 'page_title' => __( 'General Settings', 'booking' ), | |
| 232 | + 'hint' => __( 'Enable automatic approval or cancellation of bookings.', 'booking' ), | |
| 233 | + 'font_icon' => 'wpbc_icn_published_with_changes', | |
| 234 | + 'font_icon_right' => 'wpbc-bi-question-circle', | |
| 235 | + 'css_classes' => 'do_expand__' . $section_id . '_link', | |
| 236 | + 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", | |
| 237 | + 'default' => false, | |
| 238 | + ) | |
| 239 | + ); | |
| 240 | + } | |
| 157 | 241 | |
| 158 | - $subtabs['form-save'] = array( | |
| 159 | - 'type' => 'button' | |
| 160 | - , 'title' => __('Save Changes','booking') | |
| 161 | - , 'form' => 'wpbc_general_settings_form' | |
| 162 | - ); | |
| 163 | -} | |
| 164 | - | |
| 165 | - $tabs[ 'general' ][ 'subtabs' ] = $subtabs; | |
| 166 | - | |
| 167 | - return $tabs; | |
| 168 | - } | |
| 242 | + $tabs['manage_bookings']['subtabs'] = $subtabs; | |
| 169 | 243 | |
| 170 | 244 | |
| 171 | - public function content() { | |
| 172 | - | |
| 173 | - // Checking //////////////////////////////////////////////////////////// | |
| 174 | - | |
| 175 | - do_action( 'wpbc_hook_settings_page_header', 'general_settings'); // Define Notices Section and show some static messages, if needed | |
| 176 | - | |
| 177 | - if ( ! wpbc_is_mu_user_can_be_here('activated_user') ) return false; // Check if MU user activated, otherwise show Warning message. | |
| 178 | - | |
| 179 | - if ( ! wpbc_is_mu_user_can_be_here('only_super_admin') ) return false; // User is not Super admin, so exit. Basically its was already checked at the bottom of the PHP file, just in case. | |
| 180 | - | |
| 181 | - $is_can = apply_bk_filter('recheck_version', true); if ( ! $is_can ) { ?><script type="text/javascript"> jQuery(document).ready(function(){ jQuery( '.wpdvlp-sub-tabs').remove(); }); </script><?php return; } | |
| 182 | - | |
| 183 | - | |
| 184 | - // Init Settings API & Get Data from DB //////////////////////////////// | |
| 185 | - $this->settings_api(); // Define all fields and get values from DB | |
| 186 | - | |
| 187 | - // Submit ///////////////////////////////////////////////////////////// | |
| 188 | - | |
| 189 | - $submit_form_name = 'wpbc_general_settings_form'; // Define form name | |
| 190 | - | |
| 191 | - if ( isset( $_POST['is_form_sbmitted_'. $submit_form_name ] ) ) { | |
| 245 | + // ============================================================================================================= | |
| 246 | + // == Admin Panel == | |
| 247 | + // ============================================================================================================= | |
| 248 | + $tabs['admin_panel'] = array( | |
| 249 | + 'is_show_top_path' => true, // true | false. By default value is: true. | |
| 250 | + 'is_show_top_navigation' => false, // true | false. By default value is: false. | |
| 251 | + 'left_navigation__default_view_mode' => '', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''. | |
| 252 | + 'page_title' => __( 'General Settings', 'booking' ), // Header - Title. If false, than hidden. | |
| 253 | + 'page_description' => __( 'Configure various options and settings in the admin panel.', 'booking' ), // Header - Title Description. If false, than hidden. | |
| 254 | + 'title' => __( 'Admin Panel', 'booking' ), // Left Vertical Menu - Title. | |
| 255 | + // translators: 1: Booking Calendar. | |
| 256 | + 'hint' => sprintf( __( 'Configure various options and settings in the %s.', 'booking' ), 'Booking Calendar' ), | |
| 257 | + 'font_icon' => 'wpbc_icn_widgets', // Left Vertical Menu - Icon. | |
| 258 | + 'link' => '', // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link. | |
| 259 | + 'css_classes' => '', // CSS. | |
| 260 | + 'icon' => '', // Icon - link to the real PNG img. | |
| 261 | + 'default' => false, // Is this tab activated by default or not: true / false. | |
| 262 | + 'folder_style' => 'order:1000', | |
| 263 | + ); | |
| 192 | 264 | |
| 193 | - // Nonce checking {Return false if invalid, 1 if generated between, 0-12 hours ago, 2 if generated between 12-24 hours ago. } | |
| 194 | - $nonce_gen_time = check_admin_referer( 'wpbc_settings_page_' . $submit_form_name ); // Its stop show anything on submiting, if its not refear to the original page | |
| 265 | + $subtabs = array(); | |
| 195 | 266 | |
| 196 | - // Save Changes | |
| 197 | - $this->update(); | |
| 198 | - } | |
| 199 | - if ( ! empty( $_GET['scroll_to_section'] ) ) { | |
| 200 | - ?><script type="text/javascript"> | |
| 201 | - jQuery(document).ready(function(){ | |
| 202 | - jQuery( '#<?php echo esc_js( $_GET['scroll_to_section'] ); ?> a' ).trigger('click'); | |
| 267 | + $section_id = 'wpbc_general_settings_booking_listing_metabox'; | |
| 268 | + $subtabs['booking_listing'] = array_merge( | |
| 269 | + $subtab_default, | |
| 270 | + array( | |
| 271 | + 'title' => __( 'Booking Admin Panel', 'booking' ), | |
| 272 | + 'page_title' => __( 'General Settings', 'booking' ), | |
| 273 | + 'hint' => __( 'Configure various options and settings in the admin panel.', 'booking' ), | |
| 274 | + 'font_icon' => 'wpbc-bi-list', | |
| 275 | + 'font_icon_right' => 'wpbc-bi-question-circle', | |
| 276 | + 'css_classes' => 'do_expand__' . $section_id . '_link', | |
| 277 | + 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", | |
| 278 | + 'default' => false, | |
| 279 | + ) | |
| 280 | + ); | |
| 281 | + | |
| 282 | + $section_id = 'wpbc_general_settings_booking_calendar_overview_metabox'; | |
| 283 | + $subtabs['booking_calendar_overview'] = array_merge( | |
| 284 | + $subtab_default, | |
| 285 | + array( | |
| 286 | + 'title' => __( 'Timeline View (Back-End)', 'booking' ), | |
| 287 | + 'page_title' => __( 'General Settings', 'booking' ), | |
| 288 | + 'hint' => __( 'Customize timeline options in the admin panel, including displaying booking details.', 'booking' ), | |
| 289 | + 'font_icon' => 'wpbc-bi-bar-chart-steps _icn_timeline 0wpbc_icn_rotate_45 0wpbc_icn_align_vertical_bottom', | |
| 290 | + 'font_icon_right' => 'wpbc-bi-question-circle', | |
| 291 | + 'css_classes' => 'do_expand__' . $section_id . '_link', | |
| 292 | + 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", | |
| 293 | + 'default' => false, | |
| 294 | + ) | |
| 295 | + ); | |
| 296 | + | |
| 297 | + $subtabs['booking_timeline'] = $booking_timeline_subtab; | |
| 298 | + | |
| 299 | + $section_id = 'wpbc_general_settings_datestimes_metabox'; | |
| 300 | + $subtabs['datestimes'] = array_merge( | |
| 301 | + $subtab_default, | |
| 302 | + array( | |
| 303 | + 'title' => __( 'Date and Time Formats', 'booking' ), | |
| 304 | + 'page_title' => __( 'General Settings', 'booking' ), | |
| 305 | + 'hint' => __( 'Customize the display format for dates and times.', 'booking' ), | |
| 306 | + 'font_icon' => 'wpbc-bi-braces-asterisk _icn_password', | |
| 307 | + 'font_icon_right' => 'wpbc-bi-question-circle', | |
| 308 | + 'css_classes' => 'do_expand__' . $section_id . '_link', | |
| 309 | + 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", | |
| 310 | + 'default' => false, | |
| 311 | + ) | |
| 312 | + ); | |
| 313 | + | |
| 314 | + $section_id = 'wpbc_general_settings_permissions_metabox'; | |
| 315 | + $subtabs['permissions'] = array_merge( | |
| 316 | + $subtab_default, | |
| 317 | + array( | |
| 318 | + 'title' => __( 'Plugin Menu / Permissions', 'booking' ), | |
| 319 | + 'page_title' => __( 'General Settings', 'booking' ), | |
| 320 | + 'hint' => __( 'Set user permissions for accessing plugin menu pages and configure the menu position.', 'booking' ), | |
| 321 | + 'font_icon' => 'wpbc-bi-key', | |
| 322 | + 'font_icon_right' => 'wpbc-bi-question-circle', | |
| 323 | + 'css_classes' => 'do_expand__' . $section_id . '_link', | |
| 324 | + 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", | |
| 325 | + 'default' => false, | |
| 326 | + ) | |
| 327 | + ); | |
| 328 | + | |
| 329 | + $section_id = 'wpbc_general_settings_translations_metabox'; | |
| 330 | + $subtabs['translations'] = array_merge( | |
| 331 | + $subtab_default, | |
| 332 | + array( | |
| 333 | + 'title' => __( 'Translations', 'booking' ), | |
| 334 | + 'page_title' => __( 'General Settings', 'booking' ), | |
| 335 | + 'hint' => __( 'Choose whether to use local translations or WordPress translations.', 'booking' ), | |
| 336 | + 'font_icon' => 'wpbc_icn_translate 0wpbc-bi-translate', | |
| 337 | + 'font_icon_right' => 'wpbc-bi-question-circle', | |
| 338 | + 'css_classes' => 'do_expand__' . $section_id . '_link', | |
| 339 | + 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", | |
| 340 | + 'default' => false, | |
| 341 | + ) | |
| 342 | + ); | |
| 343 | + | |
| 344 | + $tabs['admin_panel']['subtabs'] = $subtabs; | |
| 345 | + $admin_panel_subtabs = $subtabs; | |
| 346 | + unset( $tabs['admin_panel'] ); | |
| 347 | + | |
| 348 | + | |
| 349 | + // ============================================================================================================= | |
| 350 | + // == Advanced == | |
| 351 | + // ============================================================================================================= | |
| 352 | + $tabs['advanced'] = array( | |
| 353 | + 'is_show_top_path' => true, // true | false. By default value is: true. | |
| 354 | + 'is_show_top_navigation' => false, // true | false. By default value is: false. | |
| 355 | + 'left_navigation__default_view_mode' => '', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''. | |
| 356 | + 'page_title' => __( 'General Settings', 'booking' ), // Header - Title. If false, than hidden. | |
| 357 | + // translators: 1: Booking Calendar. | |
| 358 | + 'page_description' => sprintf( __( 'Configure various options and settings in the %s.', 'booking' ), 'Booking Calendar' ), | |
| 359 | + 'title' => __( 'Advanced', 'booking' ), // Left Vertical Menu - Title. | |
| 360 | + // translators: 1: Booking Calendar. | |
| 361 | + 'hint' => sprintf( __( 'Configure various options and settings in the %s.', 'booking' ), 'Booking Calendar' ), | |
| 362 | + 'font_icon' => 'wpbc-bi-gear', // Left Vertical Menu - Icon. | |
| 363 | + 'link' => '', // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link. | |
| 364 | + 'css_classes' => '', // CSS. | |
| 365 | + 'icon' => '', // Icon - link to the real PNG img. | |
| 366 | + 'default' => false, // Is this tab activated by default or not: true / false. | |
| 367 | + 'folder_style' => 'order:1000', | |
| 368 | + ); | |
| 369 | + | |
| 370 | + $subtabs = array(); | |
| 371 | + | |
| 372 | + $section_id = 'wpbc_general_settings_advanced_metabox'; | |
| 373 | + $subtabs['advanced_options'] = array_merge( | |
| 374 | + $subtab_default, | |
| 375 | + array( | |
| 376 | + 'title' => __( 'Advanced Options', 'booking' ), | |
| 377 | + 'page_title' => __( 'General Settings', 'booking' ), | |
| 378 | + 'hint' => __( 'Configure loading of CSS/JavaScript files, set the number of simultaneous requests, and other advanced options.', 'booking' ), | |
| 379 | + 'font_icon' => 'wpbc_icn_adjust', | |
| 380 | + 'font_icon_right' => 'wpbc-bi-question-circle', | |
| 381 | + 'css_classes' => 'do_expand__' . $section_id . '_link', | |
| 382 | + 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", | |
| 383 | + 'default' => false, | |
| 384 | + ) | |
| 385 | + ); | |
| 386 | + | |
| 387 | + $section_id = 'wpbc_general_settings_uninstall_metabox'; | |
| 388 | + $subtabs['uninstall'] = array_merge( | |
| 389 | + $subtab_default, | |
| 390 | + array( | |
| 391 | + 'title' => __( 'Uninstall / Deactivation', 'booking' ), | |
| 392 | + 'page_title' => __( 'General Settings', 'booking' ), | |
| 393 | + 'hint' => __( 'Enable the option to fully erase booking data when the plugin is deactivated.', 'booking' ), | |
| 394 | + 'font_icon' => 'wpbc-bi-trash', | |
| 395 | + 'font_icon_right' => 'wpbc-bi-question-circle', | |
| 396 | + 'css_classes' => 'do_expand__' . $section_id . '_link', | |
| 397 | + 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", | |
| 398 | + 'default' => false, | |
| 399 | + ) | |
| 400 | + ); | |
| 401 | + | |
| 402 | + $section_id = 'wpbc_general_settings_information_metabox'; | |
| 403 | + $subtabs['information'] = array_merge( | |
| 404 | + $subtab_default, | |
| 405 | + array( | |
| 406 | + 'title' => __( 'Plugin Info & News', 'booking' ), | |
| 407 | + 'page_title' => __( 'General Settings', 'booking' ), | |
| 408 | + 'hint' => __( 'Stay informed with the latest news and details about the plugin.', 'booking' ), | |
| 409 | + 'font_icon' => 'wpbc_icn_newspaper -bi-newspaper _icn_news 0wpbc-bi-translate', | |
| 410 | + 'font_icon_right' => 'wpbc-bi-question-circle', | |
| 411 | + 'css_classes' => 'do_expand__' . $section_id . '_link', | |
| 412 | + 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", | |
| 413 | + 'default' => false, | |
| 414 | + ) | |
| 415 | + ); | |
| 416 | + | |
| 417 | + $section_id = 'wpbc_general_settings_help_metabox'; | |
| 418 | + $subtabs['tools'] = array_merge( | |
| 419 | + $subtab_default, | |
| 420 | + array( | |
| 421 | + 'title' => __( 'Tools', 'booking' ), | |
| 422 | + 'page_title' => __( 'General Settings', 'booking' ), | |
| 423 | + 'hint' => '', //__( 'Stay informed with the latest news and details about the plugin. ', 'booking' ), | |
| 424 | + 'font_icon' => 'wpbc_icn_construction', | |
| 425 | + 'font_icon_right' => '', | |
| 426 | + 'css_classes' => 'do_expand__' . $section_id . '_link', | |
| 427 | + 'onclick' => "wpbc_admin_ui__do__open_url__expand_section( '" . wpbc_get_settings_url() . "', '" . $section_id . "' );", | |
| 428 | + 'default' => false, | |
| 429 | + ) | |
| 430 | + ); | |
| 431 | + $tabs['advanced']['subtabs'] = array_merge( $admin_panel_subtabs, $subtabs ); | |
| 432 | + | |
| 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;' ) ); | |
| 435 | + | |
| 436 | + return $tabs; | |
| 437 | + } | |
| 438 | + | |
| 439 | + | |
| 440 | + public function content() { | |
| 441 | + | |
| 442 | + // Checking. | |
| 443 | + | |
| 444 | + do_action( 'wpbc_hook_settings_page_header', 'general_settings' ); // Define Notices Section and show some static messages, if needed. | |
| 445 | + | |
| 446 | + if ( ! wpbc_is_mu_user_can_be_here( 'activated_user' ) ) { | |
| 447 | + return false; | |
| 448 | + } // Check if MU user activated, otherwise show Warning message. | |
| 449 | + | |
| 450 | + if ( ! wpbc_is_mu_user_can_be_here( 'only_super_admin' ) ) { | |
| 451 | + return false; | |
| 452 | + } // User is not Super admin, so exit. Basically its was already checked at the bottom of the PHP file, just in case. | |
| 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 | + | |
| 475 | + $is_can = apply_bk_filter( 'recheck_version', true ); | |
| 476 | + if ( ! $is_can ) { | |
| 477 | + ?> | |
| 478 | + <script type="text/javascript"> jQuery(document).ready(function () { | |
| 479 | + jQuery('.wpdvlp-sub-tabs').remove(); | |
| 203 | 480 | }); |
| 204 | - </script><?php | |
| 205 | - } | |
| 481 | + </script> | |
| 482 | + <?php | |
| 483 | + return; | |
| 484 | + } | |
| 206 | 485 | |
| 207 | - // JavaScript: Tooltips, Popover, Datepick (js & css) ////////////////// | |
| 208 | - echo '<span class="wpdevelop">'; | |
| 209 | - wpbc_js_for_bookings_page(); | |
| 210 | - echo '</span>'; | |
| 211 | 486 | |
| 487 | + // Init Settings API & Get Data from DB. | |
| 488 | + $this->settings_api(); // Define all fields and get values from DB. | |
| 212 | 489 | |
| 213 | - // Content //////////////////////////////////////////////////////////// | |
| 214 | - ?> | |
| 215 | - <div class="clear" style="margin-bottom:10px;"></div> | |
| 490 | + // Submit . | |
| 491 | + | |
| 492 | + $submit_form_name = 'wpbc_general_settings_form'; // Define form name. | |
| 493 | + | |
| 494 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing | |
| 495 | + if ( isset( $_POST[ 'is_form_sbmitted_' . $submit_form_name ] ) ) { | |
| 496 | + | |
| 497 | + // Nonce checking {Return false if invalid, 1 if generated between, 0-12 hours ago, 2 if generated between 12-24 hours ago. }. | |
| 498 | + $nonce_gen_time = check_admin_referer( 'wpbc_settings_page_' . $submit_form_name ); // Its stop show anything on submiting, if its not refear to the original page. | |
| 499 | + | |
| 500 | + // Save Changes . | |
| 501 | + $this->update(); | |
| 502 | + } | |
| 503 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing | |
| 504 | + if ( ! empty( $_GET['scroll_to_section'] ) ) { | |
| 505 | + ?> | |
| 506 | + <script type="text/javascript"> | |
| 507 | + jQuery(document).ready(function () { | |
| 508 | + jQuery('#<?php echo esc_js( sanitize_text_field( wp_unslash( $_GET['scroll_to_section'] ) ) ); ?> a').trigger('click'); | |
| 509 | + }); | |
| 510 | + </script> | |
| 511 | + <?php | |
| 512 | + } | |
| 513 | + | |
| 514 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing | |
| 515 | + if ( ( isset( $_GET['wpbc_setup_wizard'] ) ) && ( 'reset' === $_GET['wpbc_setup_wizard'] ) ) { | |
| 516 | + | |
| 517 | + wpbc_setup_wizard_page__force_in_get(); | |
| 518 | + | |
| 519 | + ?> | |
| 520 | + <div class="wpdvlp-sub-tabs wpbc_redirection_message" style="margin: 20px 0;padding: 1em;font-size: 14px;"> | |
| 521 | + <a href="<?php echo esc_url( wpbc_get_setup_wizard_page_url() ); ?>">Redirect</a> after <span class="wpbc_countdown">1</span> second...</div> | |
| 522 | + <?php | |
| 523 | + | |
| 524 | + wpbc_redirect( wpbc_get_setup_wizard_page_url() ); | |
| 525 | + } | |
| 526 | + | |
| 527 | + // JavaScript: Tooltips, Popover, Datepick (js & css) . | |
| 528 | + echo '<span class="wpdevelop">'; | |
| 529 | + wpbc_js_for_bookings_page(); | |
| 530 | + echo '</span>'; | |
| 531 | + | |
| 532 | + // TODO: 2025-05-05 update in real top path. wpbc_ui_settings__top_path(); | |
| 533 | + | |
| 534 | + // Content . | |
| 535 | + ?> | |
| 536 | + <div class="clear"></div> | |
| 216 | 537 | <div class="wpbc_settings_flex_container"> |
| 217 | 538 | |
| 218 | - <div class="wpbc_settings_flex_container_left"> | |
| 539 | + <div class="wpbc_settings_flex_container_left" style="display:none;"> | |
| 219 | 540 | |
| 220 | 541 | <div class="wpbc_settings_navigation_column"> |
| 221 | 542 | |
| 222 | - <div id="wpbc_general_settings_calendar_tab" class="wpbc_settings_navigation_item wpbc_settings_navigation_item_active"> | |
| 223 | - <a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_calendar_metabox' );" href="javascript:void(0);"> | |
| 224 | - <span><?php _e( 'Calendar', 'booking' ) ?></span> | |
| 225 | - </a> | |
| 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 | + ?> | |
| 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> | |
| 226 | 555 | </div> |
| 227 | - <div id="wpbc_general_settings_days_tooltips_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> | |
| 228 | - <a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_days_tooltips_metabox' );" href="javascript:void(0);"> | |
| 229 | - <span><?php _e( 'Tooltips in days', 'booking' ) ?></span> | |
| 230 | - </a> | |
| 231 | - </div> | |
| 232 | - <div id="wpbc_general_settings_availability_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> | |
| 233 | - <a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_availability_metabox' );" href="javascript:void(0);"> | |
| 234 | - <span><?php _e( 'Availability', 'booking' ) ?></span> | |
| 235 | - </a> | |
| 236 | - </div> | |
| 237 | - <div id="wpbc_general_settings_capacity_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> | |
| 238 | - <a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_capacity_metabox,#wpbc_general_settings_capacity_upgrade_metabox' );" href="javascript:void(0);"> | |
| 239 | - <span><?php _e( 'Capacity', 'booking' ) ?></span> | |
| 240 | - </a> | |
| 241 | - </div> | |
| 242 | - <div id="wpbc_general_settings_form_tab" class="wpbc_settings_navigation_item"> | |
| 243 | - <a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_form_metabox' );" href="javascript:void(0);"> | |
| 244 | - <span><?php _e( 'Form Options', 'booking' ) ?></span> | |
| 245 | - </a> | |
| 246 | - </div> | |
| 247 | - <div id="wpbc_general_settings_time_slots_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> | |
| 248 | - <a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_time_slots_metabox' );" href="javascript:void(0);"> | |
| 249 | - <span><?php _e( 'Time Slots', 'booking' ) ?></span> | |
| 250 | - </a> | |
| 251 | - </div> | |
| 252 | - <div id="wpbc_general_settings_booking_confirmation_tab" class="wpbc_settings_navigation_item"> | |
| 253 | - <a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_booking_confirmation_metabox' );" href="javascript:void(0);"> | |
| 254 | - <span><?php _e( 'Booking Confirmation', 'booking' ) ?></span> | |
| 255 | - </a> | |
| 256 | - </div> | |
| 257 | 556 | |
| 258 | - <div id="wpbc_general_settings_booking_timeline_tab" class="wpbc_settings_navigation_item wpbc_navigation_top_border"> | |
| 259 | - <a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_booking_timeline_metabox' );" href="javascript:void(0);"> | |
| 260 | - <span><?php _e( 'Timeline (front-end)', 'booking' ) ?></span> | |
| 261 | - </a> | |
| 262 | - </div> | |
| 263 | - <?php if ( class_exists('wpdev_bk_personal') ) { ?> | |
| 557 | + <?php if ( class_exists('wpdev_bk_personal') ) { ?> | |
| 264 | 558 | <div id="wpbc_general_settings_bookings_options_tab" class="wpbc_settings_navigation_item wpbc_navigation_top_border"> |
| 265 | - <a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_bookings_options_metabox' );" href="javascript:void(0);"> | |
| 266 | - <span><?php _e( 'Manage Bookings', 'booking' ) ?></span> | |
| 267 | - </a> | |
| 559 | + <?php | |
| 560 | + $title = esc_attr__( 'Manage Bookings', 'booking' ); | |
| 561 | + ?> | |
| 562 | + <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_bookings_options_tab a' ,'#wpbc_general_settings_bookings_options_metabox', '<?php echo esc_js( $title ); ?>' );" href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> | |
| 268 | 563 | </div> |
| 269 | 564 | <?php } ?> |
| 270 | 565 | |
| 271 | 566 | <?php if ( class_exists('wpdev_bk_biz_s') ) { ?> |
| 272 | - <div id="wpbc_general_settings_auto_cancelation_approval_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> | |
| 273 | - <a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_auto_cancelation_approval_metabox' );" href="javascript:void(0);"> | |
| 274 | - <span><?php _e( 'Auto Cancellation / Auto Approval', 'booking' ) ?></span> | |
| 275 | - </a> | |
| 567 | + <div id="wpbc_general_settings_auto_cancelation_approval_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> | |
| 568 | + <?php | |
| 569 | + $title = esc_attr__( 'Auto Cancellation / Auto Approval', 'booking' ); | |
| 570 | + ?> | |
| 571 | + <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_auto_cancelation_approval_tab a' ,'#wpbc_general_settings_auto_cancelation_approval_metabox', '<?php echo esc_js( $title ); ?>' );" href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> | |
| 276 | 572 | </div> |
| 277 | 573 | <?php } ?> |
| 278 | 574 | |
| 279 | 575 | |
| 280 | - <?php if ( class_exists('wpdev_bk_multiuser') ) { ?> | |
| 281 | - <div id="wpbc_general_settings_multiuser_tab" class="wpbc_settings_navigation_item"> | |
| 282 | - <a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_multiuser_metabox' );" href="javascript:void(0);"> | |
| 283 | - <span><?php _e( 'Multiuser options', 'booking' ) ?></span> | |
| 284 | - </a> | |
| 285 | - </div> | |
| 286 | - <?php } ?> | |
| 287 | - | |
| 288 | 576 | <div id="wpbc_general_settings_booking_listing_tab" class="wpbc_settings_navigation_item wpbc_navigation_top_border"> |
| 289 | - <a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_booking_listing_metabox' );" href="javascript:void(0);"> | |
| 290 | - <span><?php _e( 'Admin Panel', 'booking' ) ?></span> | |
| 291 | - </a> | |
| 577 | + <?php | |
| 578 | + $title = esc_attr__( 'Admin Panel', 'booking' ); | |
| 579 | + ?> | |
| 580 | + <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_booking_listing_tab a' ,'#wpbc_general_settings_booking_listing_metabox', '<?php echo esc_js( $title ); ?>' );" href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> | |
| 292 | 581 | </div> |
| 293 | 582 | <div id="wpbc_general_settings_booking_calendar_overview_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> |
| 294 | - <a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_booking_calendar_overview_metabox' );" href="javascript:void(0);"> | |
| 295 | - <span><?php _e( 'Calendar Overview', 'booking' ) ?></span> | |
| 296 | - </a> | |
| 583 | + <?php | |
| 584 | + $title = esc_attr__( 'Timeline View', 'booking' ); | |
| 585 | + ?> | |
| 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"> | |
| 595 | + <?php | |
| 596 | + $title = esc_attr__( 'Date / Time Formats', 'booking' ); | |
| 597 | + ?> | |
| 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> | |
| 297 | 599 | </div> |
| 298 | - <div id="wpbc_general_settings_datestimes_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> | |
| 299 | - <a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_datestimes_metabox' );" href="javascript:void(0);"> | |
| 300 | - <span><?php _e( 'Date / Time Formats', 'booking' ) ?></span> | |
| 301 | - </a> | |
| 302 | - </div> | |
| 303 | 600 | <div id="wpbc_general_settings_permissions_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> |
| 304 | - <a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_permissions_metabox' );" href="javascript:void(0);"> | |
| 305 | - <span><?php _e( 'Plugin Menu / Permissions', 'booking' ) ?></span> | |
| 306 | - </a> | |
| 601 | + <?php | |
| 602 | + $title = esc_attr__( 'Plugin Menu / Permissions', 'booking' ); | |
| 603 | + ?> | |
| 604 | + <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_permissions_tab a' ,'#wpbc_general_settings_permissions_metabox', '<?php echo esc_js( $title ); ?>' );" href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> | |
| 307 | 605 | </div> |
| 308 | 606 | <div id="wpbc_general_settings_translations_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> |
| 309 | - <a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_translations_metabox' );" href="javascript:void(0);"> | |
| 310 | - <span><?php _e( 'Translations', 'booking' ) ?></span> | |
| 311 | - </a> | |
| 607 | + <?php | |
| 608 | + $title = esc_attr__( 'Translations', 'booking' ); | |
| 609 | + ?> | |
| 610 | + <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_translations_tab a' ,'#wpbc_general_settings_translations_metabox', '<?php echo esc_js( $title ); ?>' );" href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> | |
| 312 | 611 | </div> |
| 313 | 612 | <div id="wpbc_general_settings_advanced_tab" class="wpbc_settings_navigation_item"> |
| 314 | - <a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_advanced_metabox' );" href="javascript:void(0);"> | |
| 315 | - <span><?php _e( 'Advanced', 'booking' ) ?></span> | |
| 316 | - </a> | |
| 613 | + <?php | |
| 614 | + $title = esc_attr__( 'Advanced', 'booking' ); | |
| 615 | + ?> | |
| 616 | + <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_advanced_tab a' ,'#wpbc_general_settings_advanced_metabox', '<?php echo esc_js( $title ); ?>' );" href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> | |
| 317 | 617 | </div> |
| 318 | 618 | <div id="wpbc_general_settings_uninstall_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> |
| 319 | - <a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_uninstall_metabox' );" href="javascript:void(0);"> | |
| 320 | - <span><?php _e( 'Uninstall / deactivation', 'booking' ) ?></span> | |
| 321 | - </a> | |
| 619 | + <?php | |
| 620 | + $title = esc_attr__( 'Uninstall / deactivation', 'booking' ); | |
| 621 | + ?> | |
| 622 | + <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_uninstall_tab a' ,'#wpbc_general_settings_uninstall_metabox', '<?php echo esc_js( $title ); ?>' );" href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> | |
| 322 | 623 | </div> |
| 323 | 624 | <div id="wpbc_general_settings_information_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> |
| 324 | - <a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_information_metabox' );" href="javascript:void(0);"> | |
| 325 | - <span><?php _e( 'Info / News', 'booking' ) ?></span> | |
| 326 | - </a> | |
| 625 | + <?php | |
| 626 | + $title = esc_attr__( 'Info / News', 'booking' ); | |
| 627 | + ?> | |
| 628 | + <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_information_tab a' ,'#wpbc_general_settings_information_metabox', '<?php echo esc_js( $title ); ?>' );" href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> | |
| 327 | 629 | </div> |
| 328 | - | |
| 329 | 630 | <?php if ( ( class_exists('wpdev_bk_personal') ) && ( ! wpbc_is_this_demo() ) ) { ?> |
| 330 | 631 | <div id="wpbc_general_settings_help_tab" class="wpbc_settings_navigation_item wpbc_navigation_sub_item"> |
| 331 | - <a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'#wpbc_general_settings_help_metabox' );" href="javascript:void(0);"> | |
| 332 | - <span><?php _e( 'Tools', 'booking' ) ?></span> | |
| 333 | - </a> | |
| 632 | + <?php | |
| 633 | + $title = esc_attr__( 'Tools', 'booking' ); | |
| 634 | + ?> | |
| 635 | + <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_help_tab a' ,'#wpbc_general_settings_help_metabox', '<?php echo esc_js( $title ); ?>' );" href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> | |
| 334 | 636 | </div> |
| 335 | 637 | <?php } ?> |
| 336 | 638 | |
| 337 | 639 | <div id="wpbc_general_settings_all_tab" class="wpbc_settings_navigation_item wpbc_navigation_top_border"> |
| 338 | - <a class="" original-title="" onclick="javascript:wpbc_navigation_click_show_section(this,'.postbox' );" href="javascript:void(0);"> | |
| 339 | - <span><?php _e( 'Show All Settings', 'booking' ) ?></span> | |
| 340 | - </a> | |
| 640 | + <?php | |
| 641 | + $title = esc_attr__( 'Show All Settings', 'booking' ); | |
| 642 | + ?> | |
| 643 | + <a onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_all_tab a' ,'.postbox', '<?php echo esc_js( $title ); ?>' );" | |
| 644 | + href="javascript:void(0);"><span><?php echo esc_html( $title ); ?></span></a> | |
| 341 | 645 | </div> |
| 342 | 646 | |
| 343 | 647 | </div> |
| 344 | 648 | |
| @@ -345,62 +649,68 @@ | ||
| 345 | 649 | </div> |
| 346 | 650 | <div class="wpbc_settings_flex_container_right"> |
| 347 | 651 | |
| 348 | 652 | <span class="metabox-holder"> |
| 349 | - <form name="<?php echo $submit_form_name; ?>" id="<?php echo $submit_form_name; ?>" action="" method="post"> | |
| 653 | + <form name="<?php echo esc_attr( $submit_form_name ); ?>" id="<?php echo esc_attr( $submit_form_name ); ?>" action="" method="post"> | |
| 350 | 654 | <?php |
| 351 | - // N o n c e field, and key for checking S u b m i t | |
| 352 | - wp_nonce_field( 'wpbc_settings_page_' . $submit_form_name ); | |
| 353 | - ?><input type="hidden" name="is_form_sbmitted_<?php echo $submit_form_name; ?>" id="is_form_sbmitted_<?php echo $submit_form_name; ?>" value="1" /> | |
| 354 | - <input type="hidden" name="form_visible_section" id="form_visible_section" value="" /> | |
| 655 | + // N o n c e field, and key for checking S u b m i t. | |
| 656 | + wp_nonce_field( 'wpbc_settings_page_' . $submit_form_name ); | |
| 657 | + ?> | |
| 658 | + <input type="hidden" name="is_form_sbmitted_<?php echo esc_attr( $submit_form_name ); ?>" id="is_form_sbmitted_<?php echo esc_attr( $submit_form_name ); ?>" value="1"/> | |
| 659 | + <input type="hidden" name="form_visible_section" id="form_visible_section" value=""/> | |
| 355 | 660 | |
| 356 | - <?php if ( wpbc_is_show_general_setting_options() ) { //FixIn: 8.9.4.11 ?> | |
| 661 | + <?php | |
| 662 | + if ( wpbc_is_show_general_setting_options() ) { | |
| 663 | + // FixIn: 8.9.4.11. | |
| 664 | + ?> | |
| 357 | 665 | |
| 358 | 666 | <div class="wpbc_settings_row wpbc_settings_row_full_width" > |
| 359 | 667 | |
| 360 | - <?php wpbc_open_meta_box_section( 'wpbc_general_settings_calendar', __('Calendar', 'booking'), array( 'is_section_visible_after_load' => true, 'is_show_minimize' => false ) ); ?> | |
| 668 | + <div id="wpbc_general_settings_dashboard_metabox" class="postbox" | |
| 669 | + style="background: transparent;border: 0;box-shadow: none;"><?php //wpbc_open_meta_box_section( 'wpbc_general_settings_dashboard', __('Dashboard'), array( 'is_section_visible_after_load' => true, 'is_show_minimize' => false ) ); ?> | |
| 670 | + <?php | |
| 361 | 671 | |
| 362 | - <?php $this->settings_api()->show( 'calendar' ); ?> | |
| 672 | + wpbc_ui_settings__panel__statistic(); | |
| 363 | 673 | |
| 364 | - <?php wpbc_close_meta_box_section(); ?> | |
| 674 | + wpbc_ui_settings__panel__all_settings_panels(); | |
| 365 | 675 | |
| 676 | + wpbc_ui_settings__panel__plugin_version(); | |
| 366 | 677 | |
| 367 | - <?php wpbc_open_meta_box_section( 'wpbc_general_settings_days_tooltips', __('Calendar Dates Tooltips', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> | |
| 678 | + ?></div><?php //wpbc_close_meta_box_section(); ?> | |
| 368 | 679 | |
| 369 | - <?php $this->settings_api()->show( 'days_tooltips' ); ?> | |
| 680 | + <?php | |
| 681 | + wpbc_open_meta_box_section( 'wpbc_general_settings_booking_confirmation', | |
| 682 | + __( 'Booking Confirmation', 'booking' ), | |
| 683 | + array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); | |
| 684 | + $this->settings_api()->show( 'booking_confirmation' ); | |
| 685 | + wpbc_close_meta_box_section(); | |
| 686 | + ?> | |
| 687 | + <div class="wpbc_settings_row wpbc_settings_row_left"> | |
| 688 | + <?php | |
| 689 | + wpbc_open_meta_box_section( 'wpbc_general_settings_booking_confirmation_left', | |
| 690 | + __( 'Section', 'booking' ) . ': ' . __( 'Personal Information', 'booking' ), | |
| 691 | + array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); | |
| 692 | + $this->settings_api()->show( 'booking_confirmation_left' ); | |
| 693 | + wpbc_close_meta_box_section(); | |
| 370 | 694 | |
| 371 | - <?php wpbc_close_meta_box_section(); ?> | |
| 695 | + wpbc_open_meta_box_section( 'wpbc_general_settings_booking_confirmation_right', | |
| 696 | + __( 'Section', 'booking' ) . ': ' . __( 'Booking details', 'booking' ), | |
| 697 | + array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); | |
| 698 | + $this->settings_api()->show( 'booking_confirmation_right' ); | |
| 699 | + wpbc_close_meta_box_section(); | |
| 700 | + ?> | |
| 701 | + </div> | |
| 702 | + <div class="wpbc_settings_row wpbc_settings_row_right"> | |
| 703 | + <?php | |
| 704 | + wpbc_open_meta_box_section( 'wpbc_general_settings_booking_confirmation_help', | |
| 705 | + __( 'Shortcodes', 'booking' ), | |
| 706 | + array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); | |
| 707 | + $this->settings_api()->show( 'booking_confirmation_help' ); | |
| 708 | + wpbc_close_meta_box_section(); | |
| 709 | + ?> | |
| 710 | + </div> | |
| 711 | + <div class="clear"></div> | |
| 372 | 712 | |
| 373 | - | |
| 374 | - | |
| 375 | - <?php wpbc_open_meta_box_section( 'wpbc_general_settings_time_slots', __('Time Slots', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> | |
| 376 | - | |
| 377 | - <?php $this->settings_api()->show( 'time_slots' ); ?> | |
| 378 | - | |
| 379 | - <?php wpbc_close_meta_box_section(); ?> | |
| 380 | - | |
| 381 | - | |
| 382 | - <?php wpbc_open_meta_box_section( 'wpbc_general_settings_availability', __('Availability', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> | |
| 383 | - | |
| 384 | - <?php $this->settings_api()->show( 'availability' ); ?> | |
| 385 | - | |
| 386 | - <?php wpbc_close_meta_box_section(); ?> | |
| 387 | - | |
| 388 | - | |
| 389 | - <?php wpbc_open_meta_box_section( 'wpbc_general_settings_form', __('Form Options', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> | |
| 390 | - | |
| 391 | - <?php $this->settings_api()->show( 'form' ); ?> | |
| 392 | - | |
| 393 | - <?php wpbc_close_meta_box_section(); ?> | |
| 394 | - | |
| 395 | - | |
| 396 | - <?php wpbc_open_meta_box_section( 'wpbc_general_settings_booking_confirmation', __('Booking Confirmation', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> | |
| 397 | - | |
| 398 | - <?php $this->settings_api()->show( 'booking_confirmation' ); ?> | |
| 399 | - | |
| 400 | - <?php wpbc_close_meta_box_section(); ?> | |
| 401 | - | |
| 402 | - | |
| 403 | 713 | <?php if ( class_exists('wpdev_bk_personal') ) { ?> |
| 404 | 714 | <?php wpbc_open_meta_box_section( 'wpbc_general_settings_bookings_options', __('Bookings Options', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 405 | 715 | |
| 406 | 716 | <?php $this->settings_api()->show( 'bookings_options' ); ?> |
| @@ -417,9 +727,9 @@ | ||
| 417 | 727 | |
| 418 | 728 | |
| 419 | 729 | <?php wpbc_open_meta_box_section( 'wpbc_general_settings_booking_calendar_overview', __('Calendar Overview (admin panel)', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 420 | 730 | |
| 421 | - <?php //FixIn: 8.5.2.20 | |
| 731 | + <?php // FixIn: 8.5.2.20. | |
| 422 | 732 | $this->settings_api()->show( 'booking_calendar_overview' ); |
| 423 | 733 | ?> |
| 424 | 734 | |
| 425 | 735 | <?php wpbc_close_meta_box_section(); ?> |
| @@ -444,49 +754,8 @@ | ||
| 444 | 754 | <?php wpbc_close_meta_box_section(); ?> |
| 445 | 755 | |
| 446 | 756 | <?php } ?> |
| 447 | 757 | |
| 448 | - | |
| 449 | - | |
| 450 | - <?php wpbc_open_meta_box_section( 'wpbc_general_settings_capacity', __('Capacity', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> | |
| 451 | - | |
| 452 | - <?php $this->settings_api()->show( 'capacity' ); ?> | |
| 453 | - | |
| 454 | - <?php wpbc_close_meta_box_section(); ?> | |
| 455 | - | |
| 456 | - | |
| 457 | - <?php | |
| 458 | - if ( ! class_exists( 'wpdev_bk_personal' ) ) { | |
| 459 | - | |
| 460 | - $wpbc_metabox_id = 'wpbc_general_settings_capacity_upgrade'; | |
| 461 | - | |
| 462 | - ob_start(); | |
| 463 | - $is_panel_visible = wpbc_is_dismissed( $wpbc_metabox_id . '_metabox', array( | |
| 464 | - 'title' => '<i class="menu_icon icon-1x wpbc_icn_close"></i> ', | |
| 465 | - 'hint' => __( 'Dismiss', 'booking' ), | |
| 466 | - 'class' => 'wpbc_panel_get_started_dismiss', | |
| 467 | - 'css' => 'background: #fff;border-radius: 7px;' | |
| 468 | - )); | |
| 469 | - ?><script type="text/javascript"> jQuery('#<?php echo $wpbc_metabox_id; ?>_metabox').hide(); </script><?php | |
| 470 | - $dismiss_button_content = ob_get_clean(); | |
| 471 | - | |
| 472 | - if ( $is_panel_visible ) { | |
| 473 | - | |
| 474 | - wpbc_open_meta_box_section( $wpbc_metabox_id, | |
| 475 | - __('Booking Quantity Control - Set limits for the number of bookings per day or time slot.', 'booking'), | |
| 476 | - array( 'is_section_visible_after_load' => false, | |
| 477 | - 'is_show_minimize' => false, | |
| 478 | - 'dismiss_button' => $dismiss_button_content | |
| 479 | - ) ); | |
| 480 | - | |
| 481 | - $this->settings_api()->show( 'capacity_upgrade' ); | |
| 482 | - | |
| 483 | - wpbc_close_meta_box_section(); | |
| 484 | - } | |
| 485 | - } | |
| 486 | - ?> | |
| 487 | - | |
| 488 | - | |
| 489 | 758 | <?php wpbc_open_meta_box_section( 'wpbc_general_settings_advanced', __('Advanced', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| 490 | 759 | |
| 491 | 760 | <?php $this->settings_api()->show( 'advanced' ); ?> |
| 492 | 761 | |
| @@ -492,13 +761,13 @@ | ||
| 492 | 761 | |
| 493 | 762 | <?php wpbc_close_meta_box_section(); ?> |
| 494 | 763 | |
| 495 | 764 | |
| 496 | - <?php wpbc_open_meta_box_section( 'wpbc_general_settings_information', __('Information', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> | |
| 765 | + <?php wpbc_open_meta_box_section( 'wpbc_general_settings_information', __('Information', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> | |
| 497 | 766 | |
| 498 | - <?php $this->settings_api()->show( 'information' ); ?> | |
| 767 | + <?php $this->settings_api()->show( 'information' ); ?> | |
| 499 | 768 | |
| 500 | - <?php wpbc_close_meta_box_section(); ?> | |
| 769 | + <?php wpbc_close_meta_box_section(); ?> | |
| 501 | 770 | |
| 502 | 771 | |
| 503 | 772 | |
| 504 | 773 | <?php wpbc_open_meta_box_section( 'wpbc_general_settings_datestimes', __('Date : Time', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> |
| @@ -522,16 +791,20 @@ | ||
| 522 | 791 | |
| 523 | 792 | <?php wpbc_close_meta_box_section(); ?> |
| 524 | 793 | |
| 525 | 794 | <?php if ( ( class_exists( 'wpdev_bk_personal' ) ) && ( ! wpbc_is_this_demo() ) ) { ?> |
| 526 | - <?php wpbc_open_meta_box_section( 'wpbc_general_settings_help', __('Tools', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> | |
| 795 | + <?php wpbc_open_meta_box_section( 'wpbc_general_settings_help', __( 'Tools', 'booking' ), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> | |
| 527 | 796 | |
| 528 | - <?php $this->settings_api()->show( 'help' ); ?> | |
| 529 | - | |
| 530 | - <?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(); ?> | |
| 531 | 804 | <?php } ?> |
| 532 | 805 | |
| 533 | - <?php wpbc_open_meta_box_section( 'wpbc_general_settings_translations', __('Translations', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> | |
| 806 | + <?php wpbc_open_meta_box_section( 'wpbc_general_settings_translations', __( 'Translations', 'booking' ), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> | |
| 534 | 807 | |
| 535 | 808 | <?php $this->settings_api()->show( 'translations' ); ?> |
| 536 | 809 | |
| 537 | 810 | <?php wpbc_translation_buttons_settings_section(); ?> |
| @@ -537,34 +810,31 @@ | ||
| 537 | 810 | <?php wpbc_translation_buttons_settings_section(); ?> |
| 538 | 811 | |
| 539 | 812 | <?php wpbc_close_meta_box_section(); ?> |
| 540 | 813 | |
| 541 | - <?php if ( class_exists('wpdev_bk_multiuser') ) { //FixIn: 9.2.3.8 ?> | |
| 542 | - | |
| 543 | - <?php wpbc_open_meta_box_section( 'wpbc_general_settings_multiuser', __('Multiuser options', 'booking'), array( 'is_section_visible_after_load' => false, 'is_show_minimize' => false ) ); ?> | |
| 544 | - | |
| 545 | - <?php $this->settings_api()->show( 'multiuser' ); ?> | |
| 546 | - | |
| 547 | - <?php wpbc_close_meta_box_section(); ?> | |
| 548 | - | |
| 549 | - <?php } ?> | |
| 550 | - | |
| 551 | 814 | </div> |
| 552 | - | |
| 553 | 815 | <div class="clear"></div> |
| 554 | - <input type="submit" value="<?php _e('Save Changes','booking'); ?>" class="button button-primary wpbc_submit_button" /> | |
| 555 | - <?php | |
| 816 | + <div class="container_for_save_buttons"> | |
| 817 | + <input type="submit" value="<?php esc_attr_e( 'Save Changes', 'booking' ); ?>" class="button button-primary wpbc_submit_button"/> | |
| 818 | + <span class="sub_right"> | |
| 819 | + <a style="margin:0;" class="button button" | |
| 820 | + onclick="javascript:wpbc_ui_settings__panel__click( '#wpbc_general_settings_all_tab a' ,'.postbox', 'Show All Settings' );" | |
| 821 | + href="javascript:void(0);"> | |
| 822 | + <?php | |
| 823 | + esc_html_e( 'Show All Settings', 'booking' ) | |
| 824 | + ?> | |
| 825 | + </a> | |
| 826 | + <?php | |
| 556 | 827 | if ( 'translations_updated_from_wpbc_and_wp' !== get_bk_option( 'booking_translation_update_status' ) ) { |
| 557 | 828 | |
| 558 | 829 | $current_locale = wpbc_get_maybe_reloaded_booking_locale(); |
| 559 | 830 | |
| 560 | - if ( ! in_array( $current_locale, array( 'en_US', 'en_CA', 'en_GB', 'en_AU' ) ) ) { | |
| 831 | + if ( ! in_array( $current_locale, array( 'en_US', 'en_CA', 'en_GB', 'en_AU' ), true ) ) { | |
| 561 | 832 | |
| 562 | - echo | |
| 563 | - '<a class="button button" href="' | |
| 564 | - . wpbc_get_settings_url() | |
| 565 | - . '&system_info=show&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) .'&update_translations=1#wpbc_general_settings_system_info_metabox">' | |
| 566 | - . __( 'Update Translations' ) | |
| 833 | + echo '<a class="button button" href="' | |
| 834 | + . esc_url( wpbc_get_settings_url() . '&system_info=show&_wpnonce=' . wp_create_nonce( 'wpbc_settings_url_nonce' ) . '&update_translations=1#wpbc_general_settings_system_info_metabox' ) | |
| 835 | + . '">' | |
| 836 | + . esc_html__( 'Update Translations', 'booking' ) | |
| 567 | 837 | . '</a>'; |
| 568 | 838 | } |
| 569 | 839 | } |
| 570 | 840 | |
| @@ -569,14 +839,17 @@ | ||
| 569 | 839 | } |
| 570 | 840 | |
| 571 | 841 | if ( ! wpbc_is_this_demo() ) { |
| 572 | 842 | |
| 573 | - echo '<a style="margin:0 2em;" class="button button" href="' . wpbc_get_settings_url() | |
| 574 | - . '&system_info=show&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) .'&restore_dismissed=On#wpbc_general_settings_restore_dismissed_metabox">' | |
| 575 | - . __('Restore all dismissed windows' ,'booking') | |
| 843 | + echo '<a style="margin:0 2em;" class="button button" href="' | |
| 844 | + . esc_url( wpbc_get_settings_url() . '&system_info=show&_wpnonce=' . wp_create_nonce( 'wpbc_settings_url_nonce' ) . '&restore_dismissed=On#wpbc_general_settings_restore_dismissed_metabox' ) | |
| 845 | + . '">' | |
| 846 | + . esc_html__( 'Restore all dismissed windows', 'booking' ) | |
| 576 | 847 | . '</a>'; |
| 577 | 848 | } |
| 578 | - ?> | |
| 849 | + ?> | |
| 850 | + </span> | |
| 851 | + </div> | |
| 579 | 852 | |
| 580 | 853 | <?php } ?> |
| 581 | 854 | </form> |
| 582 | 855 | </span> |
| @@ -590,36 +863,51 @@ | ||
| 590 | 863 | do_action( 'wpbc_hook_settings_page_footer', 'general_settings' ); |
| 591 | 864 | } |
| 592 | 865 | |
| 593 | 866 | |
| 594 | - public function update() { | |
| 867 | + public function update() { | |
| 595 | 868 | |
| 596 | - $validated_fields = $this->settings_api()->validate_post(); // Get Validated Settings fields in $_POST request. | |
| 597 | - | |
| 598 | - $validated_fields = apply_filters( 'wpbc_settings_validate_fields_before_saving', $validated_fields ); //Hook for validated fields. | |
| 869 | + $validated_fields = $this->settings_api()->validate_post(); // Get Validated Settings fields in $_POST request. | |
| 599 | 870 | |
| 600 | - // unset($validated_fields['booking_start_day_weeek']); // Skip saving specific option, for example in Demo mode. | |
| 871 | + $validated_fields = apply_filters( 'wpbc_settings_validate_fields_before_saving', $validated_fields ); // Hook for validated fields. | |
| 601 | 872 | |
| 602 | - //FixIn: 9.8.6.1 | |
| 603 | - if ( ! empty( $_POST['form_visible_section'] ) ) { | |
| 604 | - ?><script type="text/javascript"> | |
| 605 | - jQuery(document).ready(function(){ | |
| 606 | - jQuery( '<?php echo esc_js( $_POST['form_visible_section'] ); ?> a' ).trigger('click'); | |
| 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 | + | |
| 879 | + /** | |
| 880 | + * Skip saving specific option, for example in Demo mode. | |
| 881 | + * // unset( $validated_fields['booking_start_day_weeek'] ); | |
| 882 | + */ | |
| 883 | + | |
| 884 | + // FixIn: 9.8.6.1. | |
| 885 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing | |
| 886 | + if ( ! empty( $_POST['form_visible_section'] ) ) { | |
| 887 | + ?> | |
| 888 | + <script type="text/javascript"> | |
| 889 | + jQuery(document).ready(function () { | |
| 890 | + jQuery('<?php | |
| 891 | + // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 892 | + echo esc_js( $_POST['form_visible_section'] ); | |
| 893 | + ?> a').trigger('click'); | |
| 607 | 894 | }); |
| 608 | - </script><?php | |
| 609 | - } | |
| 895 | + </script> | |
| 896 | + <?php | |
| 897 | + } | |
| 610 | 898 | |
| 611 | - $this->settings_api()->save_to_db( $validated_fields ); // Save fields to DB | |
| 899 | + $this->settings_api()->save_to_db( $validated_fields ); // Save fields to DB. | |
| 612 | 900 | |
| 613 | 901 | wpbc_show_changes_saved_message(); |
| 614 | 902 | |
| 615 | - /** | |
| 616 | - // O L D W A Y: Saving Fields Data | |
| 617 | - // update_bk_option( 'booking_is_delete_if_deactive' | |
| 618 | - // , WPBC_Settings_API::validate_checkbox_post('booking_is_delete_if_deactive') ); | |
| 619 | - // ( (isset( $_POST['booking_is_delete_if_deactive'] ))?'On':'Off') ); | |
| 620 | - */ | |
| 621 | - } | |
| 903 | + /** | |
| 904 | + * // O L D W A Y: Saving Fields Data | |
| 905 | + * // update_bk_option( 'booking_is_delete_if_deactive' | |
| 906 | + * // , WPBC_Settings_API::validate_checkbox_post('booking_is_delete_if_deactive') ); | |
| 907 | + * // ( (isset( $_POST['booking_is_delete_if_deactive'] ))?'On':'Off') ); | |
| 908 | + */ | |
| 909 | + } | |
| 622 | 910 | } |
| 623 | 911 | |
| 624 | 912 | |
| 625 | 913 | /** |
| @@ -626,9 +914,9 @@ | ||
| 626 | 914 | * |
| 627 | 915 | |
| 628 | 916 | if ( ! wpbc_is_mu_user_can_be_here( 'only_super_admin' ) ) { // If this User not "super admin", then do not load this page at all |
| 629 | 917 | |
| 630 | - if ( ( ! isset( $_GET['tab'] ) ) || ( $_GET['tab'] == 'general' ) ) { // If tab was not selected or selected default, then redirect it to the "form" tab. | |
| 918 | + if ( ( ! isset( $ _GET['tab'] ) ) || ( $_GET['tab'] == 'general' ) ) { // If tab was not selected or selected default, then redirect it to the "form" tab. | |
| 631 | 919 | $_GET['tab'] = 'form'; |
| 632 | 920 | } |
| 633 | 921 | } else { |
| 634 | 922 | add_action('wpbc_menu_created', array( new WPBC_Page_SettingsGeneral() , '__construct') ); // Executed after creation of Menu |
| @@ -635,5 +923,5 @@ | ||
| 635 | 923 | } |
| 636 | 924 | */ |
| 637 | 925 | |
| 638 | 926 | add_action('wpbc_menu_created', array( new WPBC_Page_SettingsGeneral() , '__construct') ); // Executed after creation of Menu |
| 639 | - | |
| 927 | + | |