PluginProbe
Elementor Website Builder – more than just a page builder / 3.6.3
Elementor Website Builder – more than just a page builder v3.6.3
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 4.0.7 All 451 releases
← All changes | modules/system-info/module.php +29 -61 4.3.0-beta13.6.3 View file →
@@ -1,16 +1,11 @@
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 7 use Elementor\Plugin;
12 -use Elementor\Settings;
13 8
14 9 if ( ! defined( 'ABSPATH' ) ) {
15 10 exit; // Exit if accessed directly.
16 11 }
@@ -70,12 +65,8 @@
70 65 'network_plugins' => [],
71 66 'mu_plugins' => [],
72 67 ];
73 68
74 - public function get_capability() {
75 - return $this->capability;
76 - }
77 -
78 69 /**
79 70 * Main system info page constructor.
80 71 *
81 72 * Initializing Elementor system info page.
@@ -120,56 +111,38 @@
120 111 * @since 2.9.0
121 112 * @access private
122 113 */
123 114 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 - } );
115 + if ( ! Plugin::$instance->experiments->is_feature_active( 'admin_menu_rearrangement' ) ) {
116 + add_action( 'admin_menu', [ $this, 'register_menu' ], 500 );
117 + }
127 118
128 119 add_action( 'wp_ajax_elementor_system_info_download_file', [ $this, 'download_file' ] );
129 - add_action( 'rest_api_init', [ $this, 'register_rest_routes' ] );
130 120 }
131 121
132 - public function register_rest_routes(): void {
133 - ( new Rest_Api() )->register_routes();
134 - }
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' );
135 134
136 - public function get_reports_data(): array {
137 - $reports = $this->load_reports( self::get_allowed_reports() );
138 -
139 - return $this->build_reports_data( $reports );
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 + );
140 143 }
141 144
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 145 /**
173 146 * Display page.
174 147 *
175 148 * Output the content for the main system info page.
@@ -182,15 +155,9 @@
182 155
183 156 $reports = $this->load_reports( $reports_info );
184 157 ?>
185 158 <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>
159 + <h3 class="wp-heading-inline"><?php echo esc_html__( 'System Info', 'elementor' ); ?></h3>
193 160 <div><?php $this->print_report( $reports, 'html' ); ?></div>
194 161 <h3><?php echo esc_html__( 'Copy & Paste Info', 'elementor' ); ?></h3>
195 162 <div id="elementor-system-info-raw">
196 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>
@@ -210,9 +177,9 @@
210 177 </div>
211 178 <hr>
212 179 <form action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" method="post">
213 180 <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' ); ?>">
181 + <input type="submit" class="button button-primary" value="<?php echo esc_html__( 'Download System Info', 'elementor' ); ?>">
215 182 </form>
216 183 </div>
217 184 <?php
218 185 }
@@ -228,9 +195,9 @@
228 195 * @access public
229 196 */
230 197 public function download_file() {
231 198 if ( ! current_user_can( $this->capability ) ) {
232 - 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' ) );
233 200 }
234 201
235 202 $reports_info = self::get_allowed_reports();
236 203 $reports = $this->load_reports( $reports_info );
@@ -310,10 +277,11 @@
310 277 * @param array $properties Report properties.
311 278 *
312 279 * @return \WP_Error|false|Base Base instance if the report was created,
313 280 * False or WP_Error otherwise.
314 - * @since 2.9.0
281 + *@since 2.9.0
315 282 * @access public
283 + *
316 284 */
317 285 public function create_reporter( array $properties ) {
318 286 $properties = Model_Helper::prepare_properties( $this->get_settings( 'reporter_properties' ), $properties );
319 287