| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Plugin Menu Structure in Admin Panel |
| 4 | 4 | * |
| @@ -284,10 +284,10 @@ | ||
| 284 | 284 | * @return mixed|string |
| 285 | 285 | */ |
| 286 | 286 | public function admin_body_class__add_loading_classes( $classes ) { |
| 287 | 287 | |
| 288 | - // Such method ->is_use_option__in_subtabs_or_tabs(...) can be load only after_tabs_defined ! | |
| 289 | - if ( $this->is_use_option__in_subtabs_or_tabs( 'is_default_full_screen' ) ) { | |
| 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 | 290 | $classes .= ' wpbc_admin_full_screen'; |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | return $classes; |
| @@ -301,11 +301,23 @@ | ||
| 301 | 301 | public function get_current_page_params() { |
| 302 | 302 | return $this->current_page_params; |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - public function get_nav_tabs() { | |
| 306 | - return self::$nav_tabs; | |
| 307 | - } | |
| 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 | + } | |
| 308 | 320 | |
| 309 | 321 | // ----------------------------------------------------------------------------------------------------------------- |
| 310 | 322 | // Active Page Parameters |
| 311 | 323 | // ----------------------------------------------------------------------------------------------------------------- |
| @@ -351,18 +363,34 @@ | ||
| 351 | 363 | if ( empty( $this_tab ) ) { |
| 352 | 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. |
| 353 | 365 | } |
| 354 | 366 | |
| 355 | - $this_subtab_tag = 0; | |
| 356 | - $this_subtab = array( 'default' => false ); | |
| 357 | - | |
| 358 | - if ( isset( $this_tab['subtabs'] ) ) { | |
| 359 | - foreach ( $this_tab['subtabs'] as $temp_this_subtab_tag => $temp_this_subtab ) { | |
| 360 | - | |
| 361 | - // Get First Subtab element from subtabs array. | |
| 362 | - if ( 'subtab' === $temp_this_subtab['type'] ) { | |
| 363 | - $this_subtab_tag = $temp_this_subtab_tag; | |
| 364 | - $this_subtab = $temp_this_subtab; | |
| 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; | |
| 365 | 393 | break; |
| 366 | 394 | } |
| 367 | 395 | } |
| 368 | 396 | } |
| @@ -417,13 +445,23 @@ | ||
| 417 | 445 | * @return void |
| 418 | 446 | */ |
| 419 | 447 | protected function define_current_page_parameters( $this_tab_tag, $this_tab, $this_subtab_tag, $this_subtab ) { |
| 420 | 448 | |
| 421 | - $this->current_page_params = array( | |
| 422 | - 'tab' => array_merge( $this_tab, array( 'tag' => $this_tab_tag ) ), | |
| 423 | - 'subtab' => array_merge( $this_subtab, array( 'tag' => $this_subtab_tag ) ), | |
| 424 | - ); | |
| 425 | - } | |
| 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 | + } | |
| 426 | 464 | |
| 427 | 465 | |
| 428 | 466 | /** |
| 429 | 467 | * Get all SubTabs of current opened page Tab |