PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2.1
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2.1
6.2.2 6.2.1 6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 All 155 releases
← All changes | class/class-mainwp-menu.php +379 -280 5.1 → 6.2.1 View file →
@@ -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 ) {
@@ -568,8 +505,12 @@
568 505 if ( empty( $params ) ) {
569 506 return;
570 507 }
571 508
509 + if ( ! empty( $params['menu_hidden'] ) ) {
510 + return;
511 + }
512 +
572 513 $level = (int) $level;
573 514
574 515 if ( 1 !== $level && 2 !== $level && 0 !== $level ) {
575 516 $level = 1;
@@ -577,20 +518,53 @@
577 518
578 519 $title = $params['title'];
579 520 $before_title = ! empty( $params['before_title'] ) ? $params['before_title'] : '';
580 521
581 - $slug = isset( $params['slug'] ) ? $params['slug'] : '';
582 - $href = $params['href'];
583 - $right = isset( $params['right'] ) ? $params['right'] : '';
584 - $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;
585 527
528 + if ( ! MainWP_Cache_Warm_Helper::is_excluded_warm_cache_pages() ) {
529 + $level_cls .= ' mainwp-js-prefetch ';
530 + }
531 +
586 532 $icon = isset( $params['icon'] ) ? $params['icon'] : '';
587 533 $leftsub_order = isset( $params['leftsub_order'] ) ? $params['leftsub_order'] : '';
588 534 $leftsub_order_level2 = isset( $params['leftsub_order_level2'] ) ? $params['leftsub_order_level2'] : '';
589 535 $ext_state = isset( $params['ext_status'] ) && ( 'activated' === $params['ext_status'] || 'inactive' === $params['ext_status'] ) ? $params['ext_status'] : '';
590 536 $parent_key = isset( $params['parent_key'] ) ? $params['parent_key'] : '';
537 + $others = array( 'level_class' => $level_cls );
591 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 +
592 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 +
559 + if ( isset( $params['active_params'] ) ) {
560 + $others['active_params'] = $params['active_params'];
561 + }
562 + if ( ! empty( $params['item_class'] ) ) {
563 + $others['item_class'] = $params['item_class'];
564 + }
565 +
566 + /**
593 567 * MainWP Left Menu, Sub Menu & Active menu slugs.
594 568 *
595 569 * @global object $mainwp_leftmenu
596 570 * @global object $mainwp_sub_leftmenu
@@ -622,9 +596,9 @@
622 596 }
623 597
624 598 if ( 0 === $level ) {
625 599 $parent_key = 'mainwp_tab'; // forced value.
626 - $mainwp_leftmenu['leftbar'][] = array( $title, $slug, $href, $id, $icon );
600 + $mainwp_leftmenu['leftbar'][] = array( $title, $slug, $href, $id, $icon, $level_cls );
627 601 } elseif ( 1 === $level ) {
628 602
629 603 if ( empty( $parent_key ) ) {
630 604 $parent_key = 'mainwp_tab'; // forced value.
@@ -630,11 +604,11 @@
630 604 $parent_key = 'mainwp_tab'; // forced value.
631 605 }
632 606
633 607 if ( 'mainwp_tab' === $parent_key ) {
634 - $mainwp_leftmenu[ $parent_key ][] = array( $title, $slug, $href, $id );
608 + $mainwp_leftmenu[ $parent_key ][] = array( $title, $slug, $href, $id, $level_cls );
635 609 } else {
636 - $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 );
637 611
638 612 if ( ! empty( $slug ) ) {
639 613 $_mainwp_menu_active_slugs['leftbar'][ $slug ] = $parent_key; // to get active menu.
640 614 }
@@ -642,9 +616,9 @@
642 616 } else {
643 617 if ( empty( $parent_key ) ) {
644 618 $parent_key = 'mainwp_tab'; // forced value.
645 619 }
646 - $mainwp_sub_leftmenu[ $parent_key ][] = array( $title, $href, $right, $id, $slug, $leftsub_order_level2, $ext_state, $active_path, $before_title );
620 + $mainwp_sub_leftmenu[ $parent_key ][] = array( $title, $href, $right, $id, $slug, $leftsub_order_level2, $ext_state, $active_path, $before_title, $others );
647 621 }
648 622
649 623 if ( ! empty( $slug ) ) {
650 624 $no_submenu = ! empty( $params['nosubmenu'] ) ? true : false;
@@ -692,8 +666,25 @@
692 666
693 667 $mainwp_sub_leftmenu = apply_filters( 'mainwp_main_menu_submenu', $mainwp_sub_leftmenu );
694 668 $sub_bar_leftmenu = isset( $mainwp_sub_leftmenu['leftbar'] ) ? $mainwp_sub_leftmenu['leftbar'] : array();
695 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 +
696 687 $version = get_option( 'mainwp_plugin_version' );
697 688
698 689 ?>
699 690 <?php
@@ -736,8 +727,9 @@
736 727 $item_key = $item[1];
737 728 $href = $item[2];
738 729 $item_id = isset( $item[3] ) ? $item[3] : '';
739 730 $item_icon = isset( $item[4] ) ? $item[4] : '';
731 + $level_cls = isset( $item[5] ) ? $item[5] : '';
740 732
741 733 $has_sub = true;
742 734 if ( ! isset( $mainwp_sub_leftmenu[ $item_key ] ) || empty( $mainwp_sub_leftmenu[ $item_key ] ) ) {
743 735 $has_sub = false;
@@ -762,10 +754,12 @@
762 754 }
763 755
764 756 $id_attr = ! empty( $item_id ) ? 'id="' . esc_html( $item_id ) . '"' : '';
765 757
758 + $item_cls = $level_cls . ' ' . $active_item;
759 +
766 760 // phpcs:disable WordPress.Security.EscapeOutput
767 - 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\">";
768 762 echo ! empty( $item_icon ) ? $item_icon : '<i class="th large icon"></i>';
769 763 echo '<span class="ui small text">' . esc_html( $title ) . '</span>';
770 764 echo '</a>';
771 765 // phpcs:enable
@@ -773,47 +767,83 @@
773 767 }
774 768 ?>
775 769 </div>
776 770 <?php
777 - $go_back_wpadmin_url = admin_url( 'index.php' );
771 + $all_updates = wp_get_update_data();
772 + $go_back_wpadmin_url = admin_url( 'index.php' );
778 773
779 - $link = array(
780 - 'url' => $go_back_wpadmin_url,
781 - 'text' => esc_html__( 'WP Admin', 'mainwp' ),
782 - 'tip' => esc_html__( 'Click to go back to the site WP Admin area.', 'mainwp' ),
783 - );
784 - /**
785 - * Filter: mainwp_go_back_wpadmin_link
786 - *
787 - * Filters URL for the Go to WP Admin button in Main navigation.
788 - *
789 - * @since 4.0
790 - */
791 - $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 );
792 787
793 - if ( false !== $go_back_link && is_array( $go_back_link ) ) {
794 - if ( isset( $go_back_link['url'] ) ) {
795 - $link['url'] = $go_back_link['url'];
796 - }
797 - if ( isset( $go_back_link['text'] ) ) {
798 - $link['text'] = $go_back_link['text'];
799 - }
800 - if ( isset( $go_back_link['tip'] ) ) {
801 - $link['tip'] = $go_back_link['tip'];
802 - }
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'];
803 791 }
804 - ?>
805 - <div id="mainwp-first-level-wpitems-menu" class="ui vertical labeled inverted icon mini menu">
806 - <a class="item" href="#" id="mainwp-collapse-second-level-navigation" aria-label="<?php esc_attr_e( 'Collapse menu.', 'mainwp' ); ?>">
807 - <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>
808 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; ?>
809 829 </div>
810 830 <div id="mainwp-first-level-navigation-version-label">
811 - <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>
812 837 </div>
813 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>
814 844 <div id="mainwp-second-level-navigation">
815 - <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">
816 846 <?php
817 847 $bar_active_item_key = '';
818 848
819 849 $set_actived = false;
@@ -818,13 +848,13 @@
818 848
819 849 $set_actived = false;
820 850
821 851 if ( ! empty( $bar_item_active ) ) {
822 - $item = $bar_item_active;
823 - $title = wptexturize( $item[0] );
824 - $item_key = $item[1];
825 - $href = $item[2];
826 - $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] : '';
827 857
828 858 $bar_active_item_key = $item_key;
829 859
830 860 $has_sub = true;
@@ -847,17 +877,17 @@
847 877 $id_attr = ! empty( $item_id ) ? 'id="' . esc_html( $item_id ) . '"' : '';
848 878
849 879 // phpcs:disable WordPress.Security.EscapeOutput
850 880 if ( $has_sub ) {
851 - echo '<div ' . $id_attr . " class=\"item $active_item\">";
852 - 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>";
853 883 echo "<div class=\"content menu $active_item\">";
854 884 static::render_sub_item( $item_key );
855 885 echo '</div>';
856 886 echo '</div>';
857 887 } else {
858 - echo '<div ' . $id_attr . ' class="item">';
859 - 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>";
860 890 echo '</div>';
861 891 }
862 892 // phpcs:enable
863 893
@@ -881,8 +911,9 @@
881 911
882 912 $href = $item[2];
883 913 $item_id = isset( $item[3] ) ? $item[3] : '';
884 914 $ext_state = isset( $item[5] ) ? $item[5] : '';
915 + $level_cls = isset( $item[7] ) ? $item[7] : '';
885 916
886 917 $item_classes = 'inactive' === $ext_state ? 'extension-inactive' : '';
887 918
888 919 $active_item = '';
@@ -904,12 +935,16 @@
904 935 if ( 'admin.php?page=ManageApiBackups' === $href ) {
905 936 $hide_item = ' style="display:none"';
906 937 }
907 938
939 + if ( ! empty( $level_cls ) ) {
940 + $item_classes = $item_classes . ' ' . $level_cls;
941 + }
942 +
908 943 // phpcs:disable WordPress.Security.EscapeOutput
909 944 if ( $has_sub ) {
910 945 echo '<div ' . $id_attr . " class=\"item $active_item $item_classes\">";
911 - 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>";
912 947 echo "<div class=\"content menu $active_item\">";
913 948 static::render_sub_item( $item_key );
914 949 echo '</div>';
915 950 echo '</div>';
@@ -914,9 +949,9 @@
914 949 echo '</div>';
915 950 echo '</div>';
916 951 } else {
917 952 echo '<div ' . $id_attr . $hide_item . " class=\"item $active_item $item_classes\">";
918 - echo "<a class='title $active_item' href=\"$href\">$title</a>";
953 + echo "<a class='title $active_item' href=\"javascript:void(0)\">$title</a>";
919 954 echo '</div>';
920 955 }
921 956 // phpcs:enable
922 957 }
@@ -923,24 +958,29 @@
923 958 }
924 959 }
925 960 ?>
926 961 </div>
927 - </div>
928 962 </div>
963 + </div>
929 964
930 - <?php
931 - /**
932 - * Action: after_mainwp_menu
933 - *
934 - * Fires after the main navigation element.
935 - *
936 - * @since 4.0
937 - */
938 - do_action( 'after_mainwp_menu' );
939 - ?>
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 + ?>
940 975 <script type="text/javascript">
976 +
941 977 jQuery( document ).ready( function () {
942 978
979 + setTimeout(() => {
980 + jQuery('#mainwp-dashboard-update-available').removeClass('looping');
981 + }, 1500);
982 +
943 983 let mainwp_left_bar_showhide_init = function(){
944 984 if(jQuery('body').hasClass('mainwp-hidden-second-level-navigation')){
945 985 return; // hide always.
946 986 }
@@ -954,13 +994,13 @@
954 994 mainwp_left_bar_showhide = function( lbar, show ){
955 995 if ( show ) {
956 996 jQuery( '#mainwp-second-level-navigation' ).show();
957 997 jQuery( '.mainwp-content-wrap' ).css( "margin-left", "272px" );
958 - jQuery( '#mainwp-screenshots-sites' ).css( "margin-left", "272px" );
998 + //jQuery( '#mainwp-screenshots-sites' ).css( "margin-left", "272px" );
959 999 jQuery( '#mainwp-main-navigation-container' ).css( "width", "272px" );
960 1000 jQuery( lbar ).find( '.icon' ).removeClass( 'right' );
961 1001 jQuery( lbar ).find( '.icon' ).addClass( 'left' );
962 - jQuery( lbar ).css( "left", "272px" );
1002 + jQuery( lbar ).parent('#mainwp-divider-handle').css( "left", "200px" );
963 1003 jQuery( lbar ).removeClass( 'collapsed' );
964 1004 if( ( typeof mainwp_ui_state_save !== 'undefined' ) ) {
965 1005 mainwp_ui_state_save( 'showmenu', 1 );
966 1006 }
@@ -966,13 +1006,13 @@
966 1006 }
967 1007 } else {
968 1008 jQuery( '#mainwp-second-level-navigation' ).hide();
969 1009 jQuery( '.mainwp-content-wrap' ).css( "margin-left", "72px" );
970 - jQuery( '#mainwp-screenshots-sites' ).css( "margin-left", "72px" );
1010 + //jQuery( '#mainwp-screenshots-sites' ).css( "margin-left", "72px" );
971 1011 jQuery( '#mainwp-main-navigation-container' ).css( "width", "72px" );
972 1012 jQuery( lbar ).find( '.icon' ).removeClass( 'left' );
973 1013 jQuery( lbar ).find( '.icon' ).addClass( 'right' );
974 - jQuery( lbar ).css( "left", "72px" );
1014 + jQuery( lbar ).parent('#mainwp-divider-handle').css( "left", "0px" );
975 1015 jQuery( lbar ).addClass( 'collapsed' );
976 1016 jQuery( '#mainwp-top-header' ).css( "width", "100%" );
977 1017 if( ( typeof mainwp_ui_state_save !== 'undefined' ) ) {
978 1018 mainwp_ui_state_save( 'showmenu', 0 );
@@ -987,9 +1027,9 @@
987 1027 } );
988 1028 mainwp_left_bar_showhide_init();
989 1029
990 1030 // click on menu with-sub icon.
991 - 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 ) {
992 1032 let pr = jQuery( this ).closest( '.item' );
993 1033 let title = jQuery( this ).closest( '.title' );
994 1034 let active = jQuery( title ).hasClass( 'active' );
995 1035
@@ -1004,9 +1044,9 @@
1004 1044 }
1005 1045 return false;
1006 1046 } );
1007 1047
1008 - 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 ) {
1009 1049 let pr = jQuery( this ).closest( '.item' );
1010 1050 let active = jQuery( this ).hasClass( 'active' );
1011 1051
1012 1052 // remove current active.
@@ -1021,14 +1061,14 @@
1021 1061 } );
1022 1062
1023 1063 mainwp_menu_collapse = function() {
1024 1064 // remove current active.
1025 - jQuery( '#mainwp-main-navigation-container #mainwp-main-menu a.title.active').removeClass('active');
1026 - jQuery( '#mainwp-main-navigation-container #mainwp-main-menu .item').removeClass('active');
1027 - 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');
1028 1068 };
1029 1069
1030 - jQuery('.mainwp-main-mobile-navigation-container #mainwp-main-menu').accordion();
1070 + jQuery( '#mainwp-main-mobile-navigation-container .accordion.menu' ).accordion();
1031 1071
1032 1072 } );
1033 1073 </script>
1034 1074 <?php
@@ -1041,10 +1081,11 @@
1041 1081 */
1042 1082 public static function render_mobile_menu() { // phpcs:ignore -- NOSONAR -Current complexity is the only way to achieve desired results, pull request solutions appreciated.
1043 1083 $mainwp_show_language_updates = get_option( 'mainwp_show_language_updates', 1 );
1044 1084 ?>
1045 - <div class="mainwp-main-mobile-navigation-container">
1046 - <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">
1047 1088 <?php
1048 1089 /**
1049 1090 * Action: before_mainwp_menu
1050 1091 *
@@ -1054,100 +1095,96 @@
1054 1095 */
1055 1096 do_action( 'before_mainwp_menu' );
1056 1097 ?>
1057 1098
1058 - <div id="mainwp-main-menu" class="test-menu ui inverted vertical accordion menu">
1059 - <div class="hamburger">
1060 - <span class="hamburger-bun"></span>
1061 - <span class="hamburger-patty"></span>
1062 - <span class="hamburger-bun"></span>
1063 - </div>
1064 -
1065 - <div class="item"><a href="admin.php?page=mainwp_tab"><?php esc_html_e( 'Overview', 'mainwp' ); ?></a></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>
1101 +
1066 1102 <div class="item">
1067 - <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>
1068 1104 <div class="content menu" id="mainwp-sites-mobile-menu-item">
1069 - <div class="accordion item">
1070 - <div class="title"><a href="admin.php?page=managesites"><?php esc_html_e( 'Sites', 'mainwp' ); ?></a><i class="dropdown icon"></i></div>
1071 - <div class="content menu">
1072 - <a class="item" href="admin.php?page=managesites"><?php esc_html_e( 'Manage Sites', 'mainwp' ); ?></a>
1073 - <a class="item" href="admin.php?page=managesites&do=new"><?php esc_html_e( 'Add New Site', 'mainwp' ); ?></a>
1074 - <a class="item" href="admin.php?page=managesites&do=bulknew"><?php esc_html_e( 'Import Sites', 'mainwp' ); ?></a>
1075 - <a class="item" href="admin.php?page=MonitoringSites"><?php esc_html_e( 'Monitoring', 'mainwp' ); ?></a>
1076 - </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>
1077 1112 </div>
1078 - <div class="item accordion">
1079 - <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>
1080 1122 <div class="content menu">
1081 - <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>
1082 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>
1083 1141 </div>
1084 - <div class="item accordion">
1085 - <div class="title"><a href="admin.php?page=UpdatesManage"><?php esc_html_e( 'Updates', 'mainwp' ); ?></a><i class="dropdown icon"></i></div>
1086 - <div class="content menu">
1087 - <a class="item" href="admin.php?page=UpdatesManage&tab=plugins-updates"><?php esc_html_e( 'Plugins Updates', 'mainwp' ); ?></a>
1088 - <a class="item" href="admin.php?page=UpdatesManage&tab=themes-updates"><?php esc_html_e( 'Themes Updates', 'mainwp' ); ?></a>
1089 - <a class="item" href="admin.php?page=UpdatesManage&tab=wordpress-updates"><?php esc_html_e( 'WordPress Updates', 'mainwp' ); ?></a>
1090 - <?php if ( $mainwp_show_language_updates ) : ?>
1091 - <a class="item" href="admin.php?page=UpdatesManage&tab=translations-updates"><?php esc_html_e( 'Translation Plugins', 'mainwp' ); ?></a>
1092 - <?php endif; ?>
1093 - <a class="item" href="admin.php?page=UpdatesManage&tab=abandoned-plugins"><?php esc_html_e( 'Abandoned Plugins', 'mainwp' ); ?></a>
1094 - <a class="item" href="admin.php?page=UpdatesManage&tab=abandoned-themes"><?php esc_html_e( 'Abandoned Themes', 'mainwp' ); ?></a>
1095 - </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>
1096 1151 </div>
1097 - <div class="item accordion">
1098 - <div class="title"><a href="admin.php?page=PluginsManage"><?php esc_html_e( 'Plugins', 'mainwp' ); ?></a><i class="dropdown icon"></i></div>
1099 - <div class="content menu">
1100 - <a class="item" href="admin.php?page=PluginsManage"><?php esc_html_e( 'Manage Plugins', 'mainwp' ); ?></a>
1101 - <a class="item" href="admin.php?page=PluginsInstall"><?php esc_html_e( 'Install', 'mainwp' ); ?></a>
1102 - <a class="item" href="admin.php?page=PluginsAutoUpdate"><?php esc_html_e( 'Advanced Auto Updates', 'mainwp' ); ?></a>
1103 - <a class="item" href="admin.php?page=PluginsIgnore"><?php esc_html_e( 'Ignored Updates', 'mainwp' ); ?></a>
1104 - <a class="item" href="admin.php?page=PluginsIgnoredAbandoned"><?php esc_html_e( 'Ignored Abandoned', 'mainwp' ); ?></a>
1105 - </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>
1106 1160 </div>
1107 - <div class="item accordion">
1108 - <div class="title"><a href="admin.php?page=ThemesManage"><?php esc_html_e( 'Themes', 'mainwp' ); ?></a><i class="dropdown icon"></i></div>
1109 - <div class="content menu">
1110 - <a class="item" href="admin.php?page=ThemesManage"><?php esc_html_e( 'Manage Themes', 'mainwp' ); ?></a>
1111 - <a class="item" href="admin.php?page=ThemesInstall"><?php esc_html_e( 'Install', 'mainwp' ); ?></a>
1112 - <a class="item" href="admin.php?page=ThemesAutoUpdate"><?php esc_html_e( 'Advanced Auto Updates', 'mainwp' ); ?></a>
1113 - <a class="item" href="admin.php?page=ThemesIgnore"><?php esc_html_e( 'Ignored Updates', 'mainwp' ); ?></a>
1114 - <a class="item" href="admin.php?page=ThemesIgnoredAbandoned"><?php esc_html_e( 'Ignored Abandoned', 'mainwp' ); ?></a>
1115 - </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>
1116 1167 </div>
1117 - <div class="item accordion">
1118 - <div class="title"><a href="admin.php?page=UserBulkManage"><?php esc_html_e( 'Users', 'mainwp' ); ?></a><i class="dropdown icon"></i></div>
1119 - <div class="content menu">
1120 - <a class="item" href="admin.php?page=UserBulkManage"><?php esc_html_e( 'Manage Users', 'mainwp' ); ?></a>
1121 - <a class="item" href="admin.php?page=UserBulkAdd"><?php esc_html_e( 'Add New User', 'mainwp' ); ?></a>
1122 - <a class="item" href="admin.php?page=BulkImportUsers"><?php esc_html_e( 'Import Users', 'mainwp' ); ?></a>
1123 - <a class="item" href="admin.php?page=UpdateAdminPasswords"><?php esc_html_e( 'Admin Passwords', 'mainwp' ); ?></a>
1124 - </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>
1125 1174 </div>
1126 - <div class="item accordion">
1127 - <div class="title"><a href="admin.php?page=PostBulkManage"><?php esc_html_e( 'Posts', 'mainwp' ); ?></a><i class="dropdown icon"></i></div>
1128 - <div class="content menu">
1129 - <a class="item" href="admin.php?page=PostBulkManage"><?php esc_html_e( 'Manage Pages', 'mainwp' ); ?></a>
1130 - <a class="item" href="admin.php?page=PostBulkAdd"><?php esc_html_e( 'Add New Post', 'mainwp' ); ?></a>
1131 - </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>
1132 1180 </div>
1133 - <div class="item accordion">
1134 - <div class="title"><a href="admin.php?page=PageBulkManage"><?php esc_html_e( 'Pages', 'mainwp' ); ?></a><i class="dropdown icon"></i></div>
1135 - <div class="content menu">
1136 - <a class="item" href="admin.php?page=PageBulkManage"><?php esc_html_e( 'Manage Pages', 'mainwp' ); ?></a>
1137 - <a class="item" href="admin.php?page=PageBulkAdd"><?php esc_html_e( 'Add New Page', 'mainwp' ); ?></a>
1138 - </div>
1139 - </div>
1140 - <div class="item accordion">
1141 - <div class="title"><a href="admin.php?page=ManageApiBackups"><?php esc_html_e( 'Backups', 'mainwp' ); ?></a><i class="dropdown icon"></i></div>
1142 - <div class="content menu">
1143 - <a class="item" href="admin.php?page=ManageApiBackups"><?php esc_html_e( 'Backups', 'mainwp' ); ?></a>
1144 - </div>
1145 - </div>
1181 + </div>
1146 1182 </div>
1147 1183 </div>
1184 +
1148 1185 <div class="item">
1149 - <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>
1150 1187 <div class="content menu">
1151 1188 <a class="item" href="admin.php?page=ManageClients"><?php esc_html_e( 'Clients', 'mainwp' ); ?></a>
1152 1189 <a class="item" href="admin.php?page=ClientAddNew"><?php esc_html_e( 'Add Client', 'mainwp' ); ?></a>
1153 1190 <a class="item" href="admin.php?page=ClientAddField"><?php esc_html_e( 'Client Fields', 'mainwp' ); ?></a>
@@ -1154,18 +1191,18 @@
1154 1191 </div>
1155 1192 </div>
1156 1193
1157 1194 <div class="item">
1158 - <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>
1159 1196 <div class="content menu">
1160 - <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>
1161 1199 <a class="item" href="admin.php?page=CostTrackerAdd"><?php esc_html_e( 'Add Cost', 'mainwp' ); ?></a>
1162 - <a class="item" href="admin.php?page=CostTrackerSettings"><?php esc_html_e( 'Cost Tracker Settings', 'mainwp' ); ?></a>
1163 1200 </div>
1164 1201 </div>
1165 1202
1166 1203 <div class="item">
1167 - <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>
1168 1205 <div class="content menu">
1169 1206 <a class="item" href="admin.php?page=InsightsOverview"><?php esc_html_e( 'Insights', 'mainwp' ); ?></a>
1170 1207 </div>
1171 1208 </div>
@@ -1170,31 +1207,37 @@
1170 1207 </div>
1171 1208 </div>
1172 1209
1173 1210 <div class="item">
1174 - <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>
1175 1212 <div class="content menu">
1176 - <a class="item" href="admin.php?page=RESTAPI"><?php esc_html_e( 'Manage API Keys', 'mainwp' ); ?></a>
1177 - <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>
1178 1214 </div>
1179 1215 </div>
1216 +
1180 1217 <div class="item">
1181 - <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>
1182 1219 <div class="content menu">
1183 - <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>
1184 1223 </div>
1185 1224 </div>
1225 +
1186 1226 <div class="item">
1187 - <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>
1188 1228 <div class="content menu">
1189 1229 <a class="item" href="admin.php?page=Settings"><?php esc_html_e( 'General Settings', 'mainwp' ); ?></a>
1190 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>
1191 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>
1192 1234 <a class="item" href="admin.php?page=MainWPTools"><?php esc_html_e( 'Tools', 'mainwp' ); ?></a>
1193 1235 </div>
1194 1236 </div>
1237 +
1195 1238 <div class="item">
1196 - <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>
1197 1240 <div class="content menu">
1198 1241 <a class="item" href="admin.php?page=ServerInformation"><?php esc_html_e( 'Server', 'mainwp' ); ?></a>
1199 1242 <a class="item" href="admin.php?page=ServerInformationCron"><?php esc_html_e( 'Cron Schedules', 'mainwp' ); ?></a>
1200 1243 <a class="item" href="admin.php?page=ErrorLog"><?php esc_html_e( 'Error Log', 'mainwp' ); ?></a>
@@ -1201,9 +1244,22 @@
1201 1244 <a class="item" href="admin.php?page=ActionLogs"><?php esc_html_e( 'Custom Event Monitor', 'mainwp' ); ?></a>
1202 1245 <a class="item" href="admin.php?page=PluginPrivacy"><?php esc_html_e( 'Plugin Privacy', 'mainwp' ); ?></a>
1203 1246 </div>
1204 1247 </div>
1205 - <?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
1206 1262 $go_back_wpadmin_url = admin_url( 'index.php' );
1207 1263
1208 1264 $link = array(
1209 1265 'url' => $go_back_wpadmin_url,
@@ -1231,25 +1287,21 @@
1231 1287 if ( isset( $go_back_link['tip'] ) ) {
1232 1288 $link['tip'] = $go_back_link['tip'];
1233 1289 }
1234 1290 }
1235 - ?>
1236 - <div class="item item-wp-admin">
1237 - <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. ?>
1238 1296 </div>
1239 - <?php } ?>
1240 -
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>
1241 1303 </div>
1242 - <?php
1243 - /**
1244 - * Action: after_mainwp_menu
1245 - *
1246 - * Fires after the main navigation element.
1247 - *
1248 - * @since 4.0
1249 - */
1250 - do_action( 'after_mainwp_menu' );
1251 - ?>
1252 1304 </div>
1253 1305 </div>
1254 1306 <?php
1255 1307 }
@@ -1270,9 +1322,9 @@
1270 1322 * MainWP Left Menu.
1271 1323 *
1272 1324 * @global object $mainwp_sub_leftmenu
1273 1325 */
1274 - global $mainwp_sub_leftmenu, $_mainwp_menu_active_slugs;
1326 + global $mainwp_sub_leftmenu;
1275 1327
1276 1328 $submenu_items = $mainwp_sub_leftmenu[ $parent_key ];
1277 1329
1278 1330 if ( ! is_array( $submenu_items ) || empty( $submenu_items ) ) {
@@ -1284,8 +1336,11 @@
1284 1336 $set_actived = false;
1285 1337
1286 1338 MainWP_Utility::array_sort_existed_keys( $submenu_items, 5 ); //phpcs:ignore Squiz.PHP.CommentedOutCode.Found -- 5 => 'leftsub_order_level2'.
1287 1339
1340 + $idx = 0;
1341 + $fix_douplicate_ids = array();
1342 +
1288 1343 foreach ( $submenu_items as $sub_item ) {
1289 1344 $title = $sub_item[0];
1290 1345 $href = $sub_item[1];
1291 1346 $right = $sub_item[2];
@@ -1293,11 +1348,20 @@
1293 1348 $slug = isset( $sub_item[4] ) ? $sub_item[4] : '';
1294 1349 $ext_state = isset( $sub_item[6] ) ? $sub_item[6] : '';
1295 1350 $active_path = isset( $sub_item[7] ) ? $sub_item[7] : '';
1296 1351 $before_title = isset( $sub_item[8] ) ? $sub_item[8] : '';
1352 + $others = isset( $sub_item[9] ) ? $sub_item[9] : array();
1297 1353
1354 + if ( ! is_array( $others ) ) {
1355 + $others = array();
1356 + }
1357 +
1298 1358 $item_classes = 'inactive' === $ext_state ? 'extension-inactive' : '';
1299 1359
1360 + if ( ! empty( $others['item_class'] ) ) {
1361 + $item_classes .= ' ' . $others['item_class'];
1362 + }
1363 +
1300 1364 $_blank = false;
1301 1365 if ( '_blank' === $id ) {
1302 1366 $_blank = true;
1303 1367 }
@@ -1306,12 +1370,13 @@
1306 1370
1307 1371 if ( ! $set_actived ) {
1308 1372 $level2_active = static::is_level2_menu_item_active( $href ) ? true : false;
1309 1373 if ( is_array( $active_path ) && ! empty( $active_path ) ) {
1310 - reset( $active_path );
1311 - $item = key( $active_path );
1312 - if ( $item === $plugin_page ) {
1313 - $level2_active = true;
1374 + foreach ( $active_path as $item => $value ) {
1375 + if ( $item === $plugin_page ) {
1376 + $level2_active = true;
1377 + break;
1378 + }
1314 1379 }
1315 1380 }
1316 1381 // hard fix managesite menu items active status.
1317 1382 //phpcs:disable WordPress.Security.NonceVerification.Recommended,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
@@ -1322,16 +1387,26 @@
1322 1387 if ( isset( $_GET['do'] ) && 'new' === $_GET['do'] && false !== strpos( $href, 'admin.php?page=managesites&do=new' ) ) {
1323 1388 $level2_active = true;
1324 1389 }
1325 1390
1326 - 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 ) ) {
1327 1392 $level2_active = true;
1328 1393 }
1329 1394
1330 - 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 ) {
1331 1396 $level2_active = true;
1332 1397 }
1333 1398 }
1399 +
1400 + if ( ! $level2_active && ! empty( $others['active_params'] ) && is_array( $others['active_params'] ) ) {
1401 + foreach ( $others['active_params'] as $name => $value ) {
1402 + if ( isset( $_GET[ $name ] ) && wp_unslash( $_GET[ $name ] ) === $value ) {
1403 + $level2_active = true;
1404 + break;
1405 + }
1406 + }
1407 + }
1408 +
1334 1409 //phpcs:enable WordPress.Security.NonceVerification.Recommended,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1335 1410 if ( $level2_active ) {
1336 1411 $set_actived = true;
1337 1412 }
@@ -1341,16 +1416,40 @@
1341 1416 if ( ! empty( $right ) && strpos( $right, 'extension_' ) === 0 ) {
1342 1417 $right_group = 'extension';
1343 1418 $right = str_replace( 'extension_', '', $right );
1344 1419 }
1345 - 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 +
1346 1445 ?>
1347 - <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"' : ''; ?>>
1348 1447 <?php echo $before_title . $title; //phpcs:ignore -- requires escaped. ?>
1349 1448 </a>
1350 -
1351 1449 <?php
1352 1450 }
1451 + ++$idx;
1353 1452 }
1354 1453 }
1355 1454
1356 1455