Query Monitor - Version 3.6.1

Version Description

Download this release

Release Info

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

Code changes from version 3.6.0 to 3.6.1

assets/query-monitor-dark.css CHANGED
@@ -1050,6 +1050,7 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
1050
  #query-monitor-main .qm a.qm-external-link:after,
1051
  #query-monitor-main .qm a.qm-link:after,
1052
  #query-monitor-main .qm a.qm-edit-link:after,
 
1053
  #query-monitor-main .qm button.qm-filter-trigger:after {
1054
  display: inline-block !important;
1055
  font-family: dashicons !important;
@@ -1062,6 +1063,13 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
1062
  visibility: hidden !important;
1063
  }
1064
 
 
 
 
 
 
 
 
1065
  #query-monitor-main .qm a.qm-external-link:after,
1066
  #query-monitor-main .qm a.qm-link:hover:after,
1067
  #query-monitor-main .qm a.qm-link:focus:after,
1050
  #query-monitor-main .qm a.qm-external-link:after,
1051
  #query-monitor-main .qm a.qm-link:after,
1052
  #query-monitor-main .qm a.qm-edit-link:after,
1053
+ #query-monitor-main .qm button.qm-filter-info:before,
1054
  #query-monitor-main .qm button.qm-filter-trigger:after {
1055
  display: inline-block !important;
1056
  font-family: dashicons !important;
1063
  visibility: hidden !important;
1064
  }
1065
 
1066
+ #query-monitor-main .qm button.qm-filter-info:before {
1067
+ left: unset !important;
1068
+ right: 2px !important;
1069
+ content: '\f534' !important;
1070
+ visibility: visible !important;
1071
+ }
1072
+
1073
  #query-monitor-main .qm a.qm-external-link:after,
1074
  #query-monitor-main .qm a.qm-link:hover:after,
1075
  #query-monitor-main .qm a.qm-link:focus:after,
assets/query-monitor.css CHANGED
@@ -1050,6 +1050,7 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
1050
  #query-monitor-main .qm a.qm-external-link:after,
1051
  #query-monitor-main .qm a.qm-link:after,
1052
  #query-monitor-main .qm a.qm-edit-link:after,
 
1053
  #query-monitor-main .qm button.qm-filter-trigger:after {
1054
  display: inline-block !important;
1055
  font-family: dashicons !important;
@@ -1062,6 +1063,13 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
1062
  visibility: hidden !important;
1063
  }
1064
 
 
 
 
 
 
 
 
1065
  #query-monitor-main .qm a.qm-external-link:after,
1066
  #query-monitor-main .qm a.qm-link:hover:after,
1067
  #query-monitor-main .qm a.qm-link:focus:after,
1050
  #query-monitor-main .qm a.qm-external-link:after,
1051
  #query-monitor-main .qm a.qm-link:after,
1052
  #query-monitor-main .qm a.qm-edit-link:after,
1053
+ #query-monitor-main .qm button.qm-filter-info:before,
1054
  #query-monitor-main .qm button.qm-filter-trigger:after {
1055
  display: inline-block !important;
1056
  font-family: dashicons !important;
1063
  visibility: hidden !important;
1064
  }
1065
 
1066
+ #query-monitor-main .qm button.qm-filter-info:before {
1067
+ left: unset !important;
1068
+ right: 2px !important;
1069
+ content: '\f534' !important;
1070
+ visibility: visible !important;
1071
+ }
1072
+
1073
  #query-monitor-main .qm a.qm-external-link:after,
1074
  #query-monitor-main .qm a.qm-link:hover:after,
1075
  #query-monitor-main .qm a.qm-link:focus:after,
assets/query-monitor.js CHANGED
@@ -54,6 +54,8 @@ if ( window.jQuery ) {
54
  var minwidth = 300;
55
  var maxwidth = $(window).width();
56
  var container = $('#query-monitor-main');
 
 
57
  var container_height_key = 'qm-container-height';
58
  var container_pinned_key = 'qm-' + ( $('body').hasClass('wp-admin') ? 'admin' : 'front' ) + '-container-pinned';
59
  var container_position_key = 'qm-container-position';
@@ -131,6 +133,12 @@ if ( window.jQuery ) {
131
  container.height( minheight );
132
  }
133
 
 
 
 
 
 
 
134
  $('#qm-panel-menu').find('button').removeAttr('aria-selected');
135
  $('#qm-panel-menu').find('li').removeClass('qm-current-menu');
136
  var selected_menu = $('#qm-panel-menu').find('[data-qm-href="' + panel + '"]').attr('aria-selected',true);
@@ -470,12 +478,14 @@ if ( window.jQuery ) {
470
  var h = ( startY - ( event.clientY || event.originalEvent.targetTouches[0].pageY ) );
471
  if ( h >= resizerHeight && h <= maxheight ) {
472
  container.height( h );
 
473
  }
474
  } else {
475
  var w = ( startX - event.clientX );
476
  if ( w >= minwidth && w <= maxwidth ) {
477
  container.width( w );
478
  }
 
479
  }
480
  }
481
 
@@ -545,6 +555,7 @@ if ( window.jQuery ) {
545
 
546
  $('.qm-button-container-close').click(function(){
547
  container.removeClass('qm-show').height('').width('');
 
548
  localStorage.removeItem( container_pinned_key );
549
  });
550
 
@@ -563,8 +574,12 @@ if ( window.jQuery ) {
563
  container.width( w );
564
  }
565
 
 
 
566
  localStorage.setItem( container_position_key, 'right' );
567
  } else {
 
 
568
  localStorage.removeItem( container_position_key );
569
  }
570
  });
54
  var minwidth = 300;
55
  var maxwidth = $(window).width();
56
  var container = $('#query-monitor-main');
57
+ var body = $('body');
58
+ var body_margin = body.css('margin-bottom');
59
  var container_height_key = 'qm-container-height';
60
  var container_pinned_key = 'qm-' + ( $('body').hasClass('wp-admin') ? 'admin' : 'front' ) + '-container-pinned';
61
  var container_position_key = 'qm-container-position';
133
  container.height( minheight );
134
  }
135
 
136
+ if ( container.hasClass('qm-show-right') ) {
137
+ body.css( 'margin-bottom', '' );
138
+ } else {
139
+ body.css( 'margin-bottom', 'calc( ' + body_margin + ' + ' + container.height() + 'px )' );
140
+ }
141
+
142
  $('#qm-panel-menu').find('button').removeAttr('aria-selected');
143
  $('#qm-panel-menu').find('li').removeClass('qm-current-menu');
144
  var selected_menu = $('#qm-panel-menu').find('[data-qm-href="' + panel + '"]').attr('aria-selected',true);
478
  var h = ( startY - ( event.clientY || event.originalEvent.targetTouches[0].pageY ) );
479
  if ( h >= resizerHeight && h <= maxheight ) {
480
  container.height( h );
481
+ body.css( 'margin-bottom', 'calc( ' + body_margin + ' + ' + h + 'px )' );
482
  }
483
  } else {
484
  var w = ( startX - event.clientX );
485
  if ( w >= minwidth && w <= maxwidth ) {
486
  container.width( w );
487
  }
488
+ body.css( 'margin-bottom', '' );
489
  }
490
  }
491
 
555
 
556
  $('.qm-button-container-close').click(function(){
557
  container.removeClass('qm-show').height('').width('');
558
+ body.css( 'margin-bottom', '' );
559
  localStorage.removeItem( container_pinned_key );
560
  });
561
 
574
  container.width( w );
575
  }
576
 
577
+ body.css( 'margin-bottom', '' );
578
+
579
  localStorage.setItem( container_position_key, 'right' );
580
  } else {
581
+ body.css( 'margin-bottom', 'calc( ' + body_margin + ' + ' + container.height() + 'px )' );
582
+
583
  localStorage.removeItem( container_position_key );
584
  }
585
  });
classes/Activation.php CHANGED
@@ -32,7 +32,7 @@ class QM_Activation extends QM_Plugin {
32
  $db = WP_CONTENT_DIR . '/db.php';
33
 
34
  if ( ! file_exists( $db ) && function_exists( 'symlink' ) ) {
35
- @symlink( $this->plugin_path( 'wp-content/db.php' ), $db ); // @codingStandardsIgnoreLine
36
  }
37
 
38
  if ( $sitewide ) {
@@ -53,7 +53,7 @@ class QM_Activation extends QM_Plugin {
53
 
54
  # Only delete db.php if it belongs to Query Monitor
55
  if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && class_exists( 'QM_DB' ) ) {
56
- unlink( WP_CONTENT_DIR . '/db.php' ); // @codingStandardsIgnoreLine
57
  }
58
 
59
  }
@@ -66,7 +66,7 @@ class QM_Activation extends QM_Plugin {
66
  return $plugins;
67
  }
68
 
69
- $f = preg_quote( basename( $this->plugin_base() ) );
70
 
71
  return array_merge(
72
  preg_grep( '/' . $f . '$/', $plugins ),
32
  $db = WP_CONTENT_DIR . '/db.php';
33
 
34
  if ( ! file_exists( $db ) && function_exists( 'symlink' ) ) {
35
+ @symlink( $this->plugin_path( 'wp-content/db.php' ), $db ); // phpcs:ignore
36
  }
37
 
38
  if ( $sitewide ) {
53
 
54
  # Only delete db.php if it belongs to Query Monitor
55
  if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && class_exists( 'QM_DB' ) ) {
56
+ unlink( WP_CONTENT_DIR . '/db.php' ); // phpcs:ignore
57
  }
58
 
59
  }
66
  return $plugins;
67
  }
68
 
69
+ $f = preg_quote( basename( $this->plugin_base() ), '/' );
70
 
71
  return array_merge(
72
  preg_grep( '/' . $f . '$/', $plugins ),
classes/Backtrace.php CHANGED
@@ -54,8 +54,8 @@ class QM_Backtrace {
54
  protected $calling_line = 0;
55
  protected $calling_file = '';
56
 
57
- public function __construct( array $args = array() ) {
58
- $this->trace = debug_backtrace( false );
59
 
60
  $args = array_merge( array(
61
  'ignore_current_filter' => true,
54
  protected $calling_line = 0;
55
  protected $calling_file = '';
56
 
57
+ public function __construct( array $args = array(), array $trace = null ) {
58
+ $this->trace = ( null === $trace ) ? debug_backtrace( false ) : $trace;
59
 
60
  $args = array_merge( array(
61
  'ignore_current_filter' => true,
classes/Dispatcher.php CHANGED
@@ -124,15 +124,15 @@ abstract class QM_Dispatcher {
124
  }
125
 
126
  public static function user_verified() {
127
- if ( isset( $_COOKIE[QM_COOKIE] ) ) { // @codingStandardsIgnoreLine
128
- return self::verify_cookie( wp_unslash( $_COOKIE[QM_COOKIE] ) ); // @codingStandardsIgnoreLine
129
  }
130
  return false;
131
  }
132
 
133
  public static function editor_cookie() {
134
- if ( defined( 'QM_EDITOR_COOKIE' ) && isset( $_COOKIE[QM_EDITOR_COOKIE] ) ) { // @codingStandardsIgnoreLine
135
- return $_COOKIE[QM_EDITOR_COOKIE]; // @codingStandardsIgnoreLine
136
  }
137
  return '';
138
  }
124
  }
125
 
126
  public static function user_verified() {
127
+ if ( isset( $_COOKIE[QM_COOKIE] ) ) { // phpcs:ignore
128
+ return self::verify_cookie( wp_unslash( $_COOKIE[QM_COOKIE] ) ); // phpcs:ignore
129
  }
130
  return false;
131
  }
132
 
133
  public static function editor_cookie() {
134
+ if ( defined( 'QM_EDITOR_COOKIE' ) && isset( $_COOKIE[QM_EDITOR_COOKIE] ) ) { // phpcs:ignore
135
+ return $_COOKIE[QM_EDITOR_COOKIE]; // phpcs:ignore
136
  }
137
  return '';
138
  }
classes/Util.php CHANGED
@@ -315,7 +315,7 @@ class QM_Util {
315
  if ( self::is_ajax() ) {
316
  return true;
317
  }
318
- if ( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && 'xmlhttprequest' === strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) ) { // @codingStandardsIgnoreLine
319
  return true;
320
  }
321
  return false;
@@ -340,12 +340,12 @@ class QM_Util {
340
  return false;
341
  }
342
 
343
- // @codingStandardsIgnoreStart
344
  $num_sites = $wpdb->get_var( "
345
  SELECT COUNT(*)
346
  FROM {$wpdb->site}
347
  " );
348
- // @codingStandardsIgnoreEnd
349
 
350
  return ( $num_sites > 1 );
351
  }
315
  if ( self::is_ajax() ) {
316
  return true;
317
  }
318
+ if ( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && 'xmlhttprequest' === strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) ) { // phpcs:ignore
319
  return true;
320
  }
321
  return false;
340
  return false;
341
  }
342
 
343
+ // phpcs:disable
344
  $num_sites = $wpdb->get_var( "
345
  SELECT COUNT(*)
346
  FROM {$wpdb->site}
347
  " );
348
+ // phpcs:enable
349
 
350
  return ( $num_sites > 1 );
351
  }
collectors/admin.php CHANGED
@@ -42,7 +42,7 @@ class QM_Collector_Admin extends QM_Collector {
42
 
43
  $current_screen = get_current_screen();
44
 
45
- if ( isset( $_GET['page'] ) && null !== $current_screen ) { // @codingStandardsIgnoreLine
46
  $this->data['base'] = $current_screen->base;
47
  } else {
48
  $this->data['base'] = $pagenow;
42
 
43
  $current_screen = get_current_screen();
44
 
45
+ if ( isset( $_GET['page'] ) && null !== $current_screen ) { // phpcs:ignore
46
  $this->data['base'] = $current_screen->base;
47
  } else {
48
  $this->data['base'] = $pagenow;
collectors/assets_scripts.php CHANGED
@@ -14,10 +14,19 @@ class QM_Collector_Assets_Scripts extends QM_Collector_Assets {
14
  }
15
 
16
  public function get_concerned_actions() {
17
- return array(
18
- 'admin_print_footer_scripts',
19
- 'wp_print_footer_scripts',
20
- );
 
 
 
 
 
 
 
 
 
21
  }
22
 
23
  public function get_concerned_filters() {
14
  }
15
 
16
  public function get_concerned_actions() {
17
+ if ( is_admin() ) {
18
+ return array(
19
+ 'admin_enqueue_scripts',
20
+ 'admin_print_footer_scripts',
21
+ 'admin_print_scripts',
22
+ );
23
+ } else {
24
+ return array(
25
+ 'wp_enqueue_scripts',
26
+ 'wp_print_footer_scripts',
27
+ 'wp_print_scripts',
28
+ );
29
+ }
30
  }
31
 
32
  public function get_concerned_filters() {
collectors/db_queries.php CHANGED
@@ -111,7 +111,7 @@ class QM_Collector_DB_Queries extends QM_Collector {
111
  foreach ( (array) $db->queries as $query ) {
112
 
113
  # @TODO: decide what I want to do with this:
114
- if ( false !== strpos( $query[2], 'wp_admin_bar' ) and !isset( $_REQUEST['qm_display_admin_bar'] ) ) { // @codingStandardsIgnoreLine
115
  continue;
116
  }
117
 
111
  foreach ( (array) $db->queries as $query ) {
112
 
113
  # @TODO: decide what I want to do with this:
114
+ if ( false !== strpos( $query[2], 'wp_admin_bar' ) and !isset( $_REQUEST['qm_display_admin_bar'] ) ) { // phpcs:ignore
115
  continue;
116
  }
117
 
collectors/debug_bar.php CHANGED
@@ -10,10 +10,6 @@ final class QM_Collector_Debug_Bar extends QM_Collector {
10
  public $id = 'debug_bar';
11
  private $panel = null;
12
 
13
- public function __construct() {
14
- parent::__construct();
15
- }
16
-
17
  public function set_panel( Debug_Bar_Panel $panel ) {
18
  $this->panel = $panel;
19
  }
@@ -74,7 +70,7 @@ function register_qm_collectors_debug_bar() {
74
  }
75
 
76
  function qm_debug_bar_being_activated() {
77
- // @codingStandardsIgnoreStart
78
 
79
  if ( ! is_admin() ) {
80
  return false;
@@ -107,7 +103,7 @@ function qm_debug_bar_being_activated() {
107
  }
108
 
109
  return false;
110
- // @codingStandardsIgnoreEnd
111
  }
112
 
113
  add_action( 'init', 'register_qm_collectors_debug_bar' );
10
  public $id = 'debug_bar';
11
  private $panel = null;
12
 
 
 
 
 
13
  public function set_panel( Debug_Bar_Panel $panel ) {
14
  $this->panel = $panel;
15
  }
70
  }
71
 
72
  function qm_debug_bar_being_activated() {
73
+ // phpcs:disable
74
 
75
  if ( ! is_admin() ) {
76
  return false;
103
  }
104
 
105
  return false;
106
+ // phpcs:enable
107
  }
108
 
109
  add_action( 'init', 'register_qm_collectors_debug_bar' );
collectors/environment.php CHANGED
@@ -119,14 +119,14 @@ class QM_Collector_Environment extends QM_Collector {
119
  $info = mysqli_get_server_info( $db->dbh );
120
  } else {
121
  // Please do not report this code as a PHP 7 incompatibility. Observe the surrounding logic.
122
- // @codingStandardsIgnoreLine
123
  if ( preg_match( '|[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}|', mysql_get_client_info(), $matches ) ) {
124
  $client = $matches[0];
125
  } else {
126
  $client = null;
127
  }
128
  // Please do not report this code as a PHP 7 incompatibility. Observe the surrounding logic.
129
- // @codingStandardsIgnoreLine
130
  $info = mysql_get_server_info( $db->dbh );
131
  }
132
 
@@ -260,9 +260,12 @@ class QM_Collector_Environment extends QM_Collector {
260
  $php_u = null;
261
 
262
  if ( function_exists( 'posix_getpwuid' ) ) {
263
- $u = posix_getpwuid( posix_getuid() );
264
- $g = posix_getgrgid( $u['gid'] );
265
- $php_u = $u['name'] . ':' . $g['name'];
 
 
 
266
  }
267
 
268
  if ( empty( $php_u ) && isset( $_ENV['APACHE_RUN_USER'] ) ) {
@@ -277,7 +280,7 @@ class QM_Collector_Environment extends QM_Collector {
277
  }
278
 
279
  if ( empty( $php_u ) && function_exists( 'exec' ) ) {
280
- $php_u = exec( 'whoami' ); // @codingStandardsIgnoreLine
281
  }
282
 
283
  if ( empty( $php_u ) && function_exists( 'getenv' ) ) {
119
  $info = mysqli_get_server_info( $db->dbh );
120
  } else {
121
  // Please do not report this code as a PHP 7 incompatibility. Observe the surrounding logic.
122
+ // phpcs:ignore
123
  if ( preg_match( '|[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}|', mysql_get_client_info(), $matches ) ) {
124
  $client = $matches[0];
125
  } else {
126
  $client = null;
127
  }
128
  // Please do not report this code as a PHP 7 incompatibility. Observe the surrounding logic.
129
+ // phpcs:ignore
130
  $info = mysql_get_server_info( $db->dbh );
131
  }
132
 
260
  $php_u = null;
261
 
262
  if ( function_exists( 'posix_getpwuid' ) ) {
263
+ $u = posix_getpwuid( posix_getuid() );
264
+ $g = posix_getgrgid( $u['gid'] );
265
+
266
+ if ( ! empty( $u ) && ! empty( $g ) ) {
267
+ $php_u = $u['name'] . ':' . $g['name'];
268
+ }
269
  }
270
 
271
  if ( empty( $php_u ) && isset( $_ENV['APACHE_RUN_USER'] ) ) {
280
  }
281
 
282
  if ( empty( $php_u ) && function_exists( 'exec' ) ) {
283
+ $php_u = exec( 'whoami' ); // phpcs:ignore
284
  }
285
 
286
  if ( empty( $php_u ) && function_exists( 'getenv' ) ) {
collectors/php_errors.php CHANGED
@@ -203,6 +203,10 @@ class QM_Collector_PHP_Errors extends QM_Collector {
203
  protected function output_fatal( $error, array $e ) {
204
  $dispatcher = QM_Dispatchers::get( 'html' );
205
 
 
 
 
 
206
  if ( empty( $this->display_errors ) && ! $dispatcher::user_can_view() ) {
207
  return;
208
  }
203
  protected function output_fatal( $error, array $e ) {
204
  $dispatcher = QM_Dispatchers::get( 'html' );
205
 
206
+ if ( empty( $dispatcher ) ) {
207
+ return;
208
+ }
209
+
210
  if ( empty( $this->display_errors ) && ! $dispatcher::user_can_view() ) {
211
  return;
212
  }
collectors/request.php CHANGED
@@ -159,7 +159,7 @@ class QM_Collector_Request extends QM_Collector {
159
  if ( is_admin() ) {
160
  if ( isset( $_SERVER['REQUEST_URI'] ) ) {
161
  $home_path = trim( parse_url( home_url(), PHP_URL_PATH ), '/' );
162
- $request = wp_unslash( $_SERVER['REQUEST_URI'] ); // @codingStandardsIgnoreLine
163
 
164
  $this->data['request']['request'] = str_replace( "/{$home_path}/", '', $request );
165
  } else {
@@ -265,7 +265,7 @@ class QM_Collector_Request extends QM_Collector {
265
  }
266
 
267
  if ( isset( $_SERVER['REQUEST_METHOD'] ) ) {
268
- $this->data['request_method'] = strtoupper( wp_unslash( $_SERVER['REQUEST_METHOD'] ) ); // @codingStandardsIgnoreLine
269
  } else {
270
  $this->data['request_method'] = '';
271
  }
159
  if ( is_admin() ) {
160
  if ( isset( $_SERVER['REQUEST_URI'] ) ) {
161
  $home_path = trim( parse_url( home_url(), PHP_URL_PATH ), '/' );
162
+ $request = wp_unslash( $_SERVER['REQUEST_URI'] ); // phpcs:ignore
163
 
164
  $this->data['request']['request'] = str_replace( "/{$home_path}/", '', $request );
165
  } else {
265
  }
266
 
267
  if ( isset( $_SERVER['REQUEST_METHOD'] ) ) {
268
+ $this->data['request_method'] = strtoupper( wp_unslash( $_SERVER['REQUEST_METHOD'] ) ); // phpcs:ignore
269
  } else {
270
  $this->data['request_method'] = '';
271
  }
collectors/theme.php CHANGED
@@ -9,6 +9,7 @@ class QM_Collector_Theme extends QM_Collector {
9
 
10
  public $id = 'response';
11
  protected $got_theme_compat = false;
 
12
 
13
  public function __construct() {
14
  parent::__construct();
@@ -95,7 +96,13 @@ class QM_Collector_Theme extends QM_Collector {
95
  if ( function_exists( $conditional ) && function_exists( $get_template ) && call_user_func( $conditional ) ) {
96
  $filter = str_replace( '_', '', $template );
97
  add_filter( "{$filter}_template_hierarchy", array( $this, 'filter_template_hierarchy' ), PHP_INT_MAX );
98
- call_user_func( $get_template );
 
 
 
 
 
 
99
  remove_filter( "{$filter}_template_hierarchy", array( $this, 'filter_template_hierarchy' ), PHP_INT_MAX );
100
  }
101
  }
@@ -120,6 +127,8 @@ class QM_Collector_Theme extends QM_Collector {
120
  }
121
 
122
  public function filter_template_hierarchy( array $templates ) {
 
 
123
  if ( ! isset( $this->data['template_hierarchy'] ) ) {
124
  $this->data['template_hierarchy'] = array();
125
  }
9
 
10
  public $id = 'response';
11
  protected $got_theme_compat = false;
12
+ protected $query_templates = array();
13
 
14
  public function __construct() {
15
  parent::__construct();
96
  if ( function_exists( $conditional ) && function_exists( $get_template ) && call_user_func( $conditional ) ) {
97
  $filter = str_replace( '_', '', $template );
98
  add_filter( "{$filter}_template_hierarchy", array( $this, 'filter_template_hierarchy' ), PHP_INT_MAX );
99
+ $loaded_template = call_user_func( $get_template );
100
+ $default_template = locate_template( $this->query_templates );
101
+
102
+ if ( $default_template !== $loaded_template ) {
103
+ $this->data['template_altered'] = true;
104
+ }
105
+
106
  remove_filter( "{$filter}_template_hierarchy", array( $this, 'filter_template_hierarchy' ), PHP_INT_MAX );
107
  }
108
  }
127
  }
128
 
129
  public function filter_template_hierarchy( array $templates ) {
130
+ $this->query_templates = $templates;
131
+
132
  if ( ! isset( $this->data['template_hierarchy'] ) ) {
133
  $this->data['template_hierarchy'] = array();
134
  }
dispatchers/Html.php CHANGED
@@ -452,6 +452,7 @@ class QM_Dispatcher_Html extends QM_Dispatcher {
452
  'Netbeans' => 'netbeans',
453
  'PhpStorm' => 'phpstorm',
454
  'Sublime Text' => 'sublime',
 
455
  'Visual Studio Code' => 'vscode',
456
  );
457
 
@@ -620,7 +621,7 @@ class QM_Dispatcher_Html extends QM_Dispatcher {
620
  $start_memory = memory_get_usage();
621
 
622
  try {
623
- $var = unserialize( serialize( $var ) ); // @codingStandardsIgnoreLine
624
  } catch ( Exception $e ) {
625
  return $e;
626
  }
452
  'Netbeans' => 'netbeans',
453
  'PhpStorm' => 'phpstorm',
454
  'Sublime Text' => 'sublime',
455
+ 'TextMate' => 'textmate',
456
  'Visual Studio Code' => 'vscode',
457
  );
458
 
621
  $start_memory = memory_get_usage();
622
 
623
  try {
624
+ $var = unserialize( serialize( $var ) ); // phpcs:ignore
625
  } catch ( Exception $e ) {
626
  return $e;
627
  }
output/Html.php CHANGED
@@ -459,6 +459,8 @@ abstract class QM_Output_Html extends QM_Output {
459
  return 'atom://open/?url=file://%f&line=%l';
460
  case 'sublime':
461
  return 'subl://open/?url=file://%f&line=%l';
 
 
462
  case 'netbeans':
463
  return 'nbopen://%f:%l';
464
  default:
459
  return 'atom://open/?url=file://%f&line=%l';
460
  case 'sublime':
461
  return 'subl://open/?url=file://%f&line=%l';
462
+ case 'textmate':
463
+ return 'txmt://open/?url=file://%f&line=%l';
464
  case 'netbeans':
465
  return 'nbopen://%f:%l';
466
  default:
output/html/debug_bar.php CHANGED
@@ -60,7 +60,7 @@ class QM_Output_Html_Debug_Bar extends QM_Output_Html {
60
  '</h2>',
61
  ), $panel );
62
 
63
- echo $panel; // @codingStandardsIgnoreLine
64
 
65
  echo '</div>';
66
 
60
  '</h2>',
61
  ), $panel );
62
 
63
+ echo $panel; // phpcs:ignore
64
 
65
  echo '</div>';
66
 
output/html/overview.php CHANGED
@@ -217,24 +217,22 @@ class QM_Output_Html_Overview extends QM_Output_Html {
217
  );
218
  echo '</span></p>';
219
  } else {
220
- echo '<p><span class="qm-warn"><span class="dashicons dashicons-warning" aria-hidden="true"></span>';
221
  echo esc_html__( 'External object cache not in use', 'query-monitor' );
222
- echo '</span></p>';
223
 
224
  $potentials = array_filter( $cache_data['object_cache_extensions'] );
225
 
226
  if ( ! empty( $potentials ) ) {
227
- echo '<ul>';
228
  foreach ( $potentials as $name => $value ) {
229
- echo '<li><span class="qm-warn">';
230
  echo esc_html( sprintf(
231
  /* translators: %s: PHP extension name */
232
  __( 'The %s extension for PHP is installed but is not in use by WordPress', 'query-monitor' ),
233
  $name
234
  ) );
235
- echo '</span></li>';
236
  }
237
- echo '</ul>';
238
  }
239
  }
240
 
217
  );
218
  echo '</span></p>';
219
  } else {
220
+ echo '<p>';
221
  echo esc_html__( 'External object cache not in use', 'query-monitor' );
222
+ echo '</p>';
223
 
224
  $potentials = array_filter( $cache_data['object_cache_extensions'] );
225
 
226
  if ( ! empty( $potentials ) ) {
 
227
  foreach ( $potentials as $name => $value ) {
228
+ echo '<p>';
229
  echo esc_html( sprintf(
230
  /* translators: %s: PHP extension name */
231
  __( 'The %s extension for PHP is installed but is not in use by WordPress', 'query-monitor' ),
232
  $name
233
  ) );
234
+ echo '</p>';
235
  }
 
236
  }
237
  }
238
 
output/html/theme.php CHANGED
@@ -63,6 +63,13 @@ class QM_Output_Html_Theme extends QM_Output_Html {
63
  echo '<p><em>' . esc_html__( 'Unknown', 'query-monitor' ) . '</em></p>';
64
  }
65
 
 
 
 
 
 
 
 
66
  if ( ! empty( $data['template_hierarchy'] ) ) {
67
  echo '<h3>' . esc_html__( 'Template Hierarchy', 'query-monitor' ) . '</h3>';
68
  echo '<ol class="qm-ltr"><li>' . implode( '</li><li>', array_map( 'esc_html', $data['template_hierarchy'] ) ) . '</li></ol>';
63
  echo '<p><em>' . esc_html__( 'Unknown', 'query-monitor' ) . '</em></p>';
64
  }
65
 
66
+ if ( ! empty( $data['template_altered'] ) ) {
67
+ printf(
68
+ '<p><button class="qm-filter-trigger qm-filter-info" data-qm-target="response-concerned_hooks">%s</button></p>',
69
+ esc_html__( 'Template Hooks in Use', 'query-monitor' )
70
+ );
71
+ }
72
+
73
  if ( ! empty( $data['template_hierarchy'] ) ) {
74
  echo '<h3>' . esc_html__( 'Template Hierarchy', 'query-monitor' ) . '</h3>';
75
  echo '<ol class="qm-ltr"><li>' . implode( '</li><li>', array_map( 'esc_html', $data['template_hierarchy'] ) ) . '</li></ol>';
query-monitor.php CHANGED
@@ -10,7 +10,7 @@
10
  *
11
  * Plugin Name: Query Monitor
12
  * Description: The Developer Tools Panel for WordPress.
13
- * Version: 3.6.0
14
  * Plugin URI: https://querymonitor.com/
15
  * Author: John Blackbourn
16
  * Author URI: https://querymonitor.com/
10
  *
11
  * Plugin Name: Query Monitor
12
  * Description: The Developer Tools Panel for WordPress.
13
+ * Version: 3.6.1
14
  * Plugin URI: https://querymonitor.com/
15
  * Author: John Blackbourn
16
  * Author URI: https://querymonitor.com/
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: johnbillion
3
  Tags: debug, debug-bar, debugging, development, developer, performance, profiler, queries, query monitor, rest-api
4
  Requires at least: 3.7
5
- Tested up to: 5.4
6
- Stable tag: 3.6.0
7
  License: GPLv2 or later
8
  Requires PHP: 5.3
9
 
@@ -113,22 +113,33 @@ No, I do not accept donations. If you like the plugin, I'd love for you to [leav
113
 
114
  ## Changelog ##
115
 
 
 
 
 
 
 
 
 
 
 
 
116
  ### 3.6.0 ###
117
 
118
- * Improvements to the UI when a fatal error occurs, including an admin toolbar warning.
119
- * Improvements to the UI when QM is running in "broken" mode due to missing jQuery or an unrecoverable JavaScript error.
120
- * Don't display fatal errors if error display is off and the user cannot view QM.
121
- * Improvements to the visual appearance of the `wp_die()` output.
122
- * Simplify re-throwing a caught exception so QM doesn't get the blame for fatal errors, eg. in the WordPress core fatal error handler.
123
- * Add support for logging a variable of any type in the logger, as a replacement for var dumping.
124
- * Don't show a message for errors in Ajax calls that have already occurred on the main page load.
125
- * Don't dispatch QM during an iframed request, eg the plugin info modal or an upgrader action.
126
- * Hide QM itself from various panels by default to remove noise. Can be controlled via the existing `QM_HIDE_SELF` configuration constant.
127
- * Support for the new `is_favicon()` conditional added in WP 5.4.
128
- * Fix the side panel resizing functionality.
129
- * Add a WP-CLI command for creating the symlink to the db file.
130
- * Add filters to `QM_Util::get_file_dirs()` and `get_file_component()` to allow support for non-standard plugin and theme locations.
131
- * Add an action that fires when QM enqueues its assets, so add-on plugins can enqueue theirs only when necessary.
132
 
133
 
134
  ### 3.5.2 ###
@@ -137,131 +148,131 @@ No, I do not accept donations. If you like the plugin, I'd love for you to [leav
137
 
138
  ### 3.5.1 ###
139
 
140
- * Defer population of the `found_formatted` property because this can fire before WPML has initialised its locale proxy. Fixes #485.
141
- * Ensure all error types are accounted for when populating the panel menu error count. Fixes #486.
142
 
143
 
144
  ### 3.5.0 ###
145
 
146
- * Add an editor selection UI on the Settings panel.
147
- * Improve the output of missing asset dependencies.
148
- * Improve the output of unsuccessful template parts.
149
- * Handle non-boolean constants such as `WP_DEBUG_LOG`, which now accepts a path too.
150
- * Add support for touch devices when resizing the panel. (Works alright-ish, probably needs some animation frame work.)
151
- * Apply the same styles to notices, deprecated, and strict errors.
152
- * Some more style resets for compatibility with popular themes.
153
- * Style changes to bring QM inline with WP 5.3's improved button and focus styles.
154
- * More colour contrast and dark mode tweaks.
155
- * Add permalink-related filters to the concerned filters for the Request panel.
156
- * Fix and improve the admin toolbar menu hover colours.
157
- * Add the error count to the panel menu.
158
- * Remove unnecessary use of plural forms added in 3.4.0.
159
- * More CSS resets to avoid overly tall filters in Firefox.
160
- * Improved styling for warning rows.
161
- * Display the log count in the menu item.
162
 
163
 
164
  ### 3.4.0 ###
165
 
166
- * Introduce an exception handler so a stack trace can be shown for fatal errors in PHP >= 7.
167
- * Add separate persistence of QM window for front-end and admin area.
168
- * Add the request and response HTTP headers to the Request panel.
169
- * Introduce Started and Stopped columns in the Timings panel.
170
- * By popular demand, revert back to closest first ordering of stack traces so they're inline with most other dev tools out there.
171
- * Show the script handle in addition to the text domain in the Languages panel.
172
- * Improve the panel menu highlighting colours.
173
- * Better presentation of the default and current values for the settings constants.
174
- * Truncate long host names in the Scripts and Styles panels.
175
- * Add some more of the admin screen globals to the admin collector.
176
- * Switch back to using a monospace font in numeric data cells.
177
- * Allow dark mode to be enabled with `QM_DARK_MODE`.
178
- * Display the total query count even when `SAVEQUERIES` is defined as false.
179
- * Allow proper plural forms to be used wherever a phrase includes a numeric value.
180
- * More style resetting for compatibility with Twenty Twenty.
181
- * Avoid a division by zero when cache hits is 0.
182
- * Switch to (mostly) CSS for the child menu item marker.
183
 
184
 
185
  ### 3.3.7 ###
186
 
187
- * Expose instances where a requested template part was not loaded.
188
- * Update the docs for multiple `wpdb` instances.
189
- * Various accessibility improvements.
190
- * Remove the RDBMS info as it's not at all reliable.
191
 
192
 
193
  ### 3.3.6 ###
194
 
195
- * Fix a compatibility issue where QM and the fatal error protection in WordPress 5.2+ were handling syntax errors differently.
196
  * Fix some bugs with the icons for the panel controls.
197
 
198
  ### 3.3.5 ###
199
 
200
- * Add support for the new `get_template_part` action in WP 5.2.
201
- * Add a friendly error message when the PHP version requirement isn't met.
202
- * Add support for the new privacy policy conditional in WP 5.2.
203
  * Add support for the new privacy policy template in WP 5.2.
204
 
205
  ### 3.3.4 ###
206
 
207
- * Updated CSS to avoid conflicts with themes using `ul`, `nav`, and `li` styling.
208
- * Don't define `ajaxurl` if there are no Debug Bar panels to show.
209
- * New icon for QM! By [Tubagus Didin Asrori](https://www.instagram.com/asrorigus/).
210
- * Push the close button a bit further away from the edge of the screen to avoid scrollbar interference on macOS.
211
- * Fix clash with object cache plugins that keep their hit and miss stats private.
212
  * Add missing asset position counters.
213
 
214
  ### 3.3.3 ###
215
 
216
- * Add scripts and styles counts to admin menu items.
217
- * Group the cache logic together to avoid calling cache related functionality when it's not available. Fixes #418.
218
  * Switch to installing the test suite as Composer dependencies.
219
 
220
  ### 3.3.2 ###
221
 
222
- * Improve the accuracy of the `ver` parameter for enqueued scripts and styles.
223
- * Separate and simplify the output for the object cache and opcode cache statuses. Fixes #413.
224
- * Better formatting when no object cache stats are available.
225
 
226
 
227
  ### 3.3.1 ###
228
 
229
- * Move the hook processing into its own class and out of the collector, so it can be re-used even if the Hooks collector isn't in use. Fixes #399.
230
- * Increase the sidebar layout to 100% height when there's no admin toolbar.
231
- * Update the QM element ID in the "worst case scenario" JS. Fixes #398.
232
- * Improve the layout of the Settings panel.
233
- * Force the `Core` and `Non-Core` filter items to the bottom of the list, so plugins and themes takes precedence.
234
- * Add an entry for the Settings screen to the narrow view nav menu.
235
  * Add the admin notice hooks to the list of concerned actions for the Admin Screen panel.
236
 
237
  ### 3.3.0 ###
238
 
239
- New features! Read about them here: https://querymonitor.com/blog/2019/02/new-features-in-query-monitor-3-3/
240
-
241
- * Introduce sub-menus for displaying Hooks in Use for each panel.
242
- * Output the call stack and responsible component when `wp_die()` is called.
243
- * Support for JavaScript (Jed) translations in WordPress 5.0+.
244
- * Add render timing for blocks using the new hooks introduced in WordPress 5.1.
245
- * Introduce a toggle to display QM on the side of the window.
246
- * Allow non-string values to be used in the logger message. They'll be presented as JSON formatted strings.
247
- * Allow boolean values to be used in log message contexts.
248
- * Add some margin to the Close button so it doesn't get covered up so much by scroll bars.
249
- * Prefix QM's cookie name with `wp-` to ensure interoperability with caches and proxies.
250
- * Separate the Scripts and Styles collector and outputter so they're actually two separate panels.
251
- * Add support for opcode cache detection separate from the object cache detection.
252
- * Rename the main QM container to get around the fact that its name clashes with the plugin rows in older versions of WordPress.
253
- * Avoid using `wp_parse_url()` as it was only introduced in WP 4.4.
254
 
255
 
256
  ### 3.2.2 ###
257
 
258
- * Support for nested content blocks (eg. in columns).
259
- * Hide long innerHTML content of blocks behind a toggle.
260
- * Add validation of the referenced media file in media blocks.
261
- * Ensure asset URLs include the `ver` query arg.
262
- * Tweak the warning colours.
263
- * Coding standards.
264
- * Layout tweaks.
265
 
266
 
267
  ### 3.2.1 ###
@@ -270,119 +281,119 @@ New features! Read about them here: https://querymonitor.com/blog/2019/02/new-fe
270
 
271
  ### 3.2.0 ###
272
 
273
- * Add a new `Blocks` panel for debugging blocks in post content. Supports WordPress 5.0 and the Gutenberg plugin.
274
- * Display the number of times that each template part was included.
275
- * Allow the scripts and styles output to be filtered based on Dependencies and Dependents.
276
- * Remove the `Pin` button in favour of always pinning QM when it's open.
277
- * Add a "Settings" link to the Plugins screen that opens the settings panel.
278
- * Add a link to the Add-ons page on the wiki.
279
- * Add some more verbose and visible error notices for suboptimal PHP configuration directives.
280
- * Add support for identifying any RDBMS, not just MySQL and MariaDB.
281
- * Perform the PHP version check earlier on so that fewer parts of QM need to be compatible with PHP 5.2.
282
- * Highlight plain `http` requests to the HTTP API as insecure.
283
- * Ensure the `Template` admin menu is always shown, even if the template file name isn't known.
284
- * Adjust the JS and CSS asset source to not include the host.
285
- * Add a warning for insecure JS and CSS assets.
286
- * Remove before and after pseudo-elements in the style reset.
287
- * Show as much theme and template information as possible, even if QM doesn't know the template name.
288
- * Highlight non-core rows when filtering the Hooks & Actions panel by Non-Core.
289
- * Add a filter for environment constants.
290
- * Min width CSS for buttons.
291
- * First pass at documenting filters and hooks.
292
  * More coding standards updates.
293
 
294
  ### 3.1.1 ###
295
 
296
- * Add a dark mode for the UI which is used via the Dark Mode plugin.
297
- * Display Query Monitor's output in the user's selected language, instead of the site language.
298
- * Add extended support for the Members and User Role Editor plugins.
299
- * Fix link hover and focus styles.
300
  * Reset some more CSS styles.
301
 
302
  ### 3.1.0 ###
303
 
304
- **Main changes:**
305
-
306
- * Lots of accessibility improvements.
307
- * Switch to system default fonts to match the WordPress admin area fonts.
308
- * [Implement a PSR-3 compatible logger](https://querymonitor.com/blog/2018/07/profiling-and-logging/).
309
- * UI improvements for mobile/touch/narrow devices.
310
- * Various improvements to the layout of the Scripts and Styles panels.
311
- * Prevent the "overscroll" behaviour that causes the main page to scroll when scrolling to the end of a panel.
312
- * Remove the second table footer when filtering tables.
313
- * Add a settings panel with information about all of the available configuration constants.
314
-
315
- **All other changes:**
316
-
317
- * Show a warning message in the Overview panel when a PHP error is trigger during an Ajax request.
318
- * Display a warning when time or memory usage is above 75% of the respective limit.
319
- * Template Part file string normalization so template parts are correctly shown on Windows systems.
320
- * Don't output toggle links or a blank HTTP API transport if not necessary.
321
- * Add a human readable representation of transient timeouts, and prevent some wrapping.
322
- * Add a tear down for the capability checks collector so that cap checks performed between QM's processing and output don't break things.
323
- * Remove the ability to sort the HTTP API Calls table. This removes a column, increasing the available horizontal space.
324
- * Handle a bunch more known object types when displaying parameter values.
325
- * Allow PHP errors to be filtered by level.
326
- * Shorten the displayed names of long namespaced symbols by initialising the inner portions of the name.
327
- * Combine the Location and Caller columns for PHP Errors to save some horizontal space.
328
- * Don't wrap text in the PHP error type column.
329
- * Improve the authentication cookie toggle so it dynamically reflects the current state.
330
- * For now, force QM to use ltr text direction.
331
- * Clarify terminology around the number of enqueued assets.
332
- * Add fallback support for `wp_cache_get_stats()` to fetch cache stats.
333
- * Improve the message shown when no queries are performed.
334
- * Pluck stats from cache controllers that implement a `getStats()` method and return a nested array of stats for each server.
335
- * Rename the `QM_HIDE_CORE_HOOKS` configuration constant to `QM_HIDE_CORE_ACTIONS`.
336
- * Better handling of environments with unlimited execution time or memory limit. Adds a warning for both.
337
- * When an external cache isn't in use, provide some helpful info if an appropriate extension is installed.
338
 
339
 
340
  ### 3.0.1 ###
341
 
342
- * Add even more hardening to the JS handling to prevent problems when jQuery is broken.
343
- * Remove the old `no-js` styles which don't work well with the new UI.
344
- * Correct the logic for showing the `Non-Core` component filter option.
345
- * Add another VIP function to the list of functions that call the HTTP API.
346
- * Add an inline warning highlight to capability checks that are empty or of a non-string type.
347
- * Add support for WordPress.com VIP Client MU plugins.
348
- * Add support for displaying laps as part of the timing information.
349
- * Add full support for namespaced Debug Bar add-on panels.
350
- * Switch back to depending on `jquery` instead of `jquery-core`.
351
- * Don't assume `php_uname()` is always callable. Add info about the host OS too.
352
  * Reset inline height attribute when the panel is closed.
353
 
354
  ### 3.0.0 ###
355
 
356
- * Brand new UI that resembles familiar web developer tools. Lots of related improvements and fixes.
357
- * Introduce some basic timing functionality in a Timings panel. See #282 for usage.
358
- * Introduce a `QM_NO_JQUERY` constant for running QM without jQuery as a dependency.
359
- * Greater resilience to JavaScript errors.
360
- * Allow the Scripts and Styles panel to be filtered by host name.
361
- * Expose information about redirects that occurred in HTTP API requests.
362
- * Expose more debugging information for HTTP API requests.
363
- * Don't enable the Capability Checks panel by default as it's very memory intensive.
364
- * Allow PHP errors to be silenced according to their component. See `qm/collect/php_error_levels` and `qm/collect/hide_silenced_php_errors` filters.
365
- * Hide all file paths and stack traces behind toggles by default.
366
- * Remove support for the AMP for WordPress plugin.
367
- * Add associative keys to the array passed to the `qm/built-in-collectors` filter.
368
- * Drop support for PHP 5.2.
369
  * Generally improve performance and reduce memory usage.
370
 
371
  ### 2.17.0 ###
372
 
373
- * Add the current user object to the Request panel.
374
- * A few improvements to the appearance of the overall layout.
375
- * Use relative positioning in place of the nasty absolute position hack needed for some themes.
376
- * Ensure the `get_*_template()` function exists before calling it.
377
- * Add a `QM_DISABLE_ERROR_HANDLER` constant to disable QM's error handling.
378
- * Switch to runtime filtering of user capabilities instead of granting the `view_query_monitor` cap upon activation.
379
- * Correct a bunch of inline docs and code standards.
380
 
381
 
382
  ### 2.16.2 ###
383
 
384
- * Correctly handle re-selection of filters with a saved value that contains special characters.
385
- * Show the correct caller for Super Admin capability checks.
386
 
387
 
388
  ### 2.16.1 ###
@@ -391,55 +402,55 @@ New features! Read about them here: https://querymonitor.com/blog/2019/02/new-fe
391
 
392
  ### 2.16.0 ###
393
 
394
- * Introduce a new panel for displaying user capability checks that have been performed during the page load.
395
- * Remember the picked value in all the filters. Uses localStorage in the browser.
396
- * Add a "Non-Core" filter to the Component filter control in all panels.
397
- * Add a "Non-SELECT" filter to the query type filter control in the Queries panel.
398
- * Display collapsed stack traces by default in all panels.
399
- * Add the error code to the Database Errors output.
400
- * Improve the visual appearance of the column sorting controls.
401
- * Improved display for parameter values in call stacks.
402
- * Any files within `wp-content` which don't have a component are now grouped by the root directory or file name.
403
 
404
 
405
  ### 2.15.0 ###
406
 
407
- * Reverse the order of stack traces so they're in natural order, and improve styling.
408
- * Enable query types to be clicked in the Overview.
409
- * Add a highlight to the currently applied table filter.
410
- * Improve table row highlighting when the row header spans multiple rows.
411
- * Expose a link to the main query from the Request panel.
412
- * Better stack traces for transient sets and HTTP API requests.
413
- * Group and sort the Languages output by textdomain.
414
- * Log and expose PHP extensions, and improve styling for error reporting level.
415
- * Better highlighting of PHP warnings and QM errors.
416
- * Add support for a `vendor` directory in the root of the `mu-plugins` directory when detecting components.
417
- * Log the size of the value of updated transients.
418
- * Add a help link when query components aren't available.
419
- * Make the Hooks table output reusable by other components.
420
- * Add a bit of vertical breathing room.
421
- * Various improvements to terminology.
422
  * Coding standards.
423
 
424
  ### 2.14.0 ###
425
 
426
- * Some more inline documentation about clickable stack traces.
427
- * Output a more complete list of error levels and their status.
428
- * Internationalisation fixes.
429
- * Add some wrapping to the Request and Theme output so posts with long unbroken slugs don't break the layout.
430
- * PHP error handler: Add new hook `qm/collect/new_php_error`
431
- * Built-in collectors: Add new `qm/built-in-collectors` filter on files before including them
432
- * More defensive CSS.
433
- * Fix the size of the expand/contract buttons.
434
  * Avoid showing two unnecessary functions in the call stack for textdomain loading.
435
 
436
  ### 2.13.4 ###
437
 
438
- * Highlight the main query to make it easier to find.
439
- * Allow filtering the db queries list to see just the main query.
440
- * Visual fixes for buttons, toggles, and filters.
441
- * Add some missing i18n.
442
- * Add some missing table row text.
443
  * Correct the Drop-in Plugins URL for network admin
444
 
445
  ### 2.13.3 ###
@@ -454,19 +465,14 @@ New features! Read about them here: https://querymonitor.com/blog/2019/02/new-fe
454
 
455
  ### 2.13.2 ###
456
 
457
- - Fix the layout of QM when the Twenty Seventeen theme is in use.
458
- - Display QM at the bottom of GlotPress' output.
459
- - Add support for logging queries made through HyperDB.
460
- - Display a more appropriate message when a conflicting db.php file is present.
461
- - `paged.php` is no longer part of the template hierarchy.
462
- - Some more CSS fixes to prevent themes having an effect.
463
- - Increase some contrast.
464
- - Correct the template hierarchy for templates that have a `theme-compat` version in core. Currently only affects `embed.php`.
465
- - Include a back-compat version of `wp_normalize_path()` for WordPress < 3.9.
466
- - Ensure the use of newer conditional functions such as `is_embed()` don't cause PHP warnings on older versions of WordPress.
467
-
468
-
469
- ### 2.13.1 ###
470
-
471
- - Correct the filter names used for the template hierarchy collection. This corrects the hierarchy when `is_front_page()` is true.
472
 
2
  Contributors: johnbillion
3
  Tags: debug, debug-bar, debugging, development, developer, performance, profiler, queries, query monitor, rest-api
4
  Requires at least: 3.7
5
+ Tested up to: 5.5
6
+ Stable tag: 3.6.1
7
  License: GPLv2 or later
8
  Requires PHP: 5.3
9
 
113
 
114
  ## Changelog ##
115
 
116
+ ### 3.6.1 ###
117
+
118
+ * Adjust the bottom margin when the QM panel is open so QM doesn't cover the bottom of the page. Works more often than not.
119
+ * Prevent QM from triggering a fatal itself if a fatal occurs before the HTML dispatcher is loaded.
120
+ * Add an informational message to the template output when template hooks are in use.
121
+ * Fix errors caused by missing user or group IDs when collecting environment data.
122
+ * Add TextMate to list of supported editors.
123
+ * Demote some cache warnings to informational messages.
124
+ * Support passing backtrace to `QM_Backtrace`.
125
+
126
+
127
  ### 3.6.0 ###
128
 
129
+ * Improvements to the UI when a fatal error occurs, including an admin toolbar warning.
130
+ * Improvements to the UI when QM is running in "broken" mode due to missing jQuery or an unrecoverable JavaScript error.
131
+ * Don't display fatal errors if error display is off and the user cannot view QM.
132
+ * Improvements to the visual appearance of the `wp_die()` output.
133
+ * Simplify re-throwing a caught exception so QM doesn't get the blame for fatal errors, eg. in the WordPress core fatal error handler.
134
+ * Add support for logging a variable of any type in the logger, as a replacement for var dumping.
135
+ * Don't show a message for errors in Ajax calls that have already occurred on the main page load.
136
+ * Don't dispatch QM during an iframed request, eg the plugin info modal or an upgrader action.
137
+ * Hide QM itself from various panels by default to remove noise. Can be controlled via the existing `QM_HIDE_SELF` configuration constant.
138
+ * Support for the new `is_favicon()` conditional added in WP 5.4.
139
+ * Fix the side panel resizing functionality.
140
+ * Add a WP-CLI command for creating the symlink to the db file.
141
+ * Add filters to `QM_Util::get_file_dirs()` and `get_file_component()` to allow support for non-standard plugin and theme locations.
142
+ * Add an action that fires when QM enqueues its assets, so add-on plugins can enqueue theirs only when necessary.
143
 
144
 
145
  ### 3.5.2 ###
148
 
149
  ### 3.5.1 ###
150
 
151
+ * Defer population of the `found_formatted` property because this can fire before WPML has initialised its locale proxy. Fixes #485.
152
+ * Ensure all error types are accounted for when populating the panel menu error count. Fixes #486.
153
 
154
 
155
  ### 3.5.0 ###
156
 
157
+ * Add an editor selection UI on the Settings panel.
158
+ * Improve the output of missing asset dependencies.
159
+ * Improve the output of unsuccessful template parts.
160
+ * Handle non-boolean constants such as `WP_DEBUG_LOG`, which now accepts a path too.
161
+ * Add support for touch devices when resizing the panel. (Works alright-ish, probably needs some animation frame work.)
162
+ * Apply the same styles to notices, deprecated, and strict errors.
163
+ * Some more style resets for compatibility with popular themes.
164
+ * Style changes to bring QM inline with WP 5.3's improved button and focus styles.
165
+ * More colour contrast and dark mode tweaks.
166
+ * Add permalink-related filters to the concerned filters for the Request panel.
167
+ * Fix and improve the admin toolbar menu hover colours.
168
+ * Add the error count to the panel menu.
169
+ * Remove unnecessary use of plural forms added in 3.4.0.
170
+ * More CSS resets to avoid overly tall filters in Firefox.
171
+ * Improved styling for warning rows.
172
+ * Display the log count in the menu item.
173
 
174
 
175
  ### 3.4.0 ###
176
 
177
+ * Introduce an exception handler so a stack trace can be shown for fatal errors in PHP >= 7.
178
+ * Add separate persistence of QM window for front-end and admin area.
179
+ * Add the request and response HTTP headers to the Request panel.
180
+ * Introduce Started and Stopped columns in the Timings panel.
181
+ * By popular demand, revert back to closest first ordering of stack traces so they're inline with most other dev tools out there.
182
+ * Show the script handle in addition to the text domain in the Languages panel.
183
+ * Improve the panel menu highlighting colours.
184
+ * Better presentation of the default and current values for the settings constants.
185
+ * Truncate long host names in the Scripts and Styles panels.
186
+ * Add some more of the admin screen globals to the admin collector.
187
+ * Switch back to using a monospace font in numeric data cells.
188
+ * Allow dark mode to be enabled with `QM_DARK_MODE`.
189
+ * Display the total query count even when `SAVEQUERIES` is defined as false.
190
+ * Allow proper plural forms to be used wherever a phrase includes a numeric value.
191
+ * More style resetting for compatibility with Twenty Twenty.
192
+ * Avoid a division by zero when cache hits is 0.
193
+ * Switch to (mostly) CSS for the child menu item marker.
194
 
195
 
196
  ### 3.3.7 ###
197
 
198
+ * Expose instances where a requested template part was not loaded.
199
+ * Update the docs for multiple `wpdb` instances.
200
+ * Various accessibility improvements.
201
+ * Remove the RDBMS info as it's not at all reliable.
202
 
203
 
204
  ### 3.3.6 ###
205
 
206
+ * Fix a compatibility issue where QM and the fatal error protection in WordPress 5.2+ were handling syntax errors differently.
207
  * Fix some bugs with the icons for the panel controls.
208
 
209
  ### 3.3.5 ###
210
 
211
+ * Add support for the new `get_template_part` action in WP 5.2.
212
+ * Add a friendly error message when the PHP version requirement isn't met.
213
+ * Add support for the new privacy policy conditional in WP 5.2.
214
  * Add support for the new privacy policy template in WP 5.2.
215
 
216
  ### 3.3.4 ###
217
 
218
+ * Updated CSS to avoid conflicts with themes using `ul`, `nav`, and `li` styling.
219
+ * Don't define `ajaxurl` if there are no Debug Bar panels to show.
220
+ * New icon for QM! By [Tubagus Didin Asrori](https://www.instagram.com/asrorigus/).
221
+ * Push the close button a bit further away from the edge of the screen to avoid scrollbar interference on macOS.
222
+ * Fix clash with object cache plugins that keep their hit and miss stats private.
223
  * Add missing asset position counters.
224
 
225
  ### 3.3.3 ###
226
 
227
+ * Add scripts and styles counts to admin menu items.
228
+ * Group the cache logic together to avoid calling cache related functionality when it's not available. Fixes #418.
229
  * Switch to installing the test suite as Composer dependencies.
230
 
231
  ### 3.3.2 ###
232
 
233
+ * Improve the accuracy of the `ver` parameter for enqueued scripts and styles.
234
+ * Separate and simplify the output for the object cache and opcode cache statuses. Fixes #413.
235
+ * Better formatting when no object cache stats are available.
236
 
237
 
238
  ### 3.3.1 ###
239
 
240
+ * Move the hook processing into its own class and out of the collector, so it can be re-used even if the Hooks collector isn't in use. Fixes #399.
241
+ * Increase the sidebar layout to 100% height when there's no admin toolbar.
242
+ * Update the QM element ID in the "worst case scenario" JS. Fixes #398.
243
+ * Improve the layout of the Settings panel.
244
+ * Force the `Core` and `Non-Core` filter items to the bottom of the list, so plugins and themes takes precedence.
245
+ * Add an entry for the Settings screen to the narrow view nav menu.
246
  * Add the admin notice hooks to the list of concerned actions for the Admin Screen panel.
247
 
248
  ### 3.3.0 ###
249
 
250
+ New features! Read about them here: https://querymonitor.com/blog/2019/02/new-features-in-query-monitor-3-3/
251
+
252
+ * Introduce sub-menus for displaying Hooks in Use for each panel.
253
+ * Output the call stack and responsible component when `wp_die()` is called.
254
+ * Support for JavaScript (Jed) translations in WordPress 5.0+.
255
+ * Add render timing for blocks using the new hooks introduced in WordPress 5.1.
256
+ * Introduce a toggle to display QM on the side of the window.
257
+ * Allow non-string values to be used in the logger message. They'll be presented as JSON formatted strings.
258
+ * Allow boolean values to be used in log message contexts.
259
+ * Add some margin to the Close button so it doesn't get covered up so much by scroll bars.
260
+ * Prefix QM's cookie name with `wp-` to ensure interoperability with caches and proxies.
261
+ * Separate the Scripts and Styles collector and outputter so they're actually two separate panels.
262
+ * Add support for opcode cache detection separate from the object cache detection.
263
+ * Rename the main QM container to get around the fact that its name clashes with the plugin rows in older versions of WordPress.
264
+ * Avoid using `wp_parse_url()` as it was only introduced in WP 4.4.
265
 
266
 
267
  ### 3.2.2 ###
268
 
269
+ * Support for nested content blocks (eg. in columns).
270
+ * Hide long innerHTML content of blocks behind a toggle.
271
+ * Add validation of the referenced media file in media blocks.
272
+ * Ensure asset URLs include the `ver` query arg.
273
+ * Tweak the warning colours.
274
+ * Coding standards.
275
+ * Layout tweaks.
276
 
277
 
278
  ### 3.2.1 ###
281
 
282
  ### 3.2.0 ###
283
 
284
+ * Add a new `Blocks` panel for debugging blocks in post content. Supports WordPress 5.0 and the Gutenberg plugin.
285
+ * Display the number of times that each template part was included.
286
+ * Allow the scripts and styles output to be filtered based on Dependencies and Dependents.
287
+ * Remove the `Pin` button in favour of always pinning QM when it's open.
288
+ * Add a "Settings" link to the Plugins screen that opens the settings panel.
289
+ * Add a link to the Add-ons page on the wiki.
290
+ * Add some more verbose and visible error notices for suboptimal PHP configuration directives.
291
+ * Add support for identifying any RDBMS, not just MySQL and MariaDB.
292
+ * Perform the PHP version check earlier on so that fewer parts of QM need to be compatible with PHP 5.2.
293
+ * Highlight plain `http` requests to the HTTP API as insecure.
294
+ * Ensure the `Template` admin menu is always shown, even if the template file name isn't known.
295
+ * Adjust the JS and CSS asset source to not include the host.
296
+ * Add a warning for insecure JS and CSS assets.
297
+ * Remove before and after pseudo-elements in the style reset.
298
+ * Show as much theme and template information as possible, even if QM doesn't know the template name.
299
+ * Highlight non-core rows when filtering the Hooks & Actions panel by Non-Core.
300
+ * Add a filter for environment constants.
301
+ * Min width CSS for buttons.
302
+ * First pass at documenting filters and hooks.
303
  * More coding standards updates.
304
 
305
  ### 3.1.1 ###
306
 
307
+ * Add a dark mode for the UI which is used via the Dark Mode plugin.
308
+ * Display Query Monitor's output in the user's selected language, instead of the site language.
309
+ * Add extended support for the Members and User Role Editor plugins.
310
+ * Fix link hover and focus styles.
311
  * Reset some more CSS styles.
312
 
313
  ### 3.1.0 ###
314
 
315
+ **Main changes:**
316
+
317
+ * Lots of accessibility improvements.
318
+ * Switch to system default fonts to match the WordPress admin area fonts.
319
+ * [Implement a PSR-3 compatible logger](https://querymonitor.com/blog/2018/07/profiling-and-logging/).
320
+ * UI improvements for mobile/touch/narrow devices.
321
+ * Various improvements to the layout of the Scripts and Styles panels.
322
+ * Prevent the "overscroll" behaviour that causes the main page to scroll when scrolling to the end of a panel.
323
+ * Remove the second table footer when filtering tables.
324
+ * Add a settings panel with information about all of the available configuration constants.
325
+
326
+ **All other changes:**
327
+
328
+ * Show a warning message in the Overview panel when a PHP error is trigger during an Ajax request.
329
+ * Display a warning when time or memory usage is above 75% of the respective limit.
330
+ * Template Part file string normalization so template parts are correctly shown on Windows systems.
331
+ * Don't output toggle links or a blank HTTP API transport if not necessary.
332
+ * Add a human readable representation of transient timeouts, and prevent some wrapping.
333
+ * Add a tear down for the capability checks collector so that cap checks performed between QM's processing and output don't break things.
334
+ * Remove the ability to sort the HTTP API Calls table. This removes a column, increasing the available horizontal space.
335
+ * Handle a bunch more known object types when displaying parameter values.
336
+ * Allow PHP errors to be filtered by level.
337
+ * Shorten the displayed names of long namespaced symbols by initialising the inner portions of the name.
338
+ * Combine the Location and Caller columns for PHP Errors to save some horizontal space.
339
+ * Don't wrap text in the PHP error type column.
340
+ * Improve the authentication cookie toggle so it dynamically reflects the current state.
341
+ * For now, force QM to use ltr text direction.
342
+ * Clarify terminology around the number of enqueued assets.
343
+ * Add fallback support for `wp_cache_get_stats()` to fetch cache stats.
344
+ * Improve the message shown when no queries are performed.
345
+ * Pluck stats from cache controllers that implement a `getStats()` method and return a nested array of stats for each server.
346
+ * Rename the `QM_HIDE_CORE_HOOKS` configuration constant to `QM_HIDE_CORE_ACTIONS`.
347
+ * Better handling of environments with unlimited execution time or memory limit. Adds a warning for both.
348
+ * When an external cache isn't in use, provide some helpful info if an appropriate extension is installed.
349
 
350
 
351
  ### 3.0.1 ###
352
 
353
+ * Add even more hardening to the JS handling to prevent problems when jQuery is broken.
354
+ * Remove the old `no-js` styles which don't work well with the new UI.
355
+ * Correct the logic for showing the `Non-Core` component filter option.
356
+ * Add another VIP function to the list of functions that call the HTTP API.
357
+ * Add an inline warning highlight to capability checks that are empty or of a non-string type.
358
+ * Add support for WordPress.com VIP Client MU plugins.
359
+ * Add support for displaying laps as part of the timing information.
360
+ * Add full support for namespaced Debug Bar add-on panels.
361
+ * Switch back to depending on `jquery` instead of `jquery-core`.
362
+ * Don't assume `php_uname()` is always callable. Add info about the host OS too.
363
  * Reset inline height attribute when the panel is closed.
364
 
365
  ### 3.0.0 ###
366
 
367
+ * Brand new UI that resembles familiar web developer tools. Lots of related improvements and fixes.
368
+ * Introduce some basic timing functionality in a Timings panel. See #282 for usage.
369
+ * Introduce a `QM_NO_JQUERY` constant for running QM without jQuery as a dependency.
370
+ * Greater resilience to JavaScript errors.
371
+ * Allow the Scripts and Styles panel to be filtered by host name.
372
+ * Expose information about redirects that occurred in HTTP API requests.
373
+ * Expose more debugging information for HTTP API requests.
374
+ * Don't enable the Capability Checks panel by default as it's very memory intensive.
375
+ * Allow PHP errors to be silenced according to their component. See `qm/collect/php_error_levels` and `qm/collect/hide_silenced_php_errors` filters.
376
+ * Hide all file paths and stack traces behind toggles by default.
377
+ * Remove support for the AMP for WordPress plugin.
378
+ * Add associative keys to the array passed to the `qm/built-in-collectors` filter.
379
+ * Drop support for PHP 5.2.
380
  * Generally improve performance and reduce memory usage.
381
 
382
  ### 2.17.0 ###
383
 
384
+ * Add the current user object to the Request panel.
385
+ * A few improvements to the appearance of the overall layout.
386
+ * Use relative positioning in place of the nasty absolute position hack needed for some themes.
387
+ * Ensure the `get_*_template()` function exists before calling it.
388
+ * Add a `QM_DISABLE_ERROR_HANDLER` constant to disable QM's error handling.
389
+ * Switch to runtime filtering of user capabilities instead of granting the `view_query_monitor` cap upon activation.
390
+ * Correct a bunch of inline docs and code standards.
391
 
392
 
393
  ### 2.16.2 ###
394
 
395
+ * Correctly handle re-selection of filters with a saved value that contains special characters.
396
+ * Show the correct caller for Super Admin capability checks.
397
 
398
 
399
  ### 2.16.1 ###
402
 
403
  ### 2.16.0 ###
404
 
405
+ * Introduce a new panel for displaying user capability checks that have been performed during the page load.
406
+ * Remember the picked value in all the filters. Uses localStorage in the browser.
407
+ * Add a "Non-Core" filter to the Component filter control in all panels.
408
+ * Add a "Non-SELECT" filter to the query type filter control in the Queries panel.
409
+ * Display collapsed stack traces by default in all panels.
410
+ * Add the error code to the Database Errors output.
411
+ * Improve the visual appearance of the column sorting controls.
412
+ * Improved display for parameter values in call stacks.
413
+ * Any files within `wp-content` which don't have a component are now grouped by the root directory or file name.
414
 
415
 
416
  ### 2.15.0 ###
417
 
418
+ * Reverse the order of stack traces so they're in natural order, and improve styling.
419
+ * Enable query types to be clicked in the Overview.
420
+ * Add a highlight to the currently applied table filter.
421
+ * Improve table row highlighting when the row header spans multiple rows.
422
+ * Expose a link to the main query from the Request panel.
423
+ * Better stack traces for transient sets and HTTP API requests.
424
+ * Group and sort the Languages output by textdomain.
425
+ * Log and expose PHP extensions, and improve styling for error reporting level.
426
+ * Better highlighting of PHP warnings and QM errors.
427
+ * Add support for a `vendor` directory in the root of the `mu-plugins` directory when detecting components.
428
+ * Log the size of the value of updated transients.
429
+ * Add a help link when query components aren't available.
430
+ * Make the Hooks table output reusable by other components.
431
+ * Add a bit of vertical breathing room.
432
+ * Various improvements to terminology.
433
  * Coding standards.
434
 
435
  ### 2.14.0 ###
436
 
437
+ * Some more inline documentation about clickable stack traces.
438
+ * Output a more complete list of error levels and their status.
439
+ * Internationalisation fixes.
440
+ * Add some wrapping to the Request and Theme output so posts with long unbroken slugs don't break the layout.
441
+ * PHP error handler: Add new hook `qm/collect/new_php_error`
442
+ * Built-in collectors: Add new `qm/built-in-collectors` filter on files before including them
443
+ * More defensive CSS.
444
+ * Fix the size of the expand/contract buttons.
445
  * Avoid showing two unnecessary functions in the call stack for textdomain loading.
446
 
447
  ### 2.13.4 ###
448
 
449
+ * Highlight the main query to make it easier to find.
450
+ * Allow filtering the db queries list to see just the main query.
451
+ * Visual fixes for buttons, toggles, and filters.
452
+ * Add some missing i18n.
453
+ * Add some missing table row text.
454
  * Correct the Drop-in Plugins URL for network admin
455
 
456
  ### 2.13.3 ###
465
 
466
  ### 2.13.2 ###
467
 
468
+ - Fix the layout of QM when the Twenty Seventeen theme is in use.
469
+ - Display QM at the bottom of GlotPress' output.
470
+ - Add support for logging queries made through HyperDB.
471
+ - Display a more appropriate message when a conflicting db.php file is present.
472
+ - `paged.php` is no longer part of the template hierarchy.
473
+ - Some more CSS fixes to prevent themes having an effect.
474
+ - Increase some contrast.
475
+ - Correct the template hierarchy for templates that have a `theme-compat` version in core. Currently only affects `embed.php`.
476
+ - Include a back-compat version of `wp_normalize_path()` for WordPress < 3.9.
477
+ - Ensure the use of newer conditional functions such as `is_embed()` don't cause PHP warnings on older versions of WordPress.
 
 
 
 
 
478
 
wp-content/db.php CHANGED
@@ -121,7 +121,7 @@ class QM_DB extends wpdb {
121
  } else {
122
  if ( is_resource( $this->dbh ) ) {
123
  // Please do not report this code as a PHP 7 incompatibility. Observe the surrounding logic.
124
- // @codingStandardsIgnoreLine
125
  $code = mysql_errno( $this->dbh );
126
  }
127
  }
121
  } else {
122
  if ( is_resource( $this->dbh ) ) {
123
  // Please do not report this code as a PHP 7 incompatibility. Observe the surrounding logic.
124
+ // phpcs:ignore
125
  $code = mysql_errno( $this->dbh );
126
  }
127
  }