PluginProbe
Booking Calendar / 11.8.2
Booking Calendar v11.8.2
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 10.11.3 All 202 releases
booking / includes / ui_settings / class-menu-structure.php

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

670 lines 27.3 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 if ( function_exists( 'wpbc_booking_modes_v3_capture_navigation_source' ) ) {
307 return wpbc_booking_modes_v3_capture_navigation_source( self::$nav_tabs );
308 }
309
310 if (
311 function_exists( 'wpbc_booking_modes_is_navigation_boundary_enabled' )
312 && wpbc_booking_modes_is_navigation_boundary_enabled()
313 && function_exists( 'wpbc_booking_modes_resolve_navigation' )
314 ) {
315 return wpbc_booking_modes_resolve_navigation( self::$nav_tabs );
316 }
317
318 return self::$nav_tabs;
319 }
320
321 // -----------------------------------------------------------------------------------------------------------------
322 // Active Page Parameters
323 // -----------------------------------------------------------------------------------------------------------------
324
325 /**
326 * Check if this page selected (active), depend from the GET parameter
327 * If selected, then define Current Page Parameters.
328 *
329 * @return boolean
330 */
331 protected function is_page_activated() {
332
333 $is_page_selected = false;
334
335 $this_page = $this->in_page();
336 $this_page_arr = ( is_array( $this_page ) ) ? $this_page : array( $this_page );
337
338 $request_arr = array();
339 $request_arr['page'] = isset( $_REQUEST['page'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
340 ? sanitize_text_field( wp_unslash( $_REQUEST['page'] ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
341 : null;
342 $request_arr['tab'] = isset( $_REQUEST[ $this->tags['tab'] ] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
343 ? sanitize_text_field( wp_unslash( $_REQUEST[ $this->tags['tab'] ] ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
344 : null;
345 $request_arr['subtab'] = isset( $_REQUEST[ $this->tags['subtab'] ] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
346 ? sanitize_text_field( wp_unslash( $_REQUEST[ $this->tags['subtab'] ] ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
347 : null;
348
349 foreach ( $this_page_arr as $this_page ) {
350
351 foreach ( $this->tabs() as $this_tab_tag => $this_tab ) {
352
353 // FixIn: 10.11.3.5.1.
354 $not_skip_type_arr = array( 'tab', 'subtab' );
355
356 if ( ( empty( $this_tab['type'] ) ) || ( in_array( $this_tab['type'], $not_skip_type_arr, true ) ) ) {
357 // Probably it is not the separator, and we have no content here !
358 // Get First Tab Element, which MUST be subtab element, all other tabs, can be links, not really showing content!!!
359 break;
360 }
361 }
362
363 if ( empty( $this_tab ) ) {
364 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.
365 }
366
367 $this_subtab_tag = 0;
368 $this_subtab = array( 'default' => false );
369
370 if (
371 isset( $request_arr['subtab'] )
372 && isset( $this_tab['subtabs'] )
373 && is_array( $this_tab['subtabs'] )
374 && isset( $this_tab['subtabs'][ $request_arr['subtab'] ] )
375 && is_array( $this_tab['subtabs'][ $request_arr['subtab'] ] )
376 && isset( $this_tab['subtabs'][ $request_arr['subtab'] ]['type'] )
377 && 'subtab' === $this_tab['subtabs'][ $request_arr['subtab'] ]['type']
378 ) {
379 // Resolve the explicitly requested subtab, even when it is not the first one declared by this page class.
380 $this_subtab_tag = $request_arr['subtab'];
381 $this_subtab = $this_tab['subtabs'][ $request_arr['subtab'] ];
382 } elseif ( isset( $this_tab['subtabs'] ) && is_array( $this_tab['subtabs'] ) ) {
383 foreach ( $this_tab['subtabs'] as $temp_this_subtab_tag => $temp_this_subtab ) {
384
385 // Get First Subtab element from subtabs array.
386 if (
387 is_array( $temp_this_subtab )
388 && isset( $temp_this_subtab['type'] )
389 && 'subtab' === $temp_this_subtab['type']
390 ) {
391 $this_subtab_tag = $temp_this_subtab_tag;
392 $this_subtab = $temp_this_subtab;
393 break;
394 }
395 }
396 }
397
398 if ( ( isset( $request_arr['page'] ) ) && ( $this_page === $request_arr['page'] ) ) { // We are inside of this page. Menu item selected.
399
400 if (
401 ( ! isset( $request_arr['tab'] ) ) // the TAB NOT selected and Default.
402 // && ( ! isset( $request_arr['subtab'] ) ) // the SubTab NOT selected.
403 && ( isset( $this_tab['default'] ) ) && ( $this_tab['default'] ) ) {
404 $is_page_selected = true;
405 }
406
407 if (
408 ( isset( $request_arr['tab'] ) ) // TAB Selected.
409 && ( ! isset( $request_arr['subtab'] ) ) // SubTab NOT selected && ! exist || Default.
410 && ( $request_arr['tab'] === $this_tab_tag ) && ( ( 0 === $this_subtab_tag ) || ( $this_subtab['default'] ) ) ) {
411 $is_page_selected = true;
412 }
413
414 if (
415 ( isset( $request_arr['tab'] ) ) // TAB Selected.
416 && ( isset( $request_arr['subtab'] ) ) // SubTab Selected.
417 && ( $request_arr['tab'] === $this_tab_tag )
418 && ( $request_arr['subtab'] === $this_subtab_tag ) ) {
419 $is_page_selected = true;
420 }
421 }
422
423 // If this page activated, then define Current Page parameters.
424 if ( $is_page_selected ) {
425 $this->define_current_page_parameters( $this_tab_tag, $this_tab, $this_subtab_tag, $this_subtab );
426 }
427
428 if ( $is_page_selected ) {
429 break;
430 }
431 }
432
433 return $is_page_selected;
434 }
435
436
437 /**
438 * Define parameters for current selected page
439 *
440 * @param string $this_tab_tag = 'email'.
441 * @param array $this_tab = [ 'title' => 'Emails', 'font_icon' => 'wpbc_icn_mail_outline', 'subtabs' => [ 'new-admin' => [ 'type' => 'subtab', 'title' => 'New Booking (admin)', ... ], ].
442 * @param string $this_subtab_tag = 'new-admin'.
443 * @param array $this_subtab = [ 'type' => 'subtab', 'title' => 'New Booking (admin)', 'page_title' => 'Emails Settings',... ].
444 *
445 * @return void
446 */
447 protected function define_current_page_parameters( $this_tab_tag, $this_tab, $this_subtab_tag, $this_subtab ) {
448
449 $this->current_page_params = array(
450 'tab' => array_merge( $this_tab, array( 'tag' => $this_tab_tag ) ),
451 'subtab' => array_merge( $this_subtab, array( 'tag' => $this_subtab_tag ) ),
452 );
453
454 if ( function_exists( 'wpbc_booking_modes_v3_apply_current_page_options' ) ) {
455 $context = wpbc_booking_modes_get_context();
456 $this->current_page_params = wpbc_booking_modes_v3_apply_current_page_options(
457 $this->current_page_params,
458 $context['page'],
459 $this_tab_tag,
460 $this_subtab_tag
461 );
462 }
463 }
464
465
466 /**
467 * Get all SubTabs of current opened page Tab
468 *
469 * @param string $menu_in_page_tag - Optional. Menu Tag, the same as $this->in_page ();.
470 *
471 * @return array
472 */
473 protected function get_all_sub_tabs_of_selected_tab( $menu_in_page_tag = false ) {
474
475 if ( false === $menu_in_page_tag ) {
476
477 $this_page = $this->in_page();
478 $this_page_arr = ( is_array( $this_page ) ) ? $this_page : array( $this_page );
479
480 $menu_in_page_tag = $this_page_arr[0];
481 }
482
483 $all_sub_tabs_of_selected_tab = self::$nav_tabs[ $menu_in_page_tag ][ $this->current_page_params['tab']['tag'] ]['subtabs'];
484
485 return $all_sub_tabs_of_selected_tab;
486 }
487
488
489
490 // -----------------------------------------------------------------------------------------------------------------
491 // T A B s - Define
492 // -----------------------------------------------------------------------------------------------------------------
493
494 /**
495 * Define TABS structure. - General structure of tabs for every plugin menu page.
496 *
497 * Function executed after creation menu in class WPBC_Admin_Menus.
498 */
499 public function wpbc_create_plugin_menu_structure_arr() {
500
501 /**
502 * Array (
503 * [wpbc-resources] => Array ()
504 * [wpbc-settings] => Array
505 * (
506 * [general] => Array
507 * (
508 * [title] => General
509 * [page_title] => General Settings
510 * ...
511 * [subtabs] => Array ()
512 * )
513 * [help] => Array
514 * (
515 * [title] => Help
516 * [page_title] =>
517 * ...
518 * [subtabs] => Array ()
519 * )
520 * [form] => Array
521 * (
522 * [title] => Form
523 * [hint] => Customization of Form Fields
524 * [page_title] => Form Fields
525 * ...
526 * [subtabs] => Array
527 * (
528 * [goto-form] => Array
529 * (
530 * [type] => goto-link
531 * [title] => Booking Form Fields
532 * ...
533 * [content] => content
534 * [update] => update
535 * )
536 *
537 * [goto-content-data] => Array
538 * (
539 * [type] => button
540 * [title] => Save Changes
541 * [form] => wpbc_form
542 * ...
543 * )
544 *
545 * )
546 *
547 * )
548 * [payment] => Array
549 * (
550 * [title] => Payments
551 * [hint] => Customization of Payment
552 * [page_title] => Payment Gateways
553 * ...
554 * [subtabs] => Array
555 * (
556 * [paypal] => Array
557 * (
558 * [type] => subtab
559 * [title] => PayPal
560 * ...
561 * )
562 *
563 * [sage] => Array
564 * (
565 * [type] => subtab
566 * [title] => Sage
567 * ...
568 * )
569 *
570 * )
571 *
572 * )
573 *
574 * )
575 *
576 * )
577 */
578 /**
579 * The self::$nav_tabs =
580 *
581 * WP Left Menu | Top Horiz Menu | Vert Left Menu or top submenu
582 * ? page =wpbc-settings & tab=email & subtab=new-admin
583 *
584 * [
585 * wpbc-settings = [
586 * general = [...]
587 * form = [...]
588 * email = [...,
589 * subtabs = [
590 * new-admin = [
591 * type = "subtab"
592 * , ...
593 */
594
595 $this_page = $this->in_page(); // e.g. 'wpbc-settings'.
596 $this_page_arr = ( is_array( $this_page ) ) ? $this_page : array( $this_page ); // it can be like: [ 'wpbc-settings' ].
597
598 // Menu Structure.
599 foreach ( $this_page_arr as $this_page ) {
600
601 // WP Left Menu.
602 if ( ! isset( self::$nav_tabs[ $this_page ] ) ) {
603 self::$nav_tabs[ $this_page ] = array();
604 }
605
606 // Top Horiz Menu - e.g. [ 'calendar_appearance' ] => [ ... ] ].
607 $local_top_main_menu_arr = $this->tabs();
608
609 // Vert Left Menu - or top submenu.
610 $local_vert_left_menu_arr = array();
611
612 foreach ( $local_top_main_menu_arr as $tab_tag => $tab_array ) {
613
614 if ( isset( $tab_array['subtabs'] ) ) {
615 $local_vert_left_menu_arr[ $tab_tag ] = $tab_array['subtabs']; // Create new Subtabs array.
616
617 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.
618 } else {
619 $local_vert_left_menu_arr[ $tab_tag ] = array();
620 }
621 }
622
623 foreach ( $local_top_main_menu_arr as $tab_tag => $tab_array ) {
624
625 if ( ! isset( self::$nav_tabs[ $this_page ][ $tab_tag ] ) ) { // If this tab ( for exmaple "payment") declared previously, then does not do anything.
626 self::$nav_tabs[ $this_page ][ $tab_tag ] = array();
627 }
628
629 foreach ( $local_top_main_menu_arr[ $tab_tag ] as $page_prop_name => $page_prop_value ) {
630 if ( 'subtabs' !== $page_prop_name ) {
631 self::$nav_tabs[ $this_page ][ $tab_tag ][ $page_prop_name ] = $page_prop_value;
632 }
633 }
634
635 if ( ! isset( self::$nav_tabs[ $this_page ][ $tab_tag ]['subtabs'] ) ) {
636 self::$nav_tabs[ $this_page ][ $tab_tag ]['subtabs'] = array();
637 }
638 // Merge subtabs (Ex: PayPal and Sage) and attach to current tab: (Ex: payment).
639 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 ] );
640
641 }
642 }
643
644 self::$nav_tabs = apply_filters( 'wpbc_plugin_menu_structure_arr', self::$nav_tabs, $this_page );
645 }
646
647
648 /**
649 * Get array of visible TABs
650 * Tabs that do not hided or disbaled
651 *
652 * @param string $menu_in_page_tag - Menu Tag, the same as $this->in_page ();.
653 *
654 * @return type
655 */
656 protected function get_visible_tabs( $menu_in_page_tag ) {
657
658 $visible_tabs = array();
659
660 foreach ( self::$nav_tabs[ $menu_in_page_tag ] as $tab_tag => $tab ) {
661
662 if ( empty( $tab['disabled'] ) && empty( $tab['hided'] ) ) {
663 $visible_tabs[ $tab_tag ] = $tab;
664 }
665 }
666
667 return $visible_tabs;
668 }
669 }
670