← All changes
|
Inc/Modules/ServerInformation/ServerInfo_Server_Details.php
+48
-36
4.2.6
→
4.0.5.4
View file →
| @@ -1,16 +1,16 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -namespace PXLBSAdminify\Inc\Modules\ServerInformation; | |
| 3 | +namespace WPAdminify\Inc\Modules\ServerInformation; | |
| 4 | 4 | |
| 5 | -use PXLBSAdminify\Inc\Classes\ServerInfo; | |
| 6 | -use PXLBSAdminify\Inc\Utils; | |
| 5 | +use WPAdminify\Inc\Classes\ServerInfo; | |
| 6 | +use WPAdminify\Inc\Utils; | |
| 7 | 7 | // no direct access allowed |
| 8 | 8 | if ( !defined( 'ABSPATH' ) ) { |
| 9 | 9 | exit; |
| 10 | 10 | } |
| 11 | 11 | /** |
| 12 | - * PXLBSAdminify | |
| 12 | + * WPAdminify | |
| 13 | 13 | * |
| 14 | 14 | * @package Server Information |
| 15 | 15 | * |
| 16 | 16 | * @author WP Adminify <support@wpadminify.com> |
| @@ -33,9 +33,9 @@ | ||
| 33 | 33 | ?> |
| 34 | 34 | |
| 35 | 35 | <div class="wrap"> |
| 36 | 36 | <h1> <?php |
| 37 | - echo esc_html( Utils::admin_page_title( esc_html__( 'Server Info', 'adminify' ) ) ); | |
| 37 | + echo Utils::admin_page_title( esc_html__( 'Server Info', 'adminify' ) ); | |
| 38 | 38 | ?> </h1> |
| 39 | 39 | |
| 40 | 40 | <p><?php |
| 41 | 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' ); |
| @@ -72,9 +72,9 @@ | ||
| 72 | 72 | <td><?php |
| 73 | 73 | esc_html_e( 'Software', 'adminify' ); |
| 74 | 74 | ?>:</td> |
| 75 | 75 | <td><?php |
| 76 | - echo esc_html( ( isset( $_SERVER['SERVER_SOFTWARE'] ) ? sanitize_text_field( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ) : '' ) ); | |
| 76 | + echo Utils::wp_kses_custom( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ); | |
| 77 | 77 | ?></td> |
| 78 | 78 | </tr> |
| 79 | 79 | <tr> |
| 80 | 80 | <td><?php |
| @@ -80,9 +80,9 @@ | ||
| 80 | 80 | <td><?php |
| 81 | 81 | esc_html_e( 'IP Address', 'adminify' ); |
| 82 | 82 | ?>:</td> |
| 83 | 83 | <td><?php |
| 84 | - echo esc_html( ( isset( $_SERVER['SERVER_ADDR'] ) ? sanitize_text_field( wp_unslash( $_SERVER['SERVER_ADDR'] ) ) : '' ) ); | |
| 84 | + echo Utils::wp_kses_custom( wp_unslash( $_SERVER['SERVER_ADDR'] ) ); | |
| 85 | 85 | ?></td> |
| 86 | 86 | </tr> |
| 87 | 87 | <tr> |
| 88 | 88 | <td><?php |
| @@ -88,9 +88,9 @@ | ||
| 88 | 88 | <td><?php |
| 89 | 89 | esc_html_e( 'Web Port', 'adminify' ); |
| 90 | 90 | ?>:</td> |
| 91 | 91 | <td><?php |
| 92 | - echo esc_html( ( isset( $_SERVER['SERVER_PORT'] ) ? sanitize_text_field( wp_unslash( $_SERVER['SERVER_PORT'] ) ) : '' ) ); | |
| 92 | + echo Utils::wp_kses_custom( wp_unslash( $_SERVER['SERVER_PORT'] ) ); | |
| 93 | 93 | ?></td> |
| 94 | 94 | </tr> |
| 95 | 95 | <tr> |
| 96 | 96 | <td><?php |
| @@ -96,9 +96,9 @@ | ||
| 96 | 96 | <td><?php |
| 97 | 97 | esc_html_e( 'Date / Time (WP)', 'adminify' ); |
| 98 | 98 | ?>:</td> |
| 99 | 99 | <td><?php |
| 100 | - echo wp_kses_post( gmdate( 'Y-m-d H:i:s', time() ) ) . ' (' . wp_kses_post( current_time( 'mysql' ) ) . ')'; | |
| 100 | + echo wp_kses_post( date( 'Y-m-d H:i:s', time() ) ) . ' (' . wp_kses_post( current_time( 'mysql' ) ) . ')'; | |
| 101 | 101 | ?></td> |
| 102 | 102 | </tr> |
| 103 | 103 | <tr> |
| 104 | 104 | <td><?php |
| @@ -115,11 +115,11 @@ | ||
| 115 | 115 | <td> |
| 116 | 116 | <?php |
| 117 | 117 | $default_timezone = date_default_timezone_get(); |
| 118 | 118 | if ( 'UTC' !== $default_timezone ) { |
| 119 | - echo '<span>' . wp_kses_post( Utils::kses_custom( $no ) ) . sprintf( wp_kses_post( 'Default timezone is %s - it should be UTC', 'adminify' ), esc_html( $default_timezone ) ) . '</span>'; | |
| 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 | 120 | } else { |
| 121 | - echo wp_kses_post( Utils::kses_custom( $yes ) ); | |
| 121 | + echo Utils::wp_kses_custom( $yes ); | |
| 122 | 122 | } |
| 123 | 123 | ?> |
| 124 | 124 | </td> |
| 125 | 125 | </tr> |
| @@ -135,9 +135,9 @@ | ||
| 135 | 135 | <td><?php |
| 136 | 136 | esc_html_e( 'CGI Version', 'adminify' ); |
| 137 | 137 | ?>:</td> |
| 138 | 138 | <td><?php |
| 139 | - echo esc_html( ( isset( $_SERVER['GATEWAY_INTERFACE'] ) ? sanitize_text_field( wp_unslash( $_SERVER['GATEWAY_INTERFACE'] ) ) : '' ) ); | |
| 139 | + echo esc_html( sanitize_text_field( wp_unslash( $_SERVER['GATEWAY_INTERFACE'] ) ) ); | |
| 140 | 140 | ?></td> |
| 141 | 141 | </tr> |
| 142 | 142 | |
| 143 | 143 | <?php |
| @@ -150,12 +150,12 @@ | ||
| 150 | 150 | <td> |
| 151 | 151 | <div class="adminify-system-progress"> |
| 152 | 152 | <div class="status-progressbar"> |
| 153 | 153 | <span><?php |
| 154 | - echo wp_kses_post( Utils::kses_custom( $server_info->get_server_cpu_load_percentage() ) ) . '% '; | |
| 154 | + echo Utils::wp_kses_custom( $server_info->get_server_cpu_load_percentage() ) . '% '; | |
| 155 | 155 | ?></span> |
| 156 | 156 | <div style="width: <?php |
| 157 | - echo esc_attr( Utils::kses_custom( $server_info->get_server_cpu_load_percentage() ) ); | |
| 157 | + echo Utils::wp_kses_custom( $server_info->get_server_cpu_load_percentage() ); | |
| 158 | 158 | ?>%"></div> |
| 159 | 159 | </div> |
| 160 | 160 | </div> |
| 161 | 161 | </td> |
| @@ -164,9 +164,9 @@ | ||
| 164 | 164 | <td><?php |
| 165 | 165 | esc_html_e( 'CPU Load Average', 'adminify' ); |
| 166 | 166 | ?>:</td> |
| 167 | 167 | <td><?php |
| 168 | - echo wp_kses_post( Utils::kses_custom( $server_info->get_cpu_load_average() ) ); | |
| 168 | + echo Utils::wp_kses_custom( $server_info->get_cpu_load_average() ); | |
| 169 | 169 | ?></td> |
| 170 | 170 | </tr> |
| 171 | 171 | <tr> |
| 172 | 172 | <td><?php |
| @@ -272,11 +272,11 @@ | ||
| 272 | 272 | ?>:</td> |
| 273 | 273 | <td> |
| 274 | 274 | <?php |
| 275 | 275 | if ( extension_loaded( 'memcache' ) ) { |
| 276 | - echo wp_kses_post( Utils::kses_custom( $yes ) ); | |
| 276 | + echo Utils::wp_kses_custom( $yes ); | |
| 277 | 277 | } else { |
| 278 | - echo wp_kses_post( Utils::kses_custom( $no ) ); | |
| 278 | + echo Utils::wp_kses_custom( $no ); | |
| 279 | 279 | } |
| 280 | 280 | ?> |
| 281 | 281 | </td> |
| 282 | 282 | </tr> |
| @@ -288,9 +288,9 @@ | ||
| 288 | 288 | <td><?php |
| 289 | 289 | esc_html_e( 'PHP Version', 'adminify' ); |
| 290 | 290 | ?>:</td> |
| 291 | 291 | <td><?php |
| 292 | - echo wp_kses_post( Utils::kses_custom( $server_info->get_php_version() ) ); | |
| 292 | + echo Utils::wp_kses_custom( $server_info->get_php_version() ); | |
| 293 | 293 | ?></td> |
| 294 | 294 | </tr> |
| 295 | 295 | |
| 296 | 296 | <?php |
| @@ -300,9 +300,9 @@ | ||
| 300 | 300 | <td><?php |
| 301 | 301 | esc_html_e( 'PHP Memory Limit (WP)', 'adminify' ); |
| 302 | 302 | ?>:</td> |
| 303 | 303 | <td><?php |
| 304 | - echo wp_kses_post( Utils::kses_custom( $server_info->get_wp_memory_limit() ) ); | |
| 304 | + echo Utils::wp_kses_custom( $server_info->get_wp_memory_limit() ); | |
| 305 | 305 | ?></td> |
| 306 | 306 | </tr> |
| 307 | 307 | <tr> |
| 308 | 308 | <td><?php |
| @@ -312,20 +312,20 @@ | ||
| 312 | 312 | <?php |
| 313 | 313 | if ( $server_info->get_server_memory_usage()['MemLimitGet'] == '-1' ) { |
| 314 | 314 | ?> |
| 315 | 315 | <?php |
| 316 | - echo wp_kses_post( Utils::kses_custom( $server_info->get_server_memory_usage()['MemUsageFormat'] ) ) . ' ' . esc_html__( 'of', 'adminify' ) . ' ' . esc_html__( 'Unlimited', 'adminify' ) . ' (-1)'; | |
| 316 | + echo Utils::wp_kses_custom( $server_info->get_server_memory_usage()['MemUsageFormat'] ) . ' ' . esc_html__( 'of', 'adminify' ) . ' ' . esc_html__( 'Unlimited', 'adminify' ) . ' (-1)'; | |
| 317 | 317 | ?> |
| 318 | 318 | <?php |
| 319 | 319 | } else { |
| 320 | 320 | ?> |
| 321 | 321 | <?php |
| 322 | - echo wp_kses_post( Utils::kses_custom( $server_info->get_server_memory_usage()['MemUsageFormat'] ) ) . ' ' . esc_html__( 'of', 'adminify' ) . ' ' . wp_kses_post( Utils::kses_custom( $server_info->get_server_memory_usage()['MemLimitFormat'] ) ); | |
| 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 | 323 | ?> |
| 324 | 324 | |
| 325 | 325 | <div class="adminify-system-progress"> |
| 326 | 326 | <div class="status-progressbar"><span><?php |
| 327 | - echo wp_kses_post( Utils::kses_custom( $server_info->get_server_memory_usage()['MemUsageCalc'] ) ) . '% '; | |
| 327 | + echo Utils::wp_kses_custom( $server_info->get_server_memory_usage()['MemUsageCalc'] ) . '% '; | |
| 328 | 328 | ?></span> |
| 329 | 329 | <div style="width: <?php |
| 330 | 330 | echo esc_attr( $server_info->get_server_memory_usage()['MemUsageCalc'] ); |
| 331 | 331 | ?>%"></div> |
| @@ -373,9 +373,9 @@ | ||
| 373 | 373 | <td><?php |
| 374 | 374 | esc_html_e( 'PHP Extensions', 'adminify' ); |
| 375 | 375 | ?>:</td> |
| 376 | 376 | <td><?php |
| 377 | - echo esc_html( implode( ', ', get_loaded_extensions() ) ); | |
| 377 | + echo Utils::wp_kses_custom( implode( ', ', get_loaded_extensions() ) ); | |
| 378 | 378 | ?></td> |
| 379 | 379 | </tr> |
| 380 | 380 | <tr> |
| 381 | 381 | <td><?php |
| @@ -384,11 +384,11 @@ | ||
| 384 | 384 | <td> |
| 385 | 385 | <?php |
| 386 | 386 | $gdl = gd_info(); |
| 387 | 387 | if ( $gdl ) { |
| 388 | - echo wp_kses_post( Utils::kses_custom( $yes ) ) . ' / ' . esc_html__( 'Version', 'adminify' ) . ': ' . wp_kses_post( $gdl['GD Version'] ); | |
| 388 | + echo Utils::wp_kses_custom( $yes ) . ' / ' . esc_html__( 'Version', 'adminify' ) . ': ' . wp_kses_post( $gdl['GD Version'] ); | |
| 389 | 389 | } else { |
| 390 | - echo wp_kses_post( Utils::kses_custom( $no ) ); | |
| 390 | + echo Utils::wp_kses_custom( $no ); | |
| 391 | 391 | } |
| 392 | 392 | ?> |
| 393 | 393 | </td> |
| 394 | 394 | </tr> |
| @@ -396,9 +396,9 @@ | ||
| 396 | 396 | <td><?php |
| 397 | 397 | esc_html_e( 'cURL Version', 'adminify' ); |
| 398 | 398 | ?>:</td> |
| 399 | 399 | <td><?php |
| 400 | - echo wp_kses_post( Utils::kses_custom( $server_info->get_cURL_version() ) ); | |
| 400 | + echo Utils::wp_kses_custom( $server_info->get_cURL_version() ); | |
| 401 | 401 | ?></td> |
| 402 | 402 | </tr> |
| 403 | 403 | <tr> |
| 404 | 404 | <td><?php |
| @@ -441,10 +441,9 @@ | ||
| 441 | 441 | if ( class_exists( 'SoapClient' ) ) { |
| 442 | 442 | $fields['soap_client']['success'] = true; |
| 443 | 443 | } else { |
| 444 | 444 | $fields['soap_client']['success'] = false; |
| 445 | - /* translators: %s: SoapClient class link */ | |
| 446 | - $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.', 'adminify' ), '<a href="https://php.net/manual/en/class.soapclient.php">SoapClient</a>' ); | |
| 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>' ); | |
| 447 | 446 | } |
| 448 | 447 | // DOMDocument. |
| 449 | 448 | $fields['dom_document']['name'] = 'DOMDocument'; |
| 450 | 449 | if ( class_exists( 'DOMDocument' ) ) { |
| @@ -450,10 +449,9 @@ | ||
| 450 | 449 | if ( class_exists( 'DOMDocument' ) ) { |
| 451 | 450 | $fields['dom_document']['success'] = true; |
| 452 | 451 | } else { |
| 453 | 452 | $fields['dom_document']['success'] = false; |
| 454 | - /* translators: %s: DOMDocument class link */ | |
| 455 | - $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.', 'adminify' ), '<a href="https://php.net/manual/en/class.domdocument.php">DOMDocument</a>' ); | |
| 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>' ); | |
| 456 | 454 | } |
| 457 | 455 | // GZIP. |
| 458 | 456 | $fields['gzip']['name'] = 'GZip'; |
| 459 | 457 | if ( is_callable( 'gzopen' ) ) { |
| @@ -459,10 +457,9 @@ | ||
| 459 | 457 | if ( is_callable( 'gzopen' ) ) { |
| 460 | 458 | $fields['gzip']['success'] = true; |
| 461 | 459 | } else { |
| 462 | 460 | $fields['gzip']['success'] = false; |
| 463 | - /* translators: %s: gzopen function link */ | |
| 464 | - $fields['gzip']['note'] = sprintf( __( 'Your server does not support the %s function - this is required to use the GeoIP database from MaxMind.', 'adminify' ), '<a href="https://php.net/manual/en/zlib.installation.php">gzopen</a>' ); | |
| 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>' ); | |
| 465 | 462 | } |
| 466 | 463 | // Multibyte String. |
| 467 | 464 | $fields['mbstring']['name'] = 'Multibyte String'; |
| 468 | 465 | if ( extension_loaded( 'mbstring' ) ) { |
| @@ -468,11 +465,26 @@ | ||
| 468 | 465 | if ( extension_loaded( 'mbstring' ) ) { |
| 469 | 466 | $fields['mbstring']['success'] = true; |
| 470 | 467 | } else { |
| 471 | 468 | $fields['mbstring']['success'] = false; |
| 472 | - /* translators: %s: mbstring functions link */ | |
| 473 | - $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.', 'adminify' ), '<a href="https://php.net/manual/en/mbstring.installation.php">mbstring</a>' ); | |
| 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>' ); | |
| 474 | 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 | + } | |
| 475 | 487 | foreach ( $fields as $field ) { |
| 476 | 488 | $mark = ( !empty( $field['success'] ) ? 'yes' : 'error' ); |
| 477 | 489 | ?> |
| 478 | 490 | <tr> |
| @@ -485,12 +497,12 @@ | ||
| 485 | 497 | <span class="<?php |
| 486 | 498 | echo esc_attr( $mark ); |
| 487 | 499 | ?>"> |
| 488 | 500 | <?php |
| 489 | - echo ( !empty( $field['success'] ) ? wp_kses_post( Utils::kses_custom( $yes ) ) : wp_kses_post( Utils::kses_custom( $no ) ) ); | |
| 501 | + echo ( !empty( $field['success'] ) ? Utils::wp_kses_custom( $yes ) : Utils::wp_kses_custom( $no ) ); | |
| 490 | 502 | ?> |
| 491 | 503 | <?php |
| 492 | - echo ( !empty( $field['note'] ) ? wp_kses_post( Utils::kses_custom( $field['note'] ) ) : '' ); | |
| 504 | + echo ( !empty( $field['note'] ) ? Utils::wp_kses_custom( $field['note'] ) : '' ); | |
| 493 | 505 | ?> |
| 494 | 506 | </span> |
| 495 | 507 | </td> |
| 496 | 508 | </tr> |