Query Monitor - Version 2.9.0

Version Description

  • Introduce a new panel which displays all matching rewrite rules for the current request.
  • Remove the deprecated is_comments_popup() from the list of conditionals.
  • Improve the display of scripts and styles which are blocked by Airplane Mode (0.1.4 and later).
  • Gracefully handle enqueued assets which are deregistered late without being unenqueued.
  • Add a filter to hide the extended query information prompt.
  • Various minor bugfixes and code quality tweaks.
Download this release

Release Info

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

Code changes from version 2.8.1 to 2.9.0

Files changed (60) hide show
  1. assets/compat.css +1 -1
  2. assets/query-monitor.css +2 -2
  3. assets/query-monitor.js +1 -1
  4. classes/Backtrace.php +5 -5
  5. classes/Collector.php +1 -1
  6. classes/Collectors.php +1 -1
  7. classes/Dispatcher.php +3 -3
  8. classes/Dispatchers.php +1 -1
  9. classes/Output.php +1 -1
  10. classes/Plugin.php +1 -1
  11. classes/Util.php +2 -6
  12. classes/debug_bar.php +2 -2
  13. classes/debug_bar_panel.php +1 -1
  14. collectors/admin.php +2 -2
  15. collectors/assets.php +5 -2
  16. collectors/conditionals.php +2 -3
  17. collectors/db_callers.php +1 -1
  18. collectors/db_components.php +1 -1
  19. collectors/db_queries.php +5 -3
  20. collectors/debug_bar.php +1 -13
  21. collectors/environment.php +1 -1
  22. collectors/hooks.php +1 -1
  23. collectors/http.php +1 -1
  24. collectors/languages.php +1 -1
  25. collectors/overview.php +1 -1
  26. collectors/php_errors.php +1 -1
  27. collectors/redirects.php +1 -1
  28. collectors/request.php +1 -1
  29. collectors/rewrites.php +63 -0
  30. collectors/theme.php +1 -1
  31. collectors/transients.php +1 -1
  32. dispatchers/AJAX.php +1 -1
  33. dispatchers/Html.php +1 -1
  34. dispatchers/REST.php +1 -1
  35. dispatchers/Redirect.php +1 -1
  36. output/Headers.php +1 -1
  37. output/Html.php +4 -4
  38. output/headers/overview.php +1 -1
  39. output/headers/php_errors.php +1 -1
  40. output/headers/redirects.php +1 -1
  41. output/html/admin.php +4 -4
  42. output/html/assets.php +25 -4
  43. output/html/conditionals.php +6 -6
  44. output/html/db_callers.php +1 -1
  45. output/html/db_components.php +1 -1
  46. output/html/db_queries.php +11 -3
  47. output/html/debug_bar.php +1 -1
  48. output/html/environment.php +3 -3
  49. output/html/hooks.php +4 -4
  50. output/html/http.php +3 -3
  51. output/html/languages.php +1 -1
  52. output/html/overview.php +1 -1
  53. output/html/php_errors.php +1 -1
  54. output/html/request.php +4 -4
  55. output/html/rewrites.php +77 -0
  56. output/html/theme.php +2 -2
  57. output/html/transients.php +3 -3
  58. query-monitor.php +2 -2
  59. readme.txt +20 -1
  60. wp-content/db.php +1 -1
assets/compat.css CHANGED
@@ -1,5 +1,5 @@
1
  /*
2
- Copyright 2009-2015 John Blackbourn
3
 
4
  This program is free software; you can redistribute it and/or modify
5
  it under the terms of the GNU General Public License as published by
1
  /*
2
+ Copyright 2009-2016 John Blackbourn
3
 
4
  This program is free software; you can redistribute it and/or modify
5
  it under the terms of the GNU General Public License as published by
assets/query-monitor.css CHANGED
@@ -1,5 +1,5 @@
1
  /*
2
- Copyright 2009-2015 John Blackbourn
3
 
4
  This program is free software; you can redistribute it and/or modify
5
  it under the terms of the GNU General Public License as published by
@@ -306,7 +306,7 @@ body.wp-admin.folded #qm {
306
  font-style: normal !important;
307
  line-height: 16px !important;
308
  color: inherit !important;
309
- background: transparent; !important;
310
  border: none !important;
311
  margin: 0 !important;
312
  padding: 0 !important;
1
  /*
2
+ Copyright 2009-2016 John Blackbourn
3
 
4
  This program is free software; you can redistribute it and/or modify
5
  it under the terms of the GNU General Public License as published by
306
  font-style: normal !important;
307
  line-height: 16px !important;
308
  color: inherit !important;
309
+ background: transparent !important;
310
  border: none !important;
311
  margin: 0 !important;
312
  padding: 0 !important;
assets/query-monitor.js CHANGED
@@ -1,5 +1,5 @@
1
  /*
2
- Copyright 2009-2015 John Blackbourn
3
 
4
  This program is free software; you can redistribute it and/or modify
5
  it under the terms of the GNU General Public License as published by
1
  /*
2
+ Copyright 2009-2016 John Blackbourn
3
 
4
  This program is free software; you can redistribute it and/or modify
5
  it under the terms of the GNU General Public License as published by
classes/Backtrace.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
@@ -64,16 +64,15 @@ class QM_Backtrace {
64
  ), $args );
65
  $this->trace = debug_backtrace( false );
66
  $this->ignore( 1 ); # Self-awareness
67
-
68
  /**
69
  * If error_handler() is in the trace, QM fails later when it tries
70
  * to get $lowest['file'] in get_filtered_trace()
71
- */
72
  if ( $this->trace[0]['function'] === 'error_handler' ) {
73
  $this->ignore( 1 );
74
  }
75
 
76
-
77
  if ( $args['ignore_items'] ) {
78
  $this->ignore( $args['ignore_items'] );
79
  }
@@ -240,8 +239,9 @@ class QM_Backtrace {
240
  } else {
241
  $args = array();
242
  for ( $i = 0; $i < $show; $i++ ) {
243
- if ( isset( $trace['args'][$i] ) )
244
  $args[] = '\'' . $trace['args'][$i] . '\'';
 
245
  }
246
  $return['id'] = $trace['function'] . '()';
247
  $return['display'] = $trace['function'] . '(' . implode( ',', $args ) . ')';
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
64
  ), $args );
65
  $this->trace = debug_backtrace( false );
66
  $this->ignore( 1 ); # Self-awareness
67
+
68
  /**
69
  * If error_handler() is in the trace, QM fails later when it tries
70
  * to get $lowest['file'] in get_filtered_trace()
71
+ */
72
  if ( $this->trace[0]['function'] === 'error_handler' ) {
73
  $this->ignore( 1 );
74
  }
75
 
 
76
  if ( $args['ignore_items'] ) {
77
  $this->ignore( $args['ignore_items'] );
78
  }
239
  } else {
240
  $args = array();
241
  for ( $i = 0; $i < $show; $i++ ) {
242
+ if ( isset( $trace['args'][$i] ) ) {
243
  $args[] = '\'' . $trace['args'][$i] . '\'';
244
+ }
245
  }
246
  $return['id'] = $trace['function'] . '()';
247
  $return['display'] = $trace['function'] . '(' . implode( ',', $args ) . ')';
classes/Collector.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
classes/Collectors.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
classes/Dispatcher.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@ abstract class QM_Dispatcher {
38
  if ( ! empty( $e ) and ( $e['type'] & ( E_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR ) ) ) {
39
  return false;
40
  }
41
-
42
  # Allow users to disable this dispatcher
43
  if ( ! apply_filters( "qm/dispatch/{$this->id}", true ) ) {
44
  return false;
@@ -95,7 +95,7 @@ abstract class QM_Dispatcher {
95
 
96
  public static function user_verified() {
97
  if ( isset( $_COOKIE[QM_COOKIE] ) ) {
98
- return self::verify_cookie( stripslashes( $_COOKIE[QM_COOKIE] ) );
99
  }
100
  return false;
101
  }
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
38
  if ( ! empty( $e ) and ( $e['type'] & ( E_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR ) ) ) {
39
  return false;
40
  }
41
+
42
  # Allow users to disable this dispatcher
43
  if ( ! apply_filters( "qm/dispatch/{$this->id}", true ) ) {
44
  return false;
95
 
96
  public static function user_verified() {
97
  if ( isset( $_COOKIE[QM_COOKIE] ) ) {
98
+ return self::verify_cookie( wp_unslash( $_COOKIE[QM_COOKIE] ) );
99
  }
100
  return false;
101
  }
classes/Dispatchers.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
classes/Output.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
classes/Plugin.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
classes/Util.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
@@ -230,7 +230,7 @@ class QM_Util {
230
  if ( self::is_ajax() ) {
231
  return true;
232
  }
233
- if ( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) and 'xmlhttprequest' == strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) ) {
234
  return true;
235
  }
236
  return false;
@@ -244,10 +244,6 @@ class QM_Util {
244
  }
245
  }
246
 
247
- public static function get_current_url() {
248
- return ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
249
- }
250
-
251
  public static function is_multi_network() {
252
  global $wpdb;
253
 
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
230
  if ( self::is_ajax() ) {
231
  return true;
232
  }
233
+ if ( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) and 'xmlhttprequest' === strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) ) {
234
  return true;
235
  }
236
  return false;
244
  }
245
  }
246
 
 
 
 
 
247
  public static function is_multi_network() {
248
  global $wpdb;
249
 
classes/debug_bar.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@ class Debug_Bar {
44
  public function ensure_ajaxurl() {
45
  ?>
46
  <script type="text/javascript">
47
- var ajaxurl = '<?php echo admin_url( 'admin-ajax.php' ); ?>';
48
  </script>
49
  <?php
50
  }
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
44
  public function ensure_ajaxurl() {
45
  ?>
46
  <script type="text/javascript">
47
+ var ajaxurl = '<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>';
48
  </script>
49
  <?php
50
  }
classes/debug_bar_panel.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
collectors/admin.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ class QM_Collector_Admin extends QM_Collector {
26
 
27
  global $pagenow;
28
 
29
- if ( isset( $_GET['page'] ) && get_current_screen() != null ) {
30
  $this->data['base'] = get_current_screen()->base;
31
  } else {
32
  $this->data['base'] = $pagenow;
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
26
 
27
  global $pagenow;
28
 
29
+ if ( isset( $_GET['page'] ) && get_current_screen() !== null ) {
30
  $this->data['base'] = get_current_screen()->base;
31
  } else {
32
  $this->data['base'] = $pagenow;
collectors/assets.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
@@ -64,7 +64,7 @@ class QM_Collector_Assets extends QM_Collector {
64
  }
65
  $raw = $this->data['raw'][ $type ];
66
  $broken = array_values( array_diff( $raw->queue, $raw->done ) );
67
- $missing = array();
68
 
69
  if ( !empty( $broken ) ) {
70
  foreach ( $broken as $key => $handle ) {
@@ -85,6 +85,9 @@ class QM_Collector_Assets extends QM_Collector {
85
  $this->data['missing'][ $type ] = array_unique( $missing );
86
  foreach ( $this->data['missing'][ $type ] as $handle ) {
87
  $raw->add( $handle, false );
 
 
 
88
  }
89
  }
90
 
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
64
  }
65
  $raw = $this->data['raw'][ $type ];
66
  $broken = array_values( array_diff( $raw->queue, $raw->done ) );
67
+ $missing = array_values( array_diff( $raw->queue, array_keys( $raw->registered ) ) );
68
 
69
  if ( !empty( $broken ) ) {
70
  foreach ( $broken as $key => $handle ) {
85
  $this->data['missing'][ $type ] = array_unique( $missing );
86
  foreach ( $this->data['missing'][ $type ] as $handle ) {
87
  $raw->add( $handle, false );
88
+ if ( false !== ( $key = array_search( $handle, $raw->done ) ) ) {
89
+ unset( $raw->done[ $key ] );
90
+ }
91
  }
92
  }
93
 
collectors/conditionals.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
@@ -33,7 +33,6 @@ class QM_Collector_Conditionals extends QM_Collector {
33
  'is_blog_admin',
34
  'is_category',
35
  'is_comment_feed',
36
- 'is_comments_popup',
37
  'is_customize_preview',
38
  'is_date',
39
  'is_day',
@@ -71,7 +70,7 @@ class QM_Collector_Conditionals extends QM_Collector {
71
  foreach ( $conds as $cond ) {
72
  if ( function_exists( $cond ) ) {
73
 
74
- if ( ( 'is_sticky' == $cond ) and !get_post( $id = null ) ) {
75
  # Special case for is_sticky to prevent PHP notices
76
  $false[] = $cond;
77
  } else if ( ! is_multisite() and in_array( $cond, array( 'is_main_network', 'is_main_site' ) ) ) {
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
33
  'is_blog_admin',
34
  'is_category',
35
  'is_comment_feed',
 
36
  'is_customize_preview',
37
  'is_date',
38
  'is_day',
70
  foreach ( $conds as $cond ) {
71
  if ( function_exists( $cond ) ) {
72
 
73
+ if ( ( 'is_sticky' === $cond ) and !get_post( $id = null ) ) {
74
  # Special case for is_sticky to prevent PHP notices
75
  $false[] = $cond;
76
  } else if ( ! is_multisite() and in_array( $cond, array( 'is_main_network', 'is_main_site' ) ) ) {
collectors/db_callers.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
collectors/db_components.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
collectors/db_queries.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
@@ -14,10 +14,12 @@ GNU General Public License for more details.
14
 
15
  */
16
 
17
- if ( !defined( 'SAVEQUERIES' ) )
18
  define( 'SAVEQUERIES', true );
19
- if ( !defined( 'QM_DB_EXPENSIVE' ) )
 
20
  define( 'QM_DB_EXPENSIVE', 0.05 );
 
21
 
22
  class QM_Collector_DB_Queries extends QM_Collector {
23
 
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
14
 
15
  */
16
 
17
+ if ( !defined( 'SAVEQUERIES' ) ) {
18
  define( 'SAVEQUERIES', true );
19
+ }
20
+ if ( !defined( 'QM_DB_EXPENSIVE' ) ) {
21
  define( 'QM_DB_EXPENSIVE', 0.05 );
22
+ }
23
 
24
  class QM_Collector_DB_Queries extends QM_Collector {
25
 
collectors/debug_bar.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
@@ -90,43 +90,31 @@ function register_qm_collectors_debug_bar() {
90
  function qm_debug_bar_being_activated() {
91
 
92
  if ( ! is_admin() ) {
93
-
94
  return false;
95
-
96
  }
97
 
98
  if ( ! isset( $_REQUEST['action'] ) ) {
99
-
100
  return false;
101
-
102
  }
103
 
104
  if ( isset( $_GET['action'] ) ) {
105
 
106
  if ( ! isset( $_GET['plugin'] ) || ! isset( $_GET['_wpnonce'] ) ) {
107
-
108
  return false;
109
-
110
  }
111
 
112
  if ( 'activate' === $_GET['action'] && false !== strpos( $_GET['plugin'], 'debug-bar.php' ) ) {
113
-
114
  return true;
115
-
116
  }
117
 
118
  } elseif ( isset( $_POST['action'] ) ) {
119
 
120
  if ( ! isset( $_POST['checked'] ) || ! is_array( $_POST['checked'] ) || ! isset( $_POST['_wpnonce'] ) ) {
121
-
122
  return false;
123
-
124
  }
125
 
126
  if ( 'activate-selected' === $_POST['action'] && in_array( 'debug-bar/debug-bar.php', $_POST['checked'] ) ) {
127
-
128
  return true;
129
-
130
  }
131
 
132
  }
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
90
  function qm_debug_bar_being_activated() {
91
 
92
  if ( ! is_admin() ) {
 
93
  return false;
 
94
  }
95
 
96
  if ( ! isset( $_REQUEST['action'] ) ) {
 
97
  return false;
 
98
  }
99
 
100
  if ( isset( $_GET['action'] ) ) {
101
 
102
  if ( ! isset( $_GET['plugin'] ) || ! isset( $_GET['_wpnonce'] ) ) {
 
103
  return false;
 
104
  }
105
 
106
  if ( 'activate' === $_GET['action'] && false !== strpos( $_GET['plugin'], 'debug-bar.php' ) ) {
 
107
  return true;
 
108
  }
109
 
110
  } elseif ( isset( $_POST['action'] ) ) {
111
 
112
  if ( ! isset( $_POST['checked'] ) || ! is_array( $_POST['checked'] ) || ! isset( $_POST['_wpnonce'] ) ) {
 
113
  return false;
 
114
  }
115
 
116
  if ( 'activate-selected' === $_POST['action'] && in_array( 'debug-bar/debug-bar.php', $_POST['checked'] ) ) {
 
117
  return true;
 
118
  }
119
 
120
  }
collectors/environment.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
collectors/hooks.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
collectors/http.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
collectors/languages.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
collectors/overview.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
collectors/php_errors.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
collectors/redirects.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
collectors/request.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
collectors/rewrites.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright 2009-2016 John Blackbourn
4
+
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation; either version 2 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ */
16
+
17
+ class QM_Collector_Rewrites extends QM_Collector {
18
+
19
+ public $id = 'rewrites';
20
+
21
+ public function name() {
22
+ return __( 'Rewrite Rules', 'query-monitor' );
23
+ }
24
+
25
+ public function process() {
26
+
27
+ global $wp_rewrite;
28
+
29
+ if ( is_admin() or QM_Util::is_async() ) {
30
+ return;
31
+ }
32
+
33
+ if ( ! $request = QM_Collectors::get( 'request' ) ) {
34
+ return;
35
+ }
36
+
37
+ if ( empty( $wp_rewrite->rules ) ) {
38
+ return;
39
+ }
40
+
41
+ $req = $request->data['request']['request'];
42
+ $matching = array();
43
+
44
+ foreach ( $wp_rewrite->rules as $match => $query ) {
45
+ if ( preg_match( "#^{$match}#", $req ) ) {
46
+ $matching[ $match ] = $query;
47
+ }
48
+ }
49
+
50
+ $this->data['matching'] = $matching;
51
+
52
+ }
53
+
54
+ }
55
+
56
+ function register_qm_collector_rewrites( array $collectors, QueryMonitor $qm ) {
57
+ $collectors['rewrites'] = new QM_Collector_Rewrites;
58
+ return $collectors;
59
+ }
60
+
61
+ if ( ! is_admin() ) {
62
+ add_filter( 'qm/collectors', 'register_qm_collector_rewrites', 11, 2 );
63
+ }
collectors/theme.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
collectors/transients.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
dispatchers/AJAX.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
dispatchers/Html.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
dispatchers/REST.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
dispatchers/Redirect.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
output/Headers.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
output/Html.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
@@ -154,7 +154,7 @@ abstract class QM_Output_Html extends QM_Output {
154
  * @return string The URL formatted with markup.
155
  */
156
  public static function format_url( $url ) {
157
- return str_replace( '&amp;', '<br>&amp;', esc_html( $url ) );
158
  }
159
 
160
  /**
@@ -167,7 +167,7 @@ abstract class QM_Output_Html extends QM_Output {
167
  * Otherwise, the display text and file details such as this is returned:
168
  *
169
  * {text}<br>{file}:{line}
170
- *
171
  * @param string $text The display text, such as a function name or file name.
172
  * @param string $file The full file path and name.
173
  * @param int $line Optional. A line number, if appropriate.
@@ -197,7 +197,7 @@ abstract class QM_Output_Html extends QM_Output {
197
  $fallback .= ':' . $line;
198
  }
199
  $return = esc_html( $text );
200
- if ( $fallback != $text ) {
201
  $return .= '<br><span class="qm-info">&nbsp;' . esc_html( $fallback ) . '</span>';
202
  }
203
  return $return;
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
154
  * @return string The URL formatted with markup.
155
  */
156
  public static function format_url( $url ) {
157
+ return str_replace( array( '?', '&amp;' ), array( '<br>?', '<br>&amp;' ), esc_html( $url ) );
158
  }
159
 
160
  /**
167
  * Otherwise, the display text and file details such as this is returned:
168
  *
169
  * {text}<br>{file}:{line}
170
+ *
171
  * @param string $text The display text, such as a function name or file name.
172
  * @param string $file The full file path and name.
173
  * @param int $line Optional. A line number, if appropriate.
197
  $fallback .= ':' . $line;
198
  }
199
  $return = esc_html( $text );
200
+ if ( $fallback !== $text ) {
201
  $return .= '<br><span class="qm-info">&nbsp;' . esc_html( $fallback ) . '</span>';
202
  }
203
  return $return;
output/headers/overview.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
output/headers/php_errors.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
output/headers/redirects.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
output/html/admin.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
@@ -94,11 +94,11 @@ class QM_Output_Html_Admin extends QM_Output_Html {
94
  $cols = $data['current_screen']->id;
95
  }
96
 
97
- if ( 'edit-comments' == $col ) {
98
  $col = 'comments';
99
- } else if ( 'upload' == $col ) {
100
  $col = 'media';
101
- } else if ( 'link-manager' == $col ) {
102
  $col = 'link';
103
  }
104
 
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
94
  $cols = $data['current_screen']->id;
95
  }
96
 
97
+ if ( 'edit-comments' === $col ) {
98
  $col = 'comments';
99
+ } else if ( 'upload' === $col ) {
100
  $col = 'media';
101
+ } else if ( 'link-manager' === $col ) {
102
  $col = 'link';
103
  }
104
 
output/html/assets.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
@@ -118,10 +118,23 @@ class QM_Output_Html_Assets extends QM_Output_Html {
118
  $ver = $script->ver;
119
  }
120
 
121
- if ( empty( $script->src ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  $src = '';
123
  } else {
124
- $src = $script->src;
125
  }
126
 
127
  $dependents = self::get_dependents( $script, $dependencies );
@@ -134,7 +147,15 @@ class QM_Output_Html_Assets extends QM_Output_Html {
134
  }
135
  }
136
 
137
- echo '<td class="qm-wrap">' . esc_html( $script->handle ) . '<br><span class="qm-info">&nbsp;' . esc_html( $src ) . '</span></td>';
 
 
 
 
 
 
 
 
138
  echo '<td class="qm-nowrap qm-highlighter" data-qm-highlight="' . esc_attr( implode( ' ', $deps ) ) . '">' . implode( '<br>', array_map( 'esc_html', $deps ) ) . '</td>';
139
  echo '<td class="qm-nowrap qm-highlighter" data-qm-highlight="' . esc_attr( implode( ' ', $dependents ) ) . '">' . implode( '<br>', array_map( 'esc_html', $dependents ) ) . '</td>';
140
  echo '<td>' . esc_html( $ver ) . '</td>';
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
118
  $ver = $script->ver;
119
  }
120
 
121
+ /**
122
+ * Filter the script loader source.
123
+ *
124
+ * @param string $src Script loader source path.
125
+ * @param string $handle Script handle.
126
+ */
127
+ $source = apply_filters( 'script_loader_src', $script->src, $script->handle );
128
+
129
+ if ( is_wp_error( $source ) ) {
130
+ $src = $source->get_error_message();
131
+ if ( ( $error_data = $source->get_error_data() ) && isset( $error_data['src'] ) ) {
132
+ $src .= ' (' . $error_data['src'] . ')';
133
+ }
134
+ } elseif ( empty( $source ) ) {
135
  $src = '';
136
  } else {
137
+ $src = $source;
138
  }
139
 
140
  $dependents = self::get_dependents( $script, $dependencies );
147
  }
148
  }
149
 
150
+ echo '<td class="qm-wrap">' . esc_html( $script->handle ) . '<br><span class="qm-info">&nbsp;';
151
+ if ( is_wp_error( $source ) ) {
152
+ printf( '<span class="qm-warn">%s</span>',
153
+ esc_html( $src )
154
+ );
155
+ } else {
156
+ echo esc_html( $src );
157
+ }
158
+ echo '</span></td>';
159
  echo '<td class="qm-nowrap qm-highlighter" data-qm-highlight="' . esc_attr( implode( ' ', $deps ) ) . '">' . implode( '<br>', array_map( 'esc_html', $deps ) ) . '</td>';
160
  echo '<td class="qm-nowrap qm-highlighter" data-qm-highlight="' . esc_attr( implode( ' ', $dependents ) ) . '">' . implode( '<br>', array_map( 'esc_html', $dependents ) ) . '</td>';
161
  echo '<td>' . esc_html( $ver ) . '</td>';
output/html/conditionals.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
@@ -40,28 +40,28 @@ class QM_Output_Html_Conditionals extends QM_Output_Html {
40
 
41
  foreach ( $data['conds']['true'] as $cond ) {
42
  $i++;
43
- if ( 1 === $i%$cols ) {
44
  echo '<tr>';
45
  }
46
  echo '<td class="qm-ltr qm-true" width="' . absint( $w ) . '%">' . esc_html( $cond ) . '()</td>';
47
- if ( 0 === $i%$cols ) {
48
  echo '</tr>';
49
  }
50
  }
51
 
52
  foreach ( $data['conds']['false'] as $cond ) {
53
  $i++;
54
- if ( 1 === $i%$cols ) {
55
  echo '<tr>';
56
  }
57
  echo '<td class="qm-ltr qm-false" width="' . absint( $w ) . '%">' . esc_html( $cond ) . '()</td>';
58
- if ( 0 === $i%$cols ) {
59
  echo '</tr>';
60
  }
61
  }
62
 
63
  $fill = ( $cols - ( $i % $cols ) );
64
- if ( $fill and ( $fill != $cols ) ) {
65
  echo '<td colspan="' . absint( $fill ) . '">&nbsp;</td>';
66
  echo '</tr>';
67
  }
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
40
 
41
  foreach ( $data['conds']['true'] as $cond ) {
42
  $i++;
43
+ if ( 1 === $i % $cols ) {
44
  echo '<tr>';
45
  }
46
  echo '<td class="qm-ltr qm-true" width="' . absint( $w ) . '%">' . esc_html( $cond ) . '()</td>';
47
+ if ( 0 === $i % $cols ) {
48
  echo '</tr>';
49
  }
50
  }
51
 
52
  foreach ( $data['conds']['false'] as $cond ) {
53
  $i++;
54
+ if ( 1 === $i % $cols ) {
55
  echo '<tr>';
56
  }
57
  echo '<td class="qm-ltr qm-false" width="' . absint( $w ) . '%">' . esc_html( $cond ) . '()</td>';
58
+ if ( 0 === $i % $cols ) {
59
  echo '</tr>';
60
  }
61
  }
62
 
63
  $fill = ( $cols - ( $i % $cols ) );
64
+ if ( $fill && ( $fill !== $cols ) ) {
65
  echo '<td colspan="' . absint( $fill ) . '">&nbsp;</td>';
66
  echo '</tr>';
67
  }
output/html/db_callers.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
output/html/db_components.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
output/html/db_queries.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
@@ -160,7 +160,15 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
160
 
161
  if ( !empty( $db->rows ) ) {
162
 
163
- if ( ! $db->has_trace && ( '$wpdb' === $name ) ) {
 
 
 
 
 
 
 
 
164
  echo '<tr>';
165
  echo '<td colspan="' . absint( $span ) . '" class="qm-warn">';
166
  echo wp_kses( sprintf(
@@ -287,7 +295,7 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
287
 
288
  $sql = self::format_sql( $row['sql'] );
289
 
290
- if ( 'SELECT' != $row['type'] ) {
291
  $sql = "<span class='qm-nonselectsql'>{$sql}</span>";
292
  }
293
 
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
160
 
161
  if ( !empty( $db->rows ) ) {
162
 
163
+ /**
164
+ * Filter whether to show the QM extended query information prompt.
165
+ *
166
+ * By default QM shows a prompt to install the QM db.php drop-in,
167
+ * this filter allows a dev to choose not to show the prompt.
168
+ *
169
+ * @param bool $show_prompt Whether to show the prompt.
170
+ */
171
+ if ( apply_filters( 'qm/show_extended_query_prompt', true ) && ! $db->has_trace && ( '$wpdb' === $name ) ) {
172
  echo '<tr>';
173
  echo '<td colspan="' . absint( $span ) . '" class="qm-warn">';
174
  echo wp_kses( sprintf(
295
 
296
  $sql = self::format_sql( $row['sql'] );
297
 
298
+ if ( 'SELECT' !== $row['type'] ) {
299
  $sql = "<span class='qm-nonselectsql'>{$sql}</span>";
300
  }
301
 
output/html/debug_bar.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
output/html/environment.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
@@ -69,7 +69,7 @@ class QM_Output_Html_Environment extends QM_Output_Html {
69
  echo '<td>';
70
  echo esc_html( $val['after'] );
71
 
72
- if ( $val['after'] != $val['before'] ) {
73
  printf(
74
  '<br><span class="qm-info">&nbsp;%s</span>',
75
  esc_html( sprintf(
@@ -100,7 +100,7 @@ class QM_Output_Html_Environment extends QM_Output_Html {
100
 
101
  foreach ( $data['db'] as $id => $db ) {
102
 
103
- if ( 1 == count( $data['db'] ) ) {
104
  $name = __( 'Database', 'query-monitor' );
105
  } else {
106
  $name = sprintf( __( 'Database: %s', 'query-monitor' ), $id );
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
69
  echo '<td>';
70
  echo esc_html( $val['after'] );
71
 
72
+ if ( $val['after'] !== $val['before'] ) {
73
  printf(
74
  '<br><span class="qm-info">&nbsp;%s</span>',
75
  esc_html( sprintf(
100
 
101
  foreach ( $data['db'] as $id => $db ) {
102
 
103
+ if ( 1 === count( $data['db'] ) ) {
104
  $name = __( 'Database', 'query-monitor' );
105
  } else {
106
  $name = sprintf( __( 'Database: %s', 'query-monitor' ), $id );
output/html/hooks.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
@@ -103,7 +103,7 @@ class QM_Output_Html_Hooks extends QM_Output_Html {
103
 
104
  if ( $first ) {
105
 
106
- echo "<th rowspan='" . absint( $rowspan ) . "'>";
107
  echo $hook_name; // WPCS: XSS ok.
108
  if ( 'all' === $hook['name'] ) {
109
  echo '<br><span class="qm-warn">';
@@ -118,7 +118,7 @@ class QM_Output_Html_Hooks extends QM_Output_Html {
118
  }
119
 
120
  echo '<td class="qm-num">' . intval( $action['priority'] ) . '</td>';
121
- echo '<td class="qm-ltr qm-nowrap">';
122
 
123
  if ( isset( $action['callback']['file'] ) ) {
124
  echo self::output_filename( $action['callback']['name'], $action['callback']['file'], $action['callback']['line'] ); // WPCS: XSS ok.
@@ -145,7 +145,7 @@ class QM_Output_Html_Hooks extends QM_Output_Html {
145
 
146
  } else {
147
  echo "<tr{$attr}>"; // WPCS: XSS ok.
148
- echo "<th>";
149
  echo $hook_name; // WPCS: XSS ok.
150
  echo '</th>';
151
  echo '<td colspan="3">&nbsp;</td>';
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
103
 
104
  if ( $first ) {
105
 
106
+ echo "<th rowspan='" . absint( $rowspan ) . "' class='qm-nowrap'>";
107
  echo $hook_name; // WPCS: XSS ok.
108
  if ( 'all' === $hook['name'] ) {
109
  echo '<br><span class="qm-warn">';
118
  }
119
 
120
  echo '<td class="qm-num">' . intval( $action['priority'] ) . '</td>';
121
+ echo '<td class="qm-ltr qm-wrap">';
122
 
123
  if ( isset( $action['callback']['file'] ) ) {
124
  echo self::output_filename( $action['callback']['name'], $action['callback']['file'], $action['callback']['line'] ); // WPCS: XSS ok.
145
 
146
  } else {
147
  echo "<tr{$attr}>"; // WPCS: XSS ok.
148
+ echo '<th>';
149
  echo $hook_name; // WPCS: XSS ok.
150
  echo '</th>';
151
  echo '<td colspan="3">&nbsp;</td>';
output/html/http.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
@@ -146,8 +146,8 @@ class QM_Output_Html_HTTP extends QM_Output_Html {
146
  );
147
  printf(
148
  '<td class="qm-nowrap qm-ltr">%s</td>',
149
- implode( '<br>', $stack ) // WPCS: XSS ok.
150
- );
151
  printf(
152
  '<td class="qm-nowrap">%s</td>',
153
  esc_html( $component->name )
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
146
  );
147
  printf(
148
  '<td class="qm-nowrap qm-ltr">%s</td>',
149
+ implode( '<br>', $stack )
150
+ ); // WPCS: XSS ok.
151
  printf(
152
  '<td class="qm-nowrap">%s</td>',
153
  esc_html( $component->name )
output/html/languages.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
output/html/overview.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
output/html/php_errors.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
output/html/request.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
@@ -72,9 +72,9 @@ class QM_Output_Html_Request extends QM_Output_Html {
72
  }
73
 
74
  if ( isset( $data['plugin_qvars'][$var] ) ) {
75
- echo "<td><span class='qm-current'>" . esc_html( $var ) . "</span></td>";
76
  } else {
77
- echo "<td>" . esc_html( $var ) . "</td>";
78
  }
79
 
80
  if ( is_array( $value ) or is_object( $value ) ) {
@@ -82,7 +82,7 @@ class QM_Output_Html_Request extends QM_Output_Html {
82
  echo esc_html( print_r( $value, true ) );
83
  echo '</pre></td>';
84
  } else {
85
- echo "<td>" . esc_html( $value ) . "</td>";
86
  }
87
 
88
  echo '</tr>';
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
72
  }
73
 
74
  if ( isset( $data['plugin_qvars'][$var] ) ) {
75
+ echo '<td><span class="qm-current">' . esc_html( $var ) . '</span></td>';
76
  } else {
77
+ echo '<td>' . esc_html( $var ) . '</td>';
78
  }
79
 
80
  if ( is_array( $value ) or is_object( $value ) ) {
82
  echo esc_html( print_r( $value, true ) );
83
  echo '</pre></td>';
84
  } else {
85
+ echo '<td>' . esc_html( $value ) . '</td>';
86
  }
87
 
88
  echo '</tr>';
output/html/rewrites.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright 2009-2016 John Blackbourn
4
+
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation; either version 2 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ */
16
+
17
+ class QM_Output_Html_Rewrites extends QM_Output_Html {
18
+
19
+ public function __construct( QM_Collector $collector ) {
20
+ parent::__construct( $collector );
21
+ add_filter( 'qm/output/menus', array( $this, 'admin_menu' ), 55 );
22
+ }
23
+
24
+ public function output() {
25
+
26
+ $data = $this->collector->get_data();
27
+
28
+ echo '<div class="qm qm-half" id="' . esc_attr( $this->collector->id() ) . '">';
29
+ echo '<table cellspacing="0">';
30
+
31
+ echo '<thead>';
32
+ echo '<tr>';
33
+ echo '<th valign="top" colspan="2">' . esc_html__( 'Matching Rewrite Rules', 'query-monitor' ) . '</th>';
34
+ echo '</tr>';
35
+ echo '</thead>';
36
+
37
+ echo '<tbody>';
38
+
39
+ if ( ! empty( $data['matching'] ) ) {
40
+
41
+ foreach ( $data['matching'] as $rule => $query ) {
42
+
43
+ $query = str_replace( 'index.php?', '', $query );
44
+
45
+ echo '<tr>';
46
+ echo '<td valign="top">' . esc_html( $rule ) . '</td>';
47
+ echo '<td valign="top">';
48
+ echo self::format_url( $query ); // WPCS: XSS ok.
49
+ echo '</td>';
50
+ echo '</tr>';
51
+
52
+ }
53
+
54
+ } else {
55
+
56
+ echo '<tr>';
57
+ echo '<td valign="top" colspan="2"><em>' . esc_html__( 'None', 'query-monitor' ) . '</em></td>';
58
+ echo '</tr>';
59
+
60
+ }
61
+
62
+ echo '</tbody>';
63
+ echo '</table>';
64
+ echo '</div>';
65
+
66
+ }
67
+
68
+ }
69
+
70
+ function register_qm_output_html_rewrites( array $output, QM_Collectors $collectors ) {
71
+ if ( $collector = QM_Collectors::get( 'rewrites' ) ) {
72
+ $output['rewrites'] = new QM_Output_Html_Rewrites( $collector );
73
+ }
74
+ return $output;
75
+ }
76
+
77
+ add_filter( 'qm/outputter/html', 'register_qm_output_html_rewrites', 65, 2 );
output/html/theme.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ class QM_Output_Html_Theme extends QM_Output_Html {
29
  return;
30
  }
31
 
32
- $child_theme = ( $data['stylesheet'] != $data['template'] );
33
 
34
  echo '<div class="qm qm-half" id="' . esc_attr( $this->collector->id() ) . '">';
35
  echo '<table cellspacing="0">';
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
29
  return;
30
  }
31
 
32
+ $child_theme = ( $data['stylesheet'] !== $data['template'] );
33
 
34
  echo '<div class="qm qm-half" id="' . esc_attr( $this->collector->id() ) . '">';
35
  echo '<table cellspacing="0">';
output/html/transients.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2015 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
@@ -89,8 +89,8 @@ class QM_Output_Html_Transients extends QM_Output_Html {
89
 
90
  printf(
91
  '<td class="qm-nowrap qm-ltr">%s</td>',
92
- implode( '<br>', $stack ) // WPCS: XSS ok.
93
- );
94
  printf(
95
  '<td class="qm-nowrap">%s</td>',
96
  esc_html( $component->name )
1
  <?php
2
  /*
3
+ Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
89
 
90
  printf(
91
  '<td class="qm-nowrap qm-ltr">%s</td>',
92
+ implode( '<br>', $stack )
93
+ ); // WPCS: XSS ok.
94
  printf(
95
  '<td class="qm-nowrap">%s</td>',
96
  esc_html( $component->name )
query-monitor.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Query Monitor
4
  Description: Monitoring of database queries, hooks, conditionals and more.
5
- Version: 2.8.1
6
  Plugin URI: https://querymonitor.com/
7
  Author: John Blackbourn
8
  Author URI: https://johnblackbourn.com/
@@ -10,7 +10,7 @@ Text Domain: query-monitor
10
  Domain Path: /languages/
11
  License: GPL v2 or later
12
 
13
- Copyright 2009-2015 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
2
  /*
3
  Plugin Name: Query Monitor
4
  Description: Monitoring of database queries, hooks, conditionals and more.
5
+ Version: 2.9.0
6
  Plugin URI: https://querymonitor.com/
7
  Author: John Blackbourn
8
  Author URI: https://johnblackbourn.com/
10
  Domain Path: /languages/
11
  License: GPL v2 or later
12
 
13
+ Copyright 2009-2016 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
readme.txt CHANGED
@@ -3,7 +3,7 @@ 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.4
6
- Stable tag: 2.8.1
7
  License: GPLv2 or later
8
 
9
  View debugging and performance information on database queries, hooks, conditionals, HTTP requests, redirects and more.
@@ -53,6 +53,10 @@ Filtering queries by component or calling function makes it easy to see which pl
53
  * Shows the **queried object** details
54
  * Shows details of the **current blog** (multisite only) and **current site** (multi-network only)
55
 
 
 
 
 
56
  = Scripts & Styles =
57
 
58
  * Shows all **enqueued scripts and styles** on the current page, along with their URL and version
@@ -153,6 +157,12 @@ In addition, Query Monitor transparently supports add-ons for the Debug Bar plug
153
 
154
  Please use [the issue tracker on Query Monitor's GitHub repo](https://github.com/johnbillion/query-monitor/issues) as it's easier to keep track of issues there, rather than on the wordpress.org support forums.
155
 
 
 
 
 
 
 
156
  = I'm using multiple instances of `wpdb`. How do I get my additional instances to show up in Query Monitor? =
157
 
158
  You'll need to hook into the `qm/collect/db_objects` filter and add an item to the array with your connection name as the key and the `wpdb` instance as the value. Your `wpdb` instance will then show up as a separate panel, and the query time and query count will show up separately in the admin toolbar menu. Aggregate information (queries by caller and component) will not be separated.
@@ -163,6 +173,15 @@ No, I do not accept donations. If you like the plugin, I'd love for you to [leav
163
 
164
  == Changelog ==
165
 
 
 
 
 
 
 
 
 
 
166
  = 2.8.1 =
167
  * Correctly detect the file name and line number responsible for loading translation files in plugins which use `load_textdomain()`.
168
  * Correct the visibility of the `before_output()` method in the REST dispatcher.
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.4
6
+ Stable tag: 2.9.0
7
  License: GPLv2 or later
8
 
9
  View debugging and performance information on database queries, hooks, conditionals, HTTP requests, redirects and more.
53
  * Shows the **queried object** details
54
  * Shows details of the **current blog** (multisite only) and **current site** (multi-network only)
55
 
56
+ = Rewrite Rules =
57
+
58
+ * Shows **all matching rewrite rules** for a given request
59
+
60
  = Scripts & Styles =
61
 
62
  * Shows all **enqueued scripts and styles** on the current page, along with their URL and version
157
 
158
  Please use [the issue tracker on Query Monitor's GitHub repo](https://github.com/johnbillion/query-monitor/issues) as it's easier to keep track of issues there, rather than on the wordpress.org support forums.
159
 
160
+ = Is Query Monitor available on WordPress.com VIP Go? =
161
+
162
+ Yep! You just need to add `define( 'WPCOM_VIP_QM_ENABLE', true );` to your `vip-config/vip-config.php` file.
163
+
164
+ (It's not available on standard WordPress.com VIP though.)
165
+
166
  = I'm using multiple instances of `wpdb`. How do I get my additional instances to show up in Query Monitor? =
167
 
168
  You'll need to hook into the `qm/collect/db_objects` filter and add an item to the array with your connection name as the key and the `wpdb` instance as the value. Your `wpdb` instance will then show up as a separate panel, and the query time and query count will show up separately in the admin toolbar menu. Aggregate information (queries by caller and component) will not be separated.
173
 
174
  == Changelog ==
175
 
176
+ = 2.9.0 =
177
+
178
+ * Introduce a new panel which displays all matching rewrite rules for the current request.
179
+ * Remove the deprecated `is_comments_popup()` from the list of conditionals.
180
+ * Improve the display of scripts and styles which are blocked by Airplane Mode (0.1.4 and later).
181
+ * Gracefully handle enqueued assets which are deregistered late without being unenqueued.
182
+ * Add a filter to hide the extended query information prompt.
183
+ * Various minor bugfixes and code quality tweaks.
184
+
185
  = 2.8.1 =
186
  * Correctly detect the file name and line number responsible for loading translation files in plugins which use `load_textdomain()`.
187
  * Correct the visibility of the `before_output()` method in the REST dispatcher.
wp-content/db.php CHANGED
@@ -9,7 +9,7 @@ additional database query information in Query Monitor's output.
9
 
10
  *********************************************************************
11
 
12
- Copyright 2009-2015 John Blackbourn
13
 
14
  This program is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License as published by
9
 
10
  *********************************************************************
11
 
12
+ Copyright 2009-2016 John Blackbourn
13
 
14
  This program is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License as published by