PluginProbe
Elementor Website Builder – more than just a page builder / 3.5.6
Elementor Website Builder – more than just a page builder v3.5.6
4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
← All changes | modules/system-info/module.php +27 -63 4.3.0-beta33.5.6 View file →
@@ -1,16 +1,10 @@
1 1 <?php
2 2 namespace Elementor\Modules\System_Info;
3 3
4 4 use Elementor\Core\Base\Module as BaseModule;
5 -use Elementor\Modules\EditorOne\Classes\Menu_Data_Provider;
6 -use Elementor\Modules\System_Info\AdminMenuItems\Editor_One_System_Info_Menu;
7 -use Elementor\Modules\System_Info\AdminMenuItems\Editor_One_System_Menu;
5 +use Elementor\Modules\System_Info\Reporters\Base;
8 6 use Elementor\Modules\System_Info\Helpers\Model_Helper;
9 -use Elementor\Modules\System_Info\Reporters\Base;
10 -use Elementor\Modules\System_Info\Rest\Rest_Api;
11 -use Elementor\Plugin;
12 -use Elementor\Settings;
13 7
14 8 if ( ! defined( 'ABSPATH' ) ) {
15 9 exit; // Exit if accessed directly.
16 10 }
@@ -70,12 +64,8 @@
70 64 'network_plugins' => [],
71 65 'mu_plugins' => [],
72 66 ];
73 67
74 - public function get_capability() {
75 - return $this->capability;
76 - }
77 -
78 68 /**
79 69 * Main system info page constructor.
80 70 *
81 71 * Initializing Elementor system info page.
@@ -120,56 +110,35 @@
120 110 * @since 2.9.0
121 111 * @access private
122 112 */
123 113 private function add_actions() {
124 - add_action( 'elementor/editor-one/menu/register', function ( Menu_Data_Provider $menu_data_provider ) {
125 - $this->register_editor_one_menu( $menu_data_provider );
126 - } );
127 -
114 + add_action( 'admin_menu', [ $this, 'register_menu' ], 500 );
128 115 add_action( 'wp_ajax_elementor_system_info_download_file', [ $this, 'download_file' ] );
129 - add_action( 'rest_api_init', [ $this, 'register_rest_routes' ] );
130 116 }
131 117
132 - public function register_rest_routes(): void {
133 - ( new Rest_Api() )->register_routes();
134 - }
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' );
135 130
136 - public function get_reports_data(): array {
137 - $reports = $this->load_reports( self::get_allowed_reports() );
138 -
139 - return $this->build_reports_data( $reports );
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 + );
140 139 }
141 140
142 - private function build_reports_data( array $reports ): array {
143 - $data = [];
144 -
145 - foreach ( $reports as $report_name => $report_details ) {
146 - $report = $report_details['report']->get_report();
147 -
148 - if ( is_wp_error( $report ) ) {
149 - continue;
150 - }
151 -
152 - $report_data = [
153 - 'label' => $report_details['label'],
154 - 'report' => $report,
155 - ];
156 -
157 - if ( ! empty( $report_details['sub'] ) ) {
158 - $report_data['sub'] = $this->build_reports_data( $report_details['sub'] );
159 - }
160 -
161 - $data[ $report_name ] = $report_data;
162 - }
163 -
164 - return $data;
165 - }
166 -
167 - private function register_editor_one_menu( Menu_Data_Provider $menu_data_provider ) {
168 - $menu_data_provider->register_menu( new Editor_One_System_Menu() );
169 - $menu_data_provider->register_menu( new Editor_One_System_Info_Menu() );
170 - }
171 -
172 141 /**
173 142 * Display page.
174 143 *
175 144 * Output the content for the main system info page.
@@ -182,15 +151,9 @@
182 151
183 152 $reports = $this->load_reports( $reports_info );
184 153 ?>
185 154 <div id="elementor-system-info">
186 - <div class="elementor-system-info-header">
187 - <h3 class="wp-heading-inline"><?php echo esc_html__( 'System Info', 'elementor' ); ?></h3>
188 - <form action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" method="post">
189 - <input type="hidden" name="action" value="elementor_system_info_download_file">
190 - <input type="submit" data-id="elementor-system-info-download-file" class="button button-primary" value="<?php echo esc_attr__( 'Download System Info', 'elementor' ); ?>">
191 - </form>
192 - </div>
155 + <h3 class="wp-heading-inline"><?php echo esc_html__( 'System Info', 'elementor' ); ?></h3>
193 156 <div><?php $this->print_report( $reports, 'html' ); ?></div>
194 157 <h3><?php echo esc_html__( 'Copy & Paste Info', 'elementor' ); ?></h3>
195 158 <div id="elementor-system-info-raw">
196 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>
@@ -210,9 +173,9 @@
210 173 </div>
211 174 <hr>
212 175 <form action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" method="post">
213 176 <input type="hidden" name="action" value="elementor_system_info_download_file">
214 - <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' ); ?>">
215 178 </form>
216 179 </div>
217 180 <?php
218 181 }
@@ -228,9 +191,9 @@
228 191 * @access public
229 192 */
230 193 public function download_file() {
231 194 if ( ! current_user_can( $this->capability ) ) {
232 - 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' ) );
233 196 }
234 197
235 198 $reports_info = self::get_allowed_reports();
236 199 $reports = $this->load_reports( $reports_info );
@@ -310,10 +273,11 @@
310 273 * @param array $properties Report properties.
311 274 *
312 275 * @return \WP_Error|false|Base Base instance if the report was created,
313 276 * False or WP_Error otherwise.
314 - * @since 2.9.0
277 + *@since 2.9.0
315 278 * @access public
279 + *
316 280 */
317 281 public function create_reporter( array $properties ) {
318 282 $properties = Model_Helper::prepare_properties( $this->get_settings( 'reporter_properties' ), $properties );
319 283