| @@ -8,8 +8,13 @@ | ||
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | namespace MainWP\Dashboard; |
| 11 | 11 | |
| 12 | +// Exit if accessed directly. | |
| 13 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 14 | + exit; | |
| 15 | +} | |
| 16 | + | |
| 12 | 17 | /** |
| 13 | 18 | * Class MainWP_Menu |
| 14 | 19 | * |
| 15 | 20 | * @package MainWP\Dashboard |
| @@ -117,8 +122,9 @@ | ||
| 117 | 122 | 'access_wpadmin_on_child_sites', |
| 118 | 123 | 'manage_security_issues', |
| 119 | 124 | 'test_connection', |
| 120 | 125 | 'manage_groups', |
| 126 | + 'manage_uptime_monitoring', | |
| 121 | 127 | ), |
| 122 | 128 | ), |
| 123 | 129 | 'init_menu_callback' => array( MainWP_Manage_Sites::class, 'init_menu' ), |
| 124 | 130 | 'leftbar_order' => 1, |
| @@ -254,13 +260,9 @@ | ||
| 254 | 260 | // Manage RESTAPI. |
| 255 | 261 | $menus_items[] = array( |
| 256 | 262 | 'slug' => 'RESTAPI', |
| 257 | 263 | 'menu_level' => 2, |
| 258 | - 'menu_rights' => array( | |
| 259 | - 'dashboard' => array( | |
| 260 | - 'manage_dashboard_restapi', | |
| 261 | - ), | |
| 262 | - ), | |
| 264 | + 'menu_rights' => true, | |
| 263 | 265 | 'init_menu_callback' => array( MainWP_Rest_Api_Page::class, 'init_menu' ), |
| 264 | 266 | 'leftbar_order' => 4, |
| 265 | 267 | ); |
| 266 | 268 | |
| @@ -267,13 +269,9 @@ | ||
| 267 | 269 | // Manage Extensions. |
| 268 | 270 | $menus_items[] = array( |
| 269 | 271 | 'slug' => 'Extensions', |
| 270 | 272 | 'menu_level' => 2, |
| 271 | - 'menu_rights' => array( | |
| 272 | - 'dashboard' => array( | |
| 273 | - 'manage_extensions', | |
| 274 | - ), | |
| 275 | - ), | |
| 273 | + 'menu_rights' => true, | |
| 276 | 274 | 'init_menu_callback' => array( MainWP_Extensions::class, 'init_menu' ), |
| 277 | 275 | 'leftbar_order' => 3, |
| 278 | 276 | ); |
| 279 | 277 | |
| @@ -288,8 +286,20 @@ | ||
| 288 | 286 | ), |
| 289 | 287 | 'init_menu_callback' => array( MainWP_Bulk_Update_Admin_Passwords::class, 'init_menu' ), |
| 290 | 288 | ); |
| 291 | 289 | |
| 290 | + // Password Policy Settings. | |
| 291 | + $menus_items[] = array( | |
| 292 | + 'slug' => 'PasswordPolicy', | |
| 293 | + 'menu_level' => 2, | |
| 294 | + 'menu_rights' => array( | |
| 295 | + 'dashboard' => array( | |
| 296 | + 'manage_users', | |
| 297 | + ), | |
| 298 | + ), | |
| 299 | + 'init_menu_callback' => array( MainWP_Password_Policy_Settings::class, 'init_menu' ), | |
| 300 | + ); | |
| 301 | + | |
| 292 | 302 | // Monitoring Sites. |
| 293 | 303 | $menus_items[] = array( |
| 294 | 304 | 'slug' => 'MonitoringSites', |
| 295 | 305 | 'menu_level' => 3, |
| @@ -363,9 +373,9 @@ | ||
| 363 | 373 | if ( is_array( $item_rights ) && ! empty( $item_rights ) ) { |
| 364 | 374 | foreach ( $item_rights as $group_right => $rights ) { |
| 365 | 375 | if ( is_array( $rights ) ) { |
| 366 | 376 | foreach ( $rights as $func_right ) { |
| 367 | - if ( mainwp_current_user_have_right( $group_right, $func_right ) ) { | |
| 377 | + if ( \mainwp_current_user_can( $group_right, $func_right ) ) { | |
| 368 | 378 | $accessable = true; |
| 369 | 379 | break; |
| 370 | 380 | } |
| 371 | 381 | } |
| @@ -386,82 +396,8 @@ | ||
| 386 | 396 | } |
| 387 | 397 | } |
| 388 | 398 | |
| 389 | 399 | /** |
| 390 | - * Method init_sub_pages() | |
| 391 | - * | |
| 392 | - * Init subpages MainWP menus. | |
| 393 | - * | |
| 394 | - * @uses \MainWP\Dashboard\MainWP_Extensions::init_subpages_menu() | |
| 395 | - * @uses \MainWP\Dashboard\MainWP_Manage_Backups::init_subpages_menu() | |
| 396 | - * @uses \MainWP\Dashboard\MainWP_Manage_Sites::init_subpages_menu() | |
| 397 | - * @uses \MainWP\Dashboard\MainWP_Page::init_subpages_menu() | |
| 398 | - * @uses \MainWP\Dashboard\MainWP_Post::init_subpages_menu() | |
| 399 | - * @uses \MainWP\Dashboard\MainWP_Settings::init_subpages_menu() | |
| 400 | - * @uses \MainWP\Dashboard\MainWP_Themes::init_subpages_menu() | |
| 401 | - * @uses \MainWP\Dashboard\MainWP_Themes::init_subpages_menu() | |
| 402 | - * @uses \MainWP\Dashboard\MainWP_Plugins::init_subpages_menu() | |
| 403 | - * @uses \MainWP\Dashboard\MainWP_User::init_subpages_menu() | |
| 404 | - * @uses \MainWP\Dashboard\MainWP_Settings::init_subpages_menu() | |
| 405 | - */ | |
| 406 | - public static function init_sub_pages() { | |
| 407 | - | |
| 408 | - if ( ! static::is_disable_menu_item( 2, 'PostBulkManage' ) ) { | |
| 409 | - MainWP_Post::init_subpages_menu(); | |
| 410 | - } | |
| 411 | - if ( ! static::is_disable_menu_item( 2, 'managesites' ) ) { | |
| 412 | - MainWP_Manage_Sites::init_subpages_menu(); | |
| 413 | - } | |
| 414 | - | |
| 415 | - if ( ! static::is_disable_menu_item( 2, 'RESTAPI' ) ) { | |
| 416 | - MainWP_Rest_Api_Page::init_subpages_menu(); | |
| 417 | - } | |
| 418 | - | |
| 419 | - if ( ! static::is_disable_menu_item( 2, 'Settings' ) ) { | |
| 420 | - MainWP_Settings::init_subpages_menu(); | |
| 421 | - } | |
| 422 | - | |
| 423 | - if ( ! static::is_disable_menu_item( 2, 'Extensions' ) ) { | |
| 424 | - MainWP_Extensions::init_subpages_menu(); | |
| 425 | - } | |
| 426 | - if ( ! static::is_disable_menu_item( 2, 'PageBulkManage' ) ) { | |
| 427 | - MainWP_Page::init_subpages_menu(); | |
| 428 | - } | |
| 429 | - if ( ! static::is_disable_menu_item( 2, 'ThemesManage' ) ) { | |
| 430 | - MainWP_Themes::init_subpages_menu(); | |
| 431 | - } | |
| 432 | - if ( ! static::is_disable_menu_item( 2, 'PluginsManage' ) ) { | |
| 433 | - MainWP_Plugins::init_subpages_menu(); | |
| 434 | - } | |
| 435 | - if ( ! static::is_disable_menu_item( 2, 'UserBulkManage' ) ) { | |
| 436 | - MainWP_User::init_subpages_menu(); | |
| 437 | - } | |
| 438 | - if ( ! static::is_disable_menu_item( 2, 'ManageClients' ) ) { | |
| 439 | - MainWP_Client::init_subpages_menu(); | |
| 440 | - } | |
| 441 | - if ( get_option( 'mainwp_enableLegacyBackupFeature' ) && ! static::is_disable_menu_item( 2, 'ManageBackups' ) ) { | |
| 442 | - MainWP_Manage_Backups::init_subpages_menu(); | |
| 443 | - } | |
| 444 | - | |
| 445 | - if ( ! static::is_disable_menu_item( 2, 'Settings' ) ) { | |
| 446 | - MainWP_Settings::init_subpages_menu(); | |
| 447 | - } | |
| 448 | - | |
| 449 | - /** | |
| 450 | - * Action: mainwp_admin_menu_sub | |
| 451 | - * | |
| 452 | - * Hooks main navigation sub-menu items. | |
| 453 | - * | |
| 454 | - * @since 4.0 | |
| 455 | - */ | |
| 456 | - do_action( 'mainwp_admin_menu_sub' ); | |
| 457 | - | |
| 458 | - if ( ! static::is_disable_menu_item( 2, 'ServerInformation' ) ) { | |
| 459 | - MainWP_Server_Information::init_subpages_menu(); | |
| 460 | - } | |
| 461 | - } | |
| 462 | - | |
| 463 | - /** | |
| 464 | 400 | * Method set_menu_active_slugs |
| 465 | 401 | * |
| 466 | 402 | * @param string $item Menu item. |
| 467 | 403 | * @param string $active Menu active slug. |
| @@ -496,18 +432,19 @@ | ||
| 496 | 432 | $subPages = apply_filters( 'mainwp_subpages_left_menu', $subPages, $initSubpage, $parentKey, $slug ); |
| 497 | 433 | |
| 498 | 434 | foreach ( $subPages as $subPage ) { |
| 499 | 435 | if ( ! isset( $subPage['menu_hidden'] ) || ( isset( $subPage['menu_hidden'] ) && empty( $subPage['menu_hidden'] ) ) ) { |
| 500 | - $_item = array( | |
| 501 | - 'title' => $subPage['title'], | |
| 436 | + $sub_slug = isset( $subPage['slug'] ) ? $subPage['slug'] : ''; | |
| 437 | + $_item = array( | |
| 438 | + 'title' => isset( $subPage['title'] ) ? $subPage['title'] : '', | |
| 502 | 439 | 'parent_key' => $parentKey, |
| 503 | - 'href' => 'admin.php?page=' . $slug . $subPage['slug'], | |
| 504 | - 'slug' => $slug . $subPage['slug'], | |
| 440 | + 'href' => 'admin.php?page=' . $slug . $sub_slug, | |
| 441 | + 'slug' => $slug . $sub_slug, | |
| 505 | 442 | 'right' => '', |
| 506 | 443 | ); |
| 507 | 444 | |
| 508 | 445 | if ( ! empty( $subPage['before_title'] ) ) { |
| 509 | - $item['before_title'] = $subPage['before_title']; | |
| 446 | + $_item['before_title'] = $subPage['before_title']; | |
| 510 | 447 | } |
| 511 | 448 | |
| 512 | 449 | // To support check right to open menu for sometime. |
| 513 | 450 | if ( isset( $subPage['item_slug'] ) ) { |
| @@ -529,10 +466,10 @@ | ||
| 529 | 466 | * Method is_disable_menu_item |
| 530 | 467 | * |
| 531 | 468 | * Check if $_mainwp_disable_menus_items contains any menu items to hide. |
| 532 | 469 | * |
| 533 | - * @param string $level The level the menu item is on. | |
| 534 | - * @param array $item The menu items meta data. | |
| 470 | + * @param string $level The level the menu item is on. | |
| 471 | + * @param array|string $item The menu items meta data. | |
| 535 | 472 | * |
| 536 | 473 | * @return bool True|False, default is False. |
| 537 | 474 | */ |
| 538 | 475 | public static function is_disable_menu_item( $level, $item ) { |
| @@ -581,22 +518,51 @@ | ||
| 581 | 518 | |
| 582 | 519 | $title = $params['title']; |
| 583 | 520 | $before_title = ! empty( $params['before_title'] ) ? $params['before_title'] : ''; |
| 584 | 521 | |
| 585 | - $slug = isset( $params['slug'] ) ? $params['slug'] : ''; | |
| 586 | - $href = isset( $params['href'] ) ? $params['href'] : ''; | |
| 587 | - $right = isset( $params['right'] ) ? $params['right'] : ''; | |
| 588 | - $id = isset( $params['id'] ) ? $params['id'] : ''; | |
| 522 | + $slug = isset( $params['slug'] ) ? $params['slug'] : ''; | |
| 523 | + $href = isset( $params['href'] ) ? $params['href'] : ''; | |
| 524 | + $right = isset( $params['right'] ) ? $params['right'] : ''; | |
| 525 | + $id = isset( $params['id'] ) ? $params['id'] : ''; | |
| 526 | + $level_cls = 'left-menu-item-level-' . $level; | |
| 589 | 527 | |
| 528 | + if ( ! MainWP_Cache_Warm_Helper::is_excluded_warm_cache_pages() ) { | |
| 529 | + $level_cls .= ' mainwp-js-prefetch '; | |
| 530 | + } | |
| 531 | + | |
| 590 | 532 | $icon = isset( $params['icon'] ) ? $params['icon'] : ''; |
| 591 | 533 | $leftsub_order = isset( $params['leftsub_order'] ) ? $params['leftsub_order'] : ''; |
| 592 | 534 | $leftsub_order_level2 = isset( $params['leftsub_order_level2'] ) ? $params['leftsub_order_level2'] : ''; |
| 593 | 535 | $ext_state = isset( $params['ext_status'] ) && ( 'activated' === $params['ext_status'] || 'inactive' === $params['ext_status'] ) ? $params['ext_status'] : ''; |
| 594 | 536 | $parent_key = isset( $params['parent_key'] ) ? $params['parent_key'] : ''; |
| 595 | - $others = array(); | |
| 537 | + $others = array( 'level_class' => $level_cls ); | |
| 538 | + | |
| 539 | + $others['classes_item'] = ''; | |
| 540 | + if ( ! empty( $params['classes_item'] ) ) { | |
| 541 | + if ( is_array( $params['classes_item'] ) ) { | |
| 542 | + $others['classes_item'] = implode( ' ', $params['classes_item'] ); | |
| 543 | + } elseif ( is_string( $params['classes_item'] ) ) { | |
| 544 | + $others['classes_item'] = $params['classes_item']; | |
| 545 | + } | |
| 546 | + } | |
| 547 | + | |
| 548 | + $excluded_warm_cached_page = MainWP_Cache_Warm_Helper::is_excluded_warm_cache_pages(); | |
| 549 | + | |
| 550 | + /** | |
| 551 | + * Menu excluded warm cache item. | |
| 552 | + * | |
| 553 | + * @since 5.5. | |
| 554 | + */ | |
| 555 | + if ( ! apply_filters( 'mainwp_menu_excluded_warm_cache_item', $excluded_warm_cached_page, $params ) ) { | |
| 556 | + $others['classes_item'] .= ' mainwp-js-prefetch '; | |
| 557 | + } | |
| 558 | + | |
| 596 | 559 | if ( isset( $params['active_params'] ) ) { |
| 597 | 560 | $others['active_params'] = $params['active_params']; |
| 598 | 561 | } |
| 562 | + if ( ! empty( $params['item_class'] ) ) { | |
| 563 | + $others['item_class'] = $params['item_class']; | |
| 564 | + } | |
| 599 | 565 | |
| 600 | 566 | /** |
| 601 | 567 | * MainWP Left Menu, Sub Menu & Active menu slugs. |
| 602 | 568 | * |
| @@ -630,9 +596,9 @@ | ||
| 630 | 596 | } |
| 631 | 597 | |
| 632 | 598 | if ( 0 === $level ) { |
| 633 | 599 | $parent_key = 'mainwp_tab'; // forced value. |
| 634 | - $mainwp_leftmenu['leftbar'][] = array( $title, $slug, $href, $id, $icon ); | |
| 600 | + $mainwp_leftmenu['leftbar'][] = array( $title, $slug, $href, $id, $icon, $level_cls ); | |
| 635 | 601 | } elseif ( 1 === $level ) { |
| 636 | 602 | |
| 637 | 603 | if ( empty( $parent_key ) ) { |
| 638 | 604 | $parent_key = 'mainwp_tab'; // forced value. |
| @@ -638,11 +604,11 @@ | ||
| 638 | 604 | $parent_key = 'mainwp_tab'; // forced value. |
| 639 | 605 | } |
| 640 | 606 | |
| 641 | 607 | if ( 'mainwp_tab' === $parent_key ) { |
| 642 | - $mainwp_leftmenu[ $parent_key ][] = array( $title, $slug, $href, $id ); | |
| 608 | + $mainwp_leftmenu[ $parent_key ][] = array( $title, $slug, $href, $id, $level_cls ); | |
| 643 | 609 | } else { |
| 644 | - $mainwp_sub_leftmenu['leftbar'][ $parent_key ][] = array( $title, $slug, $href, $id, $leftsub_order, $ext_state, $active_path ); | |
| 610 | + $mainwp_sub_leftmenu['leftbar'][ $parent_key ][] = array( $title, $slug, $href, $id, $leftsub_order, $ext_state, $active_path, $level_cls ); | |
| 645 | 611 | |
| 646 | 612 | if ( ! empty( $slug ) ) { |
| 647 | 613 | $_mainwp_menu_active_slugs['leftbar'][ $slug ] = $parent_key; // to get active menu. |
| 648 | 614 | } |
| @@ -700,8 +666,25 @@ | ||
| 700 | 666 | |
| 701 | 667 | $mainwp_sub_leftmenu = apply_filters( 'mainwp_main_menu_submenu', $mainwp_sub_leftmenu ); |
| 702 | 668 | $sub_bar_leftmenu = isset( $mainwp_sub_leftmenu['leftbar'] ) ? $mainwp_sub_leftmenu['leftbar'] : array(); |
| 703 | 669 | |
| 670 | + if ( is_array( $mainwp_sub_leftmenu ) && ! empty( $mainwp_sub_leftmenu['Extensions'] ) ) { | |
| 671 | + $add_on_items = $mainwp_sub_leftmenu['Extensions']; | |
| 672 | + | |
| 673 | + $head = array_shift( $add_on_items ); | |
| 674 | + // sort the rest by first element. | |
| 675 | + usort( | |
| 676 | + $add_on_items, | |
| 677 | + function ( $a, $b ) { | |
| 678 | + return strcmp( (string) $a[0], (string) $b[0] ); | |
| 679 | + } | |
| 680 | + ); | |
| 681 | + // put the head back. | |
| 682 | + array_unshift( $add_on_items, $head ); | |
| 683 | + | |
| 684 | + $mainwp_sub_leftmenu['Extensions'] = $add_on_items; | |
| 685 | + } | |
| 686 | + | |
| 704 | 687 | $version = get_option( 'mainwp_plugin_version' ); |
| 705 | 688 | |
| 706 | 689 | ?> |
| 707 | 690 | <?php |
| @@ -744,8 +727,9 @@ | ||
| 744 | 727 | $item_key = $item[1]; |
| 745 | 728 | $href = $item[2]; |
| 746 | 729 | $item_id = isset( $item[3] ) ? $item[3] : ''; |
| 747 | 730 | $item_icon = isset( $item[4] ) ? $item[4] : ''; |
| 731 | + $level_cls = isset( $item[5] ) ? $item[5] : ''; | |
| 748 | 732 | |
| 749 | 733 | $has_sub = true; |
| 750 | 734 | if ( ! isset( $mainwp_sub_leftmenu[ $item_key ] ) || empty( $mainwp_sub_leftmenu[ $item_key ] ) ) { |
| 751 | 735 | $has_sub = false; |
| @@ -770,10 +754,12 @@ | ||
| 770 | 754 | } |
| 771 | 755 | |
| 772 | 756 | $id_attr = ! empty( $item_id ) ? 'id="' . esc_html( $item_id ) . '"' : ''; |
| 773 | 757 | |
| 758 | + $item_cls = $level_cls . ' ' . $active_item; | |
| 759 | + | |
| 774 | 760 | // phpcs:disable WordPress.Security.EscapeOutput |
| 775 | - echo '<a ' . $id_attr . ' title="' . esc_html( $title ) . "\" class=\"item $active_item\" href=\"$href\">"; | |
| 761 | + echo '<a ' . $id_attr . ' title="' . esc_html( $title ) . '" class="item ' . esc_attr( $item_cls ) . "\" href=\"$href\">"; | |
| 776 | 762 | echo ! empty( $item_icon ) ? $item_icon : '<i class="th large icon"></i>'; |
| 777 | 763 | echo '<span class="ui small text">' . esc_html( $title ) . '</span>'; |
| 778 | 764 | echo '</a>'; |
| 779 | 765 | // phpcs:enable |
| @@ -781,47 +767,83 @@ | ||
| 781 | 767 | } |
| 782 | 768 | ?> |
| 783 | 769 | </div> |
| 784 | 770 | <?php |
| 785 | - $go_back_wpadmin_url = admin_url( 'index.php' ); | |
| 771 | + $all_updates = wp_get_update_data(); | |
| 772 | + $go_back_wpadmin_url = admin_url( 'index.php' ); | |
| 786 | 773 | |
| 787 | - $link = array( | |
| 788 | - 'url' => $go_back_wpadmin_url, | |
| 789 | - 'text' => esc_html__( 'WP Admin', 'mainwp' ), | |
| 790 | - 'tip' => esc_html__( 'Click to go back to the site WP Admin area.', 'mainwp' ), | |
| 791 | - ); | |
| 792 | - /** | |
| 793 | - * Filter: mainwp_go_back_wpadmin_link | |
| 794 | - * | |
| 795 | - * Filters URL for the Go to WP Admin button in Main navigation. | |
| 796 | - * | |
| 797 | - * @since 4.0 | |
| 798 | - */ | |
| 799 | - $go_back_link = apply_filters( 'mainwp_go_back_wpadmin_link', $link ); | |
| 774 | + $link = array( | |
| 775 | + 'url' => $go_back_wpadmin_url, | |
| 776 | + 'text' => esc_html__( 'WP Admin', 'mainwp' ), | |
| 777 | + 'tip' => esc_html__( 'Click to go back to the site WP Admin area.', 'mainwp' ), | |
| 778 | + ); | |
| 779 | + /** | |
| 780 | + * Filter: mainwp_go_back_wpadmin_link | |
| 781 | + * | |
| 782 | + * Filters URL for the Go to WP Admin button in Main navigation. | |
| 783 | + * | |
| 784 | + * @since 4.0 | |
| 785 | + */ | |
| 786 | + $go_back_link = apply_filters( 'mainwp_go_back_wpadmin_link', $link ); | |
| 800 | 787 | |
| 801 | - if ( false !== $go_back_link && is_array( $go_back_link ) ) { | |
| 802 | - if ( isset( $go_back_link['url'] ) ) { | |
| 803 | - $link['url'] = $go_back_link['url']; | |
| 804 | - } | |
| 805 | - if ( isset( $go_back_link['text'] ) ) { | |
| 806 | - $link['text'] = $go_back_link['text']; | |
| 807 | - } | |
| 808 | - if ( isset( $go_back_link['tip'] ) ) { | |
| 809 | - $link['tip'] = $go_back_link['tip']; | |
| 810 | - } | |
| 788 | + if ( false !== $go_back_link && is_array( $go_back_link ) ) { | |
| 789 | + if ( isset( $go_back_link['url'] ) ) { | |
| 790 | + $link['url'] = $go_back_link['url']; | |
| 811 | 791 | } |
| 812 | - ?> | |
| 813 | - <div id="mainwp-first-level-wpitems-menu" class="ui vertical labeled inverted icon mini menu"> | |
| 814 | - <a class="item" href="#" id="mainwp-collapse-second-level-navigation" aria-label="<?php esc_attr_e( 'Collapse menu.', 'mainwp' ); ?>"> | |
| 815 | - <i class="double angle left icon"></i> | |
| 792 | + if ( isset( $go_back_link['text'] ) ) { | |
| 793 | + $link['text'] = $go_back_link['text']; | |
| 794 | + } | |
| 795 | + if ( isset( $go_back_link['tip'] ) ) { | |
| 796 | + $link['tip'] = $go_back_link['tip']; | |
| 797 | + } | |
| 798 | + } | |
| 799 | + ?> | |
| 800 | + <div id="mainwp-support-menu"> | |
| 801 | + <a class="mainwp-help-menu-item-open" id="mainwp-help-menu-item" title="<?php esc_attr_e( 'Support', 'mainwp' ); ?>" href="#"> | |
| 802 | + <i class="question circle outline icon"></i><br/> | |
| 803 | + <span class="ui small text"><?php esc_html_e( 'Support', 'mainwp' ); ?></span> | |
| 816 | 804 | </a> |
| 805 | + <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp_support_popup' ) ) : ?> | |
| 806 | + <span class="ui mainwp-help-popup popup" style="width: 200px !important;"> | |
| 807 | + <em data-emoji=":ring_buoy:" class="large"></em> | |
| 808 | + <h4 class="ui large header"><?php esc_html_e( 'Feeling stuck?', 'mainwp' ); ?></h4> | |
| 809 | + <p><?php esc_html_e( 'Help is just a click away.', 'mainwp' ); ?></p> | |
| 810 | + <a class="ui mini green button mainwp-notice-dismiss" notice-id="mainwp_support_popup" href="#"><?php esc_html_e( 'Thanks!', 'mainwp' ); ?></a> | |
| 811 | + </span> | |
| 812 | + <script> | |
| 813 | + jQuery(document).ready(function() { | |
| 814 | + jQuery('.mainwp-help-menu-item-open').popup({ | |
| 815 | + popup : jQuery('.mainwp-help-popup'), | |
| 816 | + delay : { show: 2000 }, | |
| 817 | + distanceAway : 10, | |
| 818 | + closable: false, | |
| 819 | + position : 'top left', | |
| 820 | + }).popup('show'); | |
| 821 | + | |
| 822 | + jQuery('.mainwp-help-popup .mainwp-notice-dismiss').on('click', function (e) { | |
| 823 | + jQuery('.mainwp-help-popup').removeClass('visible').addClass('hidden').hide(); | |
| 824 | + | |
| 825 | + }); | |
| 826 | + }); | |
| 827 | + </script> | |
| 828 | + <?php endif; ?> | |
| 817 | 829 | </div> |
| 818 | 830 | <div id="mainwp-first-level-navigation-version-label"> |
| 819 | - <span id="mainwp-version-label" class="ui mini green fluid centered label"><?php echo esc_html( $version ); ?></span> | |
| 831 | + <?php if ( is_array( $all_updates ) && isset( $all_updates['counts']['total'] ) && 0 < $all_updates['counts']['total'] ) : ?> | |
| 832 | + <a class="ui tiny red fluid centered pulse looping transition label" id="mainwp-dashboard-update-available" data-inverted="" data-position="left center" data-tooltip="<?php esc_attr_e( 'Your MainWP Dashboard sites needs your attention. Please check the available updates', 'mainwp' ); ?>" aria-label="<?php esc_attr_e( 'Your MainWP Dashboard sites needs your attention. Please check the available updates', 'mainwp' ); ?>" href="update-core.php"> | |
| 833 | + <i class="exclamation triangle icon" style="color:#fff"></i> <?php esc_html_e( 'Update Dashboard Site', 'mainwp' ); ?> | |
| 834 | + </a> | |
| 835 | + <?php endif; ?> | |
| 836 | + <div id="mainwp-version-label" class="ui tiny green fluid centered label"><?php echo esc_html( $version ); ?></div> | |
| 820 | 837 | </div> |
| 821 | 838 | </div> |
| 839 | + <div id="mainwp-divider-handle"> | |
| 840 | + <div id="mainwp-collapse-second-level-navigation" aria-label="<?php esc_attr_e( 'Collapse menu.', 'mainwp' ); ?>"> | |
| 841 | + <i class="double angle left small icon"></i> | |
| 842 | + </div> | |
| 843 | + </div> | |
| 822 | 844 | <div id="mainwp-second-level-navigation"> |
| 823 | - <div id="mainwp-main-menu" class="ui inverted vertical accordion menu"> | |
| 845 | + <div id="mainwp-main-menu" class="mainwp-main-navigation-menu ui inverted vertical accordion menu"> | |
| 824 | 846 | <?php |
| 825 | 847 | $bar_active_item_key = ''; |
| 826 | 848 | |
| 827 | 849 | $set_actived = false; |
| @@ -826,13 +848,13 @@ | ||
| 826 | 848 | |
| 827 | 849 | $set_actived = false; |
| 828 | 850 | |
| 829 | 851 | if ( ! empty( $bar_item_active ) ) { |
| 830 | - $item = $bar_item_active; | |
| 831 | - $title = wptexturize( $item[0] ); | |
| 832 | - $item_key = $item[1]; | |
| 833 | - $href = $item[2]; | |
| 834 | - $item_id = isset( $item[3] ) ? $item[3] : ''; | |
| 852 | + $item = $bar_item_active; | |
| 853 | + $title = wptexturize( $item[0] ); | |
| 854 | + $item_key = $item[1]; | |
| 855 | + $item_id = isset( $item[3] ) ? $item[3] : ''; | |
| 856 | + $level_cls = isset( $item[5] ) ? $item[5] : ''; | |
| 835 | 857 | |
| 836 | 858 | $bar_active_item_key = $item_key; |
| 837 | 859 | |
| 838 | 860 | $has_sub = true; |
| @@ -855,17 +877,17 @@ | ||
| 855 | 877 | $id_attr = ! empty( $item_id ) ? 'id="' . esc_html( $item_id ) . '"' : ''; |
| 856 | 878 | |
| 857 | 879 | // phpcs:disable WordPress.Security.EscapeOutput |
| 858 | 880 | if ( $has_sub ) { |
| 859 | - echo '<div ' . $id_attr . " class=\"item $active_item\">"; | |
| 860 | - echo "<a class=\"title with-sub $active_item\" href=\"$href\">$title <i class=\"dropdown icon\"></i></a>"; | |
| 881 | + echo '<div ' . $id_attr . " class=\"item $active_item " . esc_attr( $level_cls ) . ' ">'; | |
| 882 | + echo "<a class=\"title with-sub $active_item\" href=\"javascript:void(0)\">$title <i class=\"dropdown icon\"></i></a>"; | |
| 861 | 883 | echo "<div class=\"content menu $active_item\">"; |
| 862 | 884 | static::render_sub_item( $item_key ); |
| 863 | 885 | echo '</div>'; |
| 864 | 886 | echo '</div>'; |
| 865 | 887 | } else { |
| 866 | - echo '<div ' . $id_attr . ' class="item">'; | |
| 867 | - echo "<a class='title $active_item' href=\"$href\">$title</a>"; | |
| 888 | + echo '<div ' . $id_attr . ' class="item ' . esc_attr( $level_cls ) . '">'; | |
| 889 | + echo "<a class='title $active_item' href=\"javascript:void(0)\">$title</a>"; | |
| 868 | 890 | echo '</div>'; |
| 869 | 891 | } |
| 870 | 892 | // phpcs:enable |
| 871 | 893 | |
| @@ -889,8 +911,9 @@ | ||
| 889 | 911 | |
| 890 | 912 | $href = $item[2]; |
| 891 | 913 | $item_id = isset( $item[3] ) ? $item[3] : ''; |
| 892 | 914 | $ext_state = isset( $item[5] ) ? $item[5] : ''; |
| 915 | + $level_cls = isset( $item[7] ) ? $item[7] : ''; | |
| 893 | 916 | |
| 894 | 917 | $item_classes = 'inactive' === $ext_state ? 'extension-inactive' : ''; |
| 895 | 918 | |
| 896 | 919 | $active_item = ''; |
| @@ -912,12 +935,16 @@ | ||
| 912 | 935 | if ( 'admin.php?page=ManageApiBackups' === $href ) { |
| 913 | 936 | $hide_item = ' style="display:none"'; |
| 914 | 937 | } |
| 915 | 938 | |
| 939 | + if ( ! empty( $level_cls ) ) { | |
| 940 | + $item_classes = $item_classes . ' ' . $level_cls; | |
| 941 | + } | |
| 942 | + | |
| 916 | 943 | // phpcs:disable WordPress.Security.EscapeOutput |
| 917 | 944 | if ( $has_sub ) { |
| 918 | 945 | echo '<div ' . $id_attr . " class=\"item $active_item $item_classes\">"; |
| 919 | - echo "<a class=\"title with-sub $active_item\" href=\"$href\">$title <i class=\"dropdown icon\"></i></a>"; | |
| 946 | + echo "<a class=\"title with-sub $active_item\" href=\"javascript:void(0)\">$title <i class=\"dropdown icon\"></i></a>"; | |
| 920 | 947 | echo "<div class=\"content menu $active_item\">"; |
| 921 | 948 | static::render_sub_item( $item_key ); |
| 922 | 949 | echo '</div>'; |
| 923 | 950 | echo '</div>'; |
| @@ -922,9 +949,9 @@ | ||
| 922 | 949 | echo '</div>'; |
| 923 | 950 | echo '</div>'; |
| 924 | 951 | } else { |
| 925 | 952 | echo '<div ' . $id_attr . $hide_item . " class=\"item $active_item $item_classes\">"; |
| 926 | - echo "<a class='title $active_item' href=\"$href\">$title</a>"; | |
| 953 | + echo "<a class='title $active_item' href=\"javascript:void(0)\">$title</a>"; | |
| 927 | 954 | echo '</div>'; |
| 928 | 955 | } |
| 929 | 956 | // phpcs:enable |
| 930 | 957 | } |
| @@ -931,24 +958,29 @@ | ||
| 931 | 958 | } |
| 932 | 959 | } |
| 933 | 960 | ?> |
| 934 | 961 | </div> |
| 935 | - </div> | |
| 936 | 962 | </div> |
| 963 | + </div> | |
| 937 | 964 | |
| 938 | - <?php | |
| 939 | - /** | |
| 940 | - * Action: after_mainwp_menu | |
| 941 | - * | |
| 942 | - * Fires after the main navigation element. | |
| 943 | - * | |
| 944 | - * @since 4.0 | |
| 945 | - */ | |
| 946 | - do_action( 'after_mainwp_menu' ); | |
| 947 | - ?> | |
| 965 | + <?php | |
| 966 | + /** | |
| 967 | + * Action: after_mainwp_menu | |
| 968 | + * | |
| 969 | + * Fires after the main navigation element. | |
| 970 | + * | |
| 971 | + * @since 4.0 | |
| 972 | + */ | |
| 973 | + do_action( 'after_mainwp_menu' ); | |
| 974 | + ?> | |
| 948 | 975 | <script type="text/javascript"> |
| 976 | + | |
| 949 | 977 | jQuery( document ).ready( function () { |
| 950 | 978 | |
| 979 | + setTimeout(() => { | |
| 980 | + jQuery('#mainwp-dashboard-update-available').removeClass('looping'); | |
| 981 | + }, 1500); | |
| 982 | + | |
| 951 | 983 | let mainwp_left_bar_showhide_init = function(){ |
| 952 | 984 | if(jQuery('body').hasClass('mainwp-hidden-second-level-navigation')){ |
| 953 | 985 | return; // hide always. |
| 954 | 986 | } |
| @@ -962,13 +994,13 @@ | ||
| 962 | 994 | mainwp_left_bar_showhide = function( lbar, show ){ |
| 963 | 995 | if ( show ) { |
| 964 | 996 | jQuery( '#mainwp-second-level-navigation' ).show(); |
| 965 | 997 | jQuery( '.mainwp-content-wrap' ).css( "margin-left", "272px" ); |
| 966 | - jQuery( '#mainwp-screenshots-sites' ).css( "margin-left", "272px" ); | |
| 998 | + //jQuery( '#mainwp-screenshots-sites' ).css( "margin-left", "272px" ); | |
| 967 | 999 | jQuery( '#mainwp-main-navigation-container' ).css( "width", "272px" ); |
| 968 | 1000 | jQuery( lbar ).find( '.icon' ).removeClass( 'right' ); |
| 969 | 1001 | jQuery( lbar ).find( '.icon' ).addClass( 'left' ); |
| 970 | - jQuery( lbar ).css( "left", "272px" ); | |
| 1002 | + jQuery( lbar ).parent('#mainwp-divider-handle').css( "left", "200px" ); | |
| 971 | 1003 | jQuery( lbar ).removeClass( 'collapsed' ); |
| 972 | 1004 | if( ( typeof mainwp_ui_state_save !== 'undefined' ) ) { |
| 973 | 1005 | mainwp_ui_state_save( 'showmenu', 1 ); |
| 974 | 1006 | } |
| @@ -974,13 +1006,13 @@ | ||
| 974 | 1006 | } |
| 975 | 1007 | } else { |
| 976 | 1008 | jQuery( '#mainwp-second-level-navigation' ).hide(); |
| 977 | 1009 | jQuery( '.mainwp-content-wrap' ).css( "margin-left", "72px" ); |
| 978 | - jQuery( '#mainwp-screenshots-sites' ).css( "margin-left", "72px" ); | |
| 1010 | + //jQuery( '#mainwp-screenshots-sites' ).css( "margin-left", "72px" ); | |
| 979 | 1011 | jQuery( '#mainwp-main-navigation-container' ).css( "width", "72px" ); |
| 980 | 1012 | jQuery( lbar ).find( '.icon' ).removeClass( 'left' ); |
| 981 | 1013 | jQuery( lbar ).find( '.icon' ).addClass( 'right' ); |
| 982 | - jQuery( lbar ).css( "left", "72px" ); | |
| 1014 | + jQuery( lbar ).parent('#mainwp-divider-handle').css( "left", "0px" ); | |
| 983 | 1015 | jQuery( lbar ).addClass( 'collapsed' ); |
| 984 | 1016 | jQuery( '#mainwp-top-header' ).css( "width", "100%" ); |
| 985 | 1017 | if( ( typeof mainwp_ui_state_save !== 'undefined' ) ) { |
| 986 | 1018 | mainwp_ui_state_save( 'showmenu', 0 ); |
| @@ -995,9 +1027,9 @@ | ||
| 995 | 1027 | } ); |
| 996 | 1028 | mainwp_left_bar_showhide_init(); |
| 997 | 1029 | |
| 998 | 1030 | // click on menu with-sub icon. |
| 999 | - jQuery( '#mainwp-main-navigation-container #mainwp-main-menu a.title.with-sub .icon' ).on( "click", function ( event ) { | |
| 1031 | + jQuery( '#mainwp-main-navigation-container .mainwp-main-navigation-menu a.title.with-sub .icon' ).on( "click", function ( event ) { | |
| 1000 | 1032 | let pr = jQuery( this ).closest( '.item' ); |
| 1001 | 1033 | let title = jQuery( this ).closest( '.title' ); |
| 1002 | 1034 | let active = jQuery( title ).hasClass( 'active' ); |
| 1003 | 1035 | |
| @@ -1012,9 +1044,9 @@ | ||
| 1012 | 1044 | } |
| 1013 | 1045 | return false; |
| 1014 | 1046 | } ); |
| 1015 | 1047 | |
| 1016 | - jQuery( '#mainwp-main-navigation-container #mainwp-main-menu a.title.with-sub' ).on( "click", function ( event ) { | |
| 1048 | + jQuery( '#mainwp-main-navigation-container .mainwp-main-navigation-menu a.title.with-sub' ).on( "click", function ( event ) { | |
| 1017 | 1049 | let pr = jQuery( this ).closest( '.item' ); |
| 1018 | 1050 | let active = jQuery( this ).hasClass( 'active' ); |
| 1019 | 1051 | |
| 1020 | 1052 | // remove current active. |
| @@ -1029,14 +1061,14 @@ | ||
| 1029 | 1061 | } ); |
| 1030 | 1062 | |
| 1031 | 1063 | mainwp_menu_collapse = function() { |
| 1032 | 1064 | // remove current active. |
| 1033 | - jQuery( '#mainwp-main-navigation-container #mainwp-main-menu a.title.active').removeClass('active'); | |
| 1034 | - jQuery( '#mainwp-main-navigation-container #mainwp-main-menu .item').removeClass('active'); | |
| 1035 | - jQuery( '#mainwp-main-navigation-container #mainwp-main-menu .content.menu.active').removeClass('active'); | |
| 1065 | + jQuery( '#mainwp-main-navigation-container .mainwp-main-navigation-menu a.title.active').removeClass('active'); | |
| 1066 | + jQuery( '#mainwp-main-navigation-container .mainwp-main-navigation-menu .item').removeClass('active'); | |
| 1067 | + jQuery( '#mainwp-main-navigation-container .mainwp-main-navigation-menu .content.menu.active').removeClass('active'); | |
| 1036 | 1068 | }; |
| 1037 | 1069 | |
| 1038 | - jQuery('.mainwp-main-mobile-navigation-container #mainwp-main-menu').accordion(); | |
| 1070 | + jQuery( '#mainwp-main-mobile-navigation-container .accordion.menu' ).accordion(); | |
| 1039 | 1071 | |
| 1040 | 1072 | } ); |
| 1041 | 1073 | </script> |
| 1042 | 1074 | <?php |
| @@ -1049,10 +1081,11 @@ | ||
| 1049 | 1081 | */ |
| 1050 | 1082 | public static function render_mobile_menu() { // phpcs:ignore -- NOSONAR -Current complexity is the only way to achieve desired results, pull request solutions appreciated. |
| 1051 | 1083 | $mainwp_show_language_updates = get_option( 'mainwp_show_language_updates', 1 ); |
| 1052 | 1084 | ?> |
| 1053 | - <div class="mainwp-main-mobile-navigation-container"> | |
| 1054 | - <div class="mainwp-nav-menu"> | |
| 1085 | + <div id="mainwp-overlay"></div> | |
| 1086 | + <div id="mainwp-main-mobile-navigation-container" class="mainwp-main-mobile-navigation-container ui top fullscreen flyout"> | |
| 1087 | + <div class="mainwp-nav-menu scrolling content"> | |
| 1055 | 1088 | <?php |
| 1056 | 1089 | /** |
| 1057 | 1090 | * Action: before_mainwp_menu |
| 1058 | 1091 | * |
| @@ -1062,100 +1095,96 @@ | ||
| 1062 | 1095 | */ |
| 1063 | 1096 | do_action( 'before_mainwp_menu' ); |
| 1064 | 1097 | ?> |
| 1065 | 1098 | |
| 1066 | - <div id="mainwp-main-menu" class="test-menu ui inverted vertical accordion menu"> | |
| 1067 | - <div class="hamburger"> | |
| 1068 | - <span class="hamburger-bun"></span> | |
| 1069 | - <span class="hamburger-patty"></span> | |
| 1070 | - <span class="hamburger-bun"></span> | |
| 1071 | - </div> | |
| 1099 | + <div id="mainwp-main-menu-mobile" class="mainwp-main-navigation-menu test-menu ui inverted vertical accordion menu"> | |
| 1100 | + <div class="item"><a href="admin.php?page=mainwp_tab"><i class="th icon"></i> <?php esc_html_e( 'Operations', 'mainwp' ); ?></a></div> | |
| 1072 | 1101 | |
| 1073 | - <div class="item"><a href="admin.php?page=mainwp_tab"><?php esc_html_e( 'Overview', 'mainwp' ); ?></a></div> | |
| 1074 | 1102 | <div class="item"> |
| 1075 | - <div class="title"><a href="admin.php?page=managesites" class=" with-sub"><?php esc_html_e( 'Sites', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1103 | + <div class="title"><a href="admin.php?page=managesites" class="with-sub"><i class="globe left floated icon"></i> <?php esc_html_e( 'Sites', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1076 | 1104 | <div class="content menu" id="mainwp-sites-mobile-menu-item"> |
| 1077 | - <div class="accordion item"> | |
| 1078 | - <div class="title"><a href="admin.php?page=managesites"><?php esc_html_e( 'Sites', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1079 | - <div class="content menu"> | |
| 1080 | - <a class="item" href="admin.php?page=managesites"><?php esc_html_e( 'Manage Sites', 'mainwp' ); ?></a> | |
| 1081 | - <a class="item" href="admin.php?page=managesites&do=new"><?php esc_html_e( 'Add New Site', 'mainwp' ); ?></a> | |
| 1082 | - <a class="item" href="admin.php?page=managesites&do=bulknew"><?php esc_html_e( 'Import Sites', 'mainwp' ); ?></a> | |
| 1083 | - <a class="item" href="admin.php?page=MonitoringSites"><?php esc_html_e( 'Monitoring', 'mainwp' ); ?></a> | |
| 1084 | - </div> | |
| 1105 | + <div class="item"> | |
| 1106 | + <div class="title"><a href="admin.php?page=managesites"><?php esc_html_e( 'Sites', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1107 | + <div class="content menu"> | |
| 1108 | + <a class="item" href="admin.php?page=managesites"><?php esc_html_e( 'Manage Sites', 'mainwp' ); ?></a> | |
| 1109 | + <a class="item" href="admin.php?page=managesites&do=new"><?php esc_html_e( 'Add New Site', 'mainwp' ); ?></a> | |
| 1110 | + <a class="item" href="admin.php?page=managesites&do=bulknew"><?php esc_html_e( 'Import Sites', 'mainwp' ); ?></a> | |
| 1111 | + <a class="item" href="admin.php?page=MonitoringSites"><?php esc_html_e( 'Monitoring', 'mainwp' ); ?></a> | |
| 1085 | 1112 | </div> |
| 1086 | - <div class="item accordion"> | |
| 1087 | - <div class="title"><a class="" href="admin.php?page=ManageGroups"><?php esc_html_e( 'Tags', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1113 | + </div> | |
| 1114 | + <div class="item"> | |
| 1115 | + <div class="title"><a class="" href="admin.php?page=ManageGroups"><?php esc_html_e( 'Tags', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1116 | + <div class="content menu"> | |
| 1117 | + <a class="item" href="admin.php?page=ManageGroups"><?php esc_html_e( 'Manage Tags', 'mainwp' ); ?></a> | |
| 1118 | + </div> | |
| 1119 | + </div> | |
| 1120 | + <div class="item"> | |
| 1121 | + <div class="title"><a href="admin.php?page=UpdatesManage"><?php esc_html_e( 'Updates', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1088 | 1122 | <div class="content menu"> |
| 1089 | - <a class="item" href="admin.php?page=ManageGroups"><?php esc_html_e( 'Manage Tags', 'mainwp' ); ?></a> | |
| 1123 | + <a class="item" href="admin.php?page=UpdatesManage&tab=plugins-updates"><?php esc_html_e( 'Plugin Updates', 'mainwp' ); ?></a> | |
| 1124 | + <a class="item" href="admin.php?page=UpdatesManage&tab=themes-updates"><?php esc_html_e( 'Theme Updates', 'mainwp' ); ?></a> | |
| 1125 | + <a class="item" href="admin.php?page=UpdatesManage&tab=wordpress-updates"><?php esc_html_e( 'WordPress Updates', 'mainwp' ); ?></a> | |
| 1126 | + <?php if ( $mainwp_show_language_updates ) : ?> | |
| 1127 | + <a class="item" href="admin.php?page=UpdatesManage&tab=translations-updates"><?php esc_html_e( 'Translation Plugins', 'mainwp' ); ?></a> | |
| 1128 | + <?php endif; ?> | |
| 1129 | + <a class="item" href="admin.php?page=PluginsAbandoned"><?php esc_html_e( 'Abandoned Plugins', 'mainwp' ); ?></a> | |
| 1130 | + <a class="item" href="admin.php?page=ThemesAbandoned"><?php esc_html_e( 'Abandoned Themes', 'mainwp' ); ?></a> | |
| 1090 | 1131 | </div> |
| 1132 | + </div> | |
| 1133 | + <div class="item"> | |
| 1134 | + <div class="title"><a href="admin.php?page=PluginsManage"><?php esc_html_e( 'Plugins', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1135 | + <div class="content menu"> | |
| 1136 | + <a class="item" href="admin.php?page=PluginsManage"><?php esc_html_e( 'Manage Plugins', 'mainwp' ); ?></a> | |
| 1137 | + <a class="item" href="admin.php?page=PluginsInstall"><?php esc_html_e( 'Install', 'mainwp' ); ?></a> | |
| 1138 | + <a class="item" href="admin.php?page=PluginsAutoUpdate"><?php esc_html_e( 'Advanced Auto Updates', 'mainwp' ); ?></a> | |
| 1139 | + <a class="item" href="admin.php?page=PluginsIgnore"><?php esc_html_e( 'Ignored Updates', 'mainwp' ); ?></a> | |
| 1140 | + <a class="item" href="admin.php?page=PluginsIgnoredAbandoned"><?php esc_html_e( 'Ignored Abandoned', 'mainwp' ); ?></a> | |
| 1091 | 1141 | </div> |
| 1092 | - <div class="item accordion"> | |
| 1093 | - <div class="title"><a href="admin.php?page=UpdatesManage"><?php esc_html_e( 'Updates', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1094 | - <div class="content menu"> | |
| 1095 | - <a class="item" href="admin.php?page=UpdatesManage&tab=plugins-updates"><?php esc_html_e( 'Plugins Updates', 'mainwp' ); ?></a> | |
| 1096 | - <a class="item" href="admin.php?page=UpdatesManage&tab=themes-updates"><?php esc_html_e( 'Themes Updates', 'mainwp' ); ?></a> | |
| 1097 | - <a class="item" href="admin.php?page=UpdatesManage&tab=wordpress-updates"><?php esc_html_e( 'WordPress Updates', 'mainwp' ); ?></a> | |
| 1098 | - <?php if ( $mainwp_show_language_updates ) : ?> | |
| 1099 | - <a class="item" href="admin.php?page=UpdatesManage&tab=translations-updates"><?php esc_html_e( 'Translation Plugins', 'mainwp' ); ?></a> | |
| 1100 | - <?php endif; ?> | |
| 1101 | - <a class="item" href="admin.php?page=UpdatesManage&tab=abandoned-plugins"><?php esc_html_e( 'Abandoned Plugins', 'mainwp' ); ?></a> | |
| 1102 | - <a class="item" href="admin.php?page=UpdatesManage&tab=abandoned-themes"><?php esc_html_e( 'Abandoned Themes', 'mainwp' ); ?></a> | |
| 1103 | - </div> | |
| 1142 | + </div> | |
| 1143 | + <div class="item"> | |
| 1144 | + <div class="title"><a href="admin.php?page=ThemesManage"><?php esc_html_e( 'Themes', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1145 | + <div class="content menu"> | |
| 1146 | + <a class="item" href="admin.php?page=ThemesManage"><?php esc_html_e( 'Manage Themes', 'mainwp' ); ?></a> | |
| 1147 | + <a class="item" href="admin.php?page=ThemesInstall"><?php esc_html_e( 'Install', 'mainwp' ); ?></a> | |
| 1148 | + <a class="item" href="admin.php?page=ThemesAutoUpdate"><?php esc_html_e( 'Advanced Auto Updates', 'mainwp' ); ?></a> | |
| 1149 | + <a class="item" href="admin.php?page=ThemesIgnore"><?php esc_html_e( 'Ignored Updates', 'mainwp' ); ?></a> | |
| 1150 | + <a class="item" href="admin.php?page=ThemesIgnoredAbandoned"><?php esc_html_e( 'Ignored Abandoned', 'mainwp' ); ?></a> | |
| 1104 | 1151 | </div> |
| 1105 | - <div class="item accordion"> | |
| 1106 | - <div class="title"><a href="admin.php?page=PluginsManage"><?php esc_html_e( 'Plugins', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1107 | - <div class="content menu"> | |
| 1108 | - <a class="item" href="admin.php?page=PluginsManage"><?php esc_html_e( 'Manage Plugins', 'mainwp' ); ?></a> | |
| 1109 | - <a class="item" href="admin.php?page=PluginsInstall"><?php esc_html_e( 'Install', 'mainwp' ); ?></a> | |
| 1110 | - <a class="item" href="admin.php?page=PluginsAutoUpdate"><?php esc_html_e( 'Advanced Auto Updates', 'mainwp' ); ?></a> | |
| 1111 | - <a class="item" href="admin.php?page=PluginsIgnore"><?php esc_html_e( 'Ignored Updates', 'mainwp' ); ?></a> | |
| 1112 | - <a class="item" href="admin.php?page=PluginsIgnoredAbandoned"><?php esc_html_e( 'Ignored Abandoned', 'mainwp' ); ?></a> | |
| 1113 | - </div> | |
| 1152 | + </div> | |
| 1153 | + <div class="item"> | |
| 1154 | + <div class="title"><a href="admin.php?page=UserBulkManage"><?php esc_html_e( 'Users', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1155 | + <div class="content menu"> | |
| 1156 | + <a class="item" href="admin.php?page=UserBulkManage"><?php esc_html_e( 'Manage Users', 'mainwp' ); ?></a> | |
| 1157 | + <a class="item" href="admin.php?page=UserBulkAdd"><?php esc_html_e( 'Add New User', 'mainwp' ); ?></a> | |
| 1158 | + <a class="item" href="admin.php?page=BulkImportUsers"><?php esc_html_e( 'Import Users', 'mainwp' ); ?></a> | |
| 1159 | + <a class="item" href="admin.php?page=UpdateAdminPasswords"><?php esc_html_e( 'Admin Passwords', 'mainwp' ); ?></a> | |
| 1114 | 1160 | </div> |
| 1115 | - <div class="item accordion"> | |
| 1116 | - <div class="title"><a href="admin.php?page=ThemesManage"><?php esc_html_e( 'Themes', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1117 | - <div class="content menu"> | |
| 1118 | - <a class="item" href="admin.php?page=ThemesManage"><?php esc_html_e( 'Manage Themes', 'mainwp' ); ?></a> | |
| 1119 | - <a class="item" href="admin.php?page=ThemesInstall"><?php esc_html_e( 'Install', 'mainwp' ); ?></a> | |
| 1120 | - <a class="item" href="admin.php?page=ThemesAutoUpdate"><?php esc_html_e( 'Advanced Auto Updates', 'mainwp' ); ?></a> | |
| 1121 | - <a class="item" href="admin.php?page=ThemesIgnore"><?php esc_html_e( 'Ignored Updates', 'mainwp' ); ?></a> | |
| 1122 | - <a class="item" href="admin.php?page=ThemesIgnoredAbandoned"><?php esc_html_e( 'Ignored Abandoned', 'mainwp' ); ?></a> | |
| 1123 | - </div> | |
| 1161 | + </div> | |
| 1162 | + <div class="item"> | |
| 1163 | + <div class="title"><a href="admin.php?page=PostBulkManage"><?php esc_html_e( 'Posts', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1164 | + <div class="content menu"> | |
| 1165 | + <a class="item" href="admin.php?page=PostBulkManage"><?php esc_html_e( 'Manage Posts', 'mainwp' ); ?></a> | |
| 1166 | + <a class="item" href="admin.php?page=PostBulkAdd"><?php esc_html_e( 'Add New Post', 'mainwp' ); ?></a> | |
| 1124 | 1167 | </div> |
| 1125 | - <div class="item accordion"> | |
| 1126 | - <div class="title"><a href="admin.php?page=UserBulkManage"><?php esc_html_e( 'Users', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1127 | - <div class="content menu"> | |
| 1128 | - <a class="item" href="admin.php?page=UserBulkManage"><?php esc_html_e( 'Manage Users', 'mainwp' ); ?></a> | |
| 1129 | - <a class="item" href="admin.php?page=UserBulkAdd"><?php esc_html_e( 'Add New User', 'mainwp' ); ?></a> | |
| 1130 | - <a class="item" href="admin.php?page=BulkImportUsers"><?php esc_html_e( 'Import Users', 'mainwp' ); ?></a> | |
| 1131 | - <a class="item" href="admin.php?page=UpdateAdminPasswords"><?php esc_html_e( 'Admin Passwords', 'mainwp' ); ?></a> | |
| 1132 | - </div> | |
| 1168 | + </div> | |
| 1169 | + <div class="item"> | |
| 1170 | + <div class="title"><a href="admin.php?page=PageBulkManage"><?php esc_html_e( 'Pages', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1171 | + <div class="content menu"> | |
| 1172 | + <a class="item" href="admin.php?page=PageBulkManage"><?php esc_html_e( 'Manage Pages', 'mainwp' ); ?></a> | |
| 1173 | + <a class="item" href="admin.php?page=PageBulkAdd"><?php esc_html_e( 'Add New Page', 'mainwp' ); ?></a> | |
| 1133 | 1174 | </div> |
| 1134 | - <div class="item accordion"> | |
| 1135 | - <div class="title"><a href="admin.php?page=PostBulkManage"><?php esc_html_e( 'Posts', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1136 | - <div class="content menu"> | |
| 1137 | - <a class="item" href="admin.php?page=PostBulkManage"><?php esc_html_e( 'Manage Pages', 'mainwp' ); ?></a> | |
| 1138 | - <a class="item" href="admin.php?page=PostBulkAdd"><?php esc_html_e( 'Add New Post', 'mainwp' ); ?></a> | |
| 1139 | - </div> | |
| 1175 | + </div> | |
| 1176 | + <div class="item"> | |
| 1177 | + <div class="title"><a href="admin.php?page=ManageApiBackups"><?php esc_html_e( 'Backups', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1178 | + <div class="content menu"> | |
| 1179 | + <a class="item" href="admin.php?page=ManageApiBackups"><?php esc_html_e( 'Backups', 'mainwp' ); ?></a> | |
| 1140 | 1180 | </div> |
| 1141 | - <div class="item accordion"> | |
| 1142 | - <div class="title"><a href="admin.php?page=PageBulkManage"><?php esc_html_e( 'Pages', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1143 | - <div class="content menu"> | |
| 1144 | - <a class="item" href="admin.php?page=PageBulkManage"><?php esc_html_e( 'Manage Pages', 'mainwp' ); ?></a> | |
| 1145 | - <a class="item" href="admin.php?page=PageBulkAdd"><?php esc_html_e( 'Add New Page', 'mainwp' ); ?></a> | |
| 1146 | - </div> | |
| 1147 | - </div> | |
| 1148 | - <div class="item accordion"> | |
| 1149 | - <div class="title"><a href="admin.php?page=ManageApiBackups"><?php esc_html_e( 'Backups', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1150 | - <div class="content menu"> | |
| 1151 | - <a class="item" href="admin.php?page=ManageApiBackups"><?php esc_html_e( 'Backups', 'mainwp' ); ?></a> | |
| 1152 | - </div> | |
| 1153 | - </div> | |
| 1181 | + </div> | |
| 1154 | 1182 | </div> |
| 1155 | 1183 | </div> |
| 1184 | + | |
| 1156 | 1185 | <div class="item"> |
| 1157 | - <div class="title"><a href="admin.php?page=ManageClients" class="with-sub"><?php esc_html_e( 'Clients', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1186 | + <div class="title"><a href="admin.php?page=ManageClients" class="with-sub"><i class="users icon"></i> <?php esc_html_e( 'Clients', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1158 | 1187 | <div class="content menu"> |
| 1159 | 1188 | <a class="item" href="admin.php?page=ManageClients"><?php esc_html_e( 'Clients', 'mainwp' ); ?></a> |
| 1160 | 1189 | <a class="item" href="admin.php?page=ClientAddNew"><?php esc_html_e( 'Add Client', 'mainwp' ); ?></a> |
| 1161 | 1190 | <a class="item" href="admin.php?page=ClientAddField"><?php esc_html_e( 'Client Fields', 'mainwp' ); ?></a> |
| @@ -1162,18 +1191,18 @@ | ||
| 1162 | 1191 | </div> |
| 1163 | 1192 | </div> |
| 1164 | 1193 | |
| 1165 | 1194 | <div class="item"> |
| 1166 | - <div class="title"><a href="admin.php?page=ManageCostTracker" class="with-sub"><?php esc_html_e( 'Cost Tracker', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1195 | + <div class="title"><a href="admin.php?page=ManageCostTracker" class="with-sub"><i class="dollar sign icon"></i> <?php esc_html_e( 'Cost Tracker', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1167 | 1196 | <div class="content menu"> |
| 1168 | - <a class="item" href="admin.php?page=ManageCostTracker"><?php esc_html_e( 'Cost Tracker', 'mainwp' ); ?></a> | |
| 1197 | + <a class="item" href="admin.php?page=CostSummary"><?php esc_html_e( 'Cost Summary', 'mainwp' ); ?></a> | |
| 1198 | + <a class="item" href="admin.php?page=ManageCostTracker"><?php esc_html_e( 'Manage Costs', 'mainwp' ); ?></a> | |
| 1169 | 1199 | <a class="item" href="admin.php?page=CostTrackerAdd"><?php esc_html_e( 'Add Cost', 'mainwp' ); ?></a> |
| 1170 | - <a class="item" href="admin.php?page=CostTrackerSettings"><?php esc_html_e( 'Cost Tracker Settings', 'mainwp' ); ?></a> | |
| 1171 | 1200 | </div> |
| 1172 | 1201 | </div> |
| 1173 | 1202 | |
| 1174 | 1203 | <div class="item"> |
| 1175 | - <div class="title"><a href="admin.php?page=InsightsOverview" class="with-sub"><?php esc_html_e( 'Insights', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1204 | + <div class="title"><a href="admin.php?page=InsightsOverview" class="with-sub"><i class="chart pie icon"></i> <?php esc_html_e( 'Insights', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1176 | 1205 | <div class="content menu"> |
| 1177 | 1206 | <a class="item" href="admin.php?page=InsightsOverview"><?php esc_html_e( 'Insights', 'mainwp' ); ?></a> |
| 1178 | 1207 | </div> |
| 1179 | 1208 | </div> |
| @@ -1178,31 +1207,37 @@ | ||
| 1178 | 1207 | </div> |
| 1179 | 1208 | </div> |
| 1180 | 1209 | |
| 1181 | 1210 | <div class="item"> |
| 1182 | - <div class="title"><a href="admin.php?page=RESTAPI" class="with-sub"><?php esc_html_e( 'REST API', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1211 | + <div class="title"><a href="admin.php?page=Extensions" class=""><i class="box icon"></i> <?php esc_html_e( 'Add-ons', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1183 | 1212 | <div class="content menu"> |
| 1184 | - <a class="item" href="admin.php?page=RESTAPI"><?php esc_html_e( 'Manage API Keys', 'mainwp' ); ?></a> | |
| 1185 | - <a class="item" href="admin.php?page=AddApiKeys"><?php esc_html_e( 'Add API Keys', 'mainwp' ); ?></a> | |
| 1213 | + <a class="item" href="admin.php?page=Extensions"><?php esc_html_e( 'Manage Add-ons', 'mainwp' ); ?></a> | |
| 1186 | 1214 | </div> |
| 1187 | 1215 | </div> |
| 1216 | + | |
| 1188 | 1217 | <div class="item"> |
| 1189 | - <div class="title"><a href="admin.php?page=Extensions" class=""><?php esc_html_e( 'Extensions', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1218 | + <div class="title"><a href="admin.php?page=RESTAPI" class="with-sub"><i class="key icon"></i> <?php esc_html_e( 'REST API', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1190 | 1219 | <div class="content menu"> |
| 1191 | - <a class="item" href="admin.php?page=Extensions"><?php esc_html_e( 'Manage Extensions', 'mainwp' ); ?></a> | |
| 1220 | + <a class="item" href="admin.php?page=RESTAPI"><?php esc_html_e( 'Manage API Keys', 'mainwp' ); ?></a> | |
| 1221 | + <a class="item" href="admin.php?page=AddApiKeys"><?php esc_html_e( 'Add API Keys', 'mainwp' ); ?></a> | |
| 1222 | + <a class="item" href="admin.php?page=ApplicationPasswords"><?php esc_html_e( 'Application Passwords', 'mainwp' ); ?></a> | |
| 1192 | 1223 | </div> |
| 1193 | 1224 | </div> |
| 1225 | + | |
| 1194 | 1226 | <div class="item"> |
| 1195 | - <div class="title"><a href="admin.php?page=Settings" class="with-sub"><?php esc_html_e( 'Settings', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1227 | + <div class="title"><a href="admin.php?page=Settings" class="with-sub"><i class="cog icon"></i> <?php esc_html_e( 'Settings', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1196 | 1228 | <div class="content menu"> |
| 1197 | 1229 | <a class="item" href="admin.php?page=Settings"><?php esc_html_e( 'General Settings', 'mainwp' ); ?></a> |
| 1198 | 1230 | <a class="item" href="admin.php?page=SettingsAdvanced"><?php esc_html_e( 'Advanced Settings', 'mainwp' ); ?></a> |
| 1231 | + <a class="item" href="admin.php?page=MonitoringSettings"><?php esc_html_e( 'Monitoring Settings', 'mainwp' ); ?></a> | |
| 1199 | 1232 | <a class="item" href="admin.php?page=SettingsEmail"><?php esc_html_e( 'Email Settings', 'mainwp' ); ?></a> |
| 1233 | + <a class="item" href="admin.php?page=PremiumUpdates"><?php esc_html_e( 'Premium Updates', 'mainwp' ); ?></a> | |
| 1200 | 1234 | <a class="item" href="admin.php?page=MainWPTools"><?php esc_html_e( 'Tools', 'mainwp' ); ?></a> |
| 1201 | 1235 | </div> |
| 1202 | 1236 | </div> |
| 1237 | + | |
| 1203 | 1238 | <div class="item"> |
| 1204 | - <div class="title"><a href="admin.php?page=ServerInformation" class="with-sub"><?php esc_html_e( 'Info', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1239 | + <div class="title"><a href="admin.php?page=ServerInformation" class="with-sub"><i class="info circle icon"></i> <?php esc_html_e( 'Info', 'mainwp' ); ?></a><i class="dropdown icon"></i></div> | |
| 1205 | 1240 | <div class="content menu"> |
| 1206 | 1241 | <a class="item" href="admin.php?page=ServerInformation"><?php esc_html_e( 'Server', 'mainwp' ); ?></a> |
| 1207 | 1242 | <a class="item" href="admin.php?page=ServerInformationCron"><?php esc_html_e( 'Cron Schedules', 'mainwp' ); ?></a> |
| 1208 | 1243 | <a class="item" href="admin.php?page=ErrorLog"><?php esc_html_e( 'Error Log', 'mainwp' ); ?></a> |
| @@ -1209,9 +1244,22 @@ | ||
| 1209 | 1244 | <a class="item" href="admin.php?page=ActionLogs"><?php esc_html_e( 'Custom Event Monitor', 'mainwp' ); ?></a> |
| 1210 | 1245 | <a class="item" href="admin.php?page=PluginPrivacy"><?php esc_html_e( 'Plugin Privacy', 'mainwp' ); ?></a> |
| 1211 | 1246 | </div> |
| 1212 | 1247 | </div> |
| 1213 | - <?php | |
| 1248 | + </div> | |
| 1249 | + <?php | |
| 1250 | + /** | |
| 1251 | + * Action: after_mainwp_menu | |
| 1252 | + * | |
| 1253 | + * Fires after the main navigation element. | |
| 1254 | + * | |
| 1255 | + * @since 4.0 | |
| 1256 | + */ | |
| 1257 | + do_action( 'after_mainwp_menu' ); | |
| 1258 | + ?> | |
| 1259 | + </div> | |
| 1260 | + <div class="actions"> | |
| 1261 | + <?php | |
| 1214 | 1262 | $go_back_wpadmin_url = admin_url( 'index.php' ); |
| 1215 | 1263 | |
| 1216 | 1264 | $link = array( |
| 1217 | 1265 | 'url' => $go_back_wpadmin_url, |
| @@ -1239,25 +1287,21 @@ | ||
| 1239 | 1287 | if ( isset( $go_back_link['tip'] ) ) { |
| 1240 | 1288 | $link['tip'] = $go_back_link['tip']; |
| 1241 | 1289 | } |
| 1242 | 1290 | } |
| 1243 | - ?> | |
| 1244 | - <div class="item item-wp-admin"> | |
| 1245 | - <a href="<?php echo esc_html( $link['url'] ); ?>" class="title" style="display:inline" data-position="top left" data-tooltip="<?php echo esc_html( $link['tip'] ); ?>"><b><i class="icon wordpress"></i> <?php echo esc_html( $link['text'] ); ?></b></a> <a class="ui small label" data-position="top right" data-tooltip="<?php esc_html_e( 'Logout', 'mainwp' ); ?>" href="<?php echo wp_logout_url(); ?>"><i class="sign out icon" style="margin:0"></i></a> <?php //phpcs:ignore -- to avoid auto fix icon wordpress ?> | |
| 1291 | + } | |
| 1292 | + ?> | |
| 1293 | + <div class="ui three column grid"> | |
| 1294 | + <div class="column"> | |
| 1295 | + <a href="<?php echo esc_url( $link['url'] ); ?>" class="ui mini basic fluid button small text"><i class="icon wordpress"></i> <?php echo esc_html( $link['text'] ); ?></a><?php //phpcs:ignore -- to avoid auto fix icon wordpress. ?> | |
| 1246 | 1296 | </div> |
| 1247 | - <?php } ?> | |
| 1248 | - | |
| 1297 | + <div class="column"> | |
| 1298 | + <a id="mainwp-help-menu-item-mobile" class="ui mini basic fluid button" href="#"><i class="question circle icon"></i> <?php esc_html_e( 'Help', 'mainwp' ); ?></a><?php //NOSONAR -- ignore double ID, elements not rendered at the same time. ?> | |
| 1299 | + </div> | |
| 1300 | + <div class="column item-wp-admin"> | |
| 1301 | + <a class="ui mini basic fluid button" href="<?php echo esc_url_raw( wp_logout_url() ); ?>"><i class="sign out icon"></i> <?php esc_html_e( 'Log Out', 'mainwp' ); ?></a> | |
| 1302 | + </div> | |
| 1249 | 1303 | </div> |
| 1250 | - <?php | |
| 1251 | - /** | |
| 1252 | - * Action: after_mainwp_menu | |
| 1253 | - * | |
| 1254 | - * Fires after the main navigation element. | |
| 1255 | - * | |
| 1256 | - * @since 4.0 | |
| 1257 | - */ | |
| 1258 | - do_action( 'after_mainwp_menu' ); | |
| 1259 | - ?> | |
| 1260 | 1304 | </div> |
| 1261 | 1305 | </div> |
| 1262 | 1306 | <?php |
| 1263 | 1307 | } |
| @@ -1278,9 +1322,9 @@ | ||
| 1278 | 1322 | * MainWP Left Menu. |
| 1279 | 1323 | * |
| 1280 | 1324 | * @global object $mainwp_sub_leftmenu |
| 1281 | 1325 | */ |
| 1282 | - global $mainwp_sub_leftmenu, $_mainwp_menu_active_slugs; | |
| 1326 | + global $mainwp_sub_leftmenu; | |
| 1283 | 1327 | |
| 1284 | 1328 | $submenu_items = $mainwp_sub_leftmenu[ $parent_key ]; |
| 1285 | 1329 | |
| 1286 | 1330 | if ( ! is_array( $submenu_items ) || empty( $submenu_items ) ) { |
| @@ -1292,8 +1336,11 @@ | ||
| 1292 | 1336 | $set_actived = false; |
| 1293 | 1337 | |
| 1294 | 1338 | MainWP_Utility::array_sort_existed_keys( $submenu_items, 5 ); //phpcs:ignore Squiz.PHP.CommentedOutCode.Found -- 5 => 'leftsub_order_level2'. |
| 1295 | 1339 | |
| 1340 | + $idx = 0; | |
| 1341 | + $fix_douplicate_ids = array(); | |
| 1342 | + | |
| 1296 | 1343 | foreach ( $submenu_items as $sub_item ) { |
| 1297 | 1344 | $title = $sub_item[0]; |
| 1298 | 1345 | $href = $sub_item[1]; |
| 1299 | 1346 | $right = $sub_item[2]; |
| @@ -1309,8 +1356,12 @@ | ||
| 1309 | 1356 | } |
| 1310 | 1357 | |
| 1311 | 1358 | $item_classes = 'inactive' === $ext_state ? 'extension-inactive' : ''; |
| 1312 | 1359 | |
| 1360 | + if ( ! empty( $others['item_class'] ) ) { | |
| 1361 | + $item_classes .= ' ' . $others['item_class']; | |
| 1362 | + } | |
| 1363 | + | |
| 1313 | 1364 | $_blank = false; |
| 1314 | 1365 | if ( '_blank' === $id ) { |
| 1315 | 1366 | $_blank = true; |
| 1316 | 1367 | } |
| @@ -1319,12 +1370,13 @@ | ||
| 1319 | 1370 | |
| 1320 | 1371 | if ( ! $set_actived ) { |
| 1321 | 1372 | $level2_active = static::is_level2_menu_item_active( $href ) ? true : false; |
| 1322 | 1373 | if ( is_array( $active_path ) && ! empty( $active_path ) ) { |
| 1323 | - reset( $active_path ); | |
| 1324 | - $item = key( $active_path ); | |
| 1325 | - if ( $item === $plugin_page ) { | |
| 1326 | - $level2_active = true; | |
| 1374 | + foreach ( $active_path as $item => $value ) { | |
| 1375 | + if ( $item === $plugin_page ) { | |
| 1376 | + $level2_active = true; | |
| 1377 | + break; | |
| 1378 | + } | |
| 1327 | 1379 | } |
| 1328 | 1380 | } |
| 1329 | 1381 | // hard fix managesite menu items active status. |
| 1330 | 1382 | //phpcs:disable WordPress.Security.NonceVerification.Recommended,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| @@ -1335,13 +1387,13 @@ | ||
| 1335 | 1387 | if ( isset( $_GET['do'] ) && 'new' === $_GET['do'] && false !== strpos( $href, 'admin.php?page=managesites&do=new' ) ) { |
| 1336 | 1388 | $level2_active = true; |
| 1337 | 1389 | } |
| 1338 | 1390 | |
| 1339 | - if ( ! $level2_active && isset( $_GET['do'] ) && 'bulknew' === $_GET['do'] && false !== strpos( $href, 'admin.php?page=managesites&do=bulknew' ) ) { | |
| 1391 | + if ( ! $level2_active && isset( $_GET['do'] ) && 'bulknew' === $_GET['do'] && ( false !== strpos( $href, 'admin.php?page=managesites&do=bulknew' ) || 'managesites-addnew' === $id ) ) { | |
| 1340 | 1392 | $level2_active = true; |
| 1341 | 1393 | } |
| 1342 | 1394 | |
| 1343 | - if ( ! $level2_active && ! isset( $_GET['do'] ) && 'NonMainWPChanges' !== $page_name && 'admin.php?page=managesites' === $href ) { | |
| 1395 | + if ( ! $level2_active && ! isset( $_GET['do'] ) && 'InsightsManage' !== $page_name && 'Extensions-Mainwp-Clone-Extension' !== $page_name && 'managesites-root' === $id ) { | |
| 1344 | 1396 | $level2_active = true; |
| 1345 | 1397 | } |
| 1346 | 1398 | } |
| 1347 | 1399 | |
| @@ -1364,15 +1416,40 @@ | ||
| 1364 | 1416 | if ( ! empty( $right ) && strpos( $right, 'extension_' ) === 0 ) { |
| 1365 | 1417 | $right_group = 'extension'; |
| 1366 | 1418 | $right = str_replace( 'extension_', '', $right ); |
| 1367 | 1419 | } |
| 1368 | - if ( empty( $right ) || ( ! empty( $right ) && mainwp_current_user_have_right( $right_group, $right ) ) ) { | |
| 1420 | + | |
| 1421 | + if ( ! empty( $others['level_class'] ) ) { | |
| 1422 | + $item_classes = $item_classes . ' ' . $others['level_class']; | |
| 1423 | + } | |
| 1424 | + | |
| 1425 | + if ( ! empty( $others['classes_item'] ) ) { | |
| 1426 | + $item_classes = $item_classes . ' ' . $others['classes_item']; | |
| 1427 | + } | |
| 1428 | + | |
| 1429 | + if ( empty( $right ) || ( ! empty( $right ) && \mainwp_current_user_can( $right_group, $right ) ) ) { | |
| 1430 | + $menu_itemid = $slug; // compatible. | |
| 1431 | + $menu_itemid = 'managesites' === $slug && ! empty( $id ) ? $id : $menu_itemid; | |
| 1432 | + | |
| 1433 | + // Fix duplicate ID issue caused by empty id="" (kept for backward compatibility). | |
| 1434 | + if ( empty( $menu_itemid ) ) { | |
| 1435 | + $menu_itemid = ! empty( $title ) ? sanitize_title( $title ) : 'left-menu-item'; | |
| 1436 | + $menu_itemid = 'left-menu-item-' . hash( 'crc32b', $menu_itemid . '-' . $idx ); | |
| 1437 | + } | |
| 1438 | + | |
| 1439 | + // Fix duplicate ID issue caused by same id in multiple extensions. | |
| 1440 | + if ( ! empty( $fix_douplicate_ids ) && in_array( $menu_itemid, $fix_douplicate_ids ) ) { | |
| 1441 | + $menu_itemid = $menu_itemid . '-' . $idx; | |
| 1442 | + } | |
| 1443 | + $fix_douplicate_ids[] = $menu_itemid; | |
| 1444 | + | |
| 1369 | 1445 | ?> |
| 1370 | - <a class="item <?php echo $level2_active ? 'active level-two-active' : ''; ?> <?php echo esc_attr( $item_classes ); ?>" href="<?php echo esc_url( $href ); ?>" id="<?php echo esc_attr( $slug ); ?>" <?php echo $_blank ? 'target="_blank"' : ''; ?>> | |
| 1446 | + <a class="item <?php echo $level2_active ? 'active level-two-active' : ''; ?> <?php echo esc_attr( $item_classes ); ?>" href="<?php echo esc_url( $href ); ?>" id="<?php echo esc_attr( $menu_itemid ); ?>" <?php echo $_blank ? 'target="_blank"' : ''; ?>> | |
| 1371 | 1447 | <?php echo $before_title . $title; //phpcs:ignore -- requires escaped. ?> |
| 1372 | 1448 | </a> |
| 1373 | 1449 | <?php |
| 1374 | 1450 | } |
| 1451 | + ++$idx; | |
| 1375 | 1452 | } |
| 1376 | 1453 | } |
| 1377 | 1454 | |
| 1378 | 1455 | |