← All changes
|
includes/ui_settings/class-settings-page-parts.php
+81
-33
10.15.7
→
11.9
View file →
| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Page Structure in Admin Panel |
| 4 | 4 | * |
| @@ -70,22 +70,23 @@ | ||
| 70 | 70 | |
| 71 | 71 | // ------------------------------------------------------------------------------------------------------------- |
| 72 | 72 | // 'Left Sidebar' - By default it shoud be ''. Other options: '', 'min', 'compact', 'max'. |
| 73 | 73 | // ------------------------------------------------------------------------------------------------------------- |
| 74 | - $left_navigation__default_view_mode = strval( $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'left_navigation__default_view_mode' ) ); | |
| 74 | + $left_navigation__default_view_mode = strval( $this->page_structure_obj->get_left_navigation_default_view_mode() ); | |
| 75 | + $left_navigation__is_user_mode_enabled = $this->page_structure_obj->is_left_navigation_user_mode_enabled(); | |
| 75 | 76 | |
| 76 | 77 | if ( ! empty( $left_navigation__default_view_mode ) ) { |
| 77 | 78 | if ( 'none' === $left_navigation__default_view_mode ) { |
| 78 | - echo '<script type="text/javascript"> jQuery( document ).ready( function () { wpbc_admin_ui__sidebar_left__do_hide(); } ); </script>'; | |
| 79 | + echo '<script type="text/javascript"> jQuery( document ).ready( function () { if ( "function" === typeof wpbc_admin_ui__sidebar_left__do_hide ) { wpbc_admin_ui__sidebar_left__do_hide(); } } ); </script>'; | |
| 79 | 80 | } |
| 80 | 81 | if ( 'min' === $left_navigation__default_view_mode ) { |
| 81 | - echo '<script type="text/javascript"> jQuery( document ).ready( function () { wpbc_admin_ui__sidebar_left__do_min(); } ); </script>'; | |
| 82 | + echo '<script type="text/javascript"> jQuery( document ).ready( function () { if ( "function" === typeof wpbc_admin_ui__sidebar_left__do_min ) { wpbc_admin_ui__sidebar_left__do_min(); } } ); </script>'; | |
| 82 | 83 | } |
| 83 | 84 | if ( 'compact' === $left_navigation__default_view_mode ) { |
| 84 | - echo '<script type="text/javascript"> jQuery( document ).ready( function () { wpbc_admin_ui__sidebar_left__do_compact(); } ); </script>'; | |
| 85 | + echo '<script type="text/javascript"> jQuery( document ).ready( function () { if ( "function" === typeof wpbc_admin_ui__sidebar_left__do_compact ) { wpbc_admin_ui__sidebar_left__do_compact(); } } ); </script>'; | |
| 85 | 86 | } |
| 86 | 87 | if ( 'max' === $left_navigation__default_view_mode ) { |
| 87 | - echo '<script type="text/javascript"> jQuery( document ).ready( function () { wpbc_admin_ui__sidebar_left__do_max(); } ); </script>'; | |
| 88 | + echo '<script type="text/javascript"> jQuery( document ).ready( function () { if ( "function" === typeof wpbc_admin_ui__sidebar_left__do_max ) { wpbc_admin_ui__sidebar_left__do_max(); } } ); </script>'; | |
| 88 | 89 | } |
| 89 | 90 | } |
| 90 | 91 | |
| 91 | 92 | // ------------------------------------------------------------------------------------------------------------- |
| @@ -90,24 +91,31 @@ | ||
| 90 | 91 | |
| 91 | 92 | // ------------------------------------------------------------------------------------------------------------- |
| 92 | 93 | // 'Right Sidebar' - By default it shoud be ''. Other options: '', 'min', 'compact', 'max'. |
| 93 | 94 | // ------------------------------------------------------------------------------------------------------------- |
| 94 | - $right_vertical_sidebar__is_show = $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'right_vertical_sidebar__is_show' ); | |
| 95 | - $right_vertical_sidebar__default_view_mode = strval( $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'right_vertical_sidebar__default_view_mode' ) ); | |
| 96 | - $right_vertical_sidebar__default_view_mode = ( ! empty( $right_vertical_sidebar__default_view_mode ) ) ? $right_vertical_sidebar__default_view_mode . '_right' : $right_vertical_sidebar__default_view_mode; | |
| 95 | + $right_vertical_sidebar__is_show = $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'right_vertical_sidebar__is_show' ); | |
| 96 | + $right_vertical_sidebar__default_view_mode = strval( $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'right_vertical_sidebar__default_view_mode' ) ); | |
| 97 | + $right_vertical_sidebar__default_view_mode = ( ! empty( $right_vertical_sidebar__default_view_mode ) ) ? $right_vertical_sidebar__default_view_mode . '_right' : $right_vertical_sidebar__default_view_mode; | |
| 98 | + $right_sidebar_content_click_collapse_mode = $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'right_vertical_sidebar__content_click_collapse_mode' ); | |
| 99 | + $right_sidebar_content_click_collapse_mode = is_scalar( $right_sidebar_content_click_collapse_mode ) | |
| 100 | + ? sanitize_key( (string) $right_sidebar_content_click_collapse_mode ) | |
| 101 | + : ''; | |
| 102 | + $right_sidebar_content_click_collapse_mode = in_array( $right_sidebar_content_click_collapse_mode, array( 'min', 'compact', 'none' ), true ) | |
| 103 | + ? $right_sidebar_content_click_collapse_mode | |
| 104 | + : ''; | |
| 97 | 105 | |
| 98 | 106 | if ( ! empty( $right_vertical_sidebar__default_view_mode ) ) { |
| 99 | 107 | if ( 'none_right' === $right_vertical_sidebar__default_view_mode ) { |
| 100 | - echo '<script type="text/javascript"> jQuery( document ).ready( function () { wpbc_admin_ui__sidebar_right__do_hide(); } ); </script>'; | |
| 108 | + echo '<script type="text/javascript"> jQuery( document ).ready( function () { if ( "function" === typeof wpbc_admin_ui__sidebar_right__do_hide ) { wpbc_admin_ui__sidebar_right__do_hide(); } } ); </script>'; | |
| 101 | 109 | } |
| 102 | 110 | if ( 'min_right' === $right_vertical_sidebar__default_view_mode ) { |
| 103 | - echo '<script type="text/javascript"> jQuery( document ).ready( function () { wpbc_admin_ui__sidebar_right__do_min(); } ); </script>'; | |
| 111 | + echo '<script type="text/javascript"> jQuery( document ).ready( function () { if ( "function" === typeof wpbc_admin_ui__sidebar_right__do_min ) { wpbc_admin_ui__sidebar_right__do_min(); } } ); </script>'; | |
| 104 | 112 | } |
| 105 | 113 | if ( 'compact_right' === $right_vertical_sidebar__default_view_mode ) { |
| 106 | - echo '<script type="text/javascript"> jQuery( document ).ready( function () { wpbc_admin_ui__sidebar_right__do_compact(); } ); </script>'; | |
| 114 | + echo '<script type="text/javascript"> jQuery( document ).ready( function () { if ( "function" === typeof wpbc_admin_ui__sidebar_right__do_compact ) { wpbc_admin_ui__sidebar_right__do_compact(); } } ); </script>'; | |
| 107 | 115 | } |
| 108 | 116 | if ( 'max_right' === $right_vertical_sidebar__default_view_mode ) { |
| 109 | - echo '<script type="text/javascript"> jQuery( document ).ready( function () { wpbc_admin_ui__sidebar_right__do_max(); } ); </script>'; | |
| 117 | + echo '<script type="text/javascript"> jQuery( document ).ready( function () { if ( "function" === typeof wpbc_admin_ui__sidebar_right__do_max ) { wpbc_admin_ui__sidebar_right__do_max(); } } ); </script>'; | |
| 110 | 118 | } |
| 111 | 119 | } |
| 112 | 120 | // ------------------------------------------------------------------------------------------------------------- |
| 113 | 121 | |
| @@ -120,11 +128,12 @@ | ||
| 120 | 128 | '">'; |
| 121 | 129 | |
| 122 | 130 | wpbc_ui__top_nav( |
| 123 | 131 | array( |
| 124 | - 'page_tag' => $this->active_page, | |
| 125 | - 'active_page_tab' => $this->active_tab, | |
| 126 | - 'active_page_subtab' => $this->active_subtab, | |
| 132 | + 'page_tag' => $this->active_page, | |
| 133 | + 'active_page_tab' => $this->active_tab, | |
| 134 | + 'active_page_subtab' => $this->active_subtab, | |
| 135 | + 'is_full_screen_user_mode_enabled' => $this->page_structure_obj->is_full_screen_user_mode_enabled(), | |
| 127 | 136 | ) |
| 128 | 137 | ); |
| 129 | 138 | |
| 130 | 139 | // Fires Before showing settings Content page ( for example in setup Wizard for show_top_right_wizard_button ). |
| @@ -129,13 +138,30 @@ | ||
| 129 | 138 | |
| 130 | 139 | // Fires Before showing settings Content page ( for example in setup Wizard for show_top_right_wizard_button ). |
| 131 | 140 | do_action( 'wpbc_after_wpbc_page_top__header_tabs', $this->active_page, $this->active_tab, $this->active_subtab ); |
| 132 | 141 | |
| 133 | - echo '<div class="wpbc_settings_page_wrapper ' . | |
| 134 | - esc_attr( $left_navigation__default_view_mode ) . ' ' . | |
| 135 | - esc_attr( $right_vertical_sidebar__default_view_mode ) . | |
| 136 | - '">'; | |
| 142 | + echo '<div class="wpbc_settings_page_wrapper ' . | |
| 143 | + esc_attr( $left_navigation__default_view_mode ) . ' ' . | |
| 144 | + esc_attr( $right_vertical_sidebar__default_view_mode ) . | |
| 145 | + '" data-wpbc-left-sidebar-user-mode="' . esc_attr( $left_navigation__is_user_mode_enabled ? '1' : '0' ) . '"' . | |
| 146 | + ( $right_sidebar_content_click_collapse_mode | |
| 147 | + ? ' data-wpbc-right-sidebar-content-click-collapse-mode="' . esc_attr( $right_sidebar_content_click_collapse_mode ) . '"' | |
| 148 | + : '' ) . | |
| 149 | + '>'; | |
| 137 | 150 | |
| 151 | + if ( $left_navigation__is_user_mode_enabled ) { | |
| 152 | + $user_cust_option = 'left_sidebar_view_mode'; | |
| 153 | + $nonce_action = $user_cust_option . '_nonce_act'; | |
| 154 | + | |
| 155 | + echo '<span id="wpbc_left_sidebar_view_mode_saver" style="display:none;"' . | |
| 156 | + ' data-wpbc-u-save-name="' . esc_attr( $user_cust_option ) . '"' . | |
| 157 | + ' data-wpbc-u-save-value="' . esc_attr( $left_navigation__default_view_mode ) . '"' . | |
| 158 | + ' data-wpbc-u-save-nonce="' . esc_attr( wp_create_nonce( $nonce_action ) ) . '"' . | |
| 159 | + ' data-wpbc-u-save-user-id="' . esc_attr( wpbc_get_current_user_id() ) . '"' . | |
| 160 | + ' data-wpbc-u-save-action="' . esc_attr( $nonce_action ) . '"' . | |
| 161 | + '></span>'; | |
| 162 | + } | |
| 163 | + | |
| 138 | 164 | // Left vertical menu. |
| 139 | 165 | wpbc_ui__left_vertical_nav( |
| 140 | 166 | array( |
| 141 | 167 | 'active_page' => $this->active_page, // wpbc-settings. |
| @@ -144,28 +170,50 @@ | ||
| 144 | 170 | 'page_nav_tabs' => $this->page_structure_obj->get_nav_tabs(), |
| 145 | 171 | ) |
| 146 | 172 | ); |
| 147 | 173 | |
| 148 | - ?> | |
| 149 | - <div class="wpbc_settings_page_content"> | |
| 150 | - <div id="<?php echo esc_attr( $this->active_page ); ?>-admin-page" class="wrap wpbc_page wpbc_page_tab__<?php echo esc_attr( $this->active_tab ); ?> wpbc_page_subtab__<?php echo esc_attr( $this->active_subtab ); ?>"> | |
| 174 | + ?> | |
| 175 | + <div class="wpbc_settings_page_content"> | |
| 176 | + <?php | |
| 177 | + // Initialize shared sidebar and page-control tooltips once per request. | |
| 178 | + if ( function_exists( 'wpbc_bs_javascript_tooltips' ) ) { | |
| 179 | + wpbc_bs_javascript_tooltips(); | |
| 180 | + } | |
| 181 | + ?> | |
| 182 | + <div id="<?php echo esc_attr( $this->active_page ); ?>-admin-page" class="wrap wpbc_page wpbc_page_tab__<?php echo esc_attr( $this->active_tab ); ?> wpbc_page_subtab__<?php echo esc_attr( $this->active_subtab ); ?>"> | |
| 151 | 183 | <div class="wpbc_admin_message"></div> |
| 152 | 184 | <div class="wpbc_admin_page"> |
| 153 | - <div id="ajax_working"></div> | |
| 185 | + <div id="ajax_working"> | |
| 186 | + <?php | |
| 187 | + /** | |
| 188 | + * Fires inside the Booking Calendar floating admin-message container. | |
| 189 | + * | |
| 190 | + * Persistent or actionable messages rendered here use the same fixed | |
| 191 | + * top-right presentation as transient Booking Calendar AJAX notices. | |
| 192 | + * | |
| 193 | + * @param string $active_page Current Booking Calendar page slug. | |
| 194 | + * @param string $active_tab Current active tab slug. | |
| 195 | + * @param string $active_subtab Current active subtab slug. | |
| 196 | + */ | |
| 197 | + do_action( 'wpbc_inside_ui__admin_messages', $this->active_page, $this->active_tab, $this->active_subtab ); | |
| 198 | + ?> | |
| 199 | + </div> | |
| 154 | 200 | <div class="clear wpbc_header_margin" style="height:0px;"></div> |
| 155 | 201 | <div id="ajax_respond" class="ajax_respond" style="display:none;"></div> |
| 156 | 202 | <div class="clear"></div> |
| 157 | 203 | <?php |
| 158 | 204 | |
| 159 | - $is_show_top_path = $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'is_show_top_path' ); | |
| 205 | + $is_show_top_path = method_exists( $this->page_structure_obj, 'is_top_path_enabled' ) | |
| 206 | + ? $this->page_structure_obj->is_top_path_enabled() | |
| 207 | + : $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'is_show_top_path' ); | |
| 160 | 208 | if ( $is_show_top_path ) { |
| 161 | - wpbc_ui_settings__top_path(); | |
| 209 | + wpbc_ui_settings__top_path( $this->page_structure_obj ); | |
| 162 | 210 | } |
| 163 | 211 | |
| 164 | 212 | $is_show_top_navigation = $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'is_show_top_navigation' ); |
| 165 | - if ( $is_show_top_navigation ) { | |
| 166 | - // Top horisonal menu. | |
| 167 | - wpbc_ui__top_horisontal_nav( | |
| 213 | + if ( $is_show_top_navigation ) { | |
| 214 | + // Top horisonal menu. | |
| 215 | + wpbc_ui__top_horisontal_nav( | |
| 168 | 216 | array( |
| 169 | 217 | 'active_page' => $this->active_page, // wpbc-settings. |
| 170 | 218 | 'active_tab' => $this->active_tab, // calendar_appearance. |
| 171 | 219 | 'active_subtab' => $this->active_subtab, // calendar_appearance_skin. |
| @@ -170,12 +218,12 @@ | ||
| 170 | 218 | 'active_tab' => $this->active_tab, // calendar_appearance. |
| 171 | 219 | 'active_subtab' => $this->active_subtab, // calendar_appearance_skin. |
| 172 | 220 | 'page_nav_tabs' => $this->page_structure_obj->get_nav_tabs(), |
| 173 | 221 | ) |
| 174 | - ); | |
| 175 | - } | |
| 176 | - | |
| 177 | - $this->show_title_and_description(); | |
| 222 | + ); | |
| 223 | + } | |
| 224 | + | |
| 225 | + $this->show_title_and_description(); | |
| 178 | 226 | } |
| 179 | 227 | |
| 180 | 228 | |
| 181 | 229 | /** |
| @@ -226,9 +274,9 @@ | ||
| 226 | 274 | * then this code, remove the 'wp-toolbar' class from html tag |
| 227 | 275 | * and set correct 'full screen' or 'normal' buttons in the rop right side! |
| 228 | 276 | */ |
| 229 | 277 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 230 | - echo '<script type="text/javascript">' . wpbc_jq_ready_start() . 'wpbc_check_full_screen_mode();' . wpbc_jq_ready_end() . '</script>'; | |
| 278 | + echo '<script type="text/javascript">' . wpbc_jq_ready_start() . 'if ( "function" === typeof wpbc_check_full_screen_mode ) { wpbc_check_full_screen_mode(); }' . wpbc_jq_ready_end() . '</script>'; | |
| 231 | 279 | } |
| 232 | 280 | |
| 233 | 281 | |
| 234 | 282 | /** |