PluginProbe
Booking Calendar / 11.6
Booking Calendar v11.6
11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 10.11.2 All 203 releases
booking / includes / ui_settings / class-menu-structure.php

class-menu-structure.php in Booking Calendar 11.6, at includes/ui_settings/class-menu-structure.php

657 lines 26.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Menu Structure in Admin Panel
4 *
5 * @version 1.0
6 * @package Any
7 * @category Plugin Menu Structure - in Admin Panel
8 * @author wpdevelop
9 *
10 * @web-site https://wpbookingcalendar.com/
11 * @email info@wpbookingcalendar.com
12 *
13 * @modified 2025-02-09
14 */
15
16 if ( ! defined( 'ABSPATH' ) ) {
17 exit; // Exit, if accessed directly.
18 }
19
20 // FixIn: 11.0.0.1.
21
22 /**
23 * Define Settings Page Structure
24 */
25 abstract class WPBC_Menu_Structure {
26
27 /**
28 * Parameters for current page, if this page selected, otherwise its = empty array()
29 *
30 * @var array
31 */
32 protected $current_page_params;
33
34 /**
35 * Tabs array, same for all objects.
36 *
37 * @var array
38 */
39 protected static $nav_tabs;
40
41 /**
42 * Defining Name of parameter in GET request for Navigation TOP and BOTTOM tabs: - $_GET[ 'tab' ] == 'payment' - $_GET[ 'subtab' ] == 'paypal'.
43 *
44 * @var array
45 */
46 protected $tags;
47
48
49 /**
50 * Constructor
51 */
52 public function __construct() {
53
54 self::$nav_tabs = array();
55
56 $this->current_page_params = array();
57
58 $this->tags = array();
59
60 // Defining Name of parameter in GET request - $_GET[ 'tab' ] == 'payment'.
61 $this->tags['tab'] = 'tab';
62
63 // Defining Name of parameter in GET request - $_GET[ 'subtab' ] == 'paypal'.
64 $this->tags['subtab'] = 'subtab';
65
66 // FixIn: 10.14.1.2.
67 // This Hook fire after creation menu in class WPBC_Admin_Menus.
68 add_action( 'wpbc_define_nav_tabs', array( $this, 'wpbc_create_plugin_menu_structure_arr' ), 10, 1 );
69
70 // Such calls requires for ability to use methods, such as $this->is_use_option__in_subtabs_or_tabs('...'), which can be run only after_tabs_defined !
71 // We set here priority 11, to load this function, after 'wpbc_create_plugin_menu_structure_arr', where defined all tabs.
72 add_action( 'wpbc_define_nav_tabs', array( $this, 'after_tabs_defined' ), 11, 1 );
73
74 // Right Vertical Sidebar. // FixIn: 10.14.1.3.
75 add_action( 'wpbc_ui__right_vertical_sidebar_content', array( $this, 'maybe_show_right_sidebar_content' ) );
76
77 // Right Vertical Sidebar - Compact. // FixIn: 10.14.1.3.
78 add_action( 'wpbc_ui__right_vertical_sidebar_compact_content', array( $this, 'maybe_show_right_sidebar_compact_content' ) );
79 }
80
81
82 // -----------------------------------------------------------------------------------------------------------------
83 // Abstract Methods
84 // -----------------------------------------------------------------------------------------------------------------
85
86 /**
87 * Define slug in what menu to show this page. // Parameter relative: $_GET['page'].
88 *
89 * @return string
90 *
91 * Example:
92 *
93 * return 'wpbc-settings';
94 */
95 abstract public function in_page();
96
97 /**
98 * Define Tabs and Subtabs of this Admin Page
99 *
100 * @return array();
101 *
102 * Example:
103 *
104 * $tabs = array();
105 * $tabs[ 'form' ] = array(
106 * 'title' => __('Form','booking') // Title of TAB
107 * , 'hint' => __('Customization of Form Fields', 'booking') // Hint
108 * , 'page_title' =>ucwords( __('Form fields', 'booking') ) // Title of Page
109 * //, 'link' => '' // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link
110 * //, 'position' => '' // 'left' || 'right' || ''
111 * //, 'css_classes' => '' // CSS class(es)
112 * //, 'icon' => '' // Icon - link to the real PNG img
113 * , 'font_icon' => 'wpbc_icn_draw' // CSS definition of forn Icon
114 * , 'default' => false // Is this tab activated by default or not: true || false.
115 * , 'disabled' => false // Is this tab disbaled: true || false.
116 * , 'hided' => false // Is this tab hided: true || false.
117 * , 'subtabs' => array()
118 *
119 * );
120 * $tabs[ 'upgrade' ] = array(
121 * 'title' => __('Upgrade','booking') // Title of TAB
122 * , 'hint' => __('Upgrade to higher version', 'booking') // Hint
123 * //, 'page_title' => __('Upgrade', 'booking') // Title of Page
124 * , 'link' => 'http://server.com/' // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link
125 * , 'position' => 'right' // 'left' || 'right' || ''
126 * //, 'css_classes' => '' // CSS class(es)
127 * //, 'icon' => '' // Icon - link to the real PNG img
128 * , 'font_icon' => 'wpbc_icn_auto_graph'// CSS definition of forn Icon
129 * //, 'default' => false // Is this tab activated by default or not: true || false.
130 * //, 'subtabs' => array()
131 *
132 * );
133 *
134 * $subtabs = array();
135 *
136 * $subtabs['fields'] = array(
137 * 'type' => 'subtab' // Required| Possible values: 'subtab' | 'separator' | 'button' | 'goto-link' | 'html'
138 * , 'title' => __('Form','booking') // Title of TAB
139 * , 'page_title' => __('Form Settings', 'booking') // Title of Page
140 * , 'hint' => __('Customization of Form Settings', 'booking') // Hint
141 * , 'link' => '' // link
142 * , 'position' => '' // 'left' || 'right' || ''
143 * , 'css_classes' => '' // CSS class(es)
144 * //, 'icon' => 'https://www.paypalobjects.com/webstatic/icon/pp258.png' // Icon - link to the real PNG img
145 * //, 'font_icon' => 'wpbc_icn_payment' // CSS definition of Font Icon
146 * , 'default' => true // Is this sub tab activated by default or not: true || false.
147 * , 'disabled' => false // Is this sub tab deactivated: true || false.
148 * , 'checkbox' => false // or definition array for specific checkbox: array( 'checked' => true, 'name' => 'feature1_active_status' )
149 * , 'content' => 'content' // Function to load as conten of this TAB
150 * );
151 *
152 * $subtabs['form-separator'] = array(
153 * 'type' => 'separator' // Required| Possible values: 'subtab' | 'separator' | 'button' | 'goto-link' | 'html'
154 * );
155 * $subtabs['form-goto'] = array(
156 * 'type' => 'goto-link' // Required| Possible values: 'subtab' | 'separator' | 'button' | 'goto-link' | 'html'
157 * , 'title' =>ucwords( __('Form fields', 'booking') ) // Title of TAB
158 * , 'hint' => '' // Hint
159 * , 'show_section' => 'id_of_show_section' // ID of HTML element, for scroll to.
160 * );
161 *
162 * ob_start();
163 * ...
164 * $html_element_data = ob_get_clean();
165 *
166 * $subtabs['form-selection'] = array(
167 * 'type' => 'html' // Required| Possible values: 'subtab' | 'separator' | 'button' | 'goto-link' | 'html'
168 * , 'html' => $html_element_data
169 * );
170 *
171 * $subtabs['form-save'] = array(
172 * 'type' => 'button' // Required| Possible values: 'subtab' | 'separator' | 'button' | 'goto-link' | 'html'
173 * , 'title' => __('Save Changes','booking') // Title of TAB
174 * , 'form' => 'wpbc_form' // Required for 'button'! Name of Form to submit
175 * );
176 *
177 * $tabs[ 'form' ][ 'subtabs' ] = $subtabs;
178 *
179 * return $tabs;
180 */
181 abstract public function tabs();
182
183 /**
184 * Show Content of this page - Main function.
185 *
186 * In top of this function have to be checking ubout Update (saving POST request).
187 *
188 * Exmaple:
189 *
190 * // S u b m i t ///////////////////////////////////////////////////////
191 *
192 * $this_submit_form = 'wpbc_emails_toolbar'; // Define form name
193 *
194 * // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
195 * if ( isset( $_POST['is_form_sbmitted_'. $this_submit_form ] ) ) {
196 *
197 * // Check N o n c e
198 * check_admin_referer( 'wpbc_settings_page_' . $this_submit_form ); // Its stop show anything on submiting, if its not refear to the original page
199 *
200 * // Make Update of settings
201 * $edit_field_data = $this->update_wpbc_emails_toolbar( $menu_slug );
202 * }
203 */
204 abstract public function content();
205
206
207 // -----------------------------------------------------------------------------------------------------------------
208 // Right Vertical Sidebar. // FixIn: 10.14.1.3.
209 // -----------------------------------------------------------------------------------------------------------------
210
211 /**
212 * Show content of right sidebar. Overide it in child classes !
213 *
214 * @return void
215 */
216 abstract public function right_sidebar_content();
217
218
219 /**
220 * Helper method to show 'right sidebar' only if it is enabled page!
221 *
222 * @return void
223 */
224 public function maybe_show_right_sidebar_content(){
225
226 if ( ! $this->is_page_activated() ) {
227 return false;
228 }
229
230 $this->right_sidebar_content();
231 }
232
233 /**
234 * Show content of right sidebar - Compact. Overide it in child classes !
235 *
236 * @return void
237 */
238 abstract public function right_sidebar_compact_content();
239
240
241 /**
242 * Helper method to show 'right sidebar' - Compact only if it is enabled page!
243 *
244 * @return void
245 */
246 public function maybe_show_right_sidebar_compact_content(){
247
248 if ( ! $this->is_page_activated() ) {
249 return false;
250 }
251
252 $this->right_sidebar_compact_content();
253 }
254
255 // -----------------------------------------------------------------------------------------------------------------
256 // Methods After 'Tabs' defined. // FixIn: 10.14.1.2.
257 // -----------------------------------------------------------------------------------------------------------------
258
259 /**
260 * We already prepeared all tabs and can use function such as $this->is_page_activated();
261 * // FixIn: 10.14.1.2.
262 *
263 * @return void
264 */
265 public function after_tabs_defined() {
266
267 // This call -> Initiate definition of all parameters for current page.
268 $is_page_activated = $this->is_page_activated();
269
270 if ( $is_page_activated ) {
271 add_filter( 'admin_body_class', array( $this, 'admin_body_class__add_loading_classes' ) );
272 }
273 }
274
275
276 /**
277 * Check if this page have to load in default Full Screen mode,
278 * because of parameter 'is_default_full_screen' => false in ->tabs(...) method.
279 * If yes, then we add css class 'wpbc_admin_full_screen' to the body of the page.
280 * // FixIn: 10.14.1.2.
281 *
282 * @param string $classes - CSS classes.
283 *
284 * @return mixed|string
285 */
286 public function admin_body_class__add_loading_classes( $classes ) {
287
288 // Such methods can be loaded only after_tabs_defined().
289 if ( ( method_exists( $this, 'is_full_screen_mode_enabled' ) ) && ( $this->is_full_screen_mode_enabled() ) ) {
290 $classes .= ' wpbc_admin_full_screen';
291 }
292
293 return $classes;
294 }
295
296
297 // -----------------------------------------------------------------------------------------------------------------
298 // Getters
299 // -----------------------------------------------------------------------------------------------------------------
300
301 public function get_current_page_params() {
302 return $this->current_page_params;
303 }
304
305 public function get_nav_tabs() {
306
307 if (
308 function_exists( 'wpbc_booking_modes_is_navigation_boundary_enabled' )
309 && wpbc_booking_modes_is_navigation_boundary_enabled()
310 && function_exists( 'wpbc_booking_modes_resolve_navigation' )
311 ) {
312 return wpbc_booking_modes_resolve_navigation( self::$nav_tabs );
313 }
314
315 return self::$nav_tabs;
316 }
317
318 // -----------------------------------------------------------------------------------------------------------------
319 // Active Page Parameters
320 // -----------------------------------------------------------------------------------------------------------------
321
322 /**
323 * Check if this page selected (active), depend from the GET parameter
324 * If selected, then define Current Page Parameters.
325 *
326 * @return boolean
327 */
328 protected function is_page_activated() {
329
330 $is_page_selected = false;
331
332 $this_page = $this->in_page();
333 $this_page_arr = ( is_array( $this_page ) ) ? $this_page : array( $this_page );
334
335 $request_arr = array();
336 $request_arr['page'] = isset( $_REQUEST['page'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
337 ? sanitize_text_field( wp_unslash( $_REQUEST['page'] ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
338 : null;
339 $request_arr['tab'] = isset( $_REQUEST[ $this->tags['tab'] ] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
340 ? sanitize_text_field( wp_unslash( $_REQUEST[ $this->tags['tab'] ] ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
341 : null;
342 $request_arr['subtab'] = isset( $_REQUEST[ $this->tags['subtab'] ] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
343 ? sanitize_text_field( wp_unslash( $_REQUEST[ $this->tags['subtab'] ] ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
344 : null;
345
346 foreach ( $this_page_arr as $this_page ) {
347
348 foreach ( $this->tabs() as $this_tab_tag => $this_tab ) {
349
350 // FixIn: 10.11.3.5.1.
351 $not_skip_type_arr = array( 'tab', 'subtab' );
352
353 if ( ( empty( $this_tab['type'] ) ) || ( in_array( $this_tab['type'], $not_skip_type_arr, true ) ) ) {
354 // Probably it is not the separator, and we have no content here !
355 // Get First Tab Element, which MUST be subtab element, all other tabs, can be links, not really showing content!!!
356 break;
357 }
358 }
359
360 if ( empty( $this_tab ) ) {
361 return $this_page; // this page empty - tabs is empty array, probabaly its was redefined in child CLASS to $tabs = array(); for not ability to open this page.
362 }
363
364 $this_subtab_tag = 0;
365 $this_subtab = array( 'default' => false );
366
367 if (
368 isset( $request_arr['subtab'] )
369 && isset( $this_tab['subtabs'] )
370 && is_array( $this_tab['subtabs'] )
371 && isset( $this_tab['subtabs'][ $request_arr['subtab'] ] )
372 && is_array( $this_tab['subtabs'][ $request_arr['subtab'] ] )
373 && isset( $this_tab['subtabs'][ $request_arr['subtab'] ]['type'] )
374 && 'subtab' === $this_tab['subtabs'][ $request_arr['subtab'] ]['type']
375 ) {
376 // Resolve the explicitly requested subtab, even when it is not the first one declared by this page class.
377 $this_subtab_tag = $request_arr['subtab'];
378 $this_subtab = $this_tab['subtabs'][ $request_arr['subtab'] ];
379 } elseif ( isset( $this_tab['subtabs'] ) && is_array( $this_tab['subtabs'] ) ) {
380 foreach ( $this_tab['subtabs'] as $temp_this_subtab_tag => $temp_this_subtab ) {
381
382 // Get First Subtab element from subtabs array.
383 if (
384 is_array( $temp_this_subtab )
385 && isset( $temp_this_subtab['type'] )
386 && 'subtab' === $temp_this_subtab['type']
387 ) {
388 $this_subtab_tag = $temp_this_subtab_tag;
389 $this_subtab = $temp_this_subtab;
390 break;
391 }
392 }
393 }
394
395 if ( ( isset( $request_arr['page'] ) ) && ( $this_page === $request_arr['page'] ) ) { // We are inside of this page. Menu item selected.
396
397 if (
398 ( ! isset( $request_arr['tab'] ) ) // the TAB NOT selected and Default.
399 // && ( ! isset( $request_arr['subtab'] ) ) // the SubTab NOT selected.
400 && ( isset( $this_tab['default'] ) ) && ( $this_tab['default'] ) ) {
401 $is_page_selected = true;
402 }
403
404 if (
405 ( isset( $request_arr['tab'] ) ) // TAB Selected.
406 && ( ! isset( $request_arr['subtab'] ) ) // SubTab NOT selected && ! exist || Default.
407 && ( $request_arr['tab'] === $this_tab_tag ) && ( ( 0 === $this_subtab_tag ) || ( $this_subtab['default'] ) ) ) {
408 $is_page_selected = true;
409 }
410
411 if (
412 ( isset( $request_arr['tab'] ) ) // TAB Selected.
413 && ( isset( $request_arr['subtab'] ) ) // SubTab Selected.
414 && ( $request_arr['tab'] === $this_tab_tag )
415 && ( $request_arr['subtab'] === $this_subtab_tag ) ) {
416 $is_page_selected = true;
417 }
418 }
419
420 // If this page activated, then define Current Page parameters.
421 if ( $is_page_selected ) {
422 $this->define_current_page_parameters( $this_tab_tag, $this_tab, $this_subtab_tag, $this_subtab );
423 }
424
425 if ( $is_page_selected ) {
426 break;
427 }
428 }
429
430 return $is_page_selected;
431 }
432
433
434 /**
435 * Define parameters for current selected page
436 *
437 * @param string $this_tab_tag = 'email'.
438 * @param array $this_tab = [ 'title' => 'Emails', 'font_icon' => 'wpbc_icn_mail_outline', 'subtabs' => [ 'new-admin' => [ 'type' => 'subtab', 'title' => 'New Booking (admin)', ... ], ].
439 * @param string $this_subtab_tag = 'new-admin'.
440 * @param array $this_subtab = [ 'type' => 'subtab', 'title' => 'New Booking (admin)', 'page_title' => 'Emails Settings',... ].
441 *
442 * @return void
443 */
444 protected function define_current_page_parameters( $this_tab_tag, $this_tab, $this_subtab_tag, $this_subtab ) {
445
446 $this->current_page_params = array(
447 'tab' => array_merge( $this_tab, array( 'tag' => $this_tab_tag ) ),
448 'subtab' => array_merge( $this_subtab, array( 'tag' => $this_subtab_tag ) ),
449 );
450 }
451
452
453 /**
454 * Get all SubTabs of current opened page Tab
455 *
456 * @param string $menu_in_page_tag - Optional. Menu Tag, the same as $this->in_page ();.
457 *
458 * @return array
459 */
460 protected function get_all_sub_tabs_of_selected_tab( $menu_in_page_tag = false ) {
461
462 if ( false === $menu_in_page_tag ) {
463
464 $this_page = $this->in_page();
465 $this_page_arr = ( is_array( $this_page ) ) ? $this_page : array( $this_page );
466
467 $menu_in_page_tag = $this_page_arr[0];
468 }
469
470 $all_sub_tabs_of_selected_tab = self::$nav_tabs[ $menu_in_page_tag ][ $this->current_page_params['tab']['tag'] ]['subtabs'];
471
472 return $all_sub_tabs_of_selected_tab;
473 }
474
475
476
477 // -----------------------------------------------------------------------------------------------------------------
478 // T A B s - Define
479 // -----------------------------------------------------------------------------------------------------------------
480
481 /**
482 * Define TABS structure. - General structure of tabs for every plugin menu page.
483 *
484 * Function executed after creation menu in class WPBC_Admin_Menus.
485 */
486 public function wpbc_create_plugin_menu_structure_arr() {
487
488 /**
489 * Array (
490 * [wpbc-resources] => Array ()
491 * [wpbc-settings] => Array
492 * (
493 * [general] => Array
494 * (
495 * [title] => General
496 * [page_title] => General Settings
497 * ...
498 * [subtabs] => Array ()
499 * )
500 * [help] => Array
501 * (
502 * [title] => Help
503 * [page_title] =>
504 * ...
505 * [subtabs] => Array ()
506 * )
507 * [form] => Array
508 * (
509 * [title] => Form
510 * [hint] => Customization of Form Fields
511 * [page_title] => Form Fields
512 * ...
513 * [subtabs] => Array
514 * (
515 * [goto-form] => Array
516 * (
517 * [type] => goto-link
518 * [title] => Booking Form Fields
519 * ...
520 * [content] => content
521 * [update] => update
522 * )
523 *
524 * [goto-content-data] => Array
525 * (
526 * [type] => button
527 * [title] => Save Changes
528 * [form] => wpbc_form
529 * ...
530 * )
531 *
532 * )
533 *
534 * )
535 * [payment] => Array
536 * (
537 * [title] => Payments
538 * [hint] => Customization of Payment
539 * [page_title] => Payment Gateways
540 * ...
541 * [subtabs] => Array
542 * (
543 * [paypal] => Array
544 * (
545 * [type] => subtab
546 * [title] => PayPal
547 * ...
548 * )
549 *
550 * [sage] => Array
551 * (
552 * [type] => subtab
553 * [title] => Sage
554 * ...
555 * )
556 *
557 * )
558 *
559 * )
560 *
561 * )
562 *
563 * )
564 */
565 /**
566 * The self::$nav_tabs =
567 *
568 * WP Left Menu | Top Horiz Menu | Vert Left Menu or top submenu
569 * ? page =wpbc-settings & tab=email & subtab=new-admin
570 *
571 * [
572 * wpbc-settings = [
573 * general = [...]
574 * form = [...]
575 * email = [...,
576 * subtabs = [
577 * new-admin = [
578 * type = "subtab"
579 * , ...
580 */
581
582 $this_page = $this->in_page(); // e.g. 'wpbc-settings'.
583 $this_page_arr = ( is_array( $this_page ) ) ? $this_page : array( $this_page ); // it can be like: [ 'wpbc-settings' ].
584
585 // Menu Structure.
586 foreach ( $this_page_arr as $this_page ) {
587
588 // WP Left Menu.
589 if ( ! isset( self::$nav_tabs[ $this_page ] ) ) {
590 self::$nav_tabs[ $this_page ] = array();
591 }
592
593 // Top Horiz Menu - e.g. [ 'calendar_appearance' ] => [ ... ] ].
594 $local_top_main_menu_arr = $this->tabs();
595
596 // Vert Left Menu - or top submenu.
597 $local_vert_left_menu_arr = array();
598
599 foreach ( $local_top_main_menu_arr as $tab_tag => $tab_array ) {
600
601 if ( isset( $tab_array['subtabs'] ) ) {
602 $local_vert_left_menu_arr[ $tab_tag ] = $tab_array['subtabs']; // Create new Subtabs array.
603
604 unset( $local_top_main_menu_arr[ $tab_tag ]['subtabs'] ); // Detach Subtabs array from Tab array. It's required for do not overwrite subtabs with already exist subtabs in previlosly defined tab.
605 } else {
606 $local_vert_left_menu_arr[ $tab_tag ] = array();
607 }
608 }
609
610 foreach ( $local_top_main_menu_arr as $tab_tag => $tab_array ) {
611
612 if ( ! isset( self::$nav_tabs[ $this_page ][ $tab_tag ] ) ) { // If this tab ( for exmaple "payment") declared previously, then does not do anything.
613 self::$nav_tabs[ $this_page ][ $tab_tag ] = array();
614 }
615
616 foreach ( $local_top_main_menu_arr[ $tab_tag ] as $page_prop_name => $page_prop_value ) {
617 if ( 'subtabs' !== $page_prop_name ) {
618 self::$nav_tabs[ $this_page ][ $tab_tag ][ $page_prop_name ] = $page_prop_value;
619 }
620 }
621
622 if ( ! isset( self::$nav_tabs[ $this_page ][ $tab_tag ]['subtabs'] ) ) {
623 self::$nav_tabs[ $this_page ][ $tab_tag ]['subtabs'] = array();
624 }
625 // Merge subtabs (Ex: PayPal and Sage) and attach to current tab: (Ex: payment).
626 self::$nav_tabs[ $this_page ][ $tab_tag ]['subtabs'] = array_merge( self::$nav_tabs[ $this_page ][ $tab_tag ]['subtabs'], $local_vert_left_menu_arr[ $tab_tag ] );
627
628 }
629 }
630
631 self::$nav_tabs = apply_filters( 'wpbc_plugin_menu_structure_arr', self::$nav_tabs, $this_page );
632 }
633
634
635 /**
636 * Get array of visible TABs
637 * Tabs that do not hided or disbaled
638 *
639 * @param string $menu_in_page_tag - Menu Tag, the same as $this->in_page ();.
640 *
641 * @return type
642 */
643 protected function get_visible_tabs( $menu_in_page_tag ) {
644
645 $visible_tabs = array();
646
647 foreach ( self::$nav_tabs[ $menu_in_page_tag ] as $tab_tag => $tab ) {
648
649 if ( empty( $tab['disabled'] ) && empty( $tab['hided'] ) ) {
650 $visible_tabs[ $tab_tag ] = $tab;
651 }
652 }
653
654 return $visible_tabs;
655 }
656 }
657