PluginProbe
QuadMenu – Mega Menu / 2.0.7
QuadMenu – Mega Menu v2.0.7
3.3.7 3.3.6 trunk 1.8.4 1.8.5 1.8.7 1.8.8 1.8.9 1.9.0 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 All 87 releases
quadmenu / includes / panel / welcome.php

welcome.php in QuadMenu – Mega Menu 2.0.7, at includes/panel/welcome.php

434 lines 15.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH')) {
3 die('-1');
4 }
5
6 class QuadMenu_Welcome extends QuadMenu_Panel {
7
8 static $status = array();
9
10 function __construct() {
11 add_action('admin_menu', array($this, 'add_menu'), 5);
12 }
13
14 function add_menu() {
15 add_menu_page(self::$panel_slug, QUADMENU_PLUGIN_NAME, 'edit_posts', self::$panel_slug, array($this, 'add_panel'), plugins_url('/assets/backend/images/icon.png', QUADMENU_PLUGIN_FILE));
16 add_submenu_page(self::$panel_slug, esc_html__('Welcome', 'quadmenu'), esc_html__('Welcome', 'quadmenu'), 'edit_posts', self::$panel_slug, array($this, 'add_panel'));
17 }
18
19 function add_panel() {
20 global $submenu;
21 $system = $this;
22 include (QUADMENU_PLUGIN_DIR . '/includes/panel/pages/parts/header.php');
23 include (QUADMENU_PLUGIN_DIR . '/includes/panel/pages/welcome.php');
24 }
25
26 function add($section, $status_array) {
27 self::$status[$section][] = $status_array;
28 }
29
30 function tables() {
31
32 $this->system();
33
34 foreach (self::$status as $section_name => $section_statuses) {
35 ?>
36 <table class="widefat quadmenu-system-table" cellspacing="0">
37 <thead>
38 <tr>
39 <th colspan="4"><?php echo esc_html($section_name); ?></th>
40 </tr>
41 </thead>
42 <tbody>
43 <?php
44 foreach ($section_statuses as $status_params) {
45 ?>
46 <tr>
47 <td class="quadmenu-system-name"><?php echo esc_html($status_params['check_name']); ?></td>
48 <!--<td class="quadmenu-system-help"></td>-->
49 <td class="quadmenu-system-status">
50 <?php
51 switch ($status_params['status']) {
52 case 'green':
53 echo '<div class="quadmenu-system-led success" title="' . esc_html__('Green status: this check passed our system status test!', 'quadmenu') . '"></div>';
54 break;
55 case 'yellow':
56 echo '<div class="quadmenu-system-led warning" title="' . esc_html__('Yellow status: this setting may affect the backend of the site. The frontend should still run as expected. We recommend that you fix this.', 'quadmenu') . '"></div>';
57 break;
58 case 'red' :
59 echo '<div class="quadmenu-system-led critical" title="' . esc_html__('Red status: the site may not work as expected with this option.', 'quadmenu') . '"></div>';
60 break;
61 case 'info':
62 echo '<div class="quadmenu-system-led info title="' . esc_html__('Info status: this is just for information purposes and easier debug if a problem appears', 'quadmenu') . '">i</div>';
63 break;
64 }
65 ?>
66 </td>
67 <td class="quadmenu-system-value"><?php
68 echo wp_kses($status_params['value'], array(
69 'a' => array(
70 'href' => array(),
71 'title' => array()
72 ),
73 'br' => array(),
74 'em' => array(),
75 'strong' => array(),
76 'span' => array(),
77 ));
78 ?></td>
79 </tr>
80 <?php
81 }
82 ?>
83 </tbody>
84 </table>
85 <?php
86 }
87 }
88
89 function system() {
90
91 global $quadmenu_active_locations, $_wp_registered_nav_menus;
92
93 // Plugin name
94 $this->add('Plugin config', array(
95 'check_name' => 'Plugin name',
96 'tooltip' => '',
97 'value' => QUADMENU_PLUGIN_NAME,
98 'status' => 'info'
99 ));
100
101 // Plugin version
102 $this->add('Plugin config', array(
103 'check_name' => 'Plugin version',
104 'tooltip' => '',
105 'value' => QUADMENU_PLUGIN_VERSION,
106 'status' => 'info'
107 ));
108
109 // Redux version
110 if (class_exists('ReduxFramework')) {
111 if (version_compare(ReduxFramework::$_version, '3.6.5') < 0) {
112 $this->add('Plugin config', array(
113 'check_name' => 'Redux version',
114 'tooltip' => '',
115 'value' => sprintf('%1$s - <span class="quadmenu-status-small-text">%2$s <a href="%3$s" target="_blank">%4$s</a></span>', ReduxFramework::$_version, esc_html__('Your Redux version is outdated: ', 'quadmenu'), 'https://es.wordpress.org/plugins/redux-framework/', esc_html__('Please install it as a plugin', 'quadmenu')),
116 'status' => 'red',
117 ));
118 } else {
119 $this->add('Plugin config', array(
120 'check_name' => 'Redux version',
121 'tooltip' => '',
122 'value' => ReduxFramework::$_version,
123 'status' => 'green'
124 ));
125 }
126 } else {
127 $this->add('Plugin config', array(
128 'check_name' => 'Redux version',
129 'tooltip' => '',
130 'value' => esc_html__('Activate ReduxFramework', 'quadmenu'),
131 'status' => 'red',
132 ));
133 }
134
135 // Menu Locations
136 if (is_array($quadmenu_active_locations)) {
137 $this->add('Plugin config', array(
138 'check_name' => 'Active Locations',
139 'tooltip' => '',
140 'value' => sprintf(esc_html__('You have %s active menu locations', 'quadmenu'), count($quadmenu_active_locations)),
141 'status' => count($quadmenu_active_locations) ? 'green' : 'info'
142 ));
143 }
144
145 // Server status
146 // -----------------------------------------------------------------
147 // server info
148 $this->add('php.ini configuration', array(
149 'check_name' => 'Server software',
150 'tooltip' => '',
151 'value' => esc_html($_SERVER['SERVER_SOFTWARE']),
152 'status' => 'info'
153 ));
154
155 // php version
156 $this->add('php.ini configuration', array(
157 'check_name' => 'PHP Version',
158 'tooltip' => '',
159 'value' => phpversion(),
160 'status' => 'info'
161 ));
162
163 // post_max_size
164 $this->add('php.ini configuration', array(
165 'check_name' => 'post_max_size',
166 'tooltip' => '',
167 'value' => sprintf('%1$s - <span class="quadmenu-status-small-text">%2$s</span>', ini_get('post_max_size'), esc_html__('You cannot upload images, themes and plugins that have a size bigger than this value', 'quadmenu')),
168 'status' => 'info'
169 ));
170
171 // php time limit
172 $max_execution_time = ini_get('max_execution_time');
173 if ($max_execution_time == 0 or $max_execution_time >= 300) {
174 $this->add('php.ini configuration', array(
175 'check_name' => 'max_execution_time',
176 'tooltip' => '',
177 'value' => esc_html($max_execution_time),
178 'status' => 'green'
179 ));
180 } else {
181 $this->add('php.ini configuration', array(
182 'check_name' => 'max_execution_time',
183 'tooltip' => '',
184 'value' => sprintf('%1$s - <span class="quadmenu-status-small-text">%2$s <a href="%3$s" target="_blank">%4$s</a></span>', $max_execution_time, esc_html__('To import the demo content 300 seconds of max execution time is required. See: ', 'quadmenu'), 'http://codex.wordpress.org/Common_WordPress_Errors#Maximum_execution_time_exceeded', esc_html__('Increasing max execution to PHP', 'quadmenu')),
185 'status' => 'red'
186 ));
187 }
188
189 // php max input vars
190 $max_input_vars = ini_get('max_input_vars');
191 if ($max_input_vars == 0 or $max_input_vars >= 2000) {
192 $this->add('php.ini configuration', array(
193 'check_name' => 'max_input_vars',
194 'tooltip' => '',
195 'value' => esc_html($max_input_vars),
196 'status' => 'green'
197 ));
198 } else {
199 $this->add('php.ini configuration', array(
200 'check_name' => 'max_input_vars',
201 'tooltip' => '',
202 'value' => esc_html($max_input_vars),
203 'status' => 'yellow'
204 ));
205 }
206
207 // suhosin
208 if (extension_loaded('suhosin') !== true) {
209 $this->add('php.ini configuration', array(
210 'check_name' => 'SUHOSIN Installed',
211 'tooltip' => '',
212 'value' => 'False',
213 'status' => 'green'
214 ));
215 } else {
216 $this->add('php.ini configuration', array(
217 'check_name' => 'SUHOSIN Installed',
218 'tooltip' => '',
219 'value' => sprintf('%1$s - <span class="quadmenu-status-small-text">%2$s</span>', esc_html__('SUHOSIN is installed', 'quadmenu'), esc_html__('It may cause problems with saving the plugin panel if it\'s not properly configured', 'quadmenu')),
220 'status' => 'yellow'
221 ));
222 }
223
224 $response_code = wp_remote_retrieve_response_code(wp_remote_get(QUADMENU_PLUGIN_URL . 'assets/frontend/less/quadmenu-locations.less', array(
225 'timeout' => 20,
226 'user-agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:20.0) Gecko/20100101 Firefox/20.0'
227 )));
228 // mime types
229 if ($response_code == 200) {
230 $this->add('Compiler', array(
231 'check_name' => esc_html__('LESS files allowed', 'quadmenu'),
232 'tooltip' => '',
233 'value' => $response_code,
234 'status' => 'green'
235 ));
236 } else {
237 $this->add('Compiler', array(
238 'check_name' => esc_html__('Can\'t compile stylesheets', 'quadmenu'),
239 'tooltip' => '',
240 'value' => sprintf('%1$s error - <span class="quadmenu-status-small-text">%2$s</span>', $response_code, esc_html__('Can\'t download LESS mime types', 'quadmenu')),
241 'status' => 'red'
242 ));
243 }
244
245 // mime types
246 if (wp_is_writable(QUADMENU_UPLOAD_DIR)) {
247 $this->add('Compiler', array(
248 'check_name' => esc_html__('Folder is writable', 'quadmenu'),
249 'tooltip' => '',
250 'value' => QUADMENU_UPLOAD_DIR,
251 'status' => 'green'
252 ));
253 } else {
254 $this->add('Compiler', array(
255 'check_name' => esc_html__('Can\'t write uploads folder', 'quadmenu'),
256 'tooltip' => '',
257 'value' => QUADMENU_UPLOAD_DIR,
258 'status' => 'red'
259 ));
260 }
261
262
263 // WordPress
264 // -----------------------------------------------------------------
265 // home url
266 $this->add('WordPress and plugins', array(
267 'check_name' => 'WP Home URL',
268 'tooltip' => 'test tooltip',
269 'value' => home_url(),
270 'status' => 'info'
271 ));
272
273 // site url
274 $this->add('WordPress and plugins', array(
275 'check_name' => 'WP Site URL',
276 'tooltip' => 'test tooltip',
277 'value' => site_url(),
278 'status' => 'info'
279 ));
280
281 // home_url == site_url
282 if (home_url() != site_url()) {
283 $this->add('WordPress and plugins', array(
284 'check_name' => 'Home URL - Site URL',
285 'tooltip' => 'Home URL not equal to Site URL, this may indicate a problem with your WordPress configuration.',
286 'value' => sprintf('%1$s - <span class="quadmenu-status-small-text">%2$s</span>', esc_html__('Home URL != Site URL', 'quadmenu'), esc_html__('Home URL not equal to Site URL, this may indicate a problem with your WordPress configuration.', 'quadmenu')),
287 'status' => 'red'
288 ));
289 }
290
291 // version
292 $this->add('WordPress and plugins', array(
293 'check_name' => 'WP version',
294 'tooltip' => '',
295 'value' => get_bloginfo('version'),
296 'status' => 'info'
297 ));
298
299
300 // is_multisite
301 $this->add('WordPress and plugins', array(
302 'check_name' => 'WP multisite enabled',
303 'tooltip' => '',
304 'value' => is_multisite() ? 'Yes' : 'No',
305 'status' => 'info'
306 ));
307
308
309 // language
310 $this->add('WordPress and plugins', array(
311 'check_name' => 'WP Language',
312 'tooltip' => '',
313 'value' => get_locale(),
314 'status' => 'info'
315 ));
316
317 // theme locations
318 if (!is_array($_wp_registered_nav_menus) || !count($_wp_registered_nav_menus)) {
319 $this->add('WordPress and plugins', array(
320 'check_name' => 'WP Menu Locations',
321 'tooltip' => '',
322 'value' => esc_html__('Your theme doesn\'t natively support menus'),
323 'status' => 'red'
324 ));
325 } else {
326 $this->add('WordPress and plugins', array(
327 'check_name' => 'WP Menu Locations',
328 'tooltip' => '',
329 'value' => count($_wp_registered_nav_menus),
330 'status' => 'green'
331 ));
332 }
333
334 // memory limit
335 $memory_limit = $this->wp_memory_notation_to_number(WP_MEMORY_LIMIT);
336 if ($memory_limit < 67108864) {
337 $this->add('WordPress and plugins', array(
338 'check_name' => 'WP Memory Limit',
339 'tooltip' => '',
340 'value' => sprintf('%1$s - <span class="quadmenu-status-small-text">%2$s <a href="%3$s" target="_blank">%4$s</a></span>', size_format($memory_limit) . '/request', esc_html__('We recommend setting memory to at least 64MB. The Plugin is well tested with a 40MB/request limit, but if you are using multiple plugins that may not be enough. See: ', 'quadmenu'), 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP', esc_html__('Increasing memory allocated to PHP', 'quadmenu')),
341 'status' => 'red'
342 ));
343 } else {
344 $this->add('WordPress and plugins', array(
345 'check_name' => 'WP Memory Limit',
346 'tooltip' => '',
347 'value' => size_format($memory_limit) . '/request',
348 'status' => 'green'
349 ));
350 }
351
352
353 // wp debug
354 if (defined('WP_DEBUG') and WP_DEBUG === true) {
355 $this->add('WordPress and plugins', array(
356 'check_name' => 'WP_DEBUG',
357 'tooltip' => '',
358 'value' => esc_html__('WP_DEBUG is enabled', 'quadmenu'),
359 'status' => 'yellow'
360 ));
361 } else {
362 $this->add('WordPress and plugins', array(
363 'check_name' => 'WP_DEBUG',
364 'tooltip' => '',
365 'value' => 'False',
366 'status' => 'green'
367 ));
368 }
369
370 // caching
371 $caching_plugin_list = array(
372 'wp-super-cache/wp-cache.php' => array(
373 'name' => 'WP super cache',
374 'status' => 'green',
375 ),
376 'w3-total-cache/w3-total-cache.php' => array(
377 'name' => 'W3 total cache',
378 'status' => 'green',
379 ),
380 'wp-fastest-cache/wpFastestCache.php' => array(
381 'name' => 'WP Fastest Cache (We haven\'t tested this plugin.)',
382 'status' => 'yellow',
383 ),
384 'wp-rocket/wp-rocket.php' => array(
385 'name' => 'WP Rocket (We haven\'t tested this plugin.)',
386 'status' => 'yellow',
387 ),
388 );
389
390 $active_plugins = get_plugins();
391
392 $caching_plugin = esc_html__('No caching plugin detected', 'quadmenu');
393
394 $caching_plugin_status = 'yellow';
395
396 foreach (array_keys($active_plugins) as $active_plugin) {
397
398 if (isset($caching_plugin_list[$active_plugin])) {
399
400 $caching_plugin = $caching_plugin_list[$active_plugin]['name'];
401 $caching_plugin_status = $caching_plugin_list[$active_plugin]['status'];
402 break;
403 }
404 }
405 $this->add('WordPress and plugins', array(
406 'check_name' => 'Caching plugin',
407 'tooltip' => '',
408 'value' => $caching_plugin,
409 'status' => $caching_plugin_status
410 ));
411 }
412
413 function wp_memory_notation_to_number($size) {
414 $l = substr($size, -1);
415 $ret = substr($size, 0, -1);
416 switch (strtoupper($l)) {
417 case 'P':
418 $ret *= 1024;
419 case 'T':
420 $ret *= 1024;
421 case 'G':
422 $ret *= 1024;
423 case 'M':
424 $ret *= 1024;
425 case 'K':
426 $ret *= 1024;
427 }
428 return $ret;
429 }
430
431 }
432
433 new QuadMenu_Welcome();
434