From c2caa464d1f05b79a4cd24f07b1568065dcded4a Mon Sep 17 00:00:00 2001 From: Milan Petrovic Date: Sat, 1 Apr 2023 11:44:06 +0200 Subject: [PATCH] Work in progress. --- core/admin.php | 12 +- core/admin/Plugin.php | 8 +- core/admin/Settings.php | 41 +++++- core/display/ErrorFormat.php | 80 +++++------ core/display/Loader.php | 56 ++++---- core/display/SQLFormat.php | 44 +++--- core/main/AJAX.php | 2 +- core/main/Callback.php | 54 +++---- core/main/Help.php | 12 +- core/main/IP.php | 32 ++--- core/main/Info.php | 44 +++--- core/main/OPCache.php | 10 +- core/main/Plugin.php | 48 ++++--- core/main/WP.php | 16 +-- core/panel/Basics.php | 16 +-- core/panel/Constants.php | 20 +-- core/panel/HTTP.php | 42 +++--- core/panel/Hooks.php | 50 +++---- core/panel/Layout.php | 4 +- core/panel/Plugins.php | 6 +- core/panel/Queries.php | 78 +++++----- core/panel/Request.php | 20 +-- core/panel/Store.php | 12 +- core/panel/User.php | 6 +- core/panel/bbPress.php | 16 +-- core/printer/prettyprint/PrettyPrint.php | 6 +- core/track/AJAX.php | 12 +- core/track/Tracker.php | 172 +++++++++++------------ js/debugpress.js | 17 ++- js/debugpress.min.js | 2 +- libraries/mousetrap/mousetrap.min.js | 11 ++ {popup => libraries/popup}/popup.min.css | 0 {popup => libraries/popup}/popup.min.js | 2 +- readme.txt | 10 +- 34 files changed, 522 insertions(+), 439 deletions(-) create mode 100644 libraries/mousetrap/mousetrap.min.js rename {popup => libraries/popup}/popup.min.css (100%) rename {popup => libraries/popup}/popup.min.js (69%) diff --git a/core/admin.php b/core/admin.php index fd2f26e..6c89966 100644 --- a/core/admin.php +++ b/core/admin.php @@ -31,7 +31,7 @@ function debugpress_do_settings_sections( $page ) { $close = false; foreach ( (array) $wp_settings_sections[ $page ] as $section ) { - $id = $section['id']; + $id = $section[ 'id' ]; if ( isset( $tabs[ $id ] ) ) { $tab = $tabs[ $id ]; @@ -47,21 +47,21 @@ function debugpress_do_settings_sections( $page ) { } echo '
'; - if ( $section['title'] ) { + if ( $section[ 'title' ] ) { echo "

{$section['title']}

\n"; } - if ( $section['callback'] ) { + if ( $section[ 'callback' ] ) { echo ''; } - if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[ $page ] ) || ! isset( $wp_settings_fields[ $page ][ $section['id'] ] ) ) { + if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[ $page ] ) || ! isset( $wp_settings_fields[ $page ][ $section[ 'id' ] ] ) ) { continue; } echo ''; - do_settings_fields( $page, $section['id'] ); + do_settings_fields( $page, $section[ 'id' ] ); echo ''; echo '
'; } diff --git a/core/admin/Plugin.php b/core/admin/Plugin.php index 6d591e4..13a580b 100644 --- a/core/admin/Plugin.php +++ b/core/admin/Plugin.php @@ -37,7 +37,7 @@ public static function instance() : Plugin { } public function plugin_action_links( $actions ) { - $actions['settings'] = '' . esc_html__( "Settings", "debugpress" ) . ''; + $actions[ 'settings' ] = '' . esc_html__( "Settings", "debugpress" ) . ''; return $actions; } @@ -56,16 +56,16 @@ public function enqueue_scripts() { } public function admin_menu() { - $this->_pages['settings'] = add_options_page( __( "DebugPress Settings", "debugpress" ), __( "DebugPress", "debugpress" ), 'manage_options', 'debugpress', array( + $this->_pages[ 'settings' ] = add_options_page( __( "DebugPress Settings", "debugpress" ), __( "DebugPress", "debugpress" ), 'manage_options', 'debugpress', array( $this, 'settings_page' ) ); - $this->_pages['info'] = add_management_page( __( "DebugPress Info", "debugpress" ), __( "DebugPress Info", "debugpress" ), 'manage_options', 'debugpress-info', array( + $this->_pages[ 'info' ] = add_management_page( __( "DebugPress Info", "debugpress" ), __( "DebugPress Info", "debugpress" ), 'manage_options', 'debugpress-info', array( $this, 'tools_page' ) ); - add_action( 'load-' . $this->_pages['settings'], array( $this, 'settings_context_help' ) ); + add_action( 'load-' . $this->_pages[ 'settings' ], array( $this, 'settings_context_help' ) ); } public function settings_page() { diff --git a/core/admin/Settings.php b/core/admin/Settings.php index 343edb1..a142bf5 100644 --- a/core/admin/Settings.php +++ b/core/admin/Settings.php @@ -76,6 +76,12 @@ public function sections() { array( $this, 'block_pretty' ), 'debugpress' ); + add_settings_section( + 'debugpress_settings_shortcut', + __( "Keyboard Shortcut", "debugpress" ), + array( $this, 'block_shortcut' ), + 'debugpress' ); + add_settings_section( 'debugpress_settings_autos', __( "Auto debug overrides", "debugpress" ), @@ -161,6 +167,20 @@ public function fields() { 'debugpress', 'debugpress_settings_autos' ); + add_settings_field( + 'debugpress_settings_mousetrap', + '', + array( $this, 'option_mousetrap' ), + 'debugpress', + 'debugpress_settings_shortcut' ); + + add_settings_field( + 'debugpress_settings_mousetrap_sequence', + '', + array( $this, 'option_mousetrap_sequence' ), + 'debugpress', + 'debugpress_settings_shortcut' ); + add_settings_field( 'debugpress_settings_panel_content', '', @@ -292,7 +312,7 @@ private function _roles_values() : array { $roles = array(); foreach ( wp_roles()->roles as $role => $details ) { - $roles[ $role ] = translate_user_role( $details['name'] ); + $roles[ $role ] = translate_user_role( $details[ 'name' ] ); } return $roles; @@ -363,6 +383,10 @@ public function block_pretty() { echo __( "Choose which pretty print implementation to load. This is used to display complex arrays and objects in a readable form.", "debugpress" ); } + public function block_shortcut() { + echo __( "Show and hide the debugger popup using the shortcut combination on the keyboard.", "debugpress" ); + } + public function block_autos() { echo __( "If WP_DEBUG and SAVEQUERIES are not defined, plugin will attempt to enable both, because they are needed for the full debugger information to be displayed.", "debugpress" ); } @@ -419,6 +443,7 @@ public function option_access_key() { echo ""; echo '

' . esc_html__( "Access key to use in the URL to activate DebugPress on demand. Use any URL friendly string you want that includes one or more: lowercase letters, numbers, dashes.", "debugpress" ) . '

'; + echo '

' . esc_html__( "URL Query Argument:", "debugpress" ) . '?debugpress={access-key}

'; } public function option_pretty_print() { @@ -445,6 +470,20 @@ public function option_auto_savequeries() { echo '

' . esc_html__( "Plugin will attempt to set SAVEQUERIES to 'true'. But, if the SAVEQUERIES was previously defined elsewhere as 'false', this option will not work.", "debugpress" ) . '

'; } + public function option_mousetrap() { + $checked = debugpress_plugin()->get( 'mousetrap' ) ? ' checked="checked" ' : ''; + + echo ""; + } + + public function option_mousetrap_sequence() { + $enabled = debugpress_plugin()->get( 'mousetrap_sequence' ); + + echo ""; + echo '

' . esc_html__( "Keyboard keys combination to activate the debugger popup. You can use any number of letter key, with one or more special modifier keys. Use symbol + to connect separate the keys.", "debugpress" ) . '

'; + echo '

' . esc_html__( "Modifier keys:", "debugpress" ) . 'shift, ctrl, alt, command

'; + } + public function option_panel_content() { $checked = debugpress_plugin()->get( 'panel_content' ) ? ' checked="checked" ' : ''; diff --git a/core/display/ErrorFormat.php b/core/display/ErrorFormat.php index 6bb1360..18352e7 100644 --- a/core/display/ErrorFormat.php +++ b/core/display/ErrorFormat.php @@ -19,11 +19,11 @@ public static function render_caller( $caller, $escape = false ) : string { public static function php_error( $error ) : string { $class = 'debugpress-wrapper-warning debugpress-warning-errors debugpress-error-'; - if ( ! isset( $error['errno'] ) || ! isset( $error['caller'] ) ) { + if ( ! isset( $error[ 'errno' ] ) || ! isset( $error[ 'caller' ] ) ) { return __( "Error information is missing", "debugpress" ); } - switch ( $error['errno'] ) { + switch ( $error[ 'errno' ] ) { case E_ERROR: case E_CORE_ERROR: case E_COMPILE_ERROR: @@ -62,19 +62,19 @@ public static function php_error( $error ) : string { break; } - $caller = maybe_unserialize( $error['caller'] ); + $caller = maybe_unserialize( $error[ 'caller' ] ); $caller = is_array( $caller ) ? join( '
', $caller ) : $caller; $render = '
'; - $render .= '

' . $title . ' [' . $error['errno'] . ']

'; - $render .= '' . __( "On line", "debugpress" ) . ": " . $error['errline'] . '
'; - $render .= '' . __( "In file", "debugpress" ) . ": " . $error['errfile'] . '
'; + $render .= '

' . $title . ' [' . $error[ 'errno' ] . ']

'; + $render .= '' . __( "On line", "debugpress" ) . ": " . $error[ 'errline' ] . '
'; + $render .= '' . __( "In file", "debugpress" ) . ": " . $error[ 'errfile' ] . '
'; if ( ! empty( $caller ) ) { $render .= ErrorFormat::render_caller( $caller ); } - $render .= '
' . esc_html( $error['errstr'] ) . '
'; + $render .= '
' . esc_html( $error[ 'errstr' ] ) . '
'; $render .= '
'; return $render; @@ -82,20 +82,20 @@ public static function php_error( $error ) : string { public static function doing_it_wrong( $item ) : string { $render = '
'; - $render .= '

' . sprintf( __( "For %s", "debugpress" ), $item['deprecated'] ) . '

'; - $render .= '' . __( "Since version", "debugpress" ) . ": " . $item['version'] . ', '; - $render .= '' . __( "On line", "debugpress" ) . ": " . $item['on_line'] . '
'; - $render .= '' . __( "In file", "debugpress" ) . ": " . $item['in_file'] . '
'; + $render .= '

' . sprintf( __( "For %s", "debugpress" ), $item[ 'deprecated' ] ) . '

'; + $render .= '' . __( "Since version", "debugpress" ) . ": " . $item[ 'version' ] . ', '; + $render .= '' . __( "On line", "debugpress" ) . ": " . $item[ 'on_line' ] . '
'; + $render .= '' . __( "In file", "debugpress" ) . ": " . $item[ 'in_file' ] . '
'; - $caller = isset( $item['caller'] ) ? maybe_unserialize( $item['caller'] ) : ''; + $caller = isset( $item[ 'caller' ] ) ? maybe_unserialize( $item[ 'caller' ] ) : ''; $caller = is_array( $caller ) ? join( '
', $caller ) : $caller; if ( ! empty( $caller ) ) { $render .= ErrorFormat::render_caller( $caller ); } - if ( $item['message'] ) { - $render .= '
' . esc_html( $item['message'] ) . '
'; + if ( $item[ 'message' ] ) { + $render .= '
' . esc_html( $item[ 'message' ] ) . '
'; } $render .= '
'; @@ -106,13 +106,13 @@ public static function doing_it_wrong( $item ) : string { public static function deprecated_file( $item ) : string { $render = '
'; $render .= '

' . __( "Deprecated File", "debugpress" ) . ':

'; - $render .= '' . __( "On line", "debugpress" ) . ": " . $item["on_line"] . '
'; - $render .= '' . __( "In file", "debugpress" ) . ": " . $item["in_file"] . '
'; + $render .= '' . __( "On line", "debugpress" ) . ": " . $item[ "on_line" ] . '
'; + $render .= '' . __( "In file", "debugpress" ) . ": " . $item[ "in_file" ] . '
'; - if ( $item["replacement"] ) { - $render .= sprintf( __( "%s is deprecated since version %s. Use %s instead.", "debugpress" ), $item["deprecated"], $item["version"], $item["replacement"] ); + if ( $item[ "replacement" ] ) { + $render .= sprintf( __( "%s is deprecated since version %s. Use %s instead.", "debugpress" ), $item[ "deprecated" ], $item[ "version" ], $item[ "replacement" ] ); } else { - $render .= sprintf( __( "%s is deprecated since version %s.", "debugpress" ), $item["deprecated"], $item["version"] ); + $render .= sprintf( __( "%s is deprecated since version %s.", "debugpress" ), $item[ "deprecated" ], $item[ "version" ] ); } $render .= '
'; @@ -123,21 +123,21 @@ public static function deprecated_file( $item ) : string { public static function deprecated_function( $item ) : string { $render = '
'; $render .= '

' . __( "Deprecated Function", "debugpress" ) . ':

'; - $render .= '' . __( "On line", "debugpress" ) . ": " . $item["on_line"] . '
'; - $render .= '' . __( "In file", "debugpress" ) . ": " . $item["in_file"] . '
'; + $render .= '' . __( "On line", "debugpress" ) . ": " . $item[ "on_line" ] . '
'; + $render .= '' . __( "In file", "debugpress" ) . ": " . $item[ "in_file" ] . '
'; - if ( $item["hook"] ) { - $render .= "" . __( "Hook", "debugpress" ) . ": " . $item["hook"] . "
"; + if ( $item[ "hook" ] ) { + $render .= "" . __( "Hook", "debugpress" ) . ": " . $item[ "hook" ] . "
"; } - if ( $item["replacement"] ) { - $render .= sprintf( __( "%s is deprecated since version %s. Use %s instead.", "debugpress" ), $item["deprecated"], $item["version"], $item["replacement"] ); + if ( $item[ "replacement" ] ) { + $render .= sprintf( __( "%s is deprecated since version %s. Use %s instead.", "debugpress" ), $item[ "deprecated" ], $item[ "version" ], $item[ "replacement" ] ); } else { - $render .= sprintf( __( "%s is deprecated since version %s.", "debugpress" ), $item["deprecated"], $item["version"] ); + $render .= sprintf( __( "%s is deprecated since version %s.", "debugpress" ), $item[ "deprecated" ], $item[ "version" ] ); } - if ( isset( $item['message'] ) && ! empty( $item['message'] ) ) { - $render .= '' . $item['message'] . ''; + if ( isset( $item[ 'message' ] ) && ! empty( $item[ 'message' ] ) ) { + $render .= '' . $item[ 'message' ] . ''; } $render .= '
'; @@ -148,13 +148,13 @@ public static function deprecated_function( $item ) : string { public static function deprecated_constructor( $item ) : string { $render = '
'; $render .= '

' . __( "Deprecated Constructor", "debugpress" ) . ':

'; - $render .= '' . __( "On line", "debugpress" ) . ": " . $item["on_line"] . '
'; - $render .= '' . __( "In file", "debugpress" ) . ": " . $item["in_file"] . '
'; + $render .= '' . __( "On line", "debugpress" ) . ": " . $item[ "on_line" ] . '
'; + $render .= '' . __( "In file", "debugpress" ) . ": " . $item[ "in_file" ] . '
'; - $render .= sprintf( __( "For %s since version %s.", "debugpress" ), $item["deprecated"], $item["version"] ); + $render .= sprintf( __( "For %s since version %s.", "debugpress" ), $item[ "deprecated" ], $item[ "version" ] ); - if ( isset( $item['message'] ) && ! empty( $item['message'] ) ) { - $render .= '' . $item['message'] . ''; + if ( isset( $item[ 'message' ] ) && ! empty( $item[ 'message' ] ) ) { + $render .= '' . $item[ 'message' ] . ''; } $render .= '
'; @@ -166,18 +166,18 @@ public static function deprecated_argument( $item ) : string { $render = '
'; $render .= '

' . __( "Deprecated Argument", "debugpress" ) . ':

'; - if ( $item['in_file'] ) { - if ( $item['on_line'] ) { - $render .= "" . __( "On line", "debugpress" ) . ": " . $item["on_line"] . ", "; + if ( $item[ 'in_file' ] ) { + if ( $item[ 'on_line' ] ) { + $render .= "" . __( "On line", "debugpress" ) . ": " . $item[ "on_line" ] . ", "; } - $render .= "" . __( "In file", "debugpress" ) . ": " . $item["in_file"] . "
"; + $render .= "" . __( "In file", "debugpress" ) . ": " . $item[ "in_file" ] . "
"; } - $render .= sprintf( __( "Argument in %s is deprecated since version %s.", "debugpress" ), $item["deprecated"], $item["version"] ); + $render .= sprintf( __( "Argument in %s is deprecated since version %s.", "debugpress" ), $item[ "deprecated" ], $item[ "version" ] ); - if ( isset( $item['message'] ) && ! empty( $item['message'] ) ) { - $render .= '' . $item['message'] . ''; + if ( isset( $item[ 'message' ] ) && ! empty( $item[ 'message' ] ) ) { + $render .= '' . $item[ 'message' ] . ''; } $render .= '
'; diff --git a/core/display/Loader.php b/core/display/Loader.php index 0ca0cce..a8092d4 100644 --- a/core/display/Loader.php +++ b/core/display/Loader.php @@ -89,7 +89,9 @@ public function enqueue_scripts() { 'events_show_details' => _x( "Show Details", "Popup message", "debugpress" ), 'events_hide_details' => _x( "Hide Details", "Popup message", "debugpress" ), 'icon_down' => '', - 'icon_right' => '' + 'icon_right' => '', + 'mousetrap' => debugpress_plugin()->get( 'mousetrap' ), + 'mousetrap_sequence' => debugpress_plugin()->get( 'mousetrap_sequence' ), ) ); wp_add_inline_style( 'debugpress', $this->vars_styling_override() ); @@ -117,8 +119,8 @@ public function display_float_button() { public function button_class() : string { $class = 'debugpress-debug-dialog-button'; - if ( debugpress_tracker()->counts['total'] > 0 ) { - if ( debugpress_tracker()->counts['errors'] > 0 ) { + if ( debugpress_tracker()->counts[ 'total' ] > 0 ) { + if ( debugpress_tracker()->counts[ 'errors' ] > 0 ) { $class .= ' debugpress-debug-has-errors'; } else { $class .= ' debugpress-debug-has-warnings'; @@ -129,7 +131,7 @@ public function button_class() : string { } public function button() : string { - $_error_counts = debugpress_tracker()->counts['total']; + $_error_counts = debugpress_tracker()->counts[ 'total' ]; $_http_counts = count( debugpress_tracker()->httpapi ); $_store_counts = count( debugpress_tracker()->logged ); @@ -167,97 +169,97 @@ public function prepare_tabs() { ); if ( debugpress_plugin()->get( 'panel_request' ) ) { - $this->tabs['request'] = __( "Request", "debugpress" ); + $this->tabs[ 'request' ] = __( "Request", "debugpress" ); } if ( ! is_admin() ) { - $this->tabs['query'] = __( "Query", "debugpress" ); + $this->tabs[ 'query' ] = __( "Query", "debugpress" ); } if ( debugpress_plugin()->get( 'panel_content' ) ) { - $this->tabs['content'] = __( "Content", "debugpress" ); + $this->tabs[ 'content' ] = __( "Content", "debugpress" ); } if ( debugpress_plugin()->get( 'panel_rewriter' ) ) { - $this->tabs['rewriter'] = __( "Rewriter", "debugpress" ); + $this->tabs[ 'rewriter' ] = __( "Rewriter", "debugpress" ); } if ( debugpress_plugin()->get( 'panel_roles' ) ) { - $this->tabs['roles'] = __( "Roles", "debugpress" ); + $this->tabs[ 'roles' ] = __( "Roles", "debugpress" ); } if ( debugpress_plugin()->get( 'panel_constants' ) ) { - $this->tabs['constants'] = __( "Constants", "debugpress" ); + $this->tabs[ 'constants' ] = __( "Constants", "debugpress" ); } if ( debugpress_plugin()->get( 'panel_hooks' ) ) { - $this->tabs['hooks'] = __( "Hooks", "debugpress" ); + $this->tabs[ 'hooks' ] = __( "Hooks", "debugpress" ); } if ( ! empty( debugpress_db()->wpdb()->queries ) ) { - $this->tabs['queries'] = __( "SQL Queries", "debugpress" ); + $this->tabs[ 'queries' ] = __( "SQL Queries", "debugpress" ); } if ( is_user_logged_in() && debugpress_plugin()->get( 'panel_user' ) ) { - $this->tabs['user'] = __( "User", "debugpress" ); + $this->tabs[ 'user' ] = __( "User", "debugpress" ); } if ( debugpress_plugin()->get( 'panel_enqueue' ) ) { - $this->tabs['enqueue'] = __( "Enqueue", "debugpress" ); + $this->tabs[ 'enqueue' ] = __( "Enqueue", "debugpress" ); } if ( debugpress_plugin()->get( 'panel_php' ) ) { - $this->tabs['php'] = __( "PHP", "debugpress" ); + $this->tabs[ 'php' ] = __( "PHP", "debugpress" ); } if ( debugpress_plugin()->get( 'panel_system' ) ) { - $this->tabs['server'] = __( "System", "debugpress" ); + $this->tabs[ 'server' ] = __( "System", "debugpress" ); } if ( debugpress_plugin()->get( 'panel_bbpress' ) && debugpress_has_bbpress() && is_bbpress() ) { - $this->tabs['bbpress'] = __( "bbPress", "debugpress" ); + $this->tabs[ 'bbpress' ] = __( "bbPress", "debugpress" ); } if ( ! empty( debugpress_tracker()->plugins ) ) { - $this->tabs['plugins'] = __( "Plugins", "debugpress" ); + $this->tabs[ 'plugins' ] = __( "Plugins", "debugpress" ); } if ( ! empty( debugpress_tracker()->errors ) ) { - $this->tabs['errors'] = __( "Errors", "debugpress" ) . ' (' . debugpress_tracker()->counts['errors'] . ')'; + $this->tabs[ 'errors' ] = __( "Errors", "debugpress" ) . ' (' . debugpress_tracker()->counts[ 'errors' ] . ')'; } if ( ! empty( debugpress_tracker()->deprecated ) ) { - $this->tabs['deprecated'] = __( "Deprecated", "debugpress" ) . ' (' . debugpress_tracker()->counts['deprecated'] . ')'; + $this->tabs[ 'deprecated' ] = __( "Deprecated", "debugpress" ) . ' (' . debugpress_tracker()->counts[ 'deprecated' ] . ')'; } if ( ! empty( debugpress_tracker()->doingitwrong ) ) { - $this->tabs['doingitwrong'] = __( "Doing It Wrong", "debugpress" ) . ' (' . debugpress_tracker()->counts['doingitwrong'] . ')'; + $this->tabs[ 'doingitwrong' ] = __( "Doing It Wrong", "debugpress" ) . ' (' . debugpress_tracker()->counts[ 'doingitwrong' ] . ')'; } if ( debugpress_plugin()->get( 'panel_http' ) && ! empty( debugpress_tracker()->httpapi ) ) { - $this->tabs['http'] = __( "HTTP", "debugpress" ) . ' (' . count( debugpress_tracker()->httpapi ) . ')'; + $this->tabs[ 'http' ] = __( "HTTP", "debugpress" ) . ' (' . count( debugpress_tracker()->httpapi ) . ')'; } if ( debugpress_plugin()->get( 'ajax' ) ) { - $this->tabs['ajax'] = __( "AJAX", "debugpress" ) . ' (0)'; + $this->tabs[ 'ajax' ] = __( "AJAX", "debugpress" ) . ' (0)'; } if ( ! empty( debugpress_tracker()->logged ) ) { - $this->tabs['store'] = __( "Store", "debugpress" ) . ' (' . count( debugpress_tracker()->logged ) . ')'; + $this->tabs[ 'store' ] = __( "Store", "debugpress" ) . ' (' . count( debugpress_tracker()->logged ) . ')'; } - $this->tabs['layout'] = array( + $this->tabs[ 'layout' ] = array( 'label' => __( "Layout", "debugpress" ), 'tab' => '' ); - $this->tabs['tools'] = array( + $this->tabs[ 'tools' ] = array( 'label' => __( "Tools", "debugpress" ), 'tab' => '' ); if ( debugpress_plugin()->get( 'panel_debuglog' ) ) { - $this->tabs['debuglog'] = array( + $this->tabs[ 'debuglog' ] = array( 'label' => __( "Debug Log", "debugpress" ), 'tab' => '' ); diff --git a/core/display/SQLFormat.php b/core/display/SQLFormat.php index 06fc204..0b4cec6 100644 --- a/core/display/SQLFormat.php +++ b/core/display/SQLFormat.php @@ -792,15 +792,15 @@ protected static function getNextToken( $string, $previous = null ) { // Whitespace if ( preg_match( '/^\s+/', $string, $matches ) ) { return array( - self::TOKEN_VALUE => $matches[0], + self::TOKEN_VALUE => $matches[ 0 ], self::TOKEN_TYPE => self::TOKEN_TYPE_WHITESPACE ); } // Comment - if ( $string[0] === '#' || ( isset( $string[1] ) && ( $string[0] === '-' && $string[1] === '-' ) || ( $string[0] === '/' && $string[1] === '*' ) ) ) { + if ( $string[ 0 ] === '#' || ( isset( $string[ 1 ] ) && ( $string[ 0 ] === '-' && $string[ 1 ] === '-' ) || ( $string[ 0 ] === '/' && $string[ 1 ] === '*' ) ) ) { // Comment until end of line - if ( $string[0] === '-' || $string[0] === '#' ) { + if ( $string[ 0 ] === '-' || $string[ 0 ] === '#' ) { $last = strpos( $string, "\n" ); $type = self::TOKEN_TYPE_COMMENT; } else { // Comment until closing comment tag @@ -819,28 +819,28 @@ protected static function getNextToken( $string, $previous = null ) { } // Quoted String - if ( $string[0] === '"' || $string[0] === '\'' || $string[0] === '`' || $string[0] === '[' ) { + if ( $string[ 0 ] === '"' || $string[ 0 ] === '\'' || $string[ 0 ] === '`' || $string[ 0 ] === '[' ) { return array( - self::TOKEN_TYPE => ( ( $string[0] === '`' || $string[0] === '[' ) ? self::TOKEN_TYPE_BACKTICK_QUOTE : self::TOKEN_TYPE_QUOTE ), + self::TOKEN_TYPE => ( ( $string[ 0 ] === '`' || $string[ 0 ] === '[' ) ? self::TOKEN_TYPE_BACKTICK_QUOTE : self::TOKEN_TYPE_QUOTE ), self::TOKEN_VALUE => self::getQuotedString( $string ) ); } // User-defined Variable - if ( ( $string[0] === '@' || $string[0] === ':' ) && isset( $string[1] ) ) { + if ( ( $string[ 0 ] === '@' || $string[ 0 ] === ':' ) && isset( $string[ 1 ] ) ) { $ret = array( self::TOKEN_VALUE => null, self::TOKEN_TYPE => self::TOKEN_TYPE_VARIABLE ); // If the variable name is quoted - if ( $string[1] === '"' || $string[1] === '\'' || $string[1] === '`' ) { - $ret[ self::TOKEN_VALUE ] = $string[0] . self::getQuotedString( substr( $string, 1 ) ); + if ( $string[ 1 ] === '"' || $string[ 1 ] === '\'' || $string[ 1 ] === '`' ) { + $ret[ self::TOKEN_VALUE ] = $string[ 0 ] . self::getQuotedString( substr( $string, 1 ) ); } // Non-quoted variable name else { - preg_match( '/^(' . $string[0] . '[a-zA-Z0-9\._\$]+)/', $string, $matches ); + preg_match( '/^(' . $string[ 0 ] . '[a-zA-Z0-9\._\$]+)/', $string, $matches ); if ( $matches ) { - $ret[ self::TOKEN_VALUE ] = $matches[1]; + $ret[ self::TOKEN_VALUE ] = $matches[ 1 ]; } } @@ -852,7 +852,7 @@ protected static function getNextToken( $string, $previous = null ) { // Number (decimal, binary, or hex) if ( preg_match( '/^([0-9]+(\.[0-9]+)?|0x[0-9a-fA-F]+|0b[01]+)($|\s|"\'`|' . self::$regex_boundaries . ')/', $string, $matches ) ) { return array( - self::TOKEN_VALUE => $matches[1], + self::TOKEN_VALUE => $matches[ 1 ], self::TOKEN_TYPE => self::TOKEN_TYPE_NUMBER ); } @@ -860,7 +860,7 @@ protected static function getNextToken( $string, $previous = null ) { // Boundary Character (punctuation and symbols) if ( preg_match( '/^(' . self::$regex_boundaries . ')/', $string, $matches ) ) { return array( - self::TOKEN_VALUE => $matches[1], + self::TOKEN_VALUE => $matches[ 1 ], self::TOKEN_TYPE => self::TOKEN_TYPE_BOUNDARY ); } @@ -873,21 +873,21 @@ protected static function getNextToken( $string, $previous = null ) { if ( preg_match( '/^(' . self::$regex_reserved_toplevel . ')($|\s|' . self::$regex_boundaries . ')/', $upper, $matches ) ) { return array( self::TOKEN_TYPE => self::TOKEN_TYPE_RESERVED_TOPLEVEL, - self::TOKEN_VALUE => substr( $string, 0, strlen( $matches[1] ) ) + self::TOKEN_VALUE => substr( $string, 0, strlen( $matches[ 1 ] ) ) ); } // Newline Reserved Word if ( preg_match( '/^(' . self::$regex_reserved_newline . ')($|\s|' . self::$regex_boundaries . ')/', $upper, $matches ) ) { return array( self::TOKEN_TYPE => self::TOKEN_TYPE_RESERVED_NEWLINE, - self::TOKEN_VALUE => substr( $string, 0, strlen( $matches[1] ) ) + self::TOKEN_VALUE => substr( $string, 0, strlen( $matches[ 1 ] ) ) ); } // Other Reserved Word if ( preg_match( '/^(' . self::$regex_reserved . ')($|\s|' . self::$regex_boundaries . ')/', $upper, $matches ) ) { return array( self::TOKEN_TYPE => self::TOKEN_TYPE_RESERVED, - self::TOKEN_VALUE => substr( $string, 0, strlen( $matches[1] ) ) + self::TOKEN_VALUE => substr( $string, 0, strlen( $matches[ 1 ] ) ) ); } } @@ -899,7 +899,7 @@ protected static function getNextToken( $string, $previous = null ) { if ( preg_match( '/^(' . self::$regex_function . '[(]|\s|[)])/', $upper, $matches ) ) { return array( self::TOKEN_TYPE => self::TOKEN_TYPE_RESERVED, - self::TOKEN_VALUE => substr( $string, 0, strlen( $matches[1] ) - 1 ) + self::TOKEN_VALUE => substr( $string, 0, strlen( $matches[ 1 ] ) - 1 ) ); } @@ -907,7 +907,7 @@ protected static function getNextToken( $string, $previous = null ) { preg_match( '/^(.*?)($|\s|["\'`]|' . self::$regex_boundaries . ')/', $string, $matches ); return array( - self::TOKEN_VALUE => $matches[1], + self::TOKEN_VALUE => $matches[ 1 ], self::TOKEN_TYPE => self::TOKEN_TYPE_WORD ); } @@ -921,7 +921,7 @@ protected static function getQuotedString( $string ) { // 3. double quoted string using "" or \" to escape // 4. single quoted string using '' or \' to escape if ( preg_match( '/^(((`[^`]*($|`))+)|((\[[^\]]*($|\]))(\][^\]]*($|\]))*)|(("[^"\\\\]*(?:\\\\.[^"\\\\]*)*("|$))+)|((\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*(\'|$))+))/s', $string, $matches ) ) { - $ret = $matches[1]; + $ret = $matches[ 1 ]; } return $ret; @@ -1032,8 +1032,8 @@ public static function format( $string, $highlight = true ) { $tokens = array(); foreach ( $original_tokens as $i => $token ) { if ( $token[ self::TOKEN_TYPE ] !== self::TOKEN_TYPE_WHITESPACE ) { - $token['i'] = $i; - $tokens[] = $token; + $token[ 'i' ] = $i; + $tokens[] = $token; } } @@ -1150,7 +1150,7 @@ public static function format( $string, $highlight = true ) { } // Take out the preceding space unless there was whitespace there in the original query - if ( isset( $original_tokens[ $token['i'] - 1 ] ) && $original_tokens[ $token['i'] - 1 ][ self::TOKEN_TYPE ] !== self::TOKEN_TYPE_WHITESPACE ) { + if ( isset( $original_tokens[ $token[ 'i' ] - 1 ] ) && $original_tokens[ $token[ 'i' ] - 1 ][ self::TOKEN_TYPE ] !== self::TOKEN_TYPE_WHITESPACE ) { $return = rtrim( $return, ' ' ); } @@ -1246,7 +1246,7 @@ public static function format( $string, $highlight = true ) { } // Multiple boundary characters in a row should not have spaces between them (not including parentheses) else if ( $token[ self::TOKEN_TYPE ] === self::TOKEN_TYPE_BOUNDARY ) { if ( isset( $tokens[ $i - 1 ] ) && $tokens[ $i - 1 ][ self::TOKEN_TYPE ] === self::TOKEN_TYPE_BOUNDARY ) { - if ( isset( $original_tokens[ $token['i'] - 1 ] ) && $original_tokens[ $token['i'] - 1 ][ self::TOKEN_TYPE ] !== self::TOKEN_TYPE_WHITESPACE ) { + if ( isset( $original_tokens[ $token[ 'i' ] - 1 ] ) && $original_tokens[ $token[ 'i' ] - 1 ][ self::TOKEN_TYPE ] !== self::TOKEN_TYPE_WHITESPACE ) { $return = rtrim( $return, ' ' ); } } diff --git a/core/main/AJAX.php b/core/main/AJAX.php index dddc472..85c8ca5 100644 --- a/core/main/AJAX.php +++ b/core/main/AJAX.php @@ -25,7 +25,7 @@ public static function instance() : AJAX { } public function load_debuglog() { - $_nonce = isset( $_REQUEST['_ajax_nonce'] ) ? sanitize_text_field( $_REQUEST['_ajax_nonce'] ) : ''; + $_nonce = isset( $_REQUEST[ '_ajax_nonce' ] ) ? sanitize_text_field( $_REQUEST[ '_ajax_nonce' ] ) : ''; $_verify = wp_verify_nonce( $_nonce, 'debugpress-ajax-call' ); if ( $_verify === false ) { diff --git a/core/main/Callback.php b/core/main/Callback.php index cca8071..786b93b 100644 --- a/core/main/Callback.php +++ b/core/main/Callback.php @@ -115,29 +115,29 @@ public function process( string $code, array $callback ) : array { return $this->resolve[ $code ]; } - if ( is_string( $callback['function'] ) && ( strpos( $callback['function'], '::' ) !== false ) ) { - $callback['function'] = explode( '::', $callback['function'] ); + if ( is_string( $callback[ 'function' ] ) && ( strpos( $callback[ 'function' ], '::' ) !== false ) ) { + $callback[ 'function' ] = explode( '::', $callback[ 'function' ] ); } - if ( isset( $callback['class'] ) ) { - $callback['function'] = array( $callback['class'], $callback['function'] ); + if ( isset( $callback[ 'class' ] ) ) { + $callback[ 'function' ] = array( $callback[ 'class' ], $callback[ 'function' ] ); } try { - if ( is_array( $callback['function'] ) ) { - if ( is_object( $callback['function'][0] ) ) { - $_the_class = get_class( $callback['function'][0] ); + if ( is_array( $callback[ 'function' ] ) ) { + if ( is_object( $callback[ 'function' ][ 0 ] ) ) { + $_the_class = get_class( $callback[ 'function' ][ 0 ] ); $_the_access = '->'; } else { - $_the_class = $callback['function'][0]; + $_the_class = $callback[ 'function' ][ 0 ]; $_the_access = '::'; } - $callback['name'] = $_the_class . $_the_access . $callback['function'][1] . '()'; - $ref = new ReflectionMethod( $_the_class, $callback['function'][1] ); - } else if ( is_object( $callback['function'] ) ) { - if ( $callback['function'] instanceof Closure ) { - $ref = new ReflectionFunction( $callback['function'] ); + $callback[ 'name' ] = $_the_class . $_the_access . $callback[ 'function' ][ 1 ] . '()'; + $ref = new ReflectionMethod( $_the_class, $callback[ 'function' ][ 1 ] ); + } else if ( is_object( $callback[ 'function' ] ) ) { + if ( $callback[ 'function' ] instanceof Closure ) { + $ref = new ReflectionFunction( $callback[ 'function' ] ); $filename = $ref->getFileName(); if ( $filename ) { @@ -146,31 +146,31 @@ public function process( string $code, array $callback ) : array { $file = basename( $filename ); } - $callback['name'] = sprintf( __( 'Closure in [%1$d] on line [%2$s]', "debugpress" ), $file, $ref->getStartLine() ); + $callback[ 'name' ] = sprintf( __( 'Closure in [%1$d] on line [%2$s]', "debugpress" ), $file, $ref->getStartLine() ); } else { - $callback['name'] = __( "The Unknown Closure", "debugpress" ); + $callback[ 'name' ] = __( "The Unknown Closure", "debugpress" ); } } else { - $class = get_class( $callback['function'] ); - $callback['name'] = $class . '->__invoke()'; - $ref = new ReflectionMethod( $class, '__invoke' ); + $class = get_class( $callback[ 'function' ] ); + $callback[ 'name' ] = $class . '->__invoke()'; + $ref = new ReflectionMethod( $class, '__invoke' ); } } else { - $callback['name'] = $callback['function'] . '()'; - $ref = new ReflectionFunction( $callback['function'] ); + $callback[ 'name' ] = $callback[ 'function' ] . '()'; + $ref = new ReflectionFunction( $callback[ 'function' ] ); } - $callback['file'] = $ref->getFileName(); - $callback['line'] = $ref->getStartLine(); + $callback[ 'file' ] = $ref->getFileName(); + $callback[ 'line' ] = $ref->getStartLine(); - if ( ! empty( $callback['file'] ) ) { - $callback['origin'] = $this->_origin( $callback['file'] ); + if ( ! empty( $callback[ 'file' ] ) ) { + $callback[ 'origin' ] = $this->_origin( $callback[ 'file' ] ); } else { - $callback['origin'] = 'php::php'; + $callback[ 'origin' ] = 'php::php'; } } catch ( ReflectionException $e ) { - $callback['error'] = new WP_Error( 'reflection-error', $e->getMessage() ); - $callback['origin'] = 'error::error'; + $callback[ 'error' ] = new WP_Error( 'reflection-error', $e->getMessage() ); + $callback[ 'origin' ] = 'error::error'; } $this->resolve[ $code ] = $callback; diff --git a/core/main/Help.php b/core/main/Help.php index a3b7a81..00f2c5b 100644 --- a/core/main/Help.php +++ b/core/main/Help.php @@ -18,16 +18,16 @@ public static function process_hook( $name, bool $hide_core = false ) : array { foreach ( $action as $priority => $callbacks ) { foreach ( $callbacks as $code => $cb ) { - $callback = Callback::instance()->process( $code, $cb ); - $callback['priority'] = $priority; + $callback = Callback::instance()->process( $code, $cb ); + $callback[ 'priority' ] = $priority; - unset( $callback['function'] ); + unset( $callback[ 'function' ] ); - if ( ! isset( $callback['error'] ) ) { + if ( ! isset( $callback[ 'error' ] ) ) { $actions[] = $callback; - if ( ! in_array( $callback['origin'], $origins ) ) { - $origins[] = $callback['origin']; + if ( ! in_array( $callback[ 'origin' ], $origins ) ) { + $origins[] = $callback[ 'origin' ]; } } } diff --git a/core/main/IP.php b/core/main/IP.php index 3d69aed..7bbd8e5 100644 --- a/core/main/IP.php +++ b/core/main/IP.php @@ -103,12 +103,12 @@ public static function is_ipv4_in_range( $ip, $range ) : bool { public static function is_ipv6_in_range( $ip, $range ) : bool { $pieces = explode( '/', $range, 2 ); - $left_piece = $pieces[0]; - $right_piece = $pieces[1]; + $left_piece = $pieces[ 0 ]; + $right_piece = $pieces[ 1 ]; $ip_pieces = explode( '::', $left_piece, 2 ); - $main_ip_piece = $ip_pieces[0]; - $last_ip_piece = $ip_pieces[1]; + $main_ip_piece = $ip_pieces[ 0 ]; + $last_ip_piece = $ip_pieces[ 1 ]; $main_ip_pieces = explode( ":", $main_ip_piece ); foreach ( $main_ip_pieces as $key => $val ) { @@ -129,7 +129,7 @@ public static function is_ipv6_in_range( $ip, $range ) : bool { $last[ $i ] = 'ffff'; } - $main_ip_pieces[7] = $last_piece; + $main_ip_pieces[ 7 ] = $last_piece; } else { for ( $i = $size; $i < 8; $i ++ ) { $first[ $i ] = '0000'; @@ -145,18 +145,18 @@ public static function is_ipv6_in_range( $ip, $range ) : bool { public static function get_full_ipv6( $ip ) : string { $pieces = explode( '/', $ip, 2 ); - $left_piece = $pieces[0]; + $left_piece = $pieces[ 0 ]; $right_piece = null; if ( count( $pieces ) > 1 ) { - $right_piece = $pieces[1]; + $right_piece = $pieces[ 1 ]; } $ip_pieces = explode( "::", $left_piece, 2 ); - $main_ip_piece = $ip_pieces[0]; + $main_ip_piece = $ip_pieces[ 0 ]; $last_ip_piece = null; if ( count( $ip_pieces ) > 1 ) { - $last_ip_piece = $ip_pieces[1]; + $last_ip_piece = $ip_pieces[ 1 ]; } $main_ip_pieces = explode( ':', $main_ip_piece ); @@ -173,7 +173,7 @@ public static function get_full_ipv6( $ip ) : string { $main_ip_pieces[ $i ] = '0000'; } - $main_ip_pieces[7] = $last_piece; + $main_ip_pieces[ 7 ] = $last_piece; } else { for ( $i = $size; $i < 8; $i ++ ) { $main_ip_pieces[ $i ] = '0000'; @@ -224,11 +224,11 @@ public static function is_private_ip( $ip = null ) : bool { public static function is_cloudflare_ip( $ip = null ) : bool { if ( is_null( $ip ) ) { - if ( isset( $_SERVER['HTTP_CF_CONNECTING_IP'] ) ) { - if ( isset( $_SERVER['HTTP_X_REAL_IP'] ) ) { - $ip = $_SERVER['HTTP_X_REAL_IP']; + if ( isset( $_SERVER[ 'HTTP_CF_CONNECTING_IP' ] ) ) { + if ( isset( $_SERVER[ 'HTTP_X_REAL_IP' ] ) ) { + $ip = $_SERVER[ 'HTTP_X_REAL_IP' ]; } else { - $ip = $_SERVER['REMOTE_ADDR']; + $ip = $_SERVER[ 'REMOTE_ADDR' ]; } } else { return false; @@ -253,7 +253,7 @@ public static function is_cloudflare_ip( $ip = null ) : bool { } public static function get_server_ip() { - $ip = IP::validate_ip( $_SERVER['SERVER_ADDR'] ); + $ip = IP::validate_ip( $_SERVER[ 'SERVER_ADDR' ] ); if ( $ip == '::1' ) { $ip = '127.0.0.1'; @@ -289,7 +289,7 @@ public static function get_all_ips() : array { public static function get_visitor_ip( $no_local_or_protected = false ) { if ( IP::is_cloudflare_ip() ) { - return IP::validate_ip( $_SERVER['HTTP_CF_CONNECTING_IP'], true ); + return IP::validate_ip( $_SERVER[ 'HTTP_CF_CONNECTING_IP' ], true ); } $keys = array( diff --git a/core/main/Info.php b/core/main/Info.php index 12ad16b..cddb821 100644 --- a/core/main/Info.php +++ b/core/main/Info.php @@ -47,12 +47,12 @@ public static function cms_count_plugins() : array { $plugins = array( 'total' => 0, 'active' => 0, 'inactive' => 0 ); foreach ( array_keys( $all_plugins ) as $plugin ) { - $plugins['total'] ++; + $plugins[ 'total' ] ++; if ( is_plugin_active( $plugin ) ) { - $plugins['active'] ++; + $plugins[ 'active' ] ++; } else { - $plugins['inactive'] ++; + $plugins[ 'inactive' ] ++; } } @@ -65,19 +65,19 @@ public static function cms_count_plugins() : array { public static function cms_count_plugins_total() : int { $data = Info::cms_count_plugins(); - return $data['total']; + return $data[ 'total' ]; } public static function cms_count_plugins_active() : int { $data = Info::cms_count_plugins(); - return $data['active']; + return $data[ 'active' ]; } public static function cms_count_plugins_inactive() : int { $data = Info::cms_count_plugins(); - return $data['inactive']; + return $data[ 'inactive' ]; } public static function cms_count_themes() : int { @@ -149,7 +149,7 @@ public static function apache_mod_alias() : string { } public static function server_name() : string { - return (string) $_SERVER['SERVER_SOFTWARE']; + return (string) $_SERVER[ 'SERVER_SOFTWARE' ]; } public static function server_os() : string { @@ -157,15 +157,15 @@ public static function server_os() : string { } public static function server_hostname() : string { - return (string) $_SERVER['SERVER_NAME']; + return (string) $_SERVER[ 'SERVER_NAME' ]; } public static function server_ip() : string { - return (string) $_SERVER['SERVER_ADDR']; + return (string) $_SERVER[ 'SERVER_ADDR' ]; } public static function server_port() : string { - return (string) $_SERVER['SERVER_PORT']; + return (string) $_SERVER[ 'SERVER_PORT' ]; } public static function mysql_variant() : string { @@ -207,25 +207,25 @@ public static function mysql_database() : array { public static function mysql_database_size() : string { $data = Info::mysql_database(); - return $data['size']; + return $data[ 'size' ]; } public static function mysql_database_free_space() : string { $data = Info::mysql_database(); - return $data['free']; + return $data[ 'free' ]; } public static function mysql_database_tables() : int { $data = Info::mysql_database(); - return $data['tables']; + return $data[ 'tables' ]; } public static function mysql_database_records() : int { $data = Info::mysql_database(); - return $data['records']; + return $data[ 'records' ]; } public static function mysql_wordpress() : array { @@ -250,25 +250,25 @@ public static function mysql_wordpress() : array { public static function mysql_wordpress_size() : string { $data = Info::mysql_wordpress(); - return $data['size']; + return $data[ 'size' ]; } public static function mysql_wordpress_free_space() : string { $data = Info::mysql_wordpress(); - return $data['free']; + return $data[ 'free' ]; } public static function mysql_wordpress_tables() : int { $data = Info::mysql_wordpress(); - return $data['tables']; + return $data[ 'tables' ]; } public static function mysql_wordpress_records() : int { $data = Info::mysql_wordpress(); - return $data['records']; + return $data[ 'records' ]; } public static function php_error_display() : string { @@ -379,7 +379,7 @@ public static function php_zlib() : string { if ( function_exists( 'curl_version' ) ) { $gdi = curl_version(); - return $gdi['libz_version']; + return $gdi[ 'libz_version' ]; } else { return __( "loaded", "debugpress" ); } @@ -392,7 +392,7 @@ public static function php_curl() : string { if ( extension_loaded( 'curl' ) ) { $gdi = curl_version(); - return $gdi['version']; + return $gdi[ 'version' ]; } else { return '' . __( "not loaded", "debugpress" ) . ''; } @@ -410,7 +410,7 @@ public static function php_gd() : string { if ( extension_loaded( 'gd' ) ) { $gdi = gd_info(); - return $gdi['GD Version']; + return $gdi[ 'GD Version' ]; } else { return '' . __( "not loaded", "debugpress" ) . ''; } @@ -421,7 +421,7 @@ public static function php_opcache() : string { if ( function_exists( 'opcache_get_configuration' ) ) { $config = opcache_get_configuration(); - return $config['version']['version']; + return $config[ 'version' ][ 'version' ]; } else { return '' . __( "loaded", "debugpress" ) . ''; } diff --git a/core/main/OPCache.php b/core/main/OPCache.php index e209236..7fe6d5b 100644 --- a/core/main/OPCache.php +++ b/core/main/OPCache.php @@ -39,16 +39,16 @@ public function init() { $_status = opcache_get_status(); $_config = opcache_get_configuration(); - $this->version = $_config['version']['version']; - $this->enabled = $_status['opcache_enabled']; + $this->version = $_config[ 'version' ][ 'version' ]; + $this->enabled = $_status[ 'opcache_enabled' ]; - foreach ( $_config['directives'] as $key => $value ) { + foreach ( $_config[ 'directives' ] as $key => $value ) { $name = substr( $key, 8 ); $this->settings[ $name ] = $value; } - $this->memory = $_status['memory_usage']; - $this->statistics = $_status['opcache_statistics']; + $this->memory = $_status[ 'memory_usage' ]; + $this->statistics = $_status[ 'opcache_statistics' ]; } } } diff --git a/core/main/Plugin.php b/core/main/Plugin.php index 4bf662d..efc808a 100644 --- a/core/main/Plugin.php +++ b/core/main/Plugin.php @@ -19,6 +19,8 @@ class Plugin { 'frontend' => false, 'ajax' => true, 'ajax_to_debuglog' => false, + 'mousetrap' => true, + 'mousetrap_sequence' => 'ctrl+shift+u', 'button_admin' => 'toolbar', 'button_frontend' => 'toolbar', 'for_super_admin' => true, @@ -56,6 +58,7 @@ class Plugin { private $_activate = false; private $_url_activated = false; private $_animated_popup_version = '2.0'; + private $_mousetrap_version = '1.6.5'; private $_wp_version; private $_wp_version_real; private $_cp_version; @@ -141,7 +144,7 @@ public function activation() { $the_access_key = $this->get( 'access_key' ); if ( ! empty( $the_access_key ) ) { - $this->_url_activated = isset( $_GET['debugpress'] ) && sanitize_key( $_GET['debugpress'] ) === $the_access_key; + $this->_url_activated = isset( $_GET[ 'debugpress' ] ) && sanitize_key( $_GET[ 'debugpress' ] ) === $the_access_key; } $this->_allowed = apply_filters( 'debugpress-debugger-is-allowed', $this->is_user_allowed() ); @@ -163,11 +166,21 @@ public function activation() { } public function init() { - wp_register_style( 'animated-popup', DEBUGPRESS_PLUGIN_URL . 'popup/popup.min.css', array(), $this->_animated_popup_version ); + $dependencies = array( + 'jquery', + 'animated-popup' + ); + + if ( $this->get( 'mousetrap' ) ) { + $dependencies[] = 'mousetrap'; + } + + wp_register_style( 'animated-popup', DEBUGPRESS_PLUGIN_URL . 'libraries/popup/popup.min.css', array(), $this->_animated_popup_version ); wp_register_style( 'debugpress-print', DEBUGPRESS_PLUGIN_URL . 'css/prettyprint' . ( DEBUGPRESS_IS_DEBUG ? '' : '.min' ) . '.css', array(), DEBUGPRESS_VERSION ); wp_register_style( 'debugpress', DEBUGPRESS_PLUGIN_URL . 'css/debugpress' . ( DEBUGPRESS_IS_DEBUG ? '' : '.min' ) . '.css', array( 'animated-popup' ), DEBUGPRESS_VERSION ); - wp_register_script( 'animated-popup', DEBUGPRESS_PLUGIN_URL . 'popup/popup.min.js', array( 'jquery' ), $this->_animated_popup_version, true ); - wp_register_script( 'debugpress', DEBUGPRESS_PLUGIN_URL . 'js/debugpress' . ( DEBUGPRESS_IS_DEBUG ? '' : '.min' ) . '.js', array( 'animated-popup' ), DEBUGPRESS_VERSION, true ); + wp_register_script( 'animated-popup', DEBUGPRESS_PLUGIN_URL . 'libraries/popup/popup.min.js', array( 'jquery' ), $this->_animated_popup_version, true ); + wp_register_script( 'mousetrap', DEBUGPRESS_PLUGIN_URL . 'libraries/mousetrap/mousetrap.min.js', array(), $this->_mousetrap_version, true ); + wp_register_script( 'debugpress', DEBUGPRESS_PLUGIN_URL . 'js/debugpress' . ( DEBUGPRESS_IS_DEBUG ? '' : '.min' ) . '.js', $dependencies, DEBUGPRESS_VERSION, true ); if ( $this->is_enabled() ) { Loader::instance(); @@ -196,11 +209,12 @@ public function get( $name, $fallback = false ) { public function process_settings( $input ) : array { $types = array( - 'for_roles' => 'array', - 'access_key' => 'slug', - 'pr' => 'string', - 'button_admin' => 'string', - 'button_frontend' => 'string' + 'for_roles' => 'array', + 'access_key' => 'slug', + 'mousetrap_sequence' => 'string', + 'pr' => 'string', + 'button_admin' => 'string', + 'button_frontend' => 'string' ); $settings = array(); @@ -231,22 +245,22 @@ public function environment() : array { $env = array(); if ( $this->_wp_version > 54 && function_exists( 'wp_get_environment_type' ) ) { - $env['type'] = wp_get_environment_type(); + $env[ 'type' ] = wp_get_environment_type(); - switch ( $env['type'] ) { + switch ( $env[ 'type' ] ) { default: case 'production': - $env['type'] = 'production'; - $env['label'] = __( "Production Environment", "debugpress" ); + $env[ 'type' ] = 'production'; + $env[ 'label' ] = __( "Production Environment", "debugpress" ); break; case 'staging': - $env['label'] = __( "Staging Environment", "debugpress" ); + $env[ 'label' ] = __( "Staging Environment", "debugpress" ); break; case 'local': - $env['label'] = __( "Local Environment", "debugpress" ); + $env[ 'label' ] = __( "Local Environment", "debugpress" ); break; case 'development': - $env['label'] = __( "Development Environment", "debugpress" ); + $env[ 'label' ] = __( "Development Environment", "debugpress" ); break; } } @@ -264,7 +278,7 @@ public function build_stats( $key = 'wp_footer' ) : string { $env = $this->environment(); if ( ! empty( $env ) ) { - $gd .= '' . $env['label'] . ' · '; + $gd .= '' . $env[ 'label' ] . ' · '; } $gd .= Info::cms_name() . ': ' . Info::cms_version() . ' · '; diff --git a/core/main/WP.php b/core/main/WP.php index 2187807..7741f34 100644 --- a/core/main/WP.php +++ b/core/main/WP.php @@ -29,22 +29,22 @@ public function current_url( $use_wp = true ) : string { if ( $use_wp ) { return home_url( $this->current_url_request() ); } else { - $s = empty( $_SERVER['HTTPS'] ) ? '' : ( $_SERVER['HTTPS'] == 'on' ? 's' : '' ); - $protocol = debugpress_strleft( strtolower( $_SERVER['SERVER_PROTOCOL'] ), '/' ) . $s; - $port = $_SERVER['SERVER_PORT'] == '80' || $_SERVER['SERVER_PORT'] == '443' ? '' : ':' . $_SERVER['SERVER_PORT']; + $s = empty( $_SERVER[ 'HTTPS' ] ) ? '' : ( $_SERVER[ 'HTTPS' ] == 'on' ? 's' : '' ); + $protocol = debugpress_strleft( strtolower( $_SERVER[ 'SERVER_PROTOCOL' ] ), '/' ) . $s; + $port = $_SERVER[ 'SERVER_PORT' ] == '80' || $_SERVER[ 'SERVER_PORT' ] == '443' ? '' : ':' . $_SERVER[ 'SERVER_PORT' ]; - return $protocol . '://' . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI']; + return $protocol . '://' . $_SERVER[ 'SERVER_NAME' ] . $port . $_SERVER[ 'REQUEST_URI' ]; } } public function current_url_request() : string { - $path_info = $_SERVER['PATH_INFO'] ?? ''; + $path_info = $_SERVER[ 'PATH_INFO' ] ?? ''; list( $path_info ) = explode( '?', $path_info ); $path_info = str_replace( '%', '%25', $path_info ); - $request = explode( '?', $_SERVER['REQUEST_URI'] ); - $req_uri = $request[0]; - $req_query = $request[1] ?? false; + $request = explode( '?', $_SERVER[ 'REQUEST_URI' ] ); + $req_uri = $request[ 0 ]; + $req_query = $request[ 1 ] ?? false; $home_path = parse_url( home_url(), PHP_URL_PATH ); $home_path = $home_path ? trim( $home_path, '/' ) : ''; $home_path_regex = sprintf( '|^%s|i', preg_quote( $home_path, '|' ) ); diff --git a/core/panel/Basics.php b/core/panel/Basics.php index 631a39d..36fcf61 100644 --- a/core/panel/Basics.php +++ b/core/panel/Basics.php @@ -16,9 +16,9 @@ public function left() { $test = $this->_test(); if ( ! empty( $env ) ) { - echo '
'; + echo '
'; - $this->title( $env['label'], true, true ); + $this->title( $env[ 'label' ], true, true ); echo '
'; } @@ -29,8 +29,8 @@ public function left() { $this->title( ' ' . __( "Debug mode problems", "debugpress" ), true, true ); $this->block_header(); foreach ( $test as $t ) { - $this->sub_title( $t[0] ); - echo $t[1]; + $this->sub_title( $t[ 0 ] ); + echo $t[ 1 ]; echo ' ' . __( "More Information", "debugpress" ) . ''; } $this->block_footer(); @@ -131,10 +131,10 @@ public function right() { foreach ( debugpress_tracker()->snapshots as $name => $obj ) { $this->table_row( array( $name, - debugpress_format_size( $obj['memory'] ), - number_format( $obj['time'], 5 ), - $obj['queries'], - $obj['hooks'] + debugpress_format_size( $obj[ 'memory' ] ), + number_format( $obj[ 'time' ], 5 ), + $obj[ 'queries' ], + $obj[ 'hooks' ] ) ); } $this->table_foot(); diff --git a/core/panel/Constants.php b/core/panel/Constants.php index 2024036..faaadeb 100644 --- a/core/panel/Constants.php +++ b/core/panel/Constants.php @@ -131,35 +131,35 @@ class Constants extends Panel { public function left() { $this->title( __( "Path, directories", "debugpress" ) ); - $this->list_defines( $this->constants['paths'] ); + $this->list_defines( $this->constants[ 'paths' ] ); $this->title( __( "Debug", "debugpress" ) ); - $this->list_defines( $this->constants['dbg'] ); + $this->list_defines( $this->constants[ 'dbg' ] ); $this->title( __( "System", "debugpress" ) ); - $this->list_defines( $this->constants['sys'] ); + $this->list_defines( $this->constants[ 'sys' ] ); $this->title( __( "Theme", "debugpress" ) ); - $this->list_defines( $this->constants['thm'] ); + $this->list_defines( $this->constants[ 'thm' ] ); $this->title( __( "Database", "debugpress" ) ); - $this->list_defines( $this->constants['db'] ); + $this->list_defines( $this->constants[ 'db' ] ); $this->title( __( "Request", "debugpress" ) ); - $this->list_defines( $this->constants['req'] ); + $this->list_defines( $this->constants[ 'req' ] ); } public function right() { $this->title( __( "Global", "debugpress" ) ); - $this->list_defines( $this->constants['glbl'] ); + $this->list_defines( $this->constants[ 'glbl' ] ); $this->title( __( "Multisite", "debugpress" ) ); - $this->list_defines( $this->constants['ms'] ); + $this->list_defines( $this->constants[ 'ms' ] ); $this->title( __( "Security", "debugpress" ) ); - $this->list_defines( $this->constants['sec'] ); + $this->list_defines( $this->constants[ 'sec' ] ); $this->title( __( "Back Compatibility", "debugpress" ) ); - $this->list_defines( $this->constants['bck'] ); + $this->list_defines( $this->constants[ 'bck' ] ); } } \ No newline at end of file diff --git a/core/panel/HTTP.php b/core/panel/HTTP.php index c474d99..0288590 100644 --- a/core/panel/HTTP.php +++ b/core/panel/HTTP.php @@ -28,11 +28,11 @@ public function render_request( $request ) { $url = 'N/A'; $arg = array(); - if ( isset( $request['info']['url'] ) ) { - $raw_url = explode( '?', $request['info']['url'], 2 ); + if ( isset( $request[ 'info' ][ 'url' ] ) ) { + $raw_url = explode( '?', $request[ 'info' ][ 'url' ], 2 ); - $url = $raw_url[0]; - $arg = isset( $raw_url[1] ) ? explode( '&', $raw_url[1] ) : array(); + $url = $raw_url[ 0 ]; + $arg = isset( $raw_url[ 1 ] ) ? explode( '&', $raw_url[ 1 ] ) : array(); } if ( ! empty( $arg ) ) { @@ -40,36 +40,36 @@ public function render_request( $request ) { } $_req = array( - __( "Transport", "debugpress" ) => $request['transport'], - __( "Method", "debugpress" ) => $request['args']['method'] ?? 'N/A', - __( "User Agent", "debugpress" ) => $request['args']['user-agent'] ?? 'N/A', - __( "Timeout", "debugpress" ) => $request['args']['timeout'] ?? 'N/A', - __( "Redirection", "debugpress" ) => $request['args']['redirection'] ?? 'N/A', - __( "HTTP Version", "debugpress" ) => $request['args']['httpversion'] ?? 'N/A' + __( "Transport", "debugpress" ) => $request[ 'transport' ], + __( "Method", "debugpress" ) => $request[ 'args' ][ 'method' ] ?? 'N/A', + __( "User Agent", "debugpress" ) => $request[ 'args' ][ 'user-agent' ] ?? 'N/A', + __( "Timeout", "debugpress" ) => $request[ 'args' ][ 'timeout' ] ?? 'N/A', + __( "Redirection", "debugpress" ) => $request[ 'args' ][ 'redirection' ] ?? 'N/A', + __( "HTTP Version", "debugpress" ) => $request[ 'args' ][ 'httpversion' ] ?? 'N/A' ); $_ip = 'N/A'; - if ( isset( $request['info']['primary_ip'] ) ) { - $_ip = $request['info']['primary_ip']; + if ( isset( $request[ 'info' ][ 'primary_ip' ] ) ) { + $_ip = $request[ 'info' ][ 'primary_ip' ]; - if ( isset( $request['info']['primary_port'] ) ) { - $_ip .= ':' . $request['info']['primary_port']; + if ( isset( $request[ 'info' ][ 'primary_port' ] ) ) { + $_ip .= ':' . $request[ 'info' ][ 'primary_port' ]; } } $_res = array( - __( "Code", "debugpress" ) => $request['info']['http_code'] ?? 'N/A', - __( "Content Type", "debugpress" ) => $request['info']['content_type'] ?? 'N/A', + __( "Code", "debugpress" ) => $request[ 'info' ][ 'http_code' ] ?? 'N/A', + __( "Content Type", "debugpress" ) => $request[ 'info' ][ 'content_type' ] ?? 'N/A', __( "IP and Port", "debugpress" ) => $_ip ); $_tme = array( - __( "Total", "debugpress" ) => '' . ( $request['info']['total_time'] ?? 'N/A' ) . '', - __( "DNS Resolution", "debugpress" ) => $request['info']['namelookup_time'] ?? 'N/A', - __( "Connect", "debugpress" ) => $request['info']['connect_time'] ?? 'N/A', - __( "Pre-transfer", "debugpress" ) => $request['info']['pretransfer_time'] ?? 'N/A', - __( "Redirect", "debugpress" ) => $request['info']['redirect_time'] ?? 'N/A' + __( "Total", "debugpress" ) => '' . ( $request[ 'info' ][ 'total_time' ] ?? 'N/A' ) . '', + __( "DNS Resolution", "debugpress" ) => $request[ 'info' ][ 'namelookup_time' ] ?? 'N/A', + __( "Connect", "debugpress" ) => $request[ 'info' ][ 'connect_time' ] ?? 'N/A', + __( "Pre-transfer", "debugpress" ) => $request[ 'info' ][ 'pretransfer_time' ] ?? 'N/A', + __( "Redirect", "debugpress" ) => $request[ 'info' ][ 'redirect_time' ] ?? 'N/A' ); $this->table_row( array( diff --git a/core/panel/Hooks.php b/core/panel/Hooks.php index 09fdc15..cb43009 100644 --- a/core/panel/Hooks.php +++ b/core/panel/Hooks.php @@ -18,13 +18,13 @@ class Hooks extends Panel { public function __construct() { global $wp_actions, $wp_filters, $wp_filter; - $this->origins['none::none'] = __( "No Callbacks", "debugpress" ); - $this->origins['php::php'] = __( "PHP", "debugpress" ); - $this->origins['core::core'] = __( "WordPress Core", "debugpress" ); - $this->origins['stylesheet::child-theme'] = __( "Child Theme", "debugpress" ) . ': ' . Info::cms_stylesheet_theme_name(); - $this->origins['stylesheet::theme'] = __( "Theme", "debugpress" ) . ': ' . Info::cms_templates_theme_name(); - $this->origins['template::theme'] = __( "Theme", "debugpress" ) . ': ' . Info::cms_templates_theme_name(); - $this->origins_order['none::none'] = 0; + $this->origins[ 'none::none' ] = __( "No Callbacks", "debugpress" ); + $this->origins[ 'php::php' ] = __( "PHP", "debugpress" ); + $this->origins[ 'core::core' ] = __( "WordPress Core", "debugpress" ); + $this->origins[ 'stylesheet::child-theme' ] = __( "Child Theme", "debugpress" ) . ': ' . Info::cms_stylesheet_theme_name(); + $this->origins[ 'stylesheet::theme' ] = __( "Theme", "debugpress" ) . ': ' . Info::cms_templates_theme_name(); + $this->origins[ 'template::theme' ] = __( "Theme", "debugpress" ) . ': ' . Info::cms_templates_theme_name(); + $this->origins_order[ 'none::none' ] = 0; $hook_names = array_keys( $wp_filter ); @@ -33,10 +33,10 @@ public function __construct() { $this->hooks[] = $hook; - if ( isset( $hook['origins'] ) && ! empty( $hook['origins'] ) ) { - $this->process_origin( $hook['origins'] ); + if ( isset( $hook[ 'origins' ] ) && ! empty( $hook[ 'origins' ] ) ) { + $this->process_origin( $hook[ 'origins' ] ); } else { - ++ $this->origins_order['none::none']; + ++ $this->origins_order[ 'none::none' ]; } } } @@ -53,8 +53,8 @@ private function process_origin( $origins ) { $parts = explode( '::', $origin, 2 ); $title = ''; - if ( $parts[0] == 'plugin' ) { - $title = __( "Plugin", "debugpress" ) . ': ' . $parts[1]; + if ( $parts[ 0 ] == 'plugin' ) { + $title = __( "Plugin", "debugpress" ) . ': ' . $parts[ 1 ]; } $this->origins[ $origin ] = $title; @@ -108,17 +108,17 @@ public function right() { $this->table_head( array(), 'dbg-hooks-list' ); foreach ( $this->hooks as $hook ) { - $rows = count( $hook['actions'] ); + $rows = count( $hook[ 'actions' ] ); if ( $rows == 0 ) { - echo '' . $hook['name'] . '' . __( "No callbacks registered for this hook.", "debugpress" ) . ''; + echo '' . $hook[ 'name' ] . '' . __( "No callbacks registered for this hook.", "debugpress" ) . ''; } else { - echo ''; - echo '' . $hook['name'] . ''; + echo ''; + echo '' . $hook[ 'name' ] . ''; echo ''; echo ''; - foreach ( $hook['actions'] as $action ) { - echo ''; + foreach ( $hook[ 'actions' ] as $action ) { + echo ''; $this->_action( $action ); echo ''; } @@ -150,21 +150,21 @@ private function _row_filter_classes( $actions ) : string { } private function _action( $action ) { - echo ''; - echo ''; + echo ''; - echo ''; + echo ''; } } diff --git a/core/panel/Layout.php b/core/panel/Layout.php index c40b613..225e6a5 100644 --- a/core/panel/Layout.php +++ b/core/panel/Layout.php @@ -69,8 +69,8 @@ public function single() { echo '
' . ( $action['priority'] ?? 10 ) . '' . $action['name'].''; + echo '' . ( $action[ 'priority' ] ?? 10 ) . '' . $action[ 'name' ] . ''; - if ( isset( $action['file'] ) && ! empty( $action['file'] ) ) { + if ( isset( $action[ 'file' ] ) && ! empty( $action[ 'file' ] ) ) { echo ''; - echo '
' . __( "In File", "debugpress" ) . ': ' . $action['file'] . ''; + echo '
' . __( "In File", "debugpress" ) . ': ' . $action[ 'file' ] . ''; - if ( isset( $action['line'] ) && ! empty( $action['line'] ) ) { - echo '' . __( "On Line", "debugpress" ) . ': ' . $action['line'] . ''; + if ( isset( $action[ 'line' ] ) && ! empty( $action[ 'line' ] ) ) { + echo '' . __( "On Line", "debugpress" ) . ': ' . $action[ 'line' ] . ''; } echo '
'; } echo '
' . $this->origins[$action['origin']] . '' . $this->origins[ $action[ 'origin' ] ] . '
',u.each(e.headers,function(e,s){p+=""}),p+="
NameValue
"+e+""+s+"
",s.append(p),u(".debugpress-debug-has-ajax",r).show().html(a),r.fadeOut(50).fadeIn(50).fadeOut(100).fadeIn(100).fadeOut(50).fadeIn(50)},headers:function(e){var e=e.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};return u.each(e,function(e,s){var s=s.split(": "),t=s.shift(),s=s.join(": ");"x-debugpress-"===t.substring(0,13).toLowerCase()&&(t=t.substring(13),r[t]=s)}),r}},hooks:{filters:{all:{types:[]},active:{show:"all",types:[]}},init:function(){this.prepare(),this.events()},prepare:function(){u("#debugpress-debugger-tab-hooks .sqlq-option-type").each(function(){var e=u(this).data("type");wp.dev4press.debugpress.tabs.hooks.filters.active.types.push(e),wp.dev4press.debugpress.tabs.hooks.filters.all.types.push(e)})},filter:function(){for(var e,s=0;s tbody > tr."+e).hide();for(s=0;s tbody > tr."+e).show()},events:function(){u(p).on("click","#debugpress-debugger-tab-hooks .sqlq-option-callbacks",function(e){var s;e.preventDefault(),u(this).hasClass("sqlq-option-off")&&(e=u(this).attr("id").substring(9),s=u(".dbg-hooks-actions .dbg-hook-column-action"),"full"===e?s.addClass("dbg-calls-show"):s.removeClass("dbg-calls-show"),u("#debugpress-debugger-tab-hooks .sqlq-option-callbacks").addClass("sqlq-option-off").removeClass("sqlq-option-on"),u(this).removeClass("sqlq-option-off").addClass("sqlq-option-on"))}),u(p).on("click","#debugpress-debugger-tab-hooks .sqlq-option-type",function(e){e.preventDefault();var s=u(this).data("type");u(this).hasClass("sqlq-option-off")?(wp.dev4press.debugpress.tabs.hooks.filters.active.types.push(s),u(this).addClass("sqlq-option-on").removeClass("sqlq-option-off")):(wp.dev4press.debugpress.tabs.hooks.filters.active.types=wp.dev4press.debugpress.tabs.hooks.filters.active.types.filter(function(e){return e!==s}),u(this).addClass("sqlq-option-off").removeClass("sqlq-option-on")),wp.dev4press.debugpress.tabs.hooks.filter()}),u(p).on("click","#debugpress-debugger-tab-hooks .sqlq-types-reset",function(e){e.preventDefault(),"hide"===u(this).attr("id").substring(10)?(wp.dev4press.debugpress.tabs.hooks.filters.active.types=[],u("#debugpress-debugger-tab-hooks .sqlq-option-type").addClass("sqlq-option-off").removeClass("sqlq-option-on")):(wp.dev4press.debugpress.tabs.hooks.filters.active.types=wp.dev4press.debugpress.tabs.hooks.filters.all.types,u("#debugpress-debugger-tab-hooks .sqlq-option-type").addClass("sqlq-option-on").removeClass("sqlq-option-off")),u("#debugpress-debugger-tab-hooks .sqlq-types-reset").addClass("sqlq-option-off").removeClass("sqlq-option-on"),u(this).removeClass("sqlq-option-off").addClass("sqlq-option-on"),wp.dev4press.debugpress.tabs.hooks.filter()}),u(p).on("click","#debugpress-debugger-tab-hooks .dbg-callback-button-expander",function(){var e=u(this).parent();u(this).next();e.hasClass("dbg-calls-show")?e.removeClass("dbg-calls-show"):e.addClass("dbg-calls-show")})}},queries:{filters:{total:{queries:0,total:0},all:{caller:[],types:[],tables:[]},active:{show:"all",caller:[],types:[],tables:[]}},init:function(){this.prepare(),this.events()},prepare:function(){var e=u("#debugpress-debugger-tab-queries .sqlq-option-caller"),s=u("#debugpress-debugger-tab-queries .sqlq-option-type"),t=u("#debugpress-debugger-tab-queries .sqlq-option-table");wp.dev4press.debugpress.tabs.queries.filters.total.queries=parseInt(u("#sqlq-stats-filter-queries").html()),wp.dev4press.debugpress.tabs.queries.filters.total.total=parseFloat(u("#sqlq-stats-filter-total").html()),e.each(function(){var e=parseInt(u(this).data("caller"));wp.dev4press.debugpress.tabs.queries.filters.active.caller.push(e),wp.dev4press.debugpress.tabs.queries.filters.all.caller.push(e)}),s.each(function(){var e=u(this).data("type");wp.dev4press.debugpress.tabs.queries.filters.active.types.push(e),wp.dev4press.debugpress.tabs.queries.filters.all.types.push(e)}),t.each(function(){var e=parseInt(u(this).data("table"));wp.dev4press.debugpress.tabs.queries.filters.active.tables.push(e),wp.dev4press.debugpress.tabs.queries.filters.all.tables.push(e)})},filter:function(){var e=u(".sql-query-list > .sql-query"),l={queries:0,total:0,min:!1,max:!1,avg:0},s={queries:0,total:0};e.each(function(){var e,s,t=u(this).data("caller"),r=(u(this).data("tables")+"").split(","),a=u(this).data("type"),p=u(this).data("speed"),o=parseFloat(u(this).data("time")),d=wp.dev4press.debugpress.tabs.queries.filters.active,i=!0;if(i=(i=(i="all"!==d.show&&d.show!==p?!1:i)&&-1===d.caller.indexOf(t)?!1:i)&&-1===d.types.indexOf(a)?!1:i){for(e=s=0;e