| @@ -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. |
| @@ -145,15 +154,9 @@ | ||
| 145 | 154 | |
| 146 | 155 | $reports = $this->load_reports( $reports_info ); |
| 147 | 156 | ?> |
| 148 | 157 | <div id="elementor-system-info"> |
| 149 | - <div class="elementor-system-info-header"> | |
| 150 | - <h3 class="wp-heading-inline"><?php echo esc_html__( 'System Info', 'elementor' ); ?></h3> | |
| 151 | - <form action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" method="post"> | |
| 152 | - <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' ); ?>"> | |
| 154 | - </form> | |
| 155 | - </div> | |
| 158 | + <h3 class="wp-heading-inline"><?php echo esc_html__( 'System Info', 'elementor' ); ?></h3> | |
| 156 | 159 | <div><?php $this->print_report( $reports, 'html' ); ?></div> |
| 157 | 160 | <h3><?php echo esc_html__( 'Copy & Paste Info', 'elementor' ); ?></h3> |
| 158 | 161 | <div id="elementor-system-info-raw"> |
| 159 | 162 | <label id="elementor-system-info-raw-code-label" for="elementor-system-info-raw-code"><?php echo esc_html__( 'You can copy the below info as simple text with Ctrl+C / Ctrl+V:', 'elementor' ); ?></label> |
| @@ -173,9 +176,9 @@ | ||
| 173 | 176 | </div> |
| 174 | 177 | <hr> |
| 175 | 178 | <form action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" method="post"> |
| 176 | 179 | <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' ); ?>"> | |
| 180 | + <input type="submit" class="button button-primary" value="<?php echo esc_attr__( 'Download System Info', 'elementor' ); ?>"> | |
| 178 | 181 | </form> |
| 179 | 182 | </div> |
| 180 | 183 | <?php |
| 181 | 184 | } |
| @@ -191,9 +194,9 @@ | ||
| 191 | 194 | * @access public |
| 192 | 195 | */ |
| 193 | 196 | public function download_file() { |
| 194 | 197 | if ( ! current_user_can( $this->capability ) ) { |
| 195 | - wp_die( esc_html__( 'You do not have permission to download this file.', 'elementor' ) ); | |
| 198 | + wp_die( esc_html__( 'You don\'t have permissions to download this file', 'elementor' ) ); | |
| 196 | 199 | } |
| 197 | 200 | |
| 198 | 201 | $reports_info = self::get_allowed_reports(); |
| 199 | 202 | $reports = $this->load_reports( $reports_info ); |
| @@ -273,10 +276,11 @@ | ||
| 273 | 276 | * @param array $properties Report properties. |
| 274 | 277 | * |
| 275 | 278 | * @return \WP_Error|false|Base Base instance if the report was created, |
| 276 | 279 | * False or WP_Error otherwise. |
| 277 | - * @since 2.9.0 | |
| 280 | + *@since 2.9.0 | |
| 278 | 281 | * @access public |
| 282 | + * | |
| 279 | 283 | */ |
| 280 | 284 | public function create_reporter( array $properties ) { |
| 281 | 285 | $properties = Model_Helper::prepare_properties( $this->get_settings( 'reporter_properties' ), $properties ); |
| 282 | 286 | |