| @@ -3,13 +3,9 @@ | ||
| 3 | 3 | |
| 4 | 4 | use Elementor\Core\Base\Module as BaseModule; |
| 5 | 5 | use Elementor\Modules\System_Info\Reporters\Base; |
| 6 | 6 | 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 | 7 | use Elementor\Plugin; |
| 11 | -use Elementor\Settings; | |
| 12 | 8 | |
| 13 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | 10 | exit; // Exit if accessed directly. |
| 15 | 11 | } |
| @@ -69,12 +65,8 @@ | ||
| 69 | 65 | 'network_plugins' => [], |
| 70 | 66 | 'mu_plugins' => [], |
| 71 | 67 | ]; |
| 72 | 68 | |
| 73 | - public function get_capability() { | |
| 74 | - return $this->capability; | |
| 75 | - } | |
| 76 | - | |
| 77 | 69 | /** |
| 78 | 70 | * Main system info page constructor. |
| 79 | 71 | * |
| 80 | 72 | * Initializing Elementor system info page. |
| @@ -119,18 +111,36 @@ | ||
| 119 | 111 | * @since 2.9.0 |
| 120 | 112 | * @access private |
| 121 | 113 | */ |
| 122 | 114 | 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 | - } ); | |
| 115 | + if ( ! Plugin::$instance->experiments->is_feature_active( 'admin_menu_rearrangement' ) ) { | |
| 116 | + add_action( 'admin_menu', [ $this, 'register_menu' ], 500 ); | |
| 117 | + } | |
| 126 | 118 | |
| 127 | 119 | add_action( 'wp_ajax_elementor_system_info_download_file', [ $this, 'download_file' ] ); |
| 128 | 120 | } |
| 129 | 121 | |
| 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() ); | |
| 122 | + /** | |
| 123 | + * Register admin menu. | |
| 124 | + * | |
| 125 | + * Add new Elementor system info admin menu. | |
| 126 | + * | |
| 127 | + * Fired by `admin_menu` action. | |
| 128 | + * | |
| 129 | + * @since 2.9.0 | |
| 130 | + * @access public | |
| 131 | + */ | |
| 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 | + ); | |
| 133 | 143 | } |
| 134 | 144 | |
| 135 | 145 | /** |
| 136 | 146 | * Display page. |
| @@ -145,15 +155,9 @@ | ||
| 145 | 155 | |
| 146 | 156 | $reports = $this->load_reports( $reports_info ); |
| 147 | 157 | ?> |
| 148 | 158 | <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> | |
| 159 | + <h3 class="wp-heading-inline"><?php echo esc_html__( 'System Info', 'elementor' ); ?></h3> | |
| 156 | 160 | <div><?php $this->print_report( $reports, 'html' ); ?></div> |
| 157 | 161 | <h3><?php echo esc_html__( 'Copy & Paste Info', 'elementor' ); ?></h3> |
| 158 | 162 | <div id="elementor-system-info-raw"> |
| 159 | 163 | <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 +177,9 @@ | ||
| 173 | 177 | </div> |
| 174 | 178 | <hr> |
| 175 | 179 | <form action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" method="post"> |
| 176 | 180 | <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' ); ?>"> | |
| 181 | + <input type="submit" class="button button-primary" value="<?php echo esc_html__( 'Download System Info', 'elementor' ); ?>"> | |
| 178 | 182 | </form> |
| 179 | 183 | </div> |
| 180 | 184 | <?php |
| 181 | 185 | } |
| @@ -191,9 +195,9 @@ | ||
| 191 | 195 | * @access public |
| 192 | 196 | */ |
| 193 | 197 | public function download_file() { |
| 194 | 198 | if ( ! current_user_can( $this->capability ) ) { |
| 195 | - wp_die( esc_html__( 'You do not have permission to download this file.', 'elementor' ) ); | |
| 199 | + wp_die( esc_html__( 'You don\'t have permissions to download this file', 'elementor' ) ); | |
| 196 | 200 | } |
| 197 | 201 | |
| 198 | 202 | $reports_info = self::get_allowed_reports(); |
| 199 | 203 | $reports = $this->load_reports( $reports_info ); |
| @@ -273,10 +277,11 @@ | ||
| 273 | 277 | * @param array $properties Report properties. |
| 274 | 278 | * |
| 275 | 279 | * @return \WP_Error|false|Base Base instance if the report was created, |
| 276 | 280 | * False or WP_Error otherwise. |
| 277 | - * @since 2.9.0 | |
| 281 | + *@since 2.9.0 | |
| 278 | 282 | * @access public |
| 283 | + * | |
| 279 | 284 | */ |
| 280 | 285 | public function create_reporter( array $properties ) { |
| 281 | 286 | $properties = Model_Helper::prepare_properties( $this->get_settings( 'reporter_properties' ), $properties ); |
| 282 | 287 | |