← All changes
|
Inc/Modules/ServerInformation/ServerInformation.php
+55
-75
4.2.24
→
3.1.6
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', |
| @@ -184,10 +184,9 @@ | ||
| 184 | 184 | 'fields' => [ |
| 185 | 185 | [ |
| 186 | 186 | 'id' => 'wordpress', |
| 187 | 187 | 'type' => 'callback', |
| 188 | - 'class' => 'adminify-one-col', | |
| 189 | - 'function' => 'PXLBSAdminify\Inc\Modules\ServerInformation\ServerInformation::pxlbsadminify_wordpress_details', | |
| 188 | + 'function' => 'WPAdminify\Inc\Modules\ServerInformation\ServerInformation::jltwp_adminify_wordpress_details', | |
| 190 | 189 | ], |
| 191 | 190 | ], |
| 192 | 191 | ], |
| 193 | 192 | [ |
| @@ -196,10 +195,9 @@ | ||
| 196 | 195 | 'fields' => [ |
| 197 | 196 | [ |
| 198 | 197 | 'id' => 'server', |
| 199 | 198 | 'type' => 'callback', |
| 200 | - 'class' => 'adminify-one-col', | |
| 201 | - 'function' => 'PXLBSAdminify\Inc\Modules\ServerInformation\ServerInformation::pxlbsadminify_server_details', | |
| 199 | + 'function' => 'WPAdminify\Inc\Modules\ServerInformation\ServerInformation::jltwp_adminify_server_details', | |
| 202 | 200 | ], |
| 203 | 201 | ], |
| 204 | 202 | ], |
| 205 | 203 | [ |
| @@ -208,10 +206,9 @@ | ||
| 208 | 206 | 'fields' => [ |
| 209 | 207 | [ |
| 210 | 208 | 'id' => 'php_info', |
| 211 | 209 | 'type' => 'callback', |
| 212 | - 'class' => 'adminify-one-col', | |
| 213 | - 'function' => 'PXLBSAdminify\Inc\Modules\ServerInformation\ServerInformation::pxlbsadminify_get_phpinfo', | |
| 210 | + 'function' => 'WPAdminify\Inc\Modules\ServerInformation\ServerInformation::jltwp_adminify_get_phpinfo', | |
| 214 | 211 | ], |
| 215 | 212 | ], |
| 216 | 213 | ], |
| 217 | 214 | [ |
| @@ -220,9 +217,9 @@ | ||
| 220 | 217 | 'fields' => [ |
| 221 | 218 | [ |
| 222 | 219 | 'id' => 'mysql_info', |
| 223 | 220 | 'type' => 'callback', |
| 224 | - 'function' => 'PXLBSAdminify\Inc\Modules\ServerInformation\ServerInformation::pxlbsadminify_get_mysqlinfo', | |
| 221 | + 'function' => 'WPAdminify\Inc\Modules\ServerInformation\ServerInformation::jltwp_adminify_get_mysqlinfo', | |
| 225 | 222 | ], |
| 226 | 223 | ], |
| 227 | 224 | ], |
| 228 | 225 | [ |
| @@ -231,10 +228,9 @@ | ||
| 231 | 228 | 'fields' => [ |
| 232 | 229 | [ |
| 233 | 230 | 'id' => 'constants', |
| 234 | 231 | 'type' => 'callback', |
| 235 | - 'class' => 'adminify-one-col', | |
| 236 | - 'function' => 'PXLBSAdminify\Inc\Modules\ServerInformation\ServerInformation::pxlbsadminify_constant_details', | |
| 232 | + 'function' => 'WPAdminify\Inc\Modules\ServerInformation\ServerInformation::jltwp_adminify_constant_details', | |
| 237 | 233 | ], |
| 238 | 234 | ], |
| 239 | 235 | ], |
| 240 | 236 | [ |
| @@ -243,10 +239,9 @@ | ||
| 243 | 239 | 'fields' => [ |
| 244 | 240 | [ |
| 245 | 241 | 'id' => 'htaccess', |
| 246 | 242 | 'type' => 'callback', |
| 247 | - 'class' => 'adminify-one-col', | |
| 248 | - 'function' => 'PXLBSAdminify\Inc\Modules\ServerInformation\ServerInformation::pxlbsadminify_htacces_details', | |
| 243 | + 'function' => 'WPAdminify\Inc\Modules\ServerInformation\ServerInformation::jltwp_adminify_htacces_details', | |
| 249 | 244 | ], |
| 250 | 245 | ], |
| 251 | 246 | ], |
| 252 | 247 | [ |
| @@ -255,10 +250,9 @@ | ||
| 255 | 250 | 'fields' => [ |
| 256 | 251 | [ |
| 257 | 252 | 'id' => 'php_ini', |
| 258 | 253 | 'type' => 'callback', |
| 259 | - 'class' => 'adminify-one-col', | |
| 260 | - 'function' => 'PXLBSAdminify\Inc\Modules\ServerInformation\ServerInformation::pxlbsadminify_php_ini_details', | |
| 254 | + 'function' => 'WPAdminify\Inc\Modules\ServerInformation\ServerInformation::jltwp_adminify_php_ini_details', | |
| 261 | 255 | ], |
| 262 | 256 | ], |
| 263 | 257 | ], |
| 264 | 258 | [ |
| @@ -267,10 +261,9 @@ | ||
| 267 | 261 | 'fields' => [ |
| 268 | 262 | [ |
| 269 | 263 | 'id' => 'robots_txt', |
| 270 | 264 | 'type' => 'callback', |
| 271 | - 'class' => 'adminify-one-col', | |
| 272 | - 'function' => 'PXLBSAdminify\Inc\Modules\ServerInformation\ServerInformation::pxlbsadminify_robots_details', | |
| 265 | + 'function' => 'WPAdminify\Inc\Modules\ServerInformation\ServerInformation::jltwp_adminify_robots_details', | |
| 273 | 266 | ], |
| 274 | 267 | ], |
| 275 | 268 | ], |
| 276 | 269 | [ |
| @@ -279,10 +272,9 @@ | ||
| 279 | 272 | 'fields' => [ |
| 280 | 273 | [ |
| 281 | 274 | 'id' => 'error_logs', |
| 282 | 275 | 'type' => 'callback', |
| 283 | - 'class' => 'adminify-one-col', | |
| 284 | - 'function' => '\PXLBSAdminify\Inc\Modules\ServerInformation\ServerInformation::pxlbsadminify_error_log_details', | |
| 276 | + 'function' => '\WPAdminify\Inc\Modules\ServerInformation\ServerInformation::jltwp_adminify_error_log_details', | |
| 285 | 277 | ], |
| 286 | 278 | ], |
| 287 | 279 | ], |
| 288 | 280 | |
| @@ -297,9 +289,9 @@ | ||
| 297 | 289 | |
| 298 | 290 | /** |
| 299 | 291 | * Server Details |
| 300 | 292 | */ |
| 301 | - public static function pxlbsadminify_server_details() { | |
| 293 | + public static function jltwp_adminify_server_details() { | |
| 302 | 294 | new ServerInfo_Server_Details(); |
| 303 | 295 | } |
| 304 | 296 | |
| 305 | 297 | |
| @@ -305,9 +297,9 @@ | ||
| 305 | 297 | |
| 306 | 298 | /** |
| 307 | 299 | * WordPress Details |
| 308 | 300 | */ |
| 309 | - public static function pxlbsadminify_wordpress_details() { | |
| 301 | + public static function jltwp_adminify_wordpress_details() { | |
| 310 | 302 | new ServerInfo_WP_Details(); |
| 311 | 303 | } |
| 312 | 304 | |
| 313 | 305 | |
| @@ -313,9 +305,9 @@ | ||
| 313 | 305 | |
| 314 | 306 | /** |
| 315 | 307 | * Constant Details |
| 316 | 308 | */ |
| 317 | - public static function pxlbsadminify_constant_details() { | |
| 309 | + public static function jltwp_adminify_constant_details() { | |
| 318 | 310 | new ServerInfo_Constant_Details(); |
| 319 | 311 | } |
| 320 | 312 | |
| 321 | 313 | /** |
| @@ -320,9 +312,9 @@ | ||
| 320 | 312 | |
| 321 | 313 | /** |
| 322 | 314 | * .htaccess file Details |
| 323 | 315 | */ |
| 324 | - public static function pxlbsadminify_htacces_details() { | |
| 316 | + public static function jltwp_adminify_htacces_details() { | |
| 325 | 317 | new ServerInfo_Htaccess_Details(); |
| 326 | 318 | } |
| 327 | 319 | |
| 328 | 320 | /** |
| @@ -327,9 +319,9 @@ | ||
| 327 | 319 | |
| 328 | 320 | /** |
| 329 | 321 | * php.ini file Details |
| 330 | 322 | */ |
| 331 | - public static function pxlbsadminify_php_ini_details() { | |
| 323 | + public static function jltwp_adminify_php_ini_details() { | |
| 332 | 324 | new ServerInfo_PHP_INI_Details(); |
| 333 | 325 | } |
| 334 | 326 | |
| 335 | 327 | /** |
| @@ -334,9 +326,9 @@ | ||
| 334 | 326 | |
| 335 | 327 | /** |
| 336 | 328 | * Robots file Details |
| 337 | 329 | */ |
| 338 | - public static function pxlbsadminify_robots_details() { | |
| 330 | + public static function jltwp_adminify_robots_details() { | |
| 339 | 331 | new ServerInfo_Robots_Details(); |
| 340 | 332 | } |
| 341 | 333 | |
| 342 | 334 | /** |
| @@ -341,9 +333,9 @@ | ||
| 341 | 333 | |
| 342 | 334 | /** |
| 343 | 335 | * Error Logs Details |
| 344 | 336 | */ |
| 345 | - public static function pxlbsadminify_error_log_details() { | |
| 337 | + public static function jltwp_adminify_error_log_details() { | |
| 346 | 338 | new ServerInfo_Error_Logs_Details(); |
| 347 | 339 | } |
| 348 | 340 | |
| 349 | 341 | /** |
| @@ -348,9 +340,9 @@ | ||
| 348 | 340 | |
| 349 | 341 | /** |
| 350 | 342 | * Error Logs Details |
| 351 | 343 | */ |
| 352 | - public static function pxlbsadminify_get_phpinfo() { | |
| 344 | + public static function jltwp_adminify_get_phpinfo() { | |
| 353 | 345 | if ( ! class_exists( 'DOMDocument' ) ) { |
| 354 | 346 | echo '<div class="wrap" id="PHPinfo">'; |
| 355 | 347 | echo '<h2>' . esc_html__( 'PHP', 'adminify' ) . ' ' . esc_html( phpversion() ) . '</h2>'; |
| 356 | 348 | 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 +348,9 @@ | ||
| 356 | 348 | 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 | 349 | echo '</div>'; |
| 358 | 350 | } else { |
| 359 | 351 | ob_start(); |
| 360 | - phpinfo(); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.prevent_path_disclosure_phpinfo -- intentional server-info display on a capability-gated admin screen. | |
| 352 | + phpinfo(); | |
| 361 | 353 | $phpinfo = ob_get_contents(); |
| 362 | 354 | ob_end_clean(); |
| 363 | 355 | |
| 364 | 356 | // Use DOMDocument to parse phpinfo() |
| @@ -381,9 +373,9 @@ | ||
| 381 | 373 | $phpinfo_html = $html->saveXml( $body->item( 0 ) ); |
| 382 | 374 | |
| 383 | 375 | echo '<div class="wrap" id="PHPinfo">'; |
| 384 | 376 | echo '<h2>' . esc_html__( 'PHP', 'adminify' ) . ' ' . esc_html( phpversion() ) . '</h2>'; |
| 385 | - echo wp_kses_post( Utils::kses_custom( $phpinfo_html ) ); | |
| 377 | + echo Utils::wp_kses_custom( $phpinfo_html ); | |
| 386 | 378 | echo '</div>'; |
| 387 | 379 | } |
| 388 | 380 | } |
| 389 | 381 | |
| @@ -392,14 +384,12 @@ | ||
| 392 | 384 | * Get MYSQL Information |
| 393 | 385 | * |
| 394 | 386 | * @return void |
| 395 | 387 | */ |
| 396 | - public static function pxlbsadminify_get_mysqlinfo() { | |
| 388 | + public static function jltwp_adminify_get_mysqlinfo() { | |
| 397 | 389 | 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 | 390 | $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' ); | |
| 391 | + $mysqlinfo = $wpdb->get_results( 'SHOW VARIABLES' ); | |
| 402 | 392 | |
| 403 | 393 | if ( is_rtl() ) { ?> |
| 404 | 394 | <style type="text/css"> |
| 405 | 395 | #MYSQLinfo, |
| @@ -432,15 +422,10 @@ | ||
| 432 | 422 | } |
| 433 | 423 | |
| 434 | 424 | |
| 435 | 425 | // 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 | - | |
| 426 | + public function jltwp_adminify_error_log_content_refresh() { | |
| 427 | + if ( defined( 'DOING_AJAX' ) && DOING_AJAX && check_ajax_referer( 'adminify-error-logs-security-nonce', 'security' ) > 0 ) { | |
| 443 | 428 | if ( ! empty( $_POST['command'] ) ) { |
| 444 | 429 | $action = sanitize_key( $_POST['command'] ); |
| 445 | 430 | |
| 446 | 431 | $file_content = ''; |
| @@ -448,12 +433,12 @@ | ||
| 448 | 433 | // Check for user refreshing request |
| 449 | 434 | if ( $action == 'refresh_error_log' ) { |
| 450 | 435 | |
| 451 | 436 | // Get the wp "debug.log" file |
| 452 | - $file = ServerInfo_Error_Logs_Details::custom_error_log(); | |
| 437 | + $file = ServerInfo_Error_Logs_Details::jltwp_adminify_error_log(); | |
| 453 | 438 | |
| 454 | 439 | // Get the wp "debug.log" file content |
| 455 | - $file_content = ServerInfo_Error_Logs_Details::custom_error_log_content( $file ); | |
| 440 | + $file_content = ServerInfo_Error_Logs_Details::jltwp_adminify_error_log_content( $file ); | |
| 456 | 441 | } |
| 457 | 442 | |
| 458 | 443 | wp_send_json( [ 'file_content' => $file_content ] ); |
| 459 | 444 | } |
| @@ -463,15 +448,10 @@ | ||
| 463 | 448 | } |
| 464 | 449 | |
| 465 | 450 | |
| 466 | 451 | |
| 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 | - | |
| 452 | + public function jltwp_adminify_error_log_content_clear() { | |
| 453 | + if ( defined( 'DOING_AJAX' ) && DOING_AJAX && check_ajax_referer( 'adminify-error-logs-security-nonce', 'security' ) > 0 ) { | |
| 474 | 454 | if ( ! empty( $_POST['command'] ) ) { |
| 475 | 455 | $file_content = ''; |
| 476 | 456 | $action = sanitize_key( $_POST['command'] ); |
| 477 | 457 | // Check for user clearing request |
| @@ -481,15 +461,15 @@ | ||
| 481 | 461 | global $wp_filesystem; |
| 482 | 462 | WP_Filesystem(); |
| 483 | 463 | |
| 484 | 464 | // Get the wp "debug.log" file |
| 485 | - $file = ServerInfo_Error_Logs_Details::custom_error_log(); | |
| 465 | + $file = ServerInfo_Error_Logs_Details::jltwp_adminify_error_log(); | |
| 486 | 466 | |
| 487 | 467 | // Save no content to "debug.log" file the clear the file content |
| 488 | 468 | $wp_filesystem->put_contents( $file, '', 0644 ); |
| 489 | 469 | |
| 490 | 470 | // Get the wp "debug.log" file content |
| 491 | - $file_content = ServerInfo_Error_Logs_Details::custom_error_log_content( $file ); | |
| 471 | + $file_content = ServerInfo_Error_Logs_Details::jltwp_adminify_error_log_content( $file ); | |
| 492 | 472 | } |
| 493 | 473 | |
| 494 | 474 | return wp_send_json( [ 'file_content' => $file_content ] ); |
| 495 | 475 | } |