Query Monitor - Version 2.13.2

Version Description

Download this release

Release Info

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

Code changes from version 2.13.1 to 2.13.2

assets/query-monitor.css CHANGED
@@ -273,7 +273,7 @@ body.wp-admin.folded #qm {
273
  }
274
 
275
  .qm table {
276
- color: #444 !important;
277
  border-collapse: collapse !important;
278
  box-shadow: none !important;
279
  width: 100% !important;
@@ -326,7 +326,7 @@ body.wp-admin.folded #qm {
326
  }
327
 
328
  .qm th {
329
- color: #444 !important;
330
  }
331
 
332
  .qm th.qm-num {
@@ -359,7 +359,7 @@ body.wp-admin.folded #qm {
359
  border-collapse: collapse !important;
360
  margin: 0 !important;
361
  background: #fff !important;
362
- color: #444 !important;
363
  border-style: hidden !important;
364
  width: 100% !important;
365
  }
@@ -379,6 +379,11 @@ body.wp-admin.folded #qm {
379
  .qm li {
380
  margin: 0 !important;
381
  padding: 0 !important;
 
 
 
 
 
382
  }
383
 
384
  .qm pre {
@@ -434,7 +439,7 @@ body.wp-admin.folded #qm {
434
  }
435
 
436
  .qm .qm-info {
437
- color: #999 !important;
438
  }
439
 
440
  .qm td .qm-toggled {
@@ -509,6 +514,10 @@ body.wp-admin.folded #qm {
509
 
510
  .qm label {
511
  cursor: pointer !important;
 
 
 
 
512
  }
513
 
514
  select.qm-filter {
@@ -520,7 +529,7 @@ select.qm-filter {
520
  border: 1px solid #e6e6e6 !important;
521
  padding: 1px !important;
522
  background: #fff !important;
523
- color: #444 !important;
524
  height: 2em !important;
525
  width: auto !important;
526
  border-radius: 0 !important;
273
  }
274
 
275
  .qm table {
276
+ color: #333 !important;
277
  border-collapse: collapse !important;
278
  box-shadow: none !important;
279
  width: 100% !important;
326
  }
327
 
328
  .qm th {
329
+ color: #333 !important;
330
  }
331
 
332
  .qm th.qm-num {
359
  border-collapse: collapse !important;
360
  margin: 0 !important;
361
  background: #fff !important;
362
+ color: #333 !important;
363
  border-style: hidden !important;
364
  width: 100% !important;
365
  }
379
  .qm li {
380
  margin: 0 !important;
381
  padding: 0 !important;
382
+ display: list-item !important;
383
+ }
384
+
385
+ .qm li::before {
386
+ content: '' !important;
387
  }
388
 
389
  .qm pre {
439
  }
440
 
441
  .qm .qm-info {
442
+ color: #777 !important;
443
  }
444
 
445
  .qm td .qm-toggled {
514
 
515
  .qm label {
516
  cursor: pointer !important;
517
+ color: #333 !important;
518
+ font-weight: normal !important;
519
+ font-size: 11px !important;
520
+ margin: 0 !important;
521
  }
522
 
523
  select.qm-filter {
529
  border: 1px solid #e6e6e6 !important;
530
  padding: 1px !important;
531
  background: #fff !important;
532
+ color: #333 !important;
533
  height: 2em !important;
534
  width: auto !important;
535
  border-radius: 0 !important;
classes/Util.php CHANGED
@@ -47,12 +47,12 @@ class QM_Util {
47
 
48
  public static function standard_dir( $dir, $path_replace = null ) {
49
 
50
- $dir = wp_normalize_path( $dir );
51
 
52
  if ( is_string( $path_replace ) ) {
53
  if ( ! self::$abspath ) {
54
- self::$abspath = wp_normalize_path( ABSPATH );
55
- self::$contentpath = wp_normalize_path( dirname( WP_CONTENT_DIR ) . '/' );
56
  }
57
  $dir = str_replace( array(
58
  self::$abspath,
@@ -64,6 +64,17 @@ class QM_Util {
64
 
65
  }
66
 
 
 
 
 
 
 
 
 
 
 
 
67
  public static function get_file_dirs() {
68
  if ( empty( self::$file_dirs ) ) {
69
  self::$file_dirs['plugin'] = self::standard_dir( WP_PLUGIN_DIR );
47
 
48
  public static function standard_dir( $dir, $path_replace = null ) {
49
 
50
+ $dir = self::normalize_path( $dir );
51
 
52
  if ( is_string( $path_replace ) ) {
53
  if ( ! self::$abspath ) {
54
+ self::$abspath = self::normalize_path( ABSPATH );
55
+ self::$contentpath = self::normalize_path( dirname( WP_CONTENT_DIR ) . '/' );
56
  }
57
  $dir = str_replace( array(
58
  self::$abspath,
64
 
65
  }
66
 
67
+ public static function normalize_path( $path ) {
68
+ if ( function_exists( 'wp_normalize_path' ) ) {
69
+ $path = wp_normalize_path( $path );
70
+ } else {
71
+ $path = str_replace( '\\', '/', $path );
72
+ $path = str_replace( '//', '/', $path );
73
+ }
74
+
75
+ return $path;
76
+ }
77
+
78
  public static function get_file_dirs() {
79
  if ( empty( self::$file_dirs ) ) {
80
  self::$file_dirs['plugin'] = self::standard_dir( WP_PLUGIN_DIR );
collectors/db_queries.php CHANGED
@@ -21,6 +21,10 @@ if ( !defined( 'QM_DB_EXPENSIVE' ) ) {
21
  define( 'QM_DB_EXPENSIVE', 0.05 );
22
  }
23
 
 
 
 
 
24
  class QM_Collector_DB_Queries extends QM_Collector {
25
 
26
  public $id = 'db_queries';
21
  define( 'QM_DB_EXPENSIVE', 0.05 );
22
  }
23
 
24
+ if ( SAVEQUERIES && property_exists( $GLOBALS['wpdb'], 'save_queries' ) ) {
25
+ $GLOBALS['wpdb']->save_queries = true;
26
+ }
27
+
28
  class QM_Collector_DB_Queries extends QM_Collector {
29
 
30
  public $id = 'db_queries';
collectors/theme.php CHANGED
@@ -17,6 +17,7 @@ GNU General Public License for more details.
17
  class QM_Collector_Theme extends QM_Collector {
18
 
19
  public $id = 'theme';
 
20
 
21
  public function name() {
22
  return __( 'Theme', 'query-monitor' );
@@ -48,7 +49,6 @@ class QM_Collector_Theme extends QM_Collector {
48
  'author' => 'is_author',
49
  'date' => 'is_date',
50
  'archive' => 'is_archive',
51
- 'paged' => 'is_paged',
52
  'index' => '__return_true',
53
  );
54
  }
@@ -58,7 +58,12 @@ class QM_Collector_Theme extends QM_Collector {
58
 
59
  foreach ( self::get_query_template_names() as $template => $conditional ) {
60
 
61
- if ( call_user_func( $conditional ) ) {
 
 
 
 
 
62
  $filter = str_replace( '_', '', $template );
63
  add_filter( "{$filter}_template_hierarchy", array( $this, 'filter_template_hierarchy' ), 999 );
64
  call_user_func( "get_{$template}_template" );
@@ -74,6 +79,13 @@ class QM_Collector_Theme extends QM_Collector {
74
  $this->data['template_hierarchy'] = array();
75
  }
76
 
 
 
 
 
 
 
 
77
  $this->data['template_hierarchy'] = array_merge( $this->data['template_hierarchy'], $templates );
78
 
79
  return $templates;
17
  class QM_Collector_Theme extends QM_Collector {
18
 
19
  public $id = 'theme';
20
+ protected $got_theme_compat = false;
21
 
22
  public function name() {
23
  return __( 'Theme', 'query-monitor' );
49
  'author' => 'is_author',
50
  'date' => 'is_date',
51
  'archive' => 'is_archive',
 
52
  'index' => '__return_true',
53
  );
54
  }
58
 
59
  foreach ( self::get_query_template_names() as $template => $conditional ) {
60
 
61
+ // If a matching theme-compat file is found, further conditional checks won't occur in template-loader.php
62
+ if ( $this->got_theme_compat ) {
63
+ break;
64
+ }
65
+
66
+ if ( function_exists( $conditional ) && call_user_func( $conditional ) ) {
67
  $filter = str_replace( '_', '', $template );
68
  add_filter( "{$filter}_template_hierarchy", array( $this, 'filter_template_hierarchy' ), 999 );
69
  call_user_func( "get_{$template}_template" );
79
  $this->data['template_hierarchy'] = array();
80
  }
81
 
82
+ foreach ( $templates as $template_name ) {
83
+ if ( file_exists( ABSPATH . WPINC . '/theme-compat/' . $template_name ) ) {
84
+ $this->got_theme_compat = true;
85
+ break;
86
+ }
87
+ }
88
+
89
  $this->data['template_hierarchy'] = array_merge( $this->data['template_hierarchy'], $templates );
90
 
91
  return $templates;
dispatchers/Html.php CHANGED
@@ -33,6 +33,7 @@ class QM_Dispatcher_Html extends QM_Dispatcher {
33
  add_action( 'login_footer', array( $this, 'action_footer' ) );
34
  add_action( 'embed_footer', array( $this, 'action_footer' ) );
35
  add_action( 'amp_post_template_footer', array( $this, 'action_footer' ) );
 
36
 
37
  parent::__construct( $qm );
38
 
@@ -127,6 +128,8 @@ class QM_Dispatcher_Html extends QM_Dispatcher {
127
  add_action( 'amp_post_template_head', array( $this, 'enqueue_assets' ) );
128
  add_action( 'amp_post_template_head', array( $this, 'manually_print_assets' ), 11 );
129
 
 
 
130
  }
131
 
132
  public function manually_print_assets() {
@@ -215,7 +218,7 @@ class QM_Dispatcher_Html extends QM_Dispatcher {
215
  );
216
 
217
  if ( did_action( 'wp_head' ) ) {
218
- $absolute = function_exists( 'twentyfifteen_setup' );
219
  if ( apply_filters( 'qm/output/absolute_position', $absolute ) ) {
220
  $class[] = 'qm-absolute';
221
  }
@@ -343,7 +346,7 @@ class QM_Dispatcher_Html extends QM_Dispatcher {
343
  return false;
344
  }
345
  } else {
346
- if ( ! ( did_action( 'wp' ) || did_action( 'login_init' ) ) ) {
347
  return false;
348
  }
349
  }
33
  add_action( 'login_footer', array( $this, 'action_footer' ) );
34
  add_action( 'embed_footer', array( $this, 'action_footer' ) );
35
  add_action( 'amp_post_template_footer', array( $this, 'action_footer' ) );
36
+ add_action( 'gp_footer', array( $this, 'action_footer' ) );
37
 
38
  parent::__construct( $qm );
39
 
128
  add_action( 'amp_post_template_head', array( $this, 'enqueue_assets' ) );
129
  add_action( 'amp_post_template_head', array( $this, 'manually_print_assets' ), 11 );
130
 
131
+ add_action( 'gp_head', array( $this, 'manually_print_assets' ), 11 );
132
+
133
  }
134
 
135
  public function manually_print_assets() {
218
  );
219
 
220
  if ( did_action( 'wp_head' ) ) {
221
+ $absolute = function_exists( 'twentyfifteen_setup' ) || function_exists( 'twentyseventeen_setup' );
222
  if ( apply_filters( 'qm/output/absolute_position', $absolute ) ) {
223
  $class[] = 'qm-absolute';
224
  }
346
  return false;
347
  }
348
  } else {
349
+ if ( ! ( did_action( 'wp' ) || did_action( 'login_init' ) || did_action( 'gp_head' ) ) ) {
350
  return false;
351
  }
352
  }
output/html/db_queries.php CHANGED
@@ -164,9 +164,15 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
164
  if ( apply_filters( 'qm/show_extended_query_prompt', true ) && ! $db->has_trace && ( '$wpdb' === $name ) ) {
165
  echo '<tr>';
166
  echo '<td colspan="' . absint( $span ) . '" class="qm-warn">';
167
- echo wp_kses( sprintf(
 
 
 
168
  /* translators: 1: Symlink file name, 2: URL to wiki page */
169
- __( 'Extended query information such as the component and affected rows is not available. Query Monitor was unable to symlink its %1$s file into place. <a href="%2$s" target="_blank">See this wiki page for more information.</a>', 'query-monitor' ),
 
 
 
170
  '<code>db.php</code>',
171
  'https://github.com/johnbillion/query-monitor/wiki/db.php-Symlink'
172
  ), array(
164
  if ( apply_filters( 'qm/show_extended_query_prompt', true ) && ! $db->has_trace && ( '$wpdb' === $name ) ) {
165
  echo '<tr>';
166
  echo '<td colspan="' . absint( $span ) . '" class="qm-warn">';
167
+ if ( file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
168
+ /* translators: 1: Symlink file name, 2: URL to wiki page */
169
+ $message = __( 'Extended query information such as the component and affected rows is not available. A conflicting %1$s file is present. <a href="%2$s" target="_blank">See this wiki page for more information.</a>', 'query-monitor' );
170
+ } else {
171
  /* translators: 1: Symlink file name, 2: URL to wiki page */
172
+ $message = __( 'Extended query information such as the component and affected rows is not available. Query Monitor was unable to symlink its %1$s file into place. <a href="%2$s" target="_blank">See this wiki page for more information.</a>', 'query-monitor' );
173
+ }
174
+ echo wp_kses( sprintf(
175
+ $message,
176
  '<code>db.php</code>',
177
  'https://github.com/johnbillion/query-monitor/wiki/db.php-Symlink'
178
  ), array(
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.13.1
6
  Plugin URI: https://github.com/johnbillion/query-monitor
7
  Author: John Blackbourn
8
  Author URI: https://johnblackbourn.com/
2
  /*
3
  Plugin Name: Query Monitor
4
  Description: Monitoring of database queries, hooks, conditionals and more.
5
+ Version: 2.13.2
6
  Plugin URI: https://github.com/johnbillion/query-monitor
7
  Author: John Blackbourn
8
  Author URI: https://johnblackbourn.com/
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: johnbillion
3
  Tags: ajax, debug, debug-bar, debugging, development, developer, performance, profiler, profiling, queries, query monitor, rest-api
4
  Requires at least: 3.7
5
- Tested up to: 4.6
6
- Stable tag: 2.13.1
7
  License: GPLv2 or later
8
 
9
  View debugging and performance information on database queries, hooks, conditionals, HTTP requests, redirects and more.
2
  Contributors: johnbillion
3
  Tags: ajax, debug, debug-bar, debugging, development, developer, performance, profiler, profiling, queries, query monitor, rest-api
4
  Requires at least: 3.7
5
+ Tested up to: 4.7
6
+ Stable tag: 2.13.2
7
  License: GPLv2 or later
8
 
9
  View debugging and performance information on database queries, hooks, conditionals, HTTP requests, redirects and more.