| @@ -1,13 +1,11 @@ | ||
| 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 | -use Elementor\Modules\EditorOne\Classes\Menu_Data_Provider; | |
| 8 | -use Elementor\Modules\System_Info\AdminMenuItems\Editor_One_System_Info_Menu; | |
| 9 | -use Elementor\Modules\System_Info\AdminMenuItems\Editor_One_System_Menu; | |
| 10 | 8 | use Elementor\Plugin; |
| 11 | 9 | use Elementor\Settings; |
| 12 | 10 | |
| 13 | 11 | if ( ! defined( 'ABSPATH' ) ) { |
| @@ -119,18 +117,29 @@ | ||
| 119 | 117 | * @since 2.9.0 |
| 120 | 118 | * @access private |
| 121 | 119 | */ |
| 122 | 120 | private function add_actions() { |
| 123 | - add_action( 'elementor/editor-one/menu/register', function ( Menu_Data_Provider $menu_data_provider ) { | |
| 124 | - $this->register_editor_one_menu( $menu_data_provider ); | |
| 125 | - } ); | |
| 121 | + if ( ! Plugin::$instance->experiments->is_feature_active( 'admin_menu_rearrangement' ) ) { | |
| 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 ); | |
| 125 | + } | |
| 126 | 126 | |
| 127 | 127 | add_action( 'wp_ajax_elementor_system_info_download_file', [ $this, 'download_file' ] ); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - private function register_editor_one_menu( Menu_Data_Provider $menu_data_provider ) { | |
| 131 | - $menu_data_provider->register_menu( new Editor_One_System_Menu() ); | |
| 132 | - $menu_data_provider->register_menu( new Editor_One_System_Info_Menu() ); | |
| 130 | + /** | |
| 131 | + * Register admin menu. | |
| 132 | + * | |
| 133 | + * Add new Elementor system info admin menu. | |
| 134 | + * | |
| 135 | + * Fired by `admin_menu` action. | |
| 136 | + * | |
| 137 | + * @since 2.9.0 | |
| 138 | + * @access private | |
| 139 | + */ | |
| 140 | + private function register_menu( Admin_Menu_Manager $admin_menu ) { | |
| 141 | + $admin_menu->register( 'elementor-system-info', new System_Info_Menu_Item( $this ) ); | |
| 133 | 142 | } |
| 134 | 143 | |
| 135 | 144 | /** |
| 136 | 145 | * Display page. |
| @@ -149,9 +158,9 @@ | ||
| 149 | 158 | <div class="elementor-system-info-header"> |
| 150 | 159 | <h3 class="wp-heading-inline"><?php echo esc_html__( 'System Info', 'elementor' ); ?></h3> |
| 151 | 160 | <form action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" method="post"> |
| 152 | 161 | <input type="hidden" name="action" value="elementor_system_info_download_file"> |
| 153 | - <input type="submit" data-id="elementor-system-info-download-file" class="button button-primary" value="<?php echo esc_attr__( 'Download System Info', 'elementor' ); ?>"> | |
| 162 | + <input type="submit" class="button button-primary" value="<?php echo esc_attr__( 'Download System Info', 'elementor' ); ?>"> | |
| 154 | 163 | </form> |
| 155 | 164 | </div> |
| 156 | 165 | <div><?php $this->print_report( $reports, 'html' ); ?></div> |
| 157 | 166 | <h3><?php echo esc_html__( 'Copy & Paste Info', 'elementor' ); ?></h3> |
| @@ -173,9 +182,9 @@ | ||
| 173 | 182 | </div> |
| 174 | 183 | <hr> |
| 175 | 184 | <form action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" method="post"> |
| 176 | 185 | <input type="hidden" name="action" value="elementor_system_info_download_file"> |
| 177 | - <input type="submit" data-id="elementor-system-info-download-file" class="button button-primary" value="<?php echo esc_attr__( 'Download System Info', 'elementor' ); ?>"> | |
| 186 | + <input type="submit" class="button button-primary" value="<?php echo esc_attr__( 'Download System Info', 'elementor' ); ?>"> | |
| 178 | 187 | </form> |
| 179 | 188 | </div> |
| 180 | 189 | <?php |
| 181 | 190 | } |
| @@ -191,9 +200,9 @@ | ||
| 191 | 200 | * @access public |
| 192 | 201 | */ |
| 193 | 202 | public function download_file() { |
| 194 | 203 | if ( ! current_user_can( $this->capability ) ) { |
| 195 | - wp_die( esc_html__( 'You do not have permission to download this file.', 'elementor' ) ); | |
| 204 | + wp_die( esc_html__( 'You don\'t have permissions to download this file', 'elementor' ) ); | |
| 196 | 205 | } |
| 197 | 206 | |
| 198 | 207 | $reports_info = self::get_allowed_reports(); |
| 199 | 208 | $reports = $this->load_reports( $reports_info ); |
| @@ -273,10 +282,11 @@ | ||
| 273 | 282 | * @param array $properties Report properties. |
| 274 | 283 | * |
| 275 | 284 | * @return \WP_Error|false|Base Base instance if the report was created, |
| 276 | 285 | * False or WP_Error otherwise. |
| 277 | - * @since 2.9.0 | |
| 286 | + *@since 2.9.0 | |
| 278 | 287 | * @access public |
| 288 | + * | |
| 279 | 289 | */ |
| 280 | 290 | public function create_reporter( array $properties ) { |
| 281 | 291 | $properties = Model_Helper::prepare_properties( $this->get_settings( 'reporter_properties' ), $properties ); |
| 282 | 292 | |