diff --git a/components/admin.php b/components/admin.php index a90fd2ecd..108053428 100644 --- a/components/admin.php +++ b/components/admin.php @@ -20,6 +20,9 @@ function process() { global $current_screen, $pagenow; + if ( !is_admin() ) + return; + if ( !isset( $current_screen ) or empty( $current_screen ) ) { # Pre-3.0 compat: @@ -57,15 +60,20 @@ function process() { function admin_menu( $menu ) { - $menu[] = $this->menu( array( - 'title' => sprintf( __( 'Admin Screen: %s', 'query_monitor' ), $this->data['base'] ) - ) ); + if ( isset( $this->data['base'] ) ) { + $menu[] = $this->menu( array( + 'title' => sprintf( __( 'Admin Screen: %s', 'query_monitor' ), $this->data['base'] ) + ) ); + } return $menu; } function output( $args, $data ) { + if ( empty( $data ) ) + return; + $post_type_warning = ''; echo '
{$r} | \n"; $row_class = 'qm-warn'; } else { diff --git a/components/environment.php b/components/environment.php index f067a49e6..5dd10f974 100644 --- a/components/environment.php +++ b/components/environment.php @@ -23,17 +23,21 @@ function process() { global $wp_version, $blog_id; $vars = array( - 'key_buffer_size' => true, # Key cache limit - 'max_allowed_packet' => false, # Max individual query size - 'max_connections' => false, # Max client connections - 'query_cache_limit' => true, # Individual query cache limit - 'query_cache_size' => true, # Query cache limit + 'key_buffer_size' => true, # Key cache size limit + 'max_allowed_packet' => false, # Individual query size limit + 'max_connections' => false, # Max number of client connections + # 'profiling' => 'OFF', # Query profiling on or off + 'query_cache_limit' => true, # Individual query cache size limit + 'query_cache_size' => true, # Total cache size limit 'query_cache_type' => 'ON' # Query cache on or off ); if ( $dbq = $this->get_component( 'db_queries' ) ) { - foreach ( $dbq->data['db_objects'] as $id => $db ) { + foreach ( $dbq->db_objects as $id => $db ) { + + if ( !$dbq->is_db_object( $db ) ) + continue; $variables = $db->get_results( " SHOW VARIABLES @@ -43,6 +47,8 @@ function process() { $this->data['db'][$id] = array( 'version' => mysql_get_server_info( $db->dbh ), 'user' => $db->dbuser, + 'host' => $db->dbhost, + 'name' => $db->dbname, 'vars' => $vars, 'variables' => $variables ); @@ -112,7 +118,7 @@ function output( $args, $data ) { $name = $id . '||||
' . $name . ' | '; + echo '' . $name . ' | '; echo 'version | '; echo '' . $db['version'] . ' | '; echo '' . $db['user'] . ' | '; echo ''; + echo '
host | '; + echo '' . $db['host'] . ' | '; + echo '|||
database | '; + echo '' . $db['name'] . ' | '; + echo '|||
' . $action['priority'] . ' | '; echo ''; - echo $action['function']; + echo esc_html( $action['function'] ); echo ' | '; echo '|||
' . $message . ' | '; - echo '' . esc_html( $error->file ) . ' | '; + echo '' . esc_html( $error->filename ) . ' | '; echo '' . esc_html( $error->line ) . ' | '; echo '' . esc_html( $func ) . ' | '; echo ''; + print_r( $value ); + echo ' | ';
} else {
$value = esc_html( $value );
echo "{$value} | "; diff --git a/components/theme.php b/components/theme.php index a029d9bf2..2a47e66e9 100644 --- a/components/theme.php +++ b/components/theme.php @@ -16,12 +16,21 @@ function body_class( $class ) { } function process() { + global $template; + + if ( is_admin() ) + return; + $this->data['template_file'] = apply_filters( 'query_monitor_template', basename( $template ) ); + } function output( $args, $data ) { + if ( empty( $data ) ) + return; + echo '