Query Monitor - Version 2.14.0

Version Description

Download this release

Release Info

Developer johnbillion
Plugin Icon 128x128 Query Monitor
Version 2.14.0
Comparing to
See all releases

Code changes from version 2.13.4 to 2.14.0

assets/query-monitor.css CHANGED
@@ -311,6 +311,7 @@ body.wp-admin.folded #qm {
311
  .qm caption,
312
  .qm th[scope=col] {
313
  border-bottom-width: 0 !important;
 
314
  }
315
 
316
  .qm caption {
@@ -486,6 +487,8 @@ body.wp-admin.folded #qm {
486
  text-decoration: none !important;
487
  text-shadow: none !important;
488
  font-weight: normal !important;
 
 
489
  }
490
 
491
  #qm-title a:focus,
@@ -503,7 +506,7 @@ body.wp-admin.folded #qm {
503
  .qm .qm-toggle,
504
  html[dir="rtl"] .qm .qm-ltr .qm-toggle {
505
  color: #0073aa !important;
506
- padding: 5px 8px !important;
507
  border-top: none !important;
508
  border-right: none !important;
509
  border-left: 1px solid #e8e8e8 !important;
311
  .qm caption,
312
  .qm th[scope=col] {
313
  border-bottom-width: 0 !important;
314
+ margin-bottom: 0 !important;
315
  }
316
 
317
  .qm caption {
487
  text-decoration: none !important;
488
  text-shadow: none !important;
489
  font-weight: normal !important;
490
+ border: none !important;
491
+ cursor: pointer !important;
492
  }
493
 
494
  #qm-title a:focus,
506
  .qm .qm-toggle,
507
  html[dir="rtl"] .qm .qm-ltr .qm-toggle {
508
  color: #0073aa !important;
509
+ padding: 4px 7px 3px !important;
510
  border-top: none !important;
511
  border-right: none !important;
512
  border-left: 1px solid #e8e8e8 !important;
classes/QueryMonitor.php CHANGED
@@ -26,7 +26,7 @@ class QueryMonitor extends QM_Plugin {
26
  parent::__construct( $file );
27
 
28
  # Load and register built-in collectors:
29
- foreach ( glob( $this->plugin_path( 'collectors/*.php' ) ) as $file ) {
30
  include $file;
31
  }
32
 
26
  parent::__construct( $file );
27
 
28
  # Load and register built-in collectors:
29
+ foreach ( apply_filters( 'qm/built-in-collectors', glob( $this->plugin_path( 'collectors/*.php' ) ) ) as $file ) {
30
  include $file;
31
  }
32
 
collectors/environment.php CHANGED
@@ -51,39 +51,35 @@ class QM_Collector_Environment extends QM_Collector {
51
  }
52
 
53
  public static function get_error_levels( $error_reporting ) {
54
-
55
- $levels = array();
56
-
57
- $constants = array(
58
- 'E_ERROR',
59
- 'E_WARNING',
60
- 'E_PARSE',
61
- 'E_NOTICE',
62
- 'E_CORE_ERROR',
63
- 'E_CORE_WARNING',
64
- 'E_COMPILE_ERROR',
65
- 'E_COMPILE_WARNING',
66
- 'E_USER_ERROR',
67
- 'E_USER_WARNING',
68
- 'E_USER_NOTICE',
69
- 'E_STRICT',
70
- 'E_RECOVERABLE_ERROR',
71
- 'E_DEPRECATED',
72
- 'E_USER_DEPRECATED',
73
- 'E_ALL'
74
  );
75
 
76
- foreach ( $constants as $level ) {
77
  if ( defined( $level ) ) {
78
  $c = constant( $level );
79
  if ( $error_reporting & $c ) {
80
- $levels[$c] = $level;
81
  }
82
  }
83
  }
84
 
85
  return $levels;
86
-
87
  }
88
 
89
  public function process() {
51
  }
52
 
53
  public static function get_error_levels( $error_reporting ) {
54
+ $levels = array(
55
+ 'E_ERROR' => false,
56
+ 'E_WARNING' => false,
57
+ 'E_PARSE' => false,
58
+ 'E_NOTICE' => false,
59
+ 'E_CORE_ERROR' => false,
60
+ 'E_CORE_WARNING' => false,
61
+ 'E_COMPILE_ERROR' => false,
62
+ 'E_COMPILE_WARNING' => false,
63
+ 'E_USER_ERROR' => false,
64
+ 'E_USER_WARNING' => false,
65
+ 'E_USER_NOTICE' => false,
66
+ 'E_STRICT' => false,
67
+ 'E_RECOVERABLE_ERROR' => false,
68
+ 'E_DEPRECATED' => false,
69
+ 'E_USER_DEPRECATED' => false,
70
+ 'E_ALL' => false,
 
 
 
71
  );
72
 
73
+ foreach ( $levels as $level => $reported ) {
74
  if ( defined( $level ) ) {
75
  $c = constant( $level );
76
  if ( $error_reporting & $c ) {
77
+ $levels[ $level ] = true;
78
  }
79
  }
80
  }
81
 
82
  return $levels;
 
83
  }
84
 
85
  public function process() {
collectors/languages.php CHANGED
@@ -51,8 +51,10 @@ class QM_Collector_Languages extends QM_Collector {
51
  foreach ( $filtered as $i => $item ) {
52
 
53
  if ( in_array( $item['function'], array(
 
54
  'load_plugin_textdomain',
55
  'load_theme_textdomain',
 
56
  'load_default_textdomain',
57
  ), true ) ) {
58
  $caller = $item;
51
  foreach ( $filtered as $i => $item ) {
52
 
53
  if ( in_array( $item['function'], array(
54
+ 'load_muplugin_textdomain',
55
  'load_plugin_textdomain',
56
  'load_theme_textdomain',
57
+ 'load_child_theme_textdomain',
58
  'load_default_textdomain',
59
  ), true ) ) {
60
  $caller = $item;
collectors/php_errors.php CHANGED
@@ -51,7 +51,9 @@ class QM_Collector_PHP_Errors extends QM_Collector {
51
 
52
  }
53
 
54
- public function error_handler( $errno, $message, $file = null, $line = null ) {
 
 
55
 
56
  switch ( $errno ) {
57
 
51
 
52
  }
53
 
54
+ public function error_handler( $errno, $message, $file = null, $line = null, $context = null ) {
55
+
56
+ do_action( 'qm/collect/new_php_error', $errno, $message, $file, $line, $context );
57
 
58
  switch ( $errno ) {
59
 
output/Html.php CHANGED
@@ -177,7 +177,8 @@ abstract class QM_Output_Html extends QM_Output {
177
  /**
178
  * Returns a file path, name, and line number. Safe for output.
179
  *
180
- * If clickable file links are enabled, a link such as this is returned:
 
181
  *
182
  * <a href="subl://open/?line={line}&url={file}">{text}</a>
183
  *
@@ -185,6 +186,23 @@ abstract class QM_Output_Html extends QM_Output {
185
  *
186
  * {text}<br>{file}:{line}
187
  *
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188
  * @param string $text The display text, such as a function name or file name.
189
  * @param string $file The full file path and name.
190
  * @param int $line Optional. A line number, if appropriate.
@@ -196,10 +214,6 @@ abstract class QM_Output_Html extends QM_Output {
196
  return esc_html( $text );
197
  }
198
 
199
- # Further reading:
200
- # http://simonwheatley.co.uk/2012/07/clickable-stack-traces/
201
- # https://github.com/grych/subl-handler
202
-
203
  $link_line = ( $line ) ? $line : 1;
204
 
205
  if ( ! isset( self::$file_link_format ) ) {
177
  /**
178
  * Returns a file path, name, and line number. Safe for output.
179
  *
180
+ * If clickable file links are enabled via the `xdebug.file_link_format` setting in the PHP configuration,
181
+ * a link such as this is returned:
182
  *
183
  * <a href="subl://open/?line={line}&url={file}">{text}</a>
184
  *
186
  *
187
  * {text}<br>{file}:{line}
188
  *
189
+ * Further information on clickable stack traces for your editor:
190
+ *
191
+ * PhpStorm: (support is built in)
192
+ * `phpstorm://open?file=%f&line=%l`
193
+ *
194
+ * Visual Studio Code: (support is built in)
195
+ * `vscode://file/%f:%l`
196
+ *
197
+ * Sublime Text: https://github.com/corysimmons/subl-handler
198
+ * `subl://open/?url=file://%f&line=%l`
199
+ *
200
+ * Atom: https://github.com/WizardOfOgz/atom-handler
201
+ * `atm://open/?url=file://%f&line=%l`
202
+ *
203
+ * Netbeans: http://simonwheatley.co.uk/2012/08/clickable-stack-traces-with-netbeans/
204
+ * `nbopen://%f:%l`
205
+ *
206
  * @param string $text The display text, such as a function name or file name.
207
  * @param string $file The full file path and name.
208
  * @param int $line Optional. A line number, if appropriate.
214
  return esc_html( $text );
215
  }
216
 
 
 
 
 
217
  $link_line = ( $line ) ? $line : 1;
218
 
219
  if ( ! isset( self::$file_link_format ) ) {
output/html/environment.php CHANGED
@@ -86,7 +86,18 @@ class QM_Output_Html_Environment extends QM_Output_Html {
86
  echo '</tr>';
87
  }
88
 
89
- $error_levels = implode( '</li><li>', array_map( 'esc_html', $this->collector->get_error_levels( $data['php']['error_reporting'] ) ) );
 
 
 
 
 
 
 
 
 
 
 
90
 
91
  echo '<tr>';
92
  echo '<th scope="row">error_reporting</th>';
86
  echo '</tr>';
87
  }
88
 
89
+ $error_levels = $this->collector->get_error_levels( $data['php']['error_reporting'] );
90
+ $out = array();
91
+
92
+ foreach ( $error_levels as $level => $reported ) {
93
+ if ( $reported ) {
94
+ $out[] = '<span class="qm-true">' . esc_html( $level ) . '&nbsp;&#x2713;</span>';
95
+ } else {
96
+ $out[] = '<span class="qm-false">' . esc_html( $level ) . '</span>';
97
+ }
98
+ }
99
+
100
+ $error_levels = implode( '</li><li>', $out );
101
 
102
  echo '<tr>';
103
  echo '<th scope="row">error_reporting</th>';
output/html/overview.php CHANGED
@@ -114,7 +114,7 @@ class QM_Output_Html_Overview extends QM_Output_Html {
114
  if ( isset( $cache_hit_percentage ) ) {
115
  echo esc_html( sprintf(
116
  /* translators: 1: Cache hit rate percentage, 2: number of cache hits, 3: number of cache misses */
117
- __( '%s%% hit rate (%s hits, %s misses)', 'query-monitor' ),
118
  number_format_i18n( $cache_hit_percentage, 1 ),
119
  number_format_i18n( $cache_data['stats']['cache_hits'], 0 ),
120
  number_format_i18n( $cache_data['stats']['cache_misses'], 0 )
114
  if ( isset( $cache_hit_percentage ) ) {
115
  echo esc_html( sprintf(
116
  /* translators: 1: Cache hit rate percentage, 2: number of cache hits, 3: number of cache misses */
117
+ __( '%1$s%% hit rate (%2$s hits, %3$s misses)', 'query-monitor' ),
118
  number_format_i18n( $cache_hit_percentage, 1 ),
119
  number_format_i18n( $cache_data['stats']['cache_hits'], 0 ),
120
  number_format_i18n( $cache_data['stats']['cache_misses'], 0 )
output/html/request.php CHANGED
@@ -59,7 +59,7 @@ class QM_Output_Html_Request extends QM_Output_Html {
59
 
60
  echo '<tr>';
61
  echo '<th>' . esc_html( $name ) . '</th>';
62
- echo '<td colspan="2" class="qm-ltr">' . $value . '</td>'; // WPCS: XSS ok.
63
  echo '</tr>';
64
  }
65
 
@@ -89,7 +89,7 @@ class QM_Output_Html_Request extends QM_Output_Html {
89
  echo esc_html( print_r( $value, true ) );
90
  echo '</pre></td>';
91
  } else {
92
- echo '<td class="qm-ltr">' . esc_html( $value ) . '</td>';
93
  }
94
 
95
  echo '</tr>';
59
 
60
  echo '<tr>';
61
  echo '<th>' . esc_html( $name ) . '</th>';
62
+ echo '<td colspan="2" class="qm-ltr qm-wrap">' . $value . '</td>'; // WPCS: XSS ok.
63
  echo '</tr>';
64
  }
65
 
89
  echo esc_html( print_r( $value, true ) );
90
  echo '</pre></td>';
91
  } else {
92
+ echo '<td class="qm-ltr qm-wrap">' . esc_html( $value ) . '</td>';
93
  }
94
 
95
  echo '</tr>';
output/html/rewrites.php CHANGED
@@ -28,7 +28,7 @@ class QM_Output_Html_Rewrites extends QM_Output_Html {
28
  echo '<div class="qm qm-half" id="' . esc_attr( $this->collector->id() ) . '">';
29
  echo '<table cellspacing="0">';
30
 
31
- echo '<caption>' . esc_html__( 'Matching Rewrite Rules', 'query-monitor' ) . '</caption>';
32
  echo '<thead class="screen-reader-text">';
33
  echo '<tr>';
34
  echo '<th scope="col">' . esc_html__( 'Rule', 'query-monitor' ) . '</th>';
28
  echo '<div class="qm qm-half" id="' . esc_attr( $this->collector->id() ) . '">';
29
  echo '<table cellspacing="0">';
30
 
31
+ echo '<caption>' . esc_html__( 'All Matching Rewrite Rules', 'query-monitor' ) . '</caption>';
32
  echo '<thead class="screen-reader-text">';
33
  echo '<tr>';
34
  echo '<th scope="col">' . esc_html__( 'Rule', 'query-monitor' ) . '</th>';
output/html/theme.php CHANGED
@@ -61,7 +61,7 @@ class QM_Output_Html_Theme extends QM_Output_Html {
61
 
62
  echo '<tr>';
63
  echo '<th scope="row">' . esc_html__( 'Template Hierarchy', 'query-monitor' ) . '</th>';
64
- echo '<td class="qm-ltr"><ul><li>' . implode( '</li><li>', array_map( 'esc_html', $data['template_hierarchy'] ) ) . '</li></ul></td>';
65
  echo '</tr>';
66
 
67
  }
61
 
62
  echo '<tr>';
63
  echo '<th scope="row">' . esc_html__( 'Template Hierarchy', 'query-monitor' ) . '</th>';
64
+ echo '<td class="qm-ltr qm-wrap"><ul><li>' . implode( '</li><li>', array_map( 'esc_html', $data['template_hierarchy'] ) ) . '</li></ul></td>';
65
  echo '</tr>';
66
 
67
  }
query-monitor.php CHANGED
@@ -1,28 +1,32 @@
1
  <?php
2
- /*
3
- Plugin Name: Query Monitor
4
- Description: Monitoring of database queries, hooks, conditionals and more.
5
- Version: 2.13.4
6
- Plugin URI: https://github.com/johnbillion/query-monitor
7
- Author: John Blackbourn
8
- Author URI: https://johnblackbourn.com/
9
- Text Domain: query-monitor
10
- Domain Path: /languages/
11
- License: GPL v2 or later
12
-
13
- Copyright 2009-2017 John Blackbourn
14
-
15
- This program is free software; you can redistribute it and/or modify
16
- it under the terms of the GNU General Public License as published by
17
- the Free Software Foundation; either version 2 of the License, or
18
- (at your option) any later version.
19
-
20
- This program is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU General Public License for more details.
24
-
25
- */
 
 
 
 
26
 
27
  defined( 'ABSPATH' ) or die();
28
 
1
  <?php
2
+ /**
3
+ * User Switching plugin for WordPress
4
+ *
5
+ * @package query-monitor
6
+ * @link https://github.com/johnbillion/query-monitor
7
+ * @author John Blackbourn <john@johnblackbourn.com>
8
+ * @copyright 2009-2017 John Blackbourn
9
+ * @license GPL v2 or later
10
+ *
11
+ * Plugin Name: Query Monitor
12
+ * Description: Monitoring of database queries, hooks, conditionals and more.
13
+ * Version: 2.14.0
14
+ * Plugin URI: https://github.com/johnbillion/query-monitor
15
+ * Author: John Blackbourn
16
+ * Author URI: https://johnblackbourn.com/
17
+ * Text Domain: query-monitor
18
+ * Domain Path: /languages/
19
+ *
20
+ * This program is free software; you can redistribute it and/or modify
21
+ * it under the terms of the GNU General Public License as published by
22
+ * the Free Software Foundation; either version 2 of the License, or
23
+ * (at your option) any later version.
24
+ *
25
+ * This program is distributed in the hope that it will be useful,
26
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
27
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28
+ * GNU General Public License for more details.
29
+ */
30
 
31
  defined( 'ABSPATH' ) or die();
32
 
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: johnbillion
3
  Tags: ajax, debug, debug-bar, debugging, development, developer, performance, profiler, profiling, queries, query monitor, rest-api
4
  Requires at least: 3.7
5
- Tested up to: 4.7
6
- Stable tag: 2.13.4
7
  License: GPLv2 or later
8
 
9
  View debugging and performance information on database queries, hooks, conditionals, HTTP requests, redirects and more.
2
  Contributors: johnbillion
3
  Tags: ajax, debug, debug-bar, debugging, development, developer, performance, profiler, profiling, queries, query monitor, rest-api
4
  Requires at least: 3.7
5
+ Tested up to: 4.8
6
+ Stable tag: 2.14.0
7
  License: GPLv2 or later
8
 
9
  View debugging and performance information on database queries, hooks, conditionals, HTTP requests, redirects and more.