PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.1.3
Adminify – White Label, Admin Menu Editor, Login Customizer v4.1.3
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 4.1.3, at Inc/Modules/ServerInformation/ServerInfo_Server_Details.php

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