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