PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 3.2.1
Adminify – White Label, Admin Menu Editor, Login Customizer v3.2.1
4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 4.1.17 All 164 releases
adminify / Inc / Modules / ServerInformation / ServerInfo_Server_Details.php

ServerInfo_Server_Details.php in Adminify – White Label, Admin Menu Editor, Login Customizer 3.2.1, at Inc/Modules/ServerInformation/ServerInfo_Server_Details.php

557 lines 17.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPAdminify\Inc\Modules\ServerInformation;
4
5 use WPAdminify\Inc\Classes\ServerInfo ;
6 use WPAdminify\Inc\Utils ;
7 // no direct access allowed
8 if ( !defined( 'ABSPATH' ) ) {
9 exit;
10 }
11 /**
12 * WPAdminify
13 *
14 * @package Server Information
15 *
16 * @author WP Adminify <support@wpadminify.com>
17 */
18 class ServerInfo_Server_Details
19 {
20 public function __construct()
21 {
22 $this->init();
23 }
24
25 public function init()
26 {
27 $server_info = new ServerInfo();
28 $help = '<span class="dashicons dashicons-editor-help"></span>';
29 $enabled = '<span class="adminify-compability enable"><span class="dashicons dashicons-yes"></span> ' . esc_html__( 'Enabled', 'adminify' ) . '</span>';
30 $disabled = '<span class="adminify-compability disable"><span class="dashicons dashicons-no"></span> ' . esc_html__( 'Disabled', 'adminify' ) . '</span>';
31 $yes = '<span class="adminify-compability enable"><span class="dashicons dashicons-yes"></span> ' . esc_html__( 'Yes', 'adminify' ) . '</span>';
32 $no = '<span class="adminify-compability disable"><span class="dashicons dashicons-no"></span> ' . esc_html__( 'No', 'adminify' ) . '</span>';
33 $entered = '<span class="adminify-compability enable"><span class="dashicons dashicons-yes"></span> ' . esc_html__( 'Defined', 'adminify' ) . '</span>';
34 $not_entered = '<span class="adminify-compability disable"><span class="dashicons dashicons-no"></span> ' . esc_html__( 'Not defined', 'adminify' ) . '</span>';
35 $sec_key = '<span class="error"><span class="dashicons dashicons-warning"></span> ' . esc_html__( 'Please enter this security key in the wp-confiq.php file', 'adminify' ) . '!</span>';
36 ?>
37
38 <div class="wrap">
39 <h1> <?php
40 echo Utils::admin_page_title( esc_html__( 'Server Info', 'adminify' ) ) ;
41 ?> </h1>
42
43 <p><?php
44 echo wp_kses_post( 'Interesting information about your web server. You can also use <a href="http://linfo.sourceforge.net/" target="_blank" rel="noopener">linfo</a> or <a href="https://phpsysinfo.github.io/phpsysinfo/" target="_blank" rel="noopener">phpsysinfo</a> to get more information about the web server' ) ;
45 ?>.</p>
46
47 <p><?php
48 echo wp_kses_post( 'In the most cases you can modify some server settings like "PHP Memory Limit" or "PHP Post Max Size" by upload and modify a <code>php.ini</code> file in the WordPress <code>/wp-admin/</code> folder. Learn more about <a href="https://www.wpbeginner.com/wp-tutorials/how-to-increase-the-maximum-file-upload-size-in-wordpress/" target="_blank" rel="noopener">here</a>' ) ;
49 ?>.</p>
50
51
52 <table class="wp-list-table widefat posts mt-6">
53 <thead>
54 <tr>
55 <th style="width: 300px" class="manage-column"><?php
56 echo esc_html__( 'Info', 'adminify' ) ;
57 ?></th>
58 <th class="manage-column"><?php
59 echo esc_html__( 'Result', 'adminify' ) ;
60 ?></th>
61 </tr>
62 </thead>
63 <tbody>
64 <tr>
65 <td><?php
66 esc_html_e( 'OS', 'adminify' );
67 ?>:</td>
68 <td><?php
69 echo wp_kses_post( PHP_OS ) ;
70 ?> / <?php
71 echo wp_kses_post( PHP_INT_SIZE * 8 ) . esc_html__( 'Bit OS', 'adminify' ) . ' (' . wp_kses_post( php_uname() ) . ')' ;
72 ?></td>
73 </tr>
74 <tr>
75 <td><?php
76 esc_html_e( 'Software', 'adminify' );
77 ?>:</td>
78 <td><?php
79 echo Utils::wp_kses_custom( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ) ;
80 ?></td>
81 </tr>
82 <tr>
83 <td><?php
84 esc_html_e( 'IP Address', 'adminify' );
85 ?>:</td>
86 <td><?php
87 echo Utils::wp_kses_custom( wp_unslash( $_SERVER['SERVER_ADDR'] ) ) ;
88 ?></td>
89 </tr>
90 <tr>
91 <td><?php
92 esc_html_e( 'Web Port', 'adminify' );
93 ?>:</td>
94 <td><?php
95 echo Utils::wp_kses_custom( wp_unslash( $_SERVER['SERVER_PORT'] ) ) ;
96 ?></td>
97 </tr>
98 <tr>
99 <td><?php
100 esc_html_e( 'Date / Time (WP)', 'adminify' );
101 ?>:</td>
102 <td><?php
103 echo wp_kses_post( date( 'Y-m-d H:i:s', time() ) ) . ' (' . wp_kses_post( current_time( 'mysql' ) ) . ')' ;
104 ?></td>
105 </tr>
106 <tr>
107 <td><?php
108 esc_html_e( 'Timezone (WP)', 'adminify' );
109 ?>:</td>
110 <td><?php
111 echo wp_kses_post( date_default_timezone_get() ) . ' (' . wp_kses_post( $server_info->get_wp_timezone() ) . ')' ;
112 ?></td>
113 </tr>
114 <tr>
115 <td><?php
116 esc_html_e( 'Default Timezone is UTC', 'adminify' );
117 ?>:</td>
118 <td>
119 <?php
120 $default_timezone = date_default_timezone_get();
121
122 if ( 'UTC' !== $default_timezone ) {
123 echo '<span>' . Utils::wp_kses_custom( $no ) . sprintf( wp_kses_post( 'Default timezone is %s - it should be UTC', 'adminify' ), esc_html( $default_timezone ) ) . '</span>' ;
124 } else {
125 echo Utils::wp_kses_custom( $yes ) ;
126 }
127
128 ?>
129 </td>
130 </tr>
131 <tr>
132 <td><?php
133 esc_html_e( 'Protocol', 'adminify' );
134 ?>:</td>
135 <td><?php
136 echo wp_kses_post( php_uname( 'n' ) ) ;
137 ?></td>
138 </tr>
139 <tr>
140 <td><?php
141 esc_html_e( 'CGI Version', 'adminify' );
142 ?>:</td>
143 <td><?php
144 echo esc_html( sanitize_text_field( wp_unslash( $_SERVER['GATEWAY_INTERFACE'] ) ) ) ;
145 ?></td>
146 </tr>
147
148 <?php
149 ?>
150
151 <tr>
152 <td><?php
153 esc_html_e( 'CPU Usage', 'adminify' );
154 ?>:</td>
155 <td>
156 <div class="adminify-system-progress">
157 <div class="status-progressbar">
158 <span><?php
159 echo Utils::wp_kses_custom( $server_info->get_server_cpu_load_percentage() ) . '% ' ;
160 ?></span>
161 <div style="width: <?php
162 echo Utils::wp_kses_custom( $server_info->get_server_cpu_load_percentage() ) ;
163 ?>%"></div>
164 </div>
165 </div>
166 </td>
167 </tr>
168 <tr>
169 <td><?php
170 esc_html_e( 'CPU Load Average', 'adminify' );
171 ?>:</td>
172 <td><?php
173 echo Utils::wp_kses_custom( $server_info->get_cpu_load_average() ) ;
174 ?></td>
175 </tr>
176 <tr>
177 <td><?php
178 esc_html_e( 'Disk Space', 'adminify' );
179 ?>:</td>
180 <td>
181 <?php
182 $disk_space = $server_info->get_server_disk_size();
183
184 if ( $disk_space != 'N/A' ) {
185 echo esc_html__( 'Total', 'adminify' ) . ': ' . esc_html( $disk_space['size'] ) . ' GB / ' . esc_html__( 'Free', 'adminify' ) . ': ' . esc_html( $disk_space['free'] ) . ' GB / ' . esc_html__( 'Used', 'adminify' ) . ': ' . esc_html( $disk_space['used'] ) . ' GB' ;
186 } else {
187 echo esc_html( $disk_space ) ;
188 }
189
190 ?>
191 </td>
192 </tr>
193 <tr>
194 <td><?php
195 esc_html_e( 'Disk Space Usage', 'adminify' );
196 ?>:</td>
197 <td>
198 <?php
199 $disk_space = $server_info->get_server_disk_size();
200
201 if ( $disk_space != 'N/A' ) {
202 ?>
203 <div class="status-progressbar">
204 <span><?php
205 echo esc_html( $disk_space['usage'] . '% ' ) ;
206 ?></span>
207 <div style="width: <?php
208 echo esc_attr( $disk_space['usage'] ) ;
209 ?>%"></div>
210 </div>
211 <?php
212 echo esc_html( ' ' . $disk_space['used'] . ' GB of ' . $disk_space['size'] . ' GB' ) ;
213 } else {
214 echo esc_html( $disk_space ) ;
215 }
216
217 ?>
218 </td>
219 </tr>
220 <tr>
221 <td><?php
222 esc_html_e( 'Memory (RAM) Total', 'adminify' );
223 ?>:</td>
224 <td>
225 <?php
226 $server_ram = $server_info->get_server_ram_details();
227
228 if ( $server_ram != 'N/A' ) {
229 echo esc_html( $server_ram['MemTotal'] ) . ' GB' ;
230 } else {
231 echo esc_html( $server_ram ) ;
232 }
233
234 ?>
235 </td>
236 </tr>
237 <tr>
238 <td><?php
239 esc_html_e( 'Memory (RAM) Free', 'adminify' );
240 ?>:</td>
241 <td>
242 <?php
243 $server_ram = $server_info->get_server_ram_details();
244
245 if ( $server_ram != 'N/A' ) {
246 echo esc_html( $server_ram['MemFree'] ) . ' GB' ;
247 } else {
248 echo esc_html( $server_ram ) ;
249 }
250
251 ?>
252 </td>
253 </tr>
254 <tr>
255 <td><?php
256 esc_html_e( 'Memory (RAM) Usage', 'adminify' );
257 ?>:</td>
258 <td>
259 <?php
260 $server_ram = $server_info->get_server_ram_details();
261
262 if ( $server_ram != 'N/A' ) {
263 ?>
264 <div class="status-progressbar">
265 <span>
266 <?php
267 echo esc_html( $server_ram['MemUsagePercentage'] . '% ' ) ;
268 ?>
269 </span>
270 <div style="width: <?php
271 echo esc_attr( $server_ram['MemUsagePercentage'] ) ;
272 ?>%">
273 </div>
274 </div>
275 <?php
276 echo esc_html( ' ' . ($server_ram['MemTotal'] - $server_ram['MemFree']) . ' GB of ' . $server_ram['MemTotal'] . ' GB' ) ;
277 } else {
278 echo esc_html( $server_ram ) ;
279 }
280
281 ?>
282 </td>
283 </tr>
284 <tr>
285 <td><?php
286 esc_html_e( 'Memcached', 'adminify' );
287 ?>:</td>
288 <td>
289 <?php
290
291 if ( extension_loaded( 'memcache' ) ) {
292 echo Utils::wp_kses_custom( $yes ) ;
293 } else {
294 echo Utils::wp_kses_custom( $no ) ;
295 }
296
297 ?>
298 </td>
299 </tr>
300
301 <?php
302 ?>
303
304 <tr class="table-border-top">
305 <td><?php
306 esc_html_e( 'PHP Version', 'adminify' );
307 ?>:</td>
308 <td><?php
309 echo Utils::wp_kses_custom( $server_info->get_php_version() ) ;
310 ?></td>
311 </tr>
312
313 <?php
314
315 if ( function_exists( 'ini_get' ) ) {
316 ?>
317 <tr>
318 <td><?php
319 esc_html_e( 'PHP Memory Limit (WP)', 'adminify' );
320 ?>:</td>
321 <td><?php
322 echo Utils::wp_kses_custom( $server_info->get_wp_memory_limit() ) ;
323 ?></td>
324 </tr>
325 <tr>
326 <td><?php
327 esc_html_e( 'PHP Memory Usage', 'adminify' );
328 ?>:</td>
329 <td>
330 <?php
331
332 if ( $server_info->get_server_memory_usage()['MemLimitGet'] == '-1' ) {
333 ?>
334 <?php
335 echo Utils::wp_kses_custom( $server_info->get_server_memory_usage()['MemUsageFormat'] ) . ' ' . esc_html__( 'of', 'adminify' ) . ' ' . esc_html__( 'Unlimited', 'adminify' ) . ' (-1)' ;
336 ?>
337 <?php
338 } else {
339 ?>
340 <?php
341 echo Utils::wp_kses_custom( $server_info->get_server_memory_usage()['MemUsageFormat'] ) . ' ' . esc_html__( 'of', 'adminify' ) . ' ' . Utils::wp_kses_custom( $server_info->get_server_memory_usage()['MemLimitFormat'] ) ;
342 ?>
343
344 <div class="adminify-system-progress">
345 <div class="status-progressbar"><span><?php
346 echo Utils::wp_kses_custom( $server_info->get_server_memory_usage()['MemUsageCalc'] ) . '% ' ;
347 ?></span>
348 <div style="width: <?php
349 echo esc_attr( $server_info->get_server_memory_usage()['MemUsageCalc'] ) ;
350 ?>%"></div>
351 </div>
352 </div>
353
354 <?php
355 }
356
357 ?>
358 </td>
359 </tr>
360 <tr>
361 <td><?php
362 esc_html_e( 'PHP Max Upload Size (WP)', 'adminify' );
363 ?>:</td>
364 <td><?php
365 echo (int) wp_kses_post( ini_get( 'upload_max_filesize' ) ) . ' MB (' . wp_kses_post( size_format( wp_max_upload_size() ) ) . ')' ;
366 ?></td>
367 </tr>
368 <tr>
369 <td><?php
370 esc_html_e( 'PHP Post Max Size', 'adminify' );
371 ?>:</td>
372 <td><?php
373 echo wp_kses_post( size_format( $server_info->convert_memory_size( ini_get( 'post_max_size' ) ) ) ) ;
374 ?></td>
375 </tr>
376 <tr>
377 <td><?php
378 esc_html_e( 'PHP Max Input Vars', 'adminify' );
379 ?>:</td>
380 <td><?php
381 echo wp_kses_post( ini_get( 'max_input_vars' ) ) ;
382 ?></td>
383 </tr>
384 <tr>
385 <td><?php
386 esc_html_e( 'PHP Max Execution Time', 'adminify' );
387 ?>:</td>
388 <td><?php
389 echo wp_kses_post( ini_get( 'max_execution_time' ) ) . ' ' . esc_html__( 'Seconds', 'adminify' ) ;
390 ?></td>
391 </tr>
392 <tr>
393 <td><?php
394 esc_html_e( 'PHP Extensions', 'adminify' );
395 ?>:</td>
396 <td><?php
397 echo Utils::wp_kses_custom( implode( ', ', get_loaded_extensions() ) ) ;
398 ?></td>
399 </tr>
400 <tr>
401 <td><?php
402 esc_html_e( 'GD Library', 'adminify' );
403 ?>:</td>
404 <td>
405 <?php
406 $gdl = gd_info();
407
408 if ( $gdl ) {
409 echo Utils::wp_kses_custom( $yes ) . ' / ' . esc_html__( 'Version', 'adminify' ) . ': ' . wp_kses_post( $gdl['GD Version'] ) ;
410 } else {
411 echo Utils::wp_kses_custom( $no ) ;
412 }
413
414 ?>
415 </td>
416 </tr>
417 <tr>
418 <td><?php
419 esc_html_e( 'cURL Version', 'adminify' );
420 ?>:</td>
421 <td><?php
422 echo Utils::wp_kses_custom( $server_info->get_cURL_version() ) ;
423 ?></td>
424 </tr>
425 <tr>
426 <td><?php
427 esc_html_e( 'SUHOSIN Installed', 'adminify' );
428 ?>:</td>
429 <td><?php
430 echo ( wp_kses_post( extension_loaded( 'suhosin' ) ) ? '<span class="dashicons dashicons-yes"></span>' : '&ndash;' ) ;
431 ?></td>
432 </tr>
433 <?php
434 }
435
436 ?>
437
438 <?php
439
440 if ( function_exists( 'ini_get' ) ) {
441 ?>
442 <tr>
443 <td><?php
444 esc_html_e( 'PHP Error Log File Location', 'adminify' );
445 ?>:</td>
446 <td><?php
447 echo wp_kses_post( ini_get( 'error_log' ) ) ;
448 ?></td>
449 </tr>
450 <?php
451 }
452
453 ?>
454
455 <?php
456 $fields = [];
457 // fsockopen/cURL.
458 $fields['fsockopen_curl']['name'] = 'fsockopen/cURL';
459
460 if ( function_exists( 'fsockopen' ) || function_exists( 'curl_init' ) ) {
461 $fields['fsockopen_curl']['success'] = true;
462 } else {
463 $fields['fsockopen_curl']['success'] = false;
464 }
465
466 // SOAP.
467 $fields['soap_client']['name'] = 'SoapClient';
468
469 if ( class_exists( 'SoapClient' ) ) {
470 $fields['soap_client']['success'] = true;
471 } else {
472 $fields['soap_client']['success'] = false;
473 $fields['soap_client']['note'] = sprintf( __( 'Your server does not have the %s class enabled - some gateway plugins which use SOAP may not work as expected.', 'bsi' ), '<a href="https://php.net/manual/en/class.soapclient.php">SoapClient</a>' );
474 }
475
476 // DOMDocument.
477 $fields['dom_document']['name'] = 'DOMDocument';
478
479 if ( class_exists( 'DOMDocument' ) ) {
480 $fields['dom_document']['success'] = true;
481 } else {
482 $fields['dom_document']['success'] = false;
483 $fields['dom_document']['note'] = sprintf( __( 'Your server does not have the %s class enabled - HTML/Multipart emails, and also some extensions, will not work without DOMDocument.', 'bsi' ), '<a href="https://php.net/manual/en/class.domdocument.php">DOMDocument</a>' );
484 }
485
486 // GZIP.
487 $fields['gzip']['name'] = 'GZip';
488
489 if ( is_callable( 'gzopen' ) ) {
490 $fields['gzip']['success'] = true;
491 } else {
492 $fields['gzip']['success'] = false;
493 $fields['gzip']['note'] = sprintf( __( 'Your server does not support the %s function - this is required to use the GeoIP database from MaxMind.', 'bsi' ), '<a href="https://php.net/manual/en/zlib.installation.php">gzopen</a>' );
494 }
495
496 // Multibyte String.
497 $fields['mbstring']['name'] = 'Multibyte String';
498
499 if ( extension_loaded( 'mbstring' ) ) {
500 $fields['mbstring']['success'] = true;
501 } else {
502 $fields['mbstring']['success'] = false;
503 $fields['mbstring']['note'] = sprintf( __( 'Your server does not support the %s functions - this is required for better character encoding. Some fallbacks will be used instead for it.', 'bsi' ), '<a href="https://php.net/manual/en/mbstring.installation.php">mbstring</a>' );
504 }
505
506 // Remote Get.
507 $fields['remote_get']['name'] = 'Remote Get Status';
508 $response = wp_remote_get( 'https://www.paypal.com/cgi-bin/webscr', [
509 'timeout' => 60,
510 'user-agent' => 'BSI/' . 1.0,
511 'httpversion' => '1.1',
512 'body' => [
513 'cmd' => '_notify-validate',
514 ],
515 ] );
516 $response_code = wp_remote_retrieve_response_code( $response );
517
518 if ( $response_code == 200 ) {
519 $fields['remote_get']['success'] = true;
520 } else {
521 $fields['remote_get']['success'] = false;
522 }
523
524 foreach ( $fields as $field ) {
525 $mark = ( !empty($field['success']) ? 'yes' : 'error' );
526 ?>
527 <tr>
528 <td data-export-label="<?php
529 echo esc_attr( $field['name'] ) ;
530 ?>"><?php
531 echo esc_html( $field['name'] ) ;
532 ?>:</td>
533 <td>
534 <span class="<?php
535 echo esc_attr( $mark ) ;
536 ?>">
537 <?php
538 echo ( !empty($field['success']) ? Utils::wp_kses_custom( $yes ) : Utils::wp_kses_custom( $no ) ) ;
539 ?>
540 <?php
541 echo ( !empty($field['note']) ? Utils::wp_kses_custom( $field['note'] ) : '' ) ;
542 ?>
543 </span>
544 </td>
545 </tr>
546 <?php
547 }
548 ?>
549 </tbody>
550 </table>
551 </div>
552
553
554 <?php
555 }
556
557 }