| @@ -1,11 +1,13 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace Elementor\Modules\System_Info; |
| 3 | 3 | |
| 4 | +use Elementor\Core\Admin\Menu\Admin_Menu_Manager; | |
| 4 | 5 | use Elementor\Core\Base\Module as BaseModule; |
| 5 | 6 | use Elementor\Modules\System_Info\Reporters\Base; |
| 6 | 7 | use Elementor\Modules\System_Info\Helpers\Model_Helper; |
| 7 | 8 | use Elementor\Plugin; |
| 9 | +use Elementor\Settings; | |
| 8 | 10 | |
| 9 | 11 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | 12 | exit; // Exit if accessed directly. |
| 11 | 13 | } |
| @@ -65,8 +67,12 @@ | ||
| 65 | 67 | 'network_plugins' => [], |
| 66 | 68 | 'mu_plugins' => [], |
| 67 | 69 | ]; |
| 68 | 70 | |
| 71 | + public function get_capability() { | |
| 72 | + return $this->capability; | |
| 73 | + } | |
| 74 | + | |
| 69 | 75 | /** |
| 70 | 76 | * Main system info page constructor. |
| 71 | 77 | * |
| 72 | 78 | * Initializing Elementor system info page. |
| @@ -112,9 +118,11 @@ | ||
| 112 | 118 | * @access private |
| 113 | 119 | */ |
| 114 | 120 | private function add_actions() { |
| 115 | 121 | if ( ! Plugin::$instance->experiments->is_feature_active( 'admin_menu_rearrangement' ) ) { |
| 116 | - add_action( 'admin_menu', [ $this, 'register_menu' ], 500 ); | |
| 122 | + add_action( 'elementor/admin/menu/register', function ( Admin_Menu_Manager $admin_menu_manager ) { | |
| 123 | + $this->register_menu( $admin_menu_manager ); | |
| 124 | + }, Settings::ADMIN_MENU_PRIORITY + 30 ); | |
| 117 | 125 | } |
| 118 | 126 | |
| 119 | 127 | add_action( 'wp_ajax_elementor_system_info_download_file', [ $this, 'download_file' ] ); |
| 120 | 128 | } |
| @@ -126,21 +134,12 @@ | ||
| 126 | 134 | * |
| 127 | 135 | * Fired by `admin_menu` action. |
| 128 | 136 | * |
| 129 | 137 | * @since 2.9.0 |
| 130 | - * @access public | |
| 138 | + * @access private | |
| 131 | 139 | */ |
| 132 | - public function register_menu() { | |
| 133 | - $system_info_text = esc_html__( 'System Info', 'elementor' ); | |
| 134 | - | |
| 135 | - add_submenu_page( | |
| 136 | - 'elementor', | |
| 137 | - $system_info_text, | |
| 138 | - $system_info_text, | |
| 139 | - $this->capability, | |
| 140 | - 'elementor-system-info', | |
| 141 | - [ $this, 'display_page' ] | |
| 142 | - ); | |
| 140 | + private function register_menu( Admin_Menu_Manager $admin_menu ) { | |
| 141 | + $admin_menu->register( 'elementor-system-info', new System_Info_Menu_Item( $this ) ); | |
| 143 | 142 | } |
| 144 | 143 | |
| 145 | 144 | /** |
| 146 | 145 | * Display page. |