← All changes
|
Inc/Modules/ServerInformation/ServerInformation.php
+55
-67
4.2.21
→
4.0
View file →
| @@ -1,15 +1,15 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -namespace PXLBSAdminify\Inc\Modules\ServerInformation; | |
| 3 | +namespace WPAdminify\Inc\Modules\ServerInformation; | |
| 4 | 4 | |
| 5 | -use PXLBSAdminify\Inc\Utils; | |
| 6 | -use PXLBSAdminify\Inc\Modules\ServerInformation\ServerInfo_WP_Details; | |
| 7 | -use PXLBSAdminify\Inc\Modules\ServerInformation\ServerInfo_Server_Details; | |
| 8 | -use PXLBSAdminify\Inc\Modules\ServerInformation\ServerInfo_PHP_INI_Details; | |
| 9 | -use PXLBSAdminify\Inc\Modules\ServerInformation\ServerInfo_Htaccess_Details; | |
| 10 | -use PXLBSAdminify\Inc\Modules\ServerInformation\ServerInfo_Robots_Details; | |
| 11 | -use PXLBSAdminify\Inc\Modules\ServerInformation\ServerInfo_Error_Logs_Details; | |
| 5 | +use WPAdminify\Inc\Utils; | |
| 6 | +use WPAdminify\Inc\Modules\ServerInformation\ServerInfo_WP_Details; | |
| 7 | +use WPAdminify\Inc\Modules\ServerInformation\ServerInfo_Server_Details; | |
| 8 | +use WPAdminify\Inc\Modules\ServerInformation\ServerInfo_PHP_INI_Details; | |
| 9 | +use WPAdminify\Inc\Modules\ServerInformation\ServerInfo_Htaccess_Details; | |
| 10 | +use WPAdminify\Inc\Modules\ServerInformation\ServerInfo_Robots_Details; | |
| 11 | +use WPAdminify\Inc\Modules\ServerInformation\ServerInfo_Error_Logs_Details; | |
| 12 | 12 | |
| 13 | 13 | // no direct access allowed |
| 14 | 14 | if ( ! defined( 'ABSPATH' ) ) { |
| 15 | 15 | exit; |
| @@ -15,9 +15,9 @@ | ||
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | - * PXLBSAdminify | |
| 19 | + * WPAdminify | |
| 20 | 20 | * |
| 21 | 21 | * @package Server Information |
| 22 | 22 | * |
| 23 | 23 | * @author WP Adminify <support@wpadminify.com> |
| @@ -25,9 +25,9 @@ | ||
| 25 | 25 | |
| 26 | 26 | class ServerInformation { |
| 27 | 27 | |
| 28 | 28 | private $url; |
| 29 | - public $prefix = 'pxlbsadminify_server_info'; | |
| 29 | + public $prefix = '_wpadminify_server_info'; | |
| 30 | 30 | |
| 31 | 31 | public function __construct() { |
| 32 | 32 | // if ( is_multisite() && ! is_network_admin() ) { |
| 33 | 33 | // return; // only display to network admin if multisite is enbaled |
| @@ -32,19 +32,21 @@ | ||
| 32 | 32 | // if ( is_multisite() && ! is_network_admin() ) { |
| 33 | 33 | // return; // only display to network admin if multisite is enbaled |
| 34 | 34 | // } |
| 35 | 35 | |
| 36 | - $this->url = PXLBSADMINIFY_URL . 'Inc/Modules/ServerInformation'; | |
| 37 | - add_action( 'adminify_loaded', [ $this, 'server_info_menu' ] ); | |
| 36 | + $this->url = WP_ADMINIFY_URL . 'Inc/Modules/ServerInformation'; | |
| 37 | + add_action( 'adminify_loaded', [ $this, 'jltwp_adminify_server_info_menu' ] ); | |
| 38 | 38 | |
| 39 | 39 | if ( is_admin() ) { |
| 40 | - add_action( 'admin_enqueue_scripts', [ $this, 'server_info_styles' ], 99999 ); | |
| 40 | + add_action( 'admin_enqueue_scripts', [ $this, 'jltwp_adminify_server_info_styles' ], 99999 ); | |
| 41 | 41 | |
| 42 | 42 | // Refresh Debug Log |
| 43 | - add_action( 'wp_ajax_pxlbsadminify_error_log_content_refresh', [ $this, 'pxlbsadminify_error_log_content_refresh' ] ); | |
| 43 | + add_action( 'wp_ajax_jltwp_adminify_error_log_content_refresh', [ $this, 'jltwp_adminify_error_log_content_refresh' ] ); | |
| 44 | + add_action( 'wp_ajax_nopriv_jltwp_adminify_error_log_content_refresh', [ $this, 'jltwp_adminify_error_log_content_refresh' ] ); | |
| 44 | 45 | |
| 45 | 46 | // Clear Debug Log |
| 46 | - add_action( 'wp_ajax_pxlbsadminify_error_log_content_clear', [ $this, 'pxlbsadminify_error_log_content_clear' ] ); | |
| 47 | + add_action( 'wp_ajax_jltwp_adminify_error_log_content_clear', [ $this, 'jltwp_adminify_error_log_content_clear' ] ); | |
| 48 | + add_action( 'wp_ajax_nopriv_jltwp_adminify_error_log_content_clear', [ $this, 'jltwp_adminify_error_log_content_clear' ] ); | |
| 47 | 49 | } |
| 48 | 50 | } |
| 49 | 51 | |
| 50 | 52 | |
| @@ -53,14 +55,12 @@ | ||
| 53 | 55 | * Server Information Script/Styles |
| 54 | 56 | * |
| 55 | 57 | * @return void |
| 56 | 58 | */ |
| 57 | - public function server_info_styles() { | |
| 59 | + public function jltwp_adminify_server_info_styles() { | |
| 58 | 60 | global $pagenow; |
| 59 | 61 | |
| 60 | - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only check, no state change. | |
| 61 | - $current_page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; | |
| 62 | - if ( ( 'admin.php' === $pagenow ) && ( 'adminify-server-info' === $current_page ) ) { | |
| 62 | + if ( ( 'admin.php' === $pagenow ) && ( 'adminify-server-info' === $_GET['page'] ) ) { | |
| 63 | 63 | echo '<style>.wp-adminify_page_adminify-server-info .adminify-header-inner{padding:0;}.wp-adminify_page_adminify-server-info .adminify-field-subheading{font-size:20px; padding-left:0;}.wp-adminify_page_adminify-server-info .adminify-nav,.wp-adminify_page_adminify-server-info .adminify-search,.wp-adminify_page_adminify-server-info .adminify-footer,.wp-adminify_page_adminify-server-info .adminify-reset-all,.wp-adminify_page_adminify-server-info .adminify-expand-all,.wp-adminify_page_adminify-server-info .adminify-header-left,.wp-adminify_page_adminify-server-info .adminify-reset-section,.wp-adminify_page_adminify-server-info .adminify-nav-background{display: none !important;}.wp-adminify_page_adminify-server-info .adminify-nav-normal + .adminify-content{margin-left: 0;} |
| 64 | 64 | |
| 65 | 65 | /* If needed for white top-bar */ |
| 66 | 66 | .wp-adminify_page_adminify-server-info .adminify-header-inner { |
| @@ -71,13 +71,13 @@ | ||
| 71 | 71 | display: none !important; |
| 72 | 72 | } |
| 73 | 73 | </style>'; |
| 74 | 74 | |
| 75 | - wp_enqueue_script( 'adminify-error-logs', $this->url . '/error-logs.js', [ 'jquery' ], PXLBSADMINIFY_VER, true ); | |
| 76 | - wp_localize_script( 'adminify-error-logs', 'PXLBSADMINIFY_ERROR_LOGS', $this->adminify_error_logs_object() ); | |
| 75 | + wp_enqueue_script( 'wp-adminify-error-logs', $this->url . '/error-logs.js', [ 'jquery' ], null, true ); | |
| 76 | + wp_localize_script( 'wp-adminify-error-logs', 'WPAdminify_ErrorL', $this->adminify_error_logs_object() ); | |
| 77 | 77 | |
| 78 | - wp_enqueue_style( 'adminify', \ADMINIFY_Setup::include_plugin_url( 'assets/css/style.min.css' ), [], PXLBSADMINIFY_VER, 'all' ); | |
| 79 | - wp_enqueue_script( 'adminify', \ADMINIFY_Setup::include_plugin_url( 'assets/js/main.min.js' ), [ 'jquery' ], PXLBSADMINIFY_VER, true ); | |
| 78 | + wp_enqueue_style( 'adminify', \ADMINIFY_Setup::include_plugin_url( 'assets/css/style.min.css' ), [], WP_ADMINIFY_VER, 'all' ); | |
| 79 | + wp_enqueue_script( 'adminify', \ADMINIFY_Setup::include_plugin_url( 'assets/js/main.min.js' ), [ 'jquery' ], WP_ADMINIFY_VER, true ); | |
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | |
| @@ -89,9 +89,9 @@ | ||
| 89 | 89 | */ |
| 90 | 90 | public function adminify_error_logs_object() { |
| 91 | 91 | return [ |
| 92 | 92 | 'ajax_url' => admin_url( 'admin-ajax.php' ), |
| 93 | - 'security_nonce' => wp_create_nonce( 'pxlbsadminify-error-logs-security-nonce' ), | |
| 93 | + 'security_nonce' => wp_create_nonce( 'adminify-error-logs-security-nonce' ), | |
| 94 | 94 | 'label_update' => esc_html__( 'Will be updated...', 'adminify' ), |
| 95 | 95 | 'label_clear' => esc_html__( 'Will be cleared...', 'adminify' ), |
| 96 | 96 | 'label_done' => esc_html__( 'Done!', 'adminify' ), |
| 97 | 97 | ]; |
| @@ -96,9 +96,9 @@ | ||
| 96 | 96 | 'label_done' => esc_html__( 'Done!', 'adminify' ), |
| 97 | 97 | ]; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - public function server_info_menu() { | |
| 100 | + public function jltwp_adminify_server_info_menu() { | |
| 101 | 101 | if ( ! class_exists( 'ADMINIFY' ) ) { |
| 102 | 102 | return; |
| 103 | 103 | } |
| 104 | 104 | |
| @@ -107,9 +107,9 @@ | ||
| 107 | 107 | $this->prefix, |
| 108 | 108 | [ |
| 109 | 109 | |
| 110 | 110 | // Framework Title |
| 111 | - 'framework_title' => __( 'Adminify Server Info <small>by Jewel Theme</small>', 'adminify' ), | |
| 111 | + 'framework_title' => __( 'WP Adminify Server Info <small>by Jewel Theme</small>', 'adminify' ), | |
| 112 | 112 | 'framework_class' => 'adminify-server-info', |
| 113 | 113 | |
| 114 | 114 | // menu settings |
| 115 | 115 | 'menu_title' => 'Server Info', |
| @@ -185,9 +185,9 @@ | ||
| 185 | 185 | [ |
| 186 | 186 | 'id' => 'wordpress', |
| 187 | 187 | 'type' => 'callback', |
| 188 | 188 | 'class' => 'adminify-one-col', |
| 189 | - 'function' => 'PXLBSAdminify\Inc\Modules\ServerInformation\ServerInformation::pxlbsadminify_wordpress_details', | |
| 189 | + 'function' => 'WPAdminify\Inc\Modules\ServerInformation\ServerInformation::jltwp_adminify_wordpress_details', | |
| 190 | 190 | ], |
| 191 | 191 | ], |
| 192 | 192 | ], |
| 193 | 193 | [ |
| @@ -197,9 +197,9 @@ | ||
| 197 | 197 | [ |
| 198 | 198 | 'id' => 'server', |
| 199 | 199 | 'type' => 'callback', |
| 200 | 200 | 'class' => 'adminify-one-col', |
| 201 | - 'function' => 'PXLBSAdminify\Inc\Modules\ServerInformation\ServerInformation::pxlbsadminify_server_details', | |
| 201 | + 'function' => 'WPAdminify\Inc\Modules\ServerInformation\ServerInformation::jltwp_adminify_server_details', | |
| 202 | 202 | ], |
| 203 | 203 | ], |
| 204 | 204 | ], |
| 205 | 205 | [ |
| @@ -209,9 +209,9 @@ | ||
| 209 | 209 | [ |
| 210 | 210 | 'id' => 'php_info', |
| 211 | 211 | 'type' => 'callback', |
| 212 | 212 | 'class' => 'adminify-one-col', |
| 213 | - 'function' => 'PXLBSAdminify\Inc\Modules\ServerInformation\ServerInformation::pxlbsadminify_get_phpinfo', | |
| 213 | + 'function' => 'WPAdminify\Inc\Modules\ServerInformation\ServerInformation::jltwp_adminify_get_phpinfo', | |
| 214 | 214 | ], |
| 215 | 215 | ], |
| 216 | 216 | ], |
| 217 | 217 | [ |
| @@ -220,9 +220,9 @@ | ||
| 220 | 220 | 'fields' => [ |
| 221 | 221 | [ |
| 222 | 222 | 'id' => 'mysql_info', |
| 223 | 223 | 'type' => 'callback', |
| 224 | - 'function' => 'PXLBSAdminify\Inc\Modules\ServerInformation\ServerInformation::pxlbsadminify_get_mysqlinfo', | |
| 224 | + 'function' => 'WPAdminify\Inc\Modules\ServerInformation\ServerInformation::jltwp_adminify_get_mysqlinfo', | |
| 225 | 225 | ], |
| 226 | 226 | ], |
| 227 | 227 | ], |
| 228 | 228 | [ |
| @@ -232,9 +232,9 @@ | ||
| 232 | 232 | [ |
| 233 | 233 | 'id' => 'constants', |
| 234 | 234 | 'type' => 'callback', |
| 235 | 235 | 'class' => 'adminify-one-col', |
| 236 | - 'function' => 'PXLBSAdminify\Inc\Modules\ServerInformation\ServerInformation::pxlbsadminify_constant_details', | |
| 236 | + 'function' => 'WPAdminify\Inc\Modules\ServerInformation\ServerInformation::jltwp_adminify_constant_details', | |
| 237 | 237 | ], |
| 238 | 238 | ], |
| 239 | 239 | ], |
| 240 | 240 | [ |
| @@ -244,9 +244,9 @@ | ||
| 244 | 244 | [ |
| 245 | 245 | 'id' => 'htaccess', |
| 246 | 246 | 'type' => 'callback', |
| 247 | 247 | 'class' => 'adminify-one-col', |
| 248 | - 'function' => 'PXLBSAdminify\Inc\Modules\ServerInformation\ServerInformation::pxlbsadminify_htacces_details', | |
| 248 | + 'function' => 'WPAdminify\Inc\Modules\ServerInformation\ServerInformation::jltwp_adminify_htacces_details', | |
| 249 | 249 | ], |
| 250 | 250 | ], |
| 251 | 251 | ], |
| 252 | 252 | [ |
| @@ -256,9 +256,9 @@ | ||
| 256 | 256 | [ |
| 257 | 257 | 'id' => 'php_ini', |
| 258 | 258 | 'type' => 'callback', |
| 259 | 259 | 'class' => 'adminify-one-col', |
| 260 | - 'function' => 'PXLBSAdminify\Inc\Modules\ServerInformation\ServerInformation::pxlbsadminify_php_ini_details', | |
| 260 | + 'function' => 'WPAdminify\Inc\Modules\ServerInformation\ServerInformation::jltwp_adminify_php_ini_details', | |
| 261 | 261 | ], |
| 262 | 262 | ], |
| 263 | 263 | ], |
| 264 | 264 | [ |
| @@ -268,9 +268,9 @@ | ||
| 268 | 268 | [ |
| 269 | 269 | 'id' => 'robots_txt', |
| 270 | 270 | 'type' => 'callback', |
| 271 | 271 | 'class' => 'adminify-one-col', |
| 272 | - 'function' => 'PXLBSAdminify\Inc\Modules\ServerInformation\ServerInformation::pxlbsadminify_robots_details', | |
| 272 | + 'function' => 'WPAdminify\Inc\Modules\ServerInformation\ServerInformation::jltwp_adminify_robots_details', | |
| 273 | 273 | ], |
| 274 | 274 | ], |
| 275 | 275 | ], |
| 276 | 276 | [ |
| @@ -280,9 +280,9 @@ | ||
| 280 | 280 | [ |
| 281 | 281 | 'id' => 'error_logs', |
| 282 | 282 | 'type' => 'callback', |
| 283 | 283 | 'class' => 'adminify-one-col', |
| 284 | - 'function' => '\PXLBSAdminify\Inc\Modules\ServerInformation\ServerInformation::pxlbsadminify_error_log_details', | |
| 284 | + 'function' => '\WPAdminify\Inc\Modules\ServerInformation\ServerInformation::jltwp_adminify_error_log_details', | |
| 285 | 285 | ], |
| 286 | 286 | ], |
| 287 | 287 | ], |
| 288 | 288 | |
| @@ -297,9 +297,9 @@ | ||
| 297 | 297 | |
| 298 | 298 | /** |
| 299 | 299 | * Server Details |
| 300 | 300 | */ |
| 301 | - public static function pxlbsadminify_server_details() { | |
| 301 | + public static function jltwp_adminify_server_details() { | |
| 302 | 302 | new ServerInfo_Server_Details(); |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | |
| @@ -305,9 +305,9 @@ | ||
| 305 | 305 | |
| 306 | 306 | /** |
| 307 | 307 | * WordPress Details |
| 308 | 308 | */ |
| 309 | - public static function pxlbsadminify_wordpress_details() { | |
| 309 | + public static function jltwp_adminify_wordpress_details() { | |
| 310 | 310 | new ServerInfo_WP_Details(); |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | |
| @@ -313,9 +313,9 @@ | ||
| 313 | 313 | |
| 314 | 314 | /** |
| 315 | 315 | * Constant Details |
| 316 | 316 | */ |
| 317 | - public static function pxlbsadminify_constant_details() { | |
| 317 | + public static function jltwp_adminify_constant_details() { | |
| 318 | 318 | new ServerInfo_Constant_Details(); |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | /** |
| @@ -320,9 +320,9 @@ | ||
| 320 | 320 | |
| 321 | 321 | /** |
| 322 | 322 | * .htaccess file Details |
| 323 | 323 | */ |
| 324 | - public static function pxlbsadminify_htacces_details() { | |
| 324 | + public static function jltwp_adminify_htacces_details() { | |
| 325 | 325 | new ServerInfo_Htaccess_Details(); |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | /** |
| @@ -327,9 +327,9 @@ | ||
| 327 | 327 | |
| 328 | 328 | /** |
| 329 | 329 | * php.ini file Details |
| 330 | 330 | */ |
| 331 | - public static function pxlbsadminify_php_ini_details() { | |
| 331 | + public static function jltwp_adminify_php_ini_details() { | |
| 332 | 332 | new ServerInfo_PHP_INI_Details(); |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | /** |
| @@ -334,9 +334,9 @@ | ||
| 334 | 334 | |
| 335 | 335 | /** |
| 336 | 336 | * Robots file Details |
| 337 | 337 | */ |
| 338 | - public static function pxlbsadminify_robots_details() { | |
| 338 | + public static function jltwp_adminify_robots_details() { | |
| 339 | 339 | new ServerInfo_Robots_Details(); |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | /** |
| @@ -341,9 +341,9 @@ | ||
| 341 | 341 | |
| 342 | 342 | /** |
| 343 | 343 | * Error Logs Details |
| 344 | 344 | */ |
| 345 | - public static function pxlbsadminify_error_log_details() { | |
| 345 | + public static function jltwp_adminify_error_log_details() { | |
| 346 | 346 | new ServerInfo_Error_Logs_Details(); |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | /** |
| @@ -348,9 +348,9 @@ | ||
| 348 | 348 | |
| 349 | 349 | /** |
| 350 | 350 | * Error Logs Details |
| 351 | 351 | */ |
| 352 | - public static function pxlbsadminify_get_phpinfo() { | |
| 352 | + public static function jltwp_adminify_get_phpinfo() { | |
| 353 | 353 | if ( ! class_exists( 'DOMDocument' ) ) { |
| 354 | 354 | echo '<div class="wrap" id="PHPinfo">'; |
| 355 | 355 | echo '<h2>' . esc_html__( 'PHP', 'adminify' ) . ' ' . esc_html( phpversion() ) . '</h2>'; |
| 356 | 356 | echo 'You need <a href="' . esc_url( 'http://php.net/manual/en/class.domdocument.php' ) . '" target="_blank">' . esc_html__('DOMDocument extension' , 'adminify') . '</a> to be enabled.'; |
| @@ -356,9 +356,9 @@ | ||
| 356 | 356 | echo 'You need <a href="' . esc_url( 'http://php.net/manual/en/class.domdocument.php' ) . '" target="_blank">' . esc_html__('DOMDocument extension' , 'adminify') . '</a> to be enabled.'; |
| 357 | 357 | echo '</div>'; |
| 358 | 358 | } else { |
| 359 | 359 | ob_start(); |
| 360 | - phpinfo(); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.prevent_path_disclosure_phpinfo -- intentional server-info display on a capability-gated admin screen. | |
| 360 | + phpinfo(); | |
| 361 | 361 | $phpinfo = ob_get_contents(); |
| 362 | 362 | ob_end_clean(); |
| 363 | 363 | |
| 364 | 364 | // Use DOMDocument to parse phpinfo() |
| @@ -381,9 +381,9 @@ | ||
| 381 | 381 | $phpinfo_html = $html->saveXml( $body->item( 0 ) ); |
| 382 | 382 | |
| 383 | 383 | echo '<div class="wrap" id="PHPinfo">'; |
| 384 | 384 | echo '<h2>' . esc_html__( 'PHP', 'adminify' ) . ' ' . esc_html( phpversion() ) . '</h2>'; |
| 385 | - echo wp_kses_post( Utils::kses_custom( $phpinfo_html ) ); | |
| 385 | + echo Utils::wp_kses_custom( $phpinfo_html ); | |
| 386 | 386 | echo '</div>'; |
| 387 | 387 | } |
| 388 | 388 | } |
| 389 | 389 | |
| @@ -392,14 +392,12 @@ | ||
| 392 | 392 | * Get MYSQL Information |
| 393 | 393 | * |
| 394 | 394 | * @return void |
| 395 | 395 | */ |
| 396 | - public static function pxlbsadminify_get_mysqlinfo() { | |
| 396 | + public static function jltwp_adminify_get_mysqlinfo() { | |
| 397 | 397 | global $wpdb; |
| 398 | - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- direct query required for live server-info display; not cached intentionally. | |
| 399 | 398 | $sqlversion = $wpdb->get_var( 'SELECT VERSION() AS version' ); |
| 400 | - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- direct query required for live server-info display; not cached intentionally. | |
| 401 | - $mysqlinfo = $wpdb->get_results( 'SHOW VARIABLES' ); | |
| 399 | + $mysqlinfo = $wpdb->get_results( 'SHOW VARIABLES' ); | |
| 402 | 400 | |
| 403 | 401 | if ( is_rtl() ) { ?> |
| 404 | 402 | <style type="text/css"> |
| 405 | 403 | #MYSQLinfo, |
| @@ -432,15 +430,10 @@ | ||
| 432 | 430 | } |
| 433 | 431 | |
| 434 | 432 | |
| 435 | 433 | // Refresh Button Ajax |
| 436 | - public function pxlbsadminify_error_log_content_refresh() { | |
| 437 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX && check_ajax_referer( 'pxlbsadminify-error-logs-security-nonce', 'security' ) > 0 ) { | |
| 438 | - // Security check - only administrators can access error logs | |
| 439 | - if ( ! current_user_can( 'manage_options' ) ) { | |
| 440 | - wp_send_json_error( array( 'message' => __( 'You do not have permission to perform this action.', 'adminify' ) ) ); | |
| 441 | - } | |
| 442 | - | |
| 434 | + public function jltwp_adminify_error_log_content_refresh() { | |
| 435 | + if ( defined( 'DOING_AJAX' ) && DOING_AJAX && check_ajax_referer( 'adminify-error-logs-security-nonce', 'security' ) > 0 ) { | |
| 443 | 436 | if ( ! empty( $_POST['command'] ) ) { |
| 444 | 437 | $action = sanitize_key( $_POST['command'] ); |
| 445 | 438 | |
| 446 | 439 | $file_content = ''; |
| @@ -448,12 +441,12 @@ | ||
| 448 | 441 | // Check for user refreshing request |
| 449 | 442 | if ( $action == 'refresh_error_log' ) { |
| 450 | 443 | |
| 451 | 444 | // Get the wp "debug.log" file |
| 452 | - $file = ServerInfo_Error_Logs_Details::custom_error_log(); | |
| 445 | + $file = ServerInfo_Error_Logs_Details::jltwp_adminify_error_log(); | |
| 453 | 446 | |
| 454 | 447 | // Get the wp "debug.log" file content |
| 455 | - $file_content = ServerInfo_Error_Logs_Details::custom_error_log_content( $file ); | |
| 448 | + $file_content = ServerInfo_Error_Logs_Details::jltwp_adminify_error_log_content( $file ); | |
| 456 | 449 | } |
| 457 | 450 | |
| 458 | 451 | wp_send_json( [ 'file_content' => $file_content ] ); |
| 459 | 452 | } |
| @@ -463,15 +456,10 @@ | ||
| 463 | 456 | } |
| 464 | 457 | |
| 465 | 458 | |
| 466 | 459 | |
| 467 | - public function pxlbsadminify_error_log_content_clear() { | |
| 468 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX && check_ajax_referer( 'pxlbsadminify-error-logs-security-nonce', 'security' ) > 0 ) { | |
| 469 | - // Security check - only administrators can clear error logs | |
| 470 | - if ( ! current_user_can( 'manage_options' ) ) { | |
| 471 | - wp_send_json_error( array( 'message' => __( 'You do not have permission to perform this action.', 'adminify' ) ) ); | |
| 472 | - } | |
| 473 | - | |
| 460 | + public function jltwp_adminify_error_log_content_clear() { | |
| 461 | + if ( defined( 'DOING_AJAX' ) && DOING_AJAX && check_ajax_referer( 'adminify-error-logs-security-nonce', 'security' ) > 0 ) { | |
| 474 | 462 | if ( ! empty( $_POST['command'] ) ) { |
| 475 | 463 | $file_content = ''; |
| 476 | 464 | $action = sanitize_key( $_POST['command'] ); |
| 477 | 465 | // Check for user clearing request |
| @@ -481,15 +469,15 @@ | ||
| 481 | 469 | global $wp_filesystem; |
| 482 | 470 | WP_Filesystem(); |
| 483 | 471 | |
| 484 | 472 | // Get the wp "debug.log" file |
| 485 | - $file = ServerInfo_Error_Logs_Details::custom_error_log(); | |
| 473 | + $file = ServerInfo_Error_Logs_Details::jltwp_adminify_error_log(); | |
| 486 | 474 | |
| 487 | 475 | // Save no content to "debug.log" file the clear the file content |
| 488 | 476 | $wp_filesystem->put_contents( $file, '', 0644 ); |
| 489 | 477 | |
| 490 | 478 | // Get the wp "debug.log" file content |
| 491 | - $file_content = ServerInfo_Error_Logs_Details::custom_error_log_content( $file ); | |
| 479 | + $file_content = ServerInfo_Error_Logs_Details::jltwp_adminify_error_log_content( $file ); | |
| 492 | 480 | } |
| 493 | 481 | |
| 494 | 482 | return wp_send_json( [ 'file_content' => $file_content ] ); |
| 495 | 483 | } |