Query Monitor - Version 2.11.2

Version Description

Download this release

Release Info

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

Code changes from version 2.11.1 to 2.11.2

assets/query-monitor.css CHANGED
@@ -22,6 +22,10 @@ GNU General Public License for more details.
22
  color: #4a4 !important;
23
  }
24
 
 
 
 
 
25
  #wp-admin-bar-query-monitor-notices {
26
  background-color: #740 !important;
27
  }
@@ -68,7 +72,8 @@ GNU General Public License for more details.
68
  background-color: #c00 !important;
69
  }
70
 
71
- #wpadminbar .qm-error > a {
 
72
  color: #fff !important;
73
  }
74
 
@@ -121,6 +126,7 @@ GNU General Public License for more details.
121
  border-top: 1px solid #ccc !important;
122
  padding: 0 0 35px !important;
123
  text-align: left !important;
 
124
  display: none;
125
  }
126
 
22
  color: #4a4 !important;
23
  }
24
 
25
+ #wpadminbar .qm-alert {
26
+ background-color: #f60;
27
+ }
28
+
29
  #wp-admin-bar-query-monitor-notices {
30
  background-color: #740 !important;
31
  }
72
  background-color: #c00 !important;
73
  }
74
 
75
+ #wpadminbar .qm-error > a,
76
+ #wpadminbar .qm-alert > a {
77
  color: #fff !important;
78
  }
79
 
126
  border-top: 1px solid #ccc !important;
127
  padding: 0 0 35px !important;
128
  text-align: left !important;
129
+ min-width: 800px !important;
130
  display: none;
131
  }
132
 
assets/query-monitor.js CHANGED
@@ -108,7 +108,7 @@ jQuery( function($) {
108
  return false;
109
  };
110
 
111
- } else if ( window.wp && wp.themes && wp.themes.RunInstaller ) {
112
  // Infinite scrolling on Appearance -> Add New screens
113
 
114
  var view = wp.themes.RunInstaller.view.view;
108
  return false;
109
  };
110
 
111
+ } else if ( window.wp && wp.themes && wp.themes.RunInstaller && wp.themes.RunInstaller.view ) {
112
  // Infinite scrolling on Appearance -> Add New screens
113
 
114
  var view = wp.themes.RunInstaller.view.view;
classes/Activation.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Activation extends QM_Plugin {
18
+
19
+ protected function __construct( $file ) {
20
+
21
+ # Filters
22
+ add_filter( 'pre_update_option_active_plugins', array( $this, 'filter_active_plugins' ) );
23
+ add_filter( 'pre_update_site_option_active_sitewide_plugins', array( $this, 'filter_active_sitewide_plugins' ) );
24
+
25
+ # Activation and deactivation
26
+ register_activation_hook( __FILE__, array( $this, 'activate' ) );
27
+ register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) );
28
+
29
+ # Parent setup:
30
+ parent::__construct( $file );
31
+
32
+ }
33
+
34
+ public function activate( $sitewide = false ) {
35
+
36
+ if ( $admins = QM_Util::get_admins() ) {
37
+ $admins->add_cap( 'view_query_monitor' );
38
+ }
39
+
40
+ if ( ! file_exists( $db = WP_CONTENT_DIR . '/db.php' ) && function_exists( 'symlink' ) ) {
41
+ @symlink( plugin_dir_path( __FILE__ ) . 'wp-content/db.php', $db );
42
+ }
43
+
44
+ if ( $sitewide ) {
45
+ update_site_option( 'active_sitewide_plugins', get_site_option( 'active_sitewide_plugins' ) );
46
+ } else {
47
+ update_option( 'active_plugins', get_option( 'active_plugins' ) );
48
+ }
49
+
50
+ }
51
+
52
+ public function deactivate() {
53
+
54
+ if ( $admins = QM_Util::get_admins() ) {
55
+ $admins->remove_cap( 'view_query_monitor' );
56
+ }
57
+
58
+ # Only delete db.php if it belongs to Query Monitor
59
+ if ( class_exists( 'QM_DB' ) ) {
60
+ unlink( WP_CONTENT_DIR . '/db.php' );
61
+ }
62
+
63
+ }
64
+
65
+ public function filter_active_plugins( $plugins ) {
66
+
67
+ // this needs to run on the cli too
68
+
69
+ if ( empty( $plugins ) ) {
70
+ return $plugins;
71
+ }
72
+
73
+ $f = preg_quote( basename( $this->plugin_base() ) );
74
+
75
+ return array_merge(
76
+ preg_grep( '/' . $f . '$/', $plugins ),
77
+ preg_grep( '/' . $f . '$/', $plugins, PREG_GREP_INVERT )
78
+ );
79
+
80
+ }
81
+
82
+ public function filter_active_sitewide_plugins( $plugins ) {
83
+
84
+ if ( empty( $plugins ) ) {
85
+ return $plugins;
86
+ }
87
+
88
+ $f = $this->plugin_base();
89
+
90
+ if ( isset( $plugins[$f] ) ) {
91
+
92
+ unset( $plugins[$f] );
93
+
94
+ return array_merge( array(
95
+ $f => time(),
96
+ ), $plugins );
97
+
98
+ } else {
99
+ return $plugins;
100
+ }
101
+
102
+ }
103
+
104
+ public static function init( $file = null ) {
105
+
106
+ static $instance = null;
107
+
108
+ if ( ! $instance ) {
109
+ $instance = new QM_Activation( $file );
110
+ }
111
+
112
+ return $instance;
113
+
114
+ }
115
+
116
+ }
classes/Backtrace.php CHANGED
@@ -51,7 +51,7 @@ class QM_Backtrace {
51
  'get_header' => 1,
52
  'get_sidebar' => 1,
53
  'get_footer' => 1,
54
- 'get_site_by_path' => 3,
55
  );
56
  protected static $filtered = false;
57
  protected $trace = null;
51
  'get_header' => 1,
52
  'get_sidebar' => 1,
53
  'get_footer' => 1,
54
+ 'class_exists' => 2,
55
  );
56
  protected static $filtered = false;
57
  protected $trace = null;
classes/Collector.php CHANGED
@@ -80,7 +80,8 @@ abstract class QM_Collector {
80
 
81
  public static function format_bool_constant( $constant ) {
82
  if ( !defined( $constant ) ) {
83
- return 'undefined';
 
84
  } else if ( !constant( $constant ) ) {
85
  return 'false';
86
  } else {
80
 
81
  public static function format_bool_constant( $constant ) {
82
  if ( !defined( $constant ) ) {
83
+ /* translators: Undefined PHP constant */
84
+ return __( 'undefined', 'query-monitor' );
85
  } else if ( !constant( $constant ) ) {
86
  return 'false';
87
  } else {
classes/QueryMonitor.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 QueryMonitor extends QM_Plugin {
18
+
19
+ protected function __construct( $file ) {
20
+
21
+ # Actions
22
+ add_action( 'plugins_loaded', array( $this, 'action_plugins_loaded' ) );
23
+ add_action( 'init', array( $this, 'action_init' ) );
24
+
25
+ # Parent setup:
26
+ parent::__construct( $file );
27
+
28
+ # Load and register built-in collectors:
29
+ foreach ( glob( $this->plugin_path( 'collectors/*.php' ) ) as $file ) {
30
+ include $file;
31
+ }
32
+
33
+ }
34
+
35
+ public function action_plugins_loaded() {
36
+
37
+ # Register additional collectors:
38
+ foreach ( apply_filters( 'qm/collectors', array(), $this ) as $collector ) {
39
+ QM_Collectors::add( $collector );
40
+ }
41
+
42
+ # Load dispatchers:
43
+ foreach ( glob( $this->plugin_path( 'dispatchers/*.php' ) ) as $file ) {
44
+ include $file;
45
+ }
46
+
47
+ # Register built-in and additional dispatchers:
48
+ foreach ( apply_filters( 'qm/dispatchers', array(), $this ) as $dispatcher ) {
49
+ QM_Dispatchers::add( $dispatcher );
50
+ }
51
+
52
+ }
53
+
54
+ public function action_init() {
55
+ load_plugin_textdomain( 'query-monitor', false, dirname( $this->plugin_base() ) . '/languages' );
56
+ }
57
+
58
+ public static function symlink_warning() {
59
+ $db = WP_CONTENT_DIR . '/db.php';
60
+ trigger_error( sprintf(
61
+ /* translators: %s: Symlink file location */
62
+ esc_html__( 'The symlink at %s is no longer pointing to the correct location. Please remove the symlink, then deactivate and reactivate Query Monitor.', 'query-monitor' ),
63
+ '<code>' . esc_html( $db ) . '</code>'
64
+ ), E_USER_WARNING );
65
+ }
66
+
67
+ public static function init( $file = null ) {
68
+
69
+ static $instance = null;
70
+
71
+ if ( ! $instance ) {
72
+ $instance = new QueryMonitor( $file );
73
+ }
74
+
75
+ return $instance;
76
+
77
+ }
78
+
79
+ }
classes/Util.php CHANGED
@@ -108,8 +108,10 @@ class QM_Util {
108
  $plug = basename( $plug );
109
  }
110
  if ( 'mu-plugin' === $type ) {
 
111
  $name = sprintf( __( 'MU Plugin: %s', 'query-monitor' ), $plug );
112
  } else {
 
113
  $name = sprintf( __( 'Plugin: %s', 'query-monitor' ), $plug );
114
  }
115
  $context = $plug;
@@ -124,6 +126,7 @@ class QM_Util {
124
  } else {
125
  $plug = basename( $plug );
126
  }
 
127
  $name = sprintf( __( 'VIP Plugin: %s', 'query-monitor' ), $plug );
128
  $context = $plug;
129
  break;
@@ -180,6 +183,7 @@ class QM_Util {
180
  if ( is_a( $callback['function'], 'Closure' ) ) {
181
  $ref = new ReflectionFunction( $callback['function'] );
182
  $file = QM_Util::standard_dir( $ref->getFileName(), '' );
 
183
  $callback['name'] = sprintf( __( 'Closure on line %1$d of %2$s', 'query-monitor' ), $ref->getStartLine(), $file );
184
  } else {
185
  // the object should have a __invoke() method
@@ -206,6 +210,7 @@ class QM_Util {
206
  $callback['file'] = $matches['file'];
207
  $callback['line'] = $matches['line'];
208
  $file = trim( QM_Util::standard_dir( $callback['file'], '' ), '/' );
 
209
  $callback['name'] = sprintf( __( 'Anonymous function on line %1$d of %2$s', 'query-monitor' ), $callback['line'], $file );
210
  } else {
211
  // https://github.com/facebook/hhvm/issues/5807
108
  $plug = basename( $plug );
109
  }
110
  if ( 'mu-plugin' === $type ) {
111
+ /* translators: %s: Plugin name */
112
  $name = sprintf( __( 'MU Plugin: %s', 'query-monitor' ), $plug );
113
  } else {
114
+ /* translators: %s: Plugin name */
115
  $name = sprintf( __( 'Plugin: %s', 'query-monitor' ), $plug );
116
  }
117
  $context = $plug;
126
  } else {
127
  $plug = basename( $plug );
128
  }
129
+ /* translators: %s: Plugin name */
130
  $name = sprintf( __( 'VIP Plugin: %s', 'query-monitor' ), $plug );
131
  $context = $plug;
132
  break;
183
  if ( is_a( $callback['function'], 'Closure' ) ) {
184
  $ref = new ReflectionFunction( $callback['function'] );
185
  $file = QM_Util::standard_dir( $ref->getFileName(), '' );
186
+ /* translators: 1: Line number, 2: File name */
187
  $callback['name'] = sprintf( __( 'Closure on line %1$d of %2$s', 'query-monitor' ), $ref->getStartLine(), $file );
188
  } else {
189
  // the object should have a __invoke() method
210
  $callback['file'] = $matches['file'];
211
  $callback['line'] = $matches['line'];
212
  $file = trim( QM_Util::standard_dir( $callback['file'], '' ), '/' );
213
+ /* translators: 1: Line number, 2: File name */
214
  $callback['name'] = sprintf( __( 'Anonymous function on line %1$d of %2$s', 'query-monitor' ), $callback['line'], $file );
215
  } else {
216
  // https://github.com/facebook/hhvm/issues/5807
collectors/debug_bar.php CHANGED
@@ -25,6 +25,7 @@ final class QM_Collector_Debug_Bar extends QM_Collector {
25
 
26
  public function name() {
27
  $title = $this->get_panel()->title();
 
28
  return sprintf( __( 'Debug Bar: %s', 'query-monitor' ), $title );
29
  }
30
 
25
 
26
  public function name() {
27
  $title = $this->get_panel()->title();
28
+ /* translators: %s: Name of a Debug Bar panel */
29
  return sprintf( __( 'Debug Bar: %s', 'query-monitor' ), $title );
30
  }
31
 
collectors/http.php CHANGED
@@ -133,7 +133,11 @@ class QM_Collector_HTTP extends QM_Collector {
133
  $this->data['http'][$args['_qm_key']]['args'] = $args;
134
  if ( isset( $args['_qm_original_key'] ) ) {
135
  $this->data['http'][$args['_qm_original_key']]['end'] = $this->data['http'][$args['_qm_original_key']]['start'];
136
- $this->data['http'][$args['_qm_original_key']]['response'] = new WP_Error( 'http_request_not_executed', __( 'Request not executed due to a filter on pre_http_request', 'query-monitor' ) );
 
 
 
 
137
  }
138
  }
139
 
@@ -179,7 +183,7 @@ class QM_Collector_HTTP extends QM_Collector {
179
 
180
  if ( is_wp_error( $http['response'] ) ) {
181
  if ( !in_array( $http['response']->get_error_code(), $silent ) ) {
182
- $this->data['errors']['error'][] = $key;
183
  }
184
  $http['type'] = __( 'Error', 'query-monitor' );
185
  } else {
133
  $this->data['http'][$args['_qm_key']]['args'] = $args;
134
  if ( isset( $args['_qm_original_key'] ) ) {
135
  $this->data['http'][$args['_qm_original_key']]['end'] = $this->data['http'][$args['_qm_original_key']]['start'];
136
+ $this->data['http'][$args['_qm_original_key']]['response'] = new WP_Error( 'http_request_not_executed', sprintf(
137
+ /* translators: %s: Hook name */
138
+ __( 'Request not executed due to a filter on %s', 'query-monitor' ),
139
+ 'pre_http_request'
140
+ ) );
141
  }
142
  }
143
 
183
 
184
  if ( is_wp_error( $http['response'] ) ) {
185
  if ( !in_array( $http['response']->get_error_code(), $silent ) ) {
186
+ $this->data['errors']['alert'][] = $key;
187
  }
188
  $http['type'] = __( 'Error', 'query-monitor' );
189
  } else {
collectors/php_errors.php CHANGED
@@ -31,6 +31,8 @@ class QM_Collector_PHP_Errors extends QM_Collector {
31
 
32
  public $id = 'php_errors';
33
  private $display_errors = null;
 
 
34
 
35
  public function name() {
36
  return __( 'PHP Errors', 'query-monitor' );
@@ -80,6 +82,20 @@ class QM_Collector_PHP_Errors extends QM_Collector {
80
  return false;
81
  }
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  $trace = new QM_Backtrace( array(
84
  'ignore_current_filter' => false,
85
  ) );
31
 
32
  public $id = 'php_errors';
33
  private $display_errors = null;
34
+ private static $unexpected_error;
35
+ private static $wordpress_couldnt;
36
 
37
  public function name() {
38
  return __( 'PHP Errors', 'query-monitor' );
82
  return false;
83
  }
84
 
85
+ if ( ! isset( self::$unexpected_error ) ) {
86
+ self::$unexpected_error = __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' );
87
+ self::$wordpress_couldnt = __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' );
88
+ }
89
+
90
+ // Intentionally skip reporting these core warnings. They're a distraction when developing offline.
91
+ // The failed HTTP request will still appear in QM's output so it's not a big problem hiding these warnings.
92
+ if ( self::$unexpected_error === $message ) {
93
+ return false;
94
+ }
95
+ if ( self::$unexpected_error . ' ' . self::$wordpress_couldnt === $message ) {
96
+ return false;
97
+ }
98
+
99
  $trace = new QM_Backtrace( array(
100
  'ignore_current_filter' => false,
101
  ) );
collectors/request.php CHANGED
@@ -94,6 +94,7 @@ class QM_Collector_Request extends QM_Collector {
94
 
95
  case is_a( $qo, 'WP_Post' ):
96
  // Single post
 
97
  $this->data['queried_object']['title'] = sprintf( __( 'Single %s: #%d', 'query-monitor' ),
98
  get_post_type_object( $qo->post_type )->labels->singular_name,
99
  $qo->ID
@@ -102,6 +103,7 @@ class QM_Collector_Request extends QM_Collector {
102
 
103
  case is_a( $qo, 'WP_User' ):
104
  // Author archive
 
105
  $this->data['queried_object']['title'] = sprintf( __( 'Author archive: %s', 'query-monitor' ),
106
  $qo->user_nicename
107
  );
@@ -110,13 +112,16 @@ class QM_Collector_Request extends QM_Collector {
110
  case is_a( $qo, 'WP_Term' ):
111
  case property_exists( $qo, 'term_id' ):
112
  // Term archive
 
113
  $this->data['queried_object']['title'] = sprintf( __( 'Term archive: %s', 'query-monitor' ),
114
  $qo->slug
115
  );
116
  break;
117
 
 
118
  case property_exists( $qo, 'has_archive' ):
119
  // Post type archive
 
120
  $this->data['queried_object']['title'] = sprintf( __( 'Post type archive: %s', 'query-monitor' ),
121
  $qo->name
122
  );
94
 
95
  case is_a( $qo, 'WP_Post' ):
96
  // Single post
97
+ /* translators: 1: Post type name, 2: Post ID */
98
  $this->data['queried_object']['title'] = sprintf( __( 'Single %s: #%d', 'query-monitor' ),
99
  get_post_type_object( $qo->post_type )->labels->singular_name,
100
  $qo->ID
103
 
104
  case is_a( $qo, 'WP_User' ):
105
  // Author archive
106
+ /* translators: %s: Author name */
107
  $this->data['queried_object']['title'] = sprintf( __( 'Author archive: %s', 'query-monitor' ),
108
  $qo->user_nicename
109
  );
112
  case is_a( $qo, 'WP_Term' ):
113
  case property_exists( $qo, 'term_id' ):
114
  // Term archive
115
+ /* translators: %s: Taxonomy term name */
116
  $this->data['queried_object']['title'] = sprintf( __( 'Term archive: %s', 'query-monitor' ),
117
  $qo->slug
118
  );
119
  break;
120
 
121
+ case is_a( $qo, 'WP_Post_Type' ):
122
  case property_exists( $qo, 'has_archive' ):
123
  // Post type archive
124
+ /* translators: %s: Post type name */
125
  $this->data['queried_object']['title'] = sprintf( __( 'Post type archive: %s', 'query-monitor' ),
126
  $qo->name
127
  );
collectors/theme.php CHANGED
@@ -26,6 +26,7 @@ class QM_Collector_Theme extends QM_Collector {
26
  parent::__construct();
27
  add_filter( 'body_class', array( $this, 'filter_body_class' ), 999 );
28
  add_filter( 'template_include', array( $this, 'filter_template_include' ), 999 );
 
29
  }
30
 
31
  public function filter_body_class( array $class ) {
@@ -38,6 +39,14 @@ class QM_Collector_Theme extends QM_Collector {
38
  return $template_path;
39
  }
40
 
 
 
 
 
 
 
 
 
41
  public function process() {
42
 
43
  if ( ! empty( $this->data['template_path'] ) ) {
26
  parent::__construct();
27
  add_filter( 'body_class', array( $this, 'filter_body_class' ), 999 );
28
  add_filter( 'template_include', array( $this, 'filter_template_include' ), 999 );
29
+ add_filter( 'timber/output', array( $this, 'filter_timber_output' ), 999, 3 );
30
  }
31
 
32
  public function filter_body_class( array $class ) {
39
  return $template_path;
40
  }
41
 
42
+ public function filter_timber_output( $output, $data = null, $file = null ) {
43
+ if ( $file ) {
44
+ $this->data['timber_files'][] = $file;
45
+ }
46
+
47
+ return $output;
48
+ }
49
+
50
  public function process() {
51
 
52
  if ( ! empty( $this->data['template_path'] ) ) {
output/Html.php CHANGED
@@ -166,6 +166,10 @@ abstract class QM_Output_Html extends QM_Output {
166
  */
167
  public static function output_filename( $text, $file, $line = 0 ) {
168
 
 
 
 
 
169
  # Further reading:
170
  # http://simonwheatley.co.uk/2012/07/clickable-stack-traces/
171
  # https://github.com/grych/subl-handler
166
  */
167
  public static function output_filename( $text, $file, $line = 0 ) {
168
 
169
+ if ( empty( $file ) ) {
170
+ return esc_html( $text );
171
+ }
172
+
173
  # Further reading:
174
  # http://simonwheatley.co.uk/2012/07/clickable-stack-traces/
175
  # https://github.com/grych/subl-handler
output/headers/overview.php CHANGED
@@ -23,6 +23,7 @@ class QM_Output_Headers_Overview extends QM_Output_Headers {
23
 
24
  $headers['time'] = number_format_i18n( $data['time'], 4 );
25
  $headers['time_usage'] = sprintf(
 
26
  __( '%1$s%% of %2$ss limit', 'query-monitor' ),
27
  number_format_i18n( $data['time_usage'], 1 ),
28
  number_format_i18n( $data['time_limit'] )
@@ -30,10 +31,12 @@ class QM_Output_Headers_Overview extends QM_Output_Headers {
30
 
31
  if ( ! empty( $data['memory'] ) ) {
32
  $headers['memory'] = sprintf(
 
33
  __( '%s kB', 'query-monitor' ),
34
  number_format_i18n( $data['memory'] / 1024 )
35
  );
36
  $headers['memory_usage'] = sprintf(
 
37
  __( '%1$s%% of %2$s kB limit', 'query-monitor' ),
38
  number_format_i18n( $data['memory_usage'], 1 ),
39
  number_format_i18n( $data['memory_limit'] / 1024 )
23
 
24
  $headers['time'] = number_format_i18n( $data['time'], 4 );
25
  $headers['time_usage'] = sprintf(
26
+ /* translators: 1: Percentage of time limit used, 2: Time limit in seconds */
27
  __( '%1$s%% of %2$ss limit', 'query-monitor' ),
28
  number_format_i18n( $data['time_usage'], 1 ),
29
  number_format_i18n( $data['time_limit'] )
31
 
32
  if ( ! empty( $data['memory'] ) ) {
33
  $headers['memory'] = sprintf(
34
+ /* translators: %s: Memory used in kilobytes */
35
  __( '%s kB', 'query-monitor' ),
36
  number_format_i18n( $data['memory'] / 1024 )
37
  );
38
  $headers['memory_usage'] = sprintf(
39
+ /* translators: 1: Percentage of memory limit used, 2: Memory limit in kilobytes */
40
  __( '%1$s%% of %2$s kB limit', 'query-monitor' ),
41
  number_format_i18n( $data['memory_usage'], 1 ),
42
  number_format_i18n( $data['memory_limit'] / 1024 )
output/html/assets.php CHANGED
@@ -33,6 +33,21 @@ class QM_Output_Html_Assets extends QM_Output_Html {
33
  echo '<div class="qm" id="' . esc_attr( $this->collector->id() ) . '">';
34
  echo '<table cellspacing="0">';
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  foreach ( array(
37
  'scripts' => __( 'Scripts', 'query-monitor' ),
38
  'styles' => __( 'Styles', 'query-monitor' ),
@@ -56,14 +71,14 @@ class QM_Output_Html_Assets extends QM_Output_Html {
56
  echo '<tbody>';
57
 
58
  foreach ( array(
59
- 'missing' => __( 'Missing %s', 'query-monitor' ),
60
- 'broken' => __( 'Broken Dependencies', 'query-monitor' ),
61
- 'header' => __( 'Header %s', 'query-monitor' ),
62
- 'footer' => __( 'Footer %s', 'query-monitor' ),
63
- ) as $position => $position_label ) {
64
 
65
  if ( isset( $data[ $position ][ $type ] ) ) {
66
- $this->dependency_rows( $data[ $position ][ $type ], $data['raw'][ $type ], sprintf( $position_label, $type_label ), $type );
67
  }
68
 
69
  }
@@ -143,6 +158,7 @@ class QM_Output_Html_Assets extends QM_Output_Html {
143
 
144
  foreach ( $deps as & $dep ) {
145
  if ( ! $dependencies->query( $dep ) ) {
 
146
  $dep = sprintf( __( '%s (missing)', 'query-monitor' ), $dep );
147
  }
148
  }
33
  echo '<div class="qm" id="' . esc_attr( $this->collector->id() ) . '">';
34
  echo '<table cellspacing="0">';
35
 
36
+ $position_labels = array(
37
+ 'scripts' => array(
38
+ 'missing' => __( 'Missing Scripts', 'query-monitor' ),
39
+ 'broken' => __( 'Broken Dependencies', 'query-monitor' ),
40
+ 'header' => __( 'Header Scripts', 'query-monitor' ),
41
+ 'footer' => __( 'Footer Scripts', 'query-monitor' ),
42
+ ),
43
+ 'styles' => array(
44
+ 'missing' => __( 'Missing Styles', 'query-monitor' ),
45
+ 'broken' => __( 'Broken Dependencies', 'query-monitor' ),
46
+ 'header' => __( 'Header Styles', 'query-monitor' ),
47
+ 'footer' => __( 'Footer Styles', 'query-monitor' ),
48
+ ),
49
+ );
50
+
51
  foreach ( array(
52
  'scripts' => __( 'Scripts', 'query-monitor' ),
53
  'styles' => __( 'Styles', 'query-monitor' ),
71
  echo '<tbody>';
72
 
73
  foreach ( array(
74
+ 'missing',
75
+ 'broken',
76
+ 'header',
77
+ 'footer',
78
+ ) as $position ) {
79
 
80
  if ( isset( $data[ $position ][ $type ] ) ) {
81
+ $this->dependency_rows( $data[ $position ][ $type ], $data['raw'][ $type ], $position_labels[ $type ][ $position ], $type );
82
  }
83
 
84
  }
158
 
159
  foreach ( $deps as & $dep ) {
160
  if ( ! $dependencies->query( $dep ) ) {
161
+ /* translators: %s: Script or style dependency name */
162
  $dep = sprintf( __( '%s (missing)', 'query-monitor' ), $dep );
163
  }
164
  }
output/html/db_callers.php CHANGED
@@ -39,7 +39,7 @@ class QM_Output_Html_DB_Callers extends QM_Output_Html {
39
  echo '<th colspan="' . absint( $span ) . '">' . esc_html( $this->collector->name() ) . '</th>';
40
  echo '</tr>';
41
  echo '<tr>';
42
- echo '<th>' . esc_html_x( 'Caller', 'Query caller', 'query-monitor' ) . '</th>';
43
 
44
  foreach ( $data['types'] as $type_name => $type_count ) {
45
  echo '<th class="qm-num">';
39
  echo '<th colspan="' . absint( $span ) . '">' . esc_html( $this->collector->name() ) . '</th>';
40
  echo '</tr>';
41
  echo '<tr>';
42
+ echo '<th>' . esc_html__( 'Caller', 'query-monitor' ) . '</th>';
43
 
44
  foreach ( $data['types'] as $type_name => $type_count ) {
45
  echo '<th class="qm-num">';
output/html/db_components.php CHANGED
@@ -40,7 +40,7 @@ class QM_Output_Html_DB_Components extends QM_Output_Html {
40
  echo '<th colspan="' . esc_attr( $span ) . '">' . esc_html( $this->collector->name() ) . '</th>';
41
  echo '</tr>';
42
  echo '<tr>';
43
- echo '<th>' . esc_html_x( 'Component', 'Query component', 'query-monitor' ) . '</th>';
44
 
45
  foreach ( $data['types'] as $type_name => $type_count ) {
46
  echo '<th class="qm-num">';
40
  echo '<th colspan="' . esc_attr( $span ) . '">' . esc_html( $this->collector->name() ) . '</th>';
41
  echo '</tr>';
42
  echo '<tr>';
43
+ echo '<th>' . esc_html__( 'Component', 'query-monitor' ) . '</th>';
44
 
45
  foreach ( $data['types'] as $type_name => $type_count ) {
46
  echo '<th class="qm-num">';
output/html/db_dupes.php CHANGED
@@ -52,6 +52,9 @@ class QM_Output_Html_DB_Dupes extends QM_Output_Html {
52
 
53
  echo '<tbody>';
54
 
 
 
 
55
  foreach ( $data['dupes'] as $sql => $queries ) {
56
 
57
  // This should probably happen in the collector's processor
@@ -76,7 +79,7 @@ class QM_Output_Html_DB_Dupes extends QM_Output_Html {
76
  esc_attr( $caller ),
77
  esc_html( $caller ),
78
  esc_html( sprintf(
79
- _n( '%s call', '%s calls', $calls, 'query-monitor' ),
80
  number_format_i18n( $calls )
81
  ) )
82
  );
@@ -89,7 +92,7 @@ class QM_Output_Html_DB_Dupes extends QM_Output_Html {
89
  '%s<br><span class="qm-info">&nbsp;%s</span><br>',
90
  esc_html( $component ),
91
  esc_html( sprintf(
92
- _n( '%s call', '%s calls', $calls, 'query-monitor' ),
93
  number_format_i18n( $calls )
94
  ) )
95
  );
@@ -102,7 +105,7 @@ class QM_Output_Html_DB_Dupes extends QM_Output_Html {
102
  '%s<br><span class="qm-info">&nbsp;%s</span><br>',
103
  esc_html( $source ),
104
  esc_html( sprintf(
105
- _n( '%s call', '%s calls', $calls, 'query-monitor' ),
106
  number_format_i18n( $calls )
107
  ) )
108
  );
@@ -124,6 +127,7 @@ class QM_Output_Html_DB_Dupes extends QM_Output_Html {
124
  if ( isset( $dbq_data['dupes'] ) && count( $dbq_data['dupes'] ) ) {
125
  $menu[] = $this->menu( array(
126
  'title' => esc_html( sprintf(
 
127
  __( 'Duplicate Queries (%s)', 'query-monitor' ),
128
  count( $dbq_data['dupes'] )
129
  ) ),
52
 
53
  echo '<tbody>';
54
 
55
+ /* translators: %s: Number of calls to a PHP function */
56
+ $call_text = _n_noop( '%s call', '%s calls', 'query-monitor' );
57
+
58
  foreach ( $data['dupes'] as $sql => $queries ) {
59
 
60
  // This should probably happen in the collector's processor
79
  esc_attr( $caller ),
80
  esc_html( $caller ),
81
  esc_html( sprintf(
82
+ translate_nooped_plural( $call_text, $calls, 'query-monitor' ),
83
  number_format_i18n( $calls )
84
  ) )
85
  );
92
  '%s<br><span class="qm-info">&nbsp;%s</span><br>',
93
  esc_html( $component ),
94
  esc_html( sprintf(
95
+ translate_nooped_plural( $call_text, $calls, 'query-monitor' ),
96
  number_format_i18n( $calls )
97
  ) )
98
  );
105
  '%s<br><span class="qm-info">&nbsp;%s</span><br>',
106
  esc_html( $source ),
107
  esc_html( sprintf(
108
+ translate_nooped_plural( $call_text, $calls, 'query-monitor' ),
109
  number_format_i18n( $calls )
110
  ) )
111
  );
127
  if ( isset( $dbq_data['dupes'] ) && count( $dbq_data['dupes'] ) ) {
128
  $menu[] = $this->menu( array(
129
  'title' => esc_html( sprintf(
130
+ /* translators: %s: Number of duplicate database queries */
131
  __( 'Duplicate Queries (%s)', 'query-monitor' ),
132
  count( $dbq_data['dupes'] )
133
  ) ),
output/html/db_queries.php CHANGED
@@ -60,6 +60,7 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
60
  echo '<tbody>';
61
  echo '<tr>';
62
  echo '<td class="qm-warn">';
 
63
  printf( esc_html__( 'No database queries were logged because the %s constant is set to %s', 'query-monitor' ),
64
  '<code>SAVEQUERIES</code>',
65
  '<code>false</code>'
@@ -108,6 +109,7 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
108
  echo '<thead>';
109
  echo '<tr>';
110
  echo '<th colspan="5" class="qm-expensive">';
 
111
  printf( esc_html__( 'Slow Database Queries (above %ss)', 'query-monitor' ),
112
  '<span class="qm-expensive">' . esc_html( number_format_i18n( QM_DB_EXPENSIVE, $dp ) ) . '</span>'
113
  );
@@ -155,6 +157,7 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
155
  echo '<table cellspacing="0" class="qm-sortable">';
156
  echo '<thead>';
157
  echo '<tr>';
 
158
  echo '<th colspan="' . absint( $span ) . '">' . esc_html( sprintf( __( '%s Queries', 'query-monitor' ), $name ) ) . '</th>';
159
  echo '</tr>';
160
 
@@ -172,6 +175,7 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
172
  echo '<tr>';
173
  echo '<td colspan="' . absint( $span ) . '" class="qm-warn">';
174
  echo wp_kses( sprintf(
 
175
  __( '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' ),
176
  '<code>db.php</code>',
177
  'https://github.com/johnbillion/query-monitor/wiki/db.php-Symlink'
@@ -243,6 +247,7 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
243
  echo '<tr class="qm-items-shown qm-hide">';
244
  echo '<td colspan="' . absint( $span - 1 ) . '">';
245
  printf(
 
246
  esc_html__( 'Queries in filter: %s', 'query-monitor' ),
247
  '<span class="qm-items-number">' . esc_html( number_format_i18n( $db->total_qs ) ) . '</span>'
248
  );
@@ -253,6 +258,7 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
253
  echo '<tr>';
254
  echo '<td colspan="' . absint( $span - 1 ) . '">';
255
  echo esc_html( sprintf(
 
256
  __( 'Total Queries: %s', 'query-monitor' ),
257
  number_format_i18n( $db->total_qs )
258
  ) );
@@ -409,12 +415,14 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
409
  if ( isset( $data['dbs'] ) ) {
410
  foreach ( $data['dbs'] as $key => $db ) {
411
  $title[] = sprintf(
412
- _x( '%s%s<small>S</small>', 'database query time', 'query-monitor' ),
 
413
  ( count( $data['dbs'] ) > 1 ? '&bull;&nbsp;&nbsp;&nbsp;' : '' ),
414
  number_format_i18n( $db->total_time, 4 )
415
  );
416
  $title[] = sprintf(
417
- _x( '%s<small>Q</small>', 'database query number', 'query-monitor' ),
 
418
  number_format_i18n( $db->total_qs )
419
  );
420
  }
@@ -443,6 +451,7 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
443
  'id' => 'query-monitor-errors',
444
  'href' => '#qm-query-errors',
445
  'title' => esc_html( sprintf(
 
446
  __( 'Database Errors (%s)', 'query-monitor' ),
447
  number_format_i18n( count( $errors ) )
448
  ) ),
@@ -453,6 +462,7 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
453
  'id' => 'query-monitor-expensive',
454
  'href' => '#qm-query-expensive',
455
  'title' => esc_html( sprintf(
 
456
  __( 'Slow Queries (%s)', 'query-monitor' ),
457
  number_format_i18n( count( $expensive ) )
458
  ) ),
@@ -464,6 +474,7 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
464
  $menu[] = $this->menu( array(
465
  'id' => esc_attr( sprintf( 'query-monitor-%s-db-%s', $this->collector->id(), sanitize_title_with_dashes( $name ) ) ),
466
  'title' => esc_html( sprintf(
 
467
  __( 'Queries - %s', 'query-monitor' ),
468
  $name
469
  ) ),
60
  echo '<tbody>';
61
  echo '<tr>';
62
  echo '<td class="qm-warn">';
63
+ /* translators: 1: Name of PHP constant, 2: Value of PHP constant */
64
  printf( esc_html__( 'No database queries were logged because the %s constant is set to %s', 'query-monitor' ),
65
  '<code>SAVEQUERIES</code>',
66
  '<code>false</code>'
109
  echo '<thead>';
110
  echo '<tr>';
111
  echo '<th colspan="5" class="qm-expensive">';
112
+ /* translators: %s: Database query time in seconds */
113
  printf( esc_html__( 'Slow Database Queries (above %ss)', 'query-monitor' ),
114
  '<span class="qm-expensive">' . esc_html( number_format_i18n( QM_DB_EXPENSIVE, $dp ) ) . '</span>'
115
  );
157
  echo '<table cellspacing="0" class="qm-sortable">';
158
  echo '<thead>';
159
  echo '<tr>';
160
+ /* translators: %s: Name of database controller */
161
  echo '<th colspan="' . absint( $span ) . '">' . esc_html( sprintf( __( '%s Queries', 'query-monitor' ), $name ) ) . '</th>';
162
  echo '</tr>';
163
 
175
  echo '<tr>';
176
  echo '<td colspan="' . absint( $span ) . '" class="qm-warn">';
177
  echo wp_kses( sprintf(
178
+ /* translators: 1: Symlink file name, 2: URL to wiki page */
179
  __( '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' ),
180
  '<code>db.php</code>',
181
  'https://github.com/johnbillion/query-monitor/wiki/db.php-Symlink'
247
  echo '<tr class="qm-items-shown qm-hide">';
248
  echo '<td colspan="' . absint( $span - 1 ) . '">';
249
  printf(
250
+ /* translators: %s: Number of database queries in the current filtered view */
251
  esc_html__( 'Queries in filter: %s', 'query-monitor' ),
252
  '<span class="qm-items-number">' . esc_html( number_format_i18n( $db->total_qs ) ) . '</span>'
253
  );
258
  echo '<tr>';
259
  echo '<td colspan="' . absint( $span - 1 ) . '">';
260
  echo esc_html( sprintf(
261
+ /* translators: %s: Number of database queries */
262
  __( 'Total Queries: %s', 'query-monitor' ),
263
  number_format_i18n( $db->total_qs )
264
  ) );
415
  if ( isset( $data['dbs'] ) ) {
416
  foreach ( $data['dbs'] as $key => $db ) {
417
  $title[] = sprintf(
418
+ /* translators: %s: Database query time in seconds */
419
+ '%s' . _x( '%s<small>S</small>', 'Query time', 'query-monitor' ),
420
  ( count( $data['dbs'] ) > 1 ? '&bull;&nbsp;&nbsp;&nbsp;' : '' ),
421
  number_format_i18n( $db->total_time, 4 )
422
  );
423
  $title[] = sprintf(
424
+ /* translators: %s: Number of database queries */
425
+ _x( '%s<small>Q</small>', 'Query count', 'query-monitor' ),
426
  number_format_i18n( $db->total_qs )
427
  );
428
  }
451
  'id' => 'query-monitor-errors',
452
  'href' => '#qm-query-errors',
453
  'title' => esc_html( sprintf(
454
+ /* translators: %s: Number of database errors */
455
  __( 'Database Errors (%s)', 'query-monitor' ),
456
  number_format_i18n( count( $errors ) )
457
  ) ),
462
  'id' => 'query-monitor-expensive',
463
  'href' => '#qm-query-expensive',
464
  'title' => esc_html( sprintf(
465
+ /* translators: %s: Number of slow database queries */
466
  __( 'Slow Queries (%s)', 'query-monitor' ),
467
  number_format_i18n( count( $expensive ) )
468
  ) ),
474
  $menu[] = $this->menu( array(
475
  'id' => esc_attr( sprintf( 'query-monitor-%s-db-%s', $this->collector->id(), sanitize_title_with_dashes( $name ) ) ),
476
  'title' => esc_html( sprintf(
477
+ /* translators: %s: Name of database controller */
478
  __( 'Queries - %s', 'query-monitor' ),
479
  $name
480
  ) ),
output/html/environment.php CHANGED
@@ -73,6 +73,7 @@ class QM_Output_Html_Environment extends QM_Output_Html {
73
  printf(
74
  '<br><span class="qm-info">&nbsp;%s</span>',
75
  esc_html( sprintf(
 
76
  __( 'Overridden at runtime from %s', 'query-monitor' ),
77
  $val['before']
78
  ) )
@@ -103,6 +104,7 @@ class QM_Output_Html_Environment extends QM_Output_Html {
103
  if ( 1 === count( $data['db'] ) ) {
104
  $name = __( 'Database', 'query-monitor' );
105
  } else {
 
106
  $name = sprintf( __( 'Database: %s', 'query-monitor' ), $id );
107
  }
108
 
@@ -133,6 +135,7 @@ class QM_Output_Html_Environment extends QM_Output_Html {
133
  echo '<tr>';
134
 
135
  $first = true;
 
136
  $search = __( 'https://www.google.com/search?q=mysql+performance+%s', 'query-monitor' );
137
 
138
  foreach ( $db['variables'] as $setting ) {
@@ -151,7 +154,7 @@ class QM_Output_Html_Environment extends QM_Output_Html {
151
  if ( $show_warning ) {
152
  $append .= sprintf(
153
  '&nbsp;<span class="qm-info">(<a href="%s" target="_blank">%s</a>)</span>',
154
- esc_url( sprintf( $search, $key ) ),
155
  esc_html__( 'Help', 'query-monitor' )
156
  );
157
  }
73
  printf(
74
  '<br><span class="qm-info">&nbsp;%s</span>',
75
  esc_html( sprintf(
76
+ /* translators: %s: Original value of a variable */
77
  __( 'Overridden at runtime from %s', 'query-monitor' ),
78
  $val['before']
79
  ) )
104
  if ( 1 === count( $data['db'] ) ) {
105
  $name = __( 'Database', 'query-monitor' );
106
  } else {
107
+ /* translators: %s: Name of database controller */
108
  $name = sprintf( __( 'Database: %s', 'query-monitor' ), $id );
109
  }
110
 
135
  echo '<tr>';
136
 
137
  $first = true;
138
+ /* translators: %s: Search term */
139
  $search = __( 'https://www.google.com/search?q=mysql+performance+%s', 'query-monitor' );
140
 
141
  foreach ( $db['variables'] as $setting ) {
154
  if ( $show_warning ) {
155
  $append .= sprintf(
156
  '&nbsp;<span class="qm-info">(<a href="%s" target="_blank">%s</a>)</span>',
157
+ esc_url( sprintf( $search, urlencode( $key ) ) ),
158
  esc_html__( 'Help', 'query-monitor' )
159
  );
160
  }
output/html/hooks.php CHANGED
@@ -108,6 +108,7 @@ class QM_Output_Html_Hooks extends QM_Output_Html {
108
  if ( 'all' === $hook['name'] ) {
109
  echo '<br><span class="qm-warn">';
110
  printf(
 
111
  esc_html__( 'Warning: The %s action is extremely resource intensive. Try to avoid using it.', 'query-monitor' ),
112
  '<code>all</code>'
113
  );
@@ -129,6 +130,7 @@ class QM_Output_Html_Hooks extends QM_Output_Html {
129
  if ( isset( $action['callback']['error'] ) ) {
130
  echo '<br><span class="qm-warn">';
131
  echo esc_html( sprintf(
 
132
  __( 'Error: %s', 'query-monitor' ),
133
  $action['callback']['error']->get_error_message()
134
  ) );
108
  if ( 'all' === $hook['name'] ) {
109
  echo '<br><span class="qm-warn">';
110
  printf(
111
+ /* translators: %s: Action name */
112
  esc_html__( 'Warning: The %s action is extremely resource intensive. Try to avoid using it.', 'query-monitor' ),
113
  '<code>all</code>'
114
  );
130
  if ( isset( $action['callback']['error'] ) ) {
131
  echo '<br><span class="qm-warn">';
132
  echo esc_html( sprintf(
133
+ /* translators: %s: Error message text */
134
  __( 'Error: %s', 'query-monitor' ),
135
  $action['callback']['error']->get_error_message()
136
  ) );
output/html/http.php CHANGED
@@ -76,33 +76,31 @@ class QM_Output_Html_HTTP extends QM_Output_Html {
76
  $response = $row['response']->get_error_message();
77
  $css = 'qm-warn';
78
  } else {
79
- $response = wp_remote_retrieve_response_code( $row['response'] );
80
  $msg = wp_remote_retrieve_response_message( $row['response'] );
81
  $css = '';
82
 
83
- if ( empty( $response ) ) {
84
- $response = __( 'n/a', 'query-monitor' );
85
- } else {
86
- $response = $response . ' ' . $msg;
87
- }
88
-
89
- if ( intval( $response ) >= 400 ) {
90
  $css = 'qm-warn';
91
  }
92
 
 
 
93
  }
94
 
95
  $method = esc_html( $row['args']['method'] );
96
 
97
  if ( empty( $row['args']['blocking'] ) ) {
98
  $method .= '<br><span class="qm-info">' . esc_html( sprintf(
99
- _x( '(Non-blocking request: %s)', 'non-blocking HTTP transport', 'query-monitor' ),
 
100
  'blocking=false'
101
  ) ) . '</span>';
102
  }
103
 
104
  if ( empty( $row['args']['sslverify'] ) && empty( $row['args']['local'] ) && 'https' === parse_url( $row['url'], PHP_URL_SCHEME ) ) {
105
  $method .= '<br><span class="qm-warn">' . esc_html( sprintf(
 
106
  __( '(Certificate verification disabled: %s)', 'query-monitor' ),
107
  'sslverify=false'
108
  ) ) . '</span>';
@@ -223,8 +221,8 @@ class QM_Output_Html_HTTP extends QM_Output_Html {
223
 
224
  $data = $this->collector->get_data();
225
 
226
- if ( isset( $data['errors']['error'] ) ) {
227
- $class[] = 'qm-error';
228
  } else if ( isset( $data['errors']['warning'] ) ) {
229
  $class[] = 'qm-warning';
230
  }
@@ -241,6 +239,7 @@ class QM_Output_Html_HTTP extends QM_Output_Html {
241
 
242
  $title = ( empty( $count ) )
243
  ? __( 'HTTP Requests', 'query-monitor' )
 
244
  : __( 'HTTP Requests (%s)', 'query-monitor' );
245
 
246
  $args = array(
@@ -250,8 +249,8 @@ class QM_Output_Html_HTTP extends QM_Output_Html {
250
  ) ),
251
  );
252
 
253
- if ( isset( $data['errors']['error'] ) ) {
254
- $args['meta']['classname'] = 'qm-error';
255
  } else if ( isset( $data['errors']['warning'] ) ) {
256
  $args['meta']['classname'] = 'qm-warning';
257
  }
76
  $response = $row['response']->get_error_message();
77
  $css = 'qm-warn';
78
  } else {
79
+ $code = wp_remote_retrieve_response_code( $row['response'] );
80
  $msg = wp_remote_retrieve_response_message( $row['response'] );
81
  $css = '';
82
 
83
+ if ( intval( $code ) >= 400 ) {
 
 
 
 
 
 
84
  $css = 'qm-warn';
85
  }
86
 
87
+ $response = $code . ' ' . $msg;
88
+
89
  }
90
 
91
  $method = esc_html( $row['args']['method'] );
92
 
93
  if ( empty( $row['args']['blocking'] ) ) {
94
  $method .= '<br><span class="qm-info">' . esc_html( sprintf(
95
+ /* translators: A non-blocking HTTP API request. %s: Relevant argument name */
96
+ __( '(Non-blocking request: %s)', 'query-monitor' ),
97
  'blocking=false'
98
  ) ) . '</span>';
99
  }
100
 
101
  if ( empty( $row['args']['sslverify'] ) && empty( $row['args']['local'] ) && 'https' === parse_url( $row['url'], PHP_URL_SCHEME ) ) {
102
  $method .= '<br><span class="qm-warn">' . esc_html( sprintf(
103
+ /* translators: An HTTP API request has disabled certificate verification. %s: Relevant argument name */
104
  __( '(Certificate verification disabled: %s)', 'query-monitor' ),
105
  'sslverify=false'
106
  ) ) . '</span>';
221
 
222
  $data = $this->collector->get_data();
223
 
224
+ if ( isset( $data['errors']['alert'] ) ) {
225
+ $class[] = 'qm-alert';
226
  } else if ( isset( $data['errors']['warning'] ) ) {
227
  $class[] = 'qm-warning';
228
  }
239
 
240
  $title = ( empty( $count ) )
241
  ? __( 'HTTP Requests', 'query-monitor' )
242
+ /* translators: %s: Number of HTTP requests */
243
  : __( 'HTTP Requests (%s)', 'query-monitor' );
244
 
245
  $args = array(
249
  ) ),
250
  );
251
 
252
+ if ( isset( $data['errors']['alert'] ) ) {
253
+ $args['meta']['classname'] = 'qm-alert';
254
  } else if ( isset( $data['errors']['warning'] ) ) {
255
  $args['meta']['classname'] = 'qm-warning';
256
  }
output/html/languages.php CHANGED
@@ -35,7 +35,11 @@ class QM_Output_Html_Languages extends QM_Output_Html {
35
  echo '<table cellspacing="0">';
36
  echo '<thead>';
37
  echo '<tr>';
38
- echo '<th colspan="4">' . esc_html__( 'Language Setting:', 'query-monitor' ) . ' ' . esc_html( $data['locale'] ) . '</th>';
 
 
 
 
39
  echo '</tr>';
40
  echo '<tr>';
41
  echo '<td>' . esc_html__( 'Text Domain', 'query-monitor' ) . '</td>';
35
  echo '<table cellspacing="0">';
36
  echo '<thead>';
37
  echo '<tr>';
38
+ echo '<th colspan="4">' . esc_html( sprintf(
39
+ /* translators: %s: Name of current language */
40
+ __( 'Language Setting: %s', 'query-monitor' ),
41
+ $data['locale']
42
+ ) ) . '</th>';
43
  echo '</tr>';
44
  echo '<tr>';
45
  echo '<td>' . esc_html__( 'Text Domain', 'query-monitor' ) . '</td>';
output/html/overview.php CHANGED
@@ -116,6 +116,7 @@ class QM_Output_Html_Overview extends QM_Output_Html {
116
  number_format_i18n( $cache_hit_percentage, 1 )
117
  ) );
118
  echo '<br>' . esc_html( sprintf(
 
119
  __( 'External object cache: %s'),
120
  ( $cache_data['ext_object_cache'] ? 'true' : 'false' )
121
  ) );
@@ -141,11 +142,13 @@ class QM_Output_Html_Overview extends QM_Output_Html {
141
  }
142
 
143
  $title[] = sprintf(
144
- _x( '%s<small>S</small>', 'page load time', 'query-monitor' ),
 
145
  number_format_i18n( $data['time'], 2 )
146
  );
147
  $title[] = sprintf(
148
- _x( '%s<small>MB</small>', 'memory usage', 'query-monitor' ),
 
149
  $memory
150
  );
151
  return $title;
116
  number_format_i18n( $cache_hit_percentage, 1 )
117
  ) );
118
  echo '<br>' . esc_html( sprintf(
119
+ /* translators: %s: External object cache status */
120
  __( 'External object cache: %s'),
121
  ( $cache_data['ext_object_cache'] ? 'true' : 'false' )
122
  ) );
142
  }
143
 
144
  $title[] = sprintf(
145
+ /* translators: %s: Page load time in seconds */
146
+ _x( '%s<small>S</small>', 'Page load time', 'query-monitor' ),
147
  number_format_i18n( $data['time'], 2 )
148
  );
149
  $title[] = sprintf(
150
+ /* translators: %s: Memory usage in megabytes */
151
+ _x( '%s<small>MB</small>', 'Memory usage', 'query-monitor' ),
152
  $memory
153
  );
154
  return $title;
output/html/php_errors.php CHANGED
@@ -44,10 +44,10 @@ class QM_Output_Html_PHP_Errors extends QM_Output_Html {
44
  echo '<tbody>';
45
 
46
  $types = array(
47
- 'warning' => __( 'Warning', 'query-monitor' ),
48
- 'notice' => __( 'Notice', 'query-monitor' ),
49
- 'strict' => __( 'Strict', 'query-monitor' ),
50
- 'deprecated' => __( 'Deprecated', 'query-monitor' ),
51
  );
52
 
53
  foreach ( $types as $type => $title ) {
@@ -142,6 +142,7 @@ class QM_Output_Html_PHP_Errors extends QM_Output_Html {
142
  $menu[] = $this->menu( array(
143
  'id' => 'query-monitor-warnings',
144
  'title' => esc_html( sprintf(
 
145
  __( 'PHP Warnings (%s)', 'query-monitor' ),
146
  number_format_i18n( count( $data['errors']['warning'] ) )
147
  ) )
@@ -151,6 +152,7 @@ class QM_Output_Html_PHP_Errors extends QM_Output_Html {
151
  $menu[] = $this->menu( array(
152
  'id' => 'query-monitor-notices',
153
  'title' => esc_html( sprintf(
 
154
  __( 'PHP Notices (%s)', 'query-monitor' ),
155
  number_format_i18n( count( $data['errors']['notice'] ) )
156
  ) )
@@ -160,6 +162,7 @@ class QM_Output_Html_PHP_Errors extends QM_Output_Html {
160
  $menu[] = $this->menu( array(
161
  'id' => 'query-monitor-stricts',
162
  'title' => esc_html( sprintf(
 
163
  __( 'PHP Stricts (%s)', 'query-monitor' ),
164
  number_format_i18n( count( $data['errors']['strict'] ) )
165
  ) )
@@ -169,6 +172,7 @@ class QM_Output_Html_PHP_Errors extends QM_Output_Html {
169
  $menu[] = $this->menu( array(
170
  'id' => 'query-monitor-deprecated',
171
  'title' => esc_html( sprintf(
 
172
  __( 'PHP Deprecated (%s)', 'query-monitor' ),
173
  number_format_i18n( count( $data['errors']['deprecated'] ) )
174
  ) )
44
  echo '<tbody>';
45
 
46
  $types = array(
47
+ 'warning' => _x( 'Warning', 'PHP error level', 'query-monitor' ),
48
+ 'notice' => _x( 'Notice', 'PHP error level', 'query-monitor' ),
49
+ 'strict' => _x( 'Strict', 'PHP error level', 'query-monitor' ),
50
+ 'deprecated' => _x( 'Deprecated', 'PHP error level', 'query-monitor' ),
51
  );
52
 
53
  foreach ( $types as $type => $title ) {
142
  $menu[] = $this->menu( array(
143
  'id' => 'query-monitor-warnings',
144
  'title' => esc_html( sprintf(
145
+ /* translators: %s: Number of PHP warnings */
146
  __( 'PHP Warnings (%s)', 'query-monitor' ),
147
  number_format_i18n( count( $data['errors']['warning'] ) )
148
  ) )
152
  $menu[] = $this->menu( array(
153
  'id' => 'query-monitor-notices',
154
  'title' => esc_html( sprintf(
155
+ /* translators: %s: Number of PHP notices */
156
  __( 'PHP Notices (%s)', 'query-monitor' ),
157
  number_format_i18n( count( $data['errors']['notice'] ) )
158
  ) )
162
  $menu[] = $this->menu( array(
163
  'id' => 'query-monitor-stricts',
164
  'title' => esc_html( sprintf(
165
+ /* translators: %s: Number of strict PHP errors */
166
  __( 'PHP Stricts (%s)', 'query-monitor' ),
167
  number_format_i18n( count( $data['errors']['strict'] ) )
168
  ) )
172
  $menu[] = $this->menu( array(
173
  'id' => 'query-monitor-deprecated',
174
  'title' => esc_html( sprintf(
175
+ /* translators: %s: Number of deprecated PHP errors */
176
  __( 'PHP Deprecated (%s)', 'query-monitor' ),
177
  number_format_i18n( count( $data['errors']['deprecated'] ) )
178
  ) )
output/html/request.php CHANGED
@@ -165,6 +165,7 @@ class QM_Output_Html_Request extends QM_Output_Html {
165
 
166
  $title = ( empty( $count ) )
167
  ? __( 'Request', 'query-monitor' )
 
168
  : __( 'Request (+%s)', 'query-monitor' );
169
 
170
  $menu[] = $this->menu( array(
165
 
166
  $title = ( empty( $count ) )
167
  ? __( 'Request', 'query-monitor' )
168
+ /* translators: %s: Number of additional query variables */
169
  : __( 'Request (+%s)', 'query-monitor' );
170
 
171
  $menu[] = $this->menu( array(
output/html/theme.php CHANGED
@@ -81,6 +81,27 @@ class QM_Output_Html_Theme extends QM_Output_Html {
81
  echo '</tr>';
82
  }
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
 
85
  echo '<tr>';
86
  if ( $data['is_child_theme'] ) {
@@ -132,6 +153,7 @@ class QM_Output_Html_Theme extends QM_Output_Html {
132
  if ( isset( $data['template_file'] ) ) {
133
  $menu[] = $this->menu( array(
134
  'title' => esc_html( sprintf(
 
135
  __( 'Template: %s', 'query-monitor' ),
136
  ( $data['is_child_theme'] ? $data['theme_template_file'] : $data['template_file'] )
137
  ) ),
81
  echo '</tr>';
82
  }
83
 
84
+ if ( ! empty( $data['timber_files'] ) ) {
85
+
86
+ $count = count( $data['timber_files'] );
87
+ echo '<tr>';
88
+ echo '<td rowspan="' . absint( $count ) . '">' . esc_html__( 'Timber Files', 'query-monitor' ) . '</td>';
89
+ $first = true;
90
+
91
+ foreach ( $data['timber_files'] as $filename ) {
92
+
93
+ if ( ! $first ) {
94
+ echo '<tr>';
95
+ }
96
+
97
+ echo '<td>' . esc_html( $filename ) . '</td>';
98
+ echo '</tr>';
99
+
100
+ $first = false;
101
+
102
+ }
103
+
104
+ }
105
 
106
  echo '<tr>';
107
  if ( $data['is_child_theme'] ) {
153
  if ( isset( $data['template_file'] ) ) {
154
  $menu[] = $this->menu( array(
155
  'title' => esc_html( sprintf(
156
+ /* translators: %s: Template file name */
157
  __( 'Template: %s', 'query-monitor' ),
158
  ( $data['is_child_theme'] ? $data['theme_template_file'] : $data['template_file'] )
159
  ) ),
output/html/transients.php CHANGED
@@ -124,6 +124,7 @@ class QM_Output_Html_Transients extends QM_Output_Html {
124
 
125
  $title = ( empty( $count ) )
126
  ? __( 'Transients Set', 'query-monitor' )
 
127
  : __( 'Transients Set (%s)', 'query-monitor' );
128
 
129
  $menu[] = $this->menu( array(
124
 
125
  $title = ( empty( $count ) )
126
  ? __( 'Transients Set', 'query-monitor' )
127
+ /* translators: %s: Number of transient values that were set */
128
  : __( 'Transients Set (%s)', 'query-monitor' );
129
 
130
  $menu[] = $this->menu( array(
query-monitor.php CHANGED
@@ -2,8 +2,8 @@
2
  /*
3
  Plugin Name: Query Monitor
4
  Description: Monitoring of database queries, hooks, conditionals and more.
5
- Version: 2.11.1
6
- Plugin URI: https://github.com/johnbillion/querymonitor
7
  Author: John Blackbourn
8
  Author URI: https://johnblackbourn.com/
9
  Text Domain: query-monitor
@@ -26,6 +26,15 @@ GNU General Public License for more details.
26
 
27
  defined( 'ABSPATH' ) or die();
28
 
 
 
 
 
 
 
 
 
 
29
  if ( defined( 'QM_DISABLED' ) and QM_DISABLED ) {
30
  return;
31
  }
@@ -41,151 +50,8 @@ if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
41
  return;
42
  }
43
 
44
- # No autoloaders for us. See https://github.com/johnbillion/QueryMonitor/issues/7
45
- $qm_dir = dirname( __FILE__ );
46
- foreach ( array( 'Backtrace', 'Collectors', 'Collector', 'Plugin', 'Util', 'Dispatchers', 'Dispatcher', 'Output' ) as $qm_class ) {
47
  require_once "{$qm_dir}/classes/{$qm_class}.php";
48
  }
49
 
50
- class QueryMonitor extends QM_Plugin {
51
-
52
- protected function __construct( $file ) {
53
-
54
- # Actions
55
- add_action( 'plugins_loaded', array( $this, 'action_plugins_loaded' ) );
56
- add_action( 'init', array( $this, 'action_init' ) );
57
-
58
- # Filters
59
- add_filter( 'pre_update_option_active_plugins', array( $this, 'filter_active_plugins' ) );
60
- add_filter( 'pre_update_site_option_active_sitewide_plugins', array( $this, 'filter_active_sitewide_plugins' ) );
61
-
62
- # [Dea|A]ctivation
63
- register_activation_hook( __FILE__, array( $this, 'activate' ) );
64
- register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) );
65
-
66
- # Parent setup:
67
- parent::__construct( $file );
68
-
69
- # Load and register built-in collectors:
70
- foreach ( glob( $this->plugin_path( 'collectors/*.php' ) ) as $file ) {
71
- include $file;
72
- }
73
-
74
- }
75
-
76
- public function action_plugins_loaded() {
77
-
78
- # Register additional collectors:
79
- foreach ( apply_filters( 'qm/collectors', array(), $this ) as $collector ) {
80
- QM_Collectors::add( $collector );
81
- }
82
-
83
- # Load dispatchers:
84
- foreach ( glob( $this->plugin_path( 'dispatchers/*.php' ) ) as $file ) {
85
- include $file;
86
- }
87
-
88
- # Register built-in and additional dispatchers:
89
- foreach ( apply_filters( 'qm/dispatchers', array(), $this ) as $dispatcher ) {
90
- QM_Dispatchers::add( $dispatcher );
91
- }
92
-
93
- }
94
-
95
- public function activate( $sitewide = false ) {
96
-
97
- if ( $admins = QM_Util::get_admins() ) {
98
- $admins->add_cap( 'view_query_monitor' );
99
- }
100
-
101
- if ( ! file_exists( $db = WP_CONTENT_DIR . '/db.php' ) and function_exists( 'symlink' ) ) {
102
- @symlink( $this->plugin_path( 'wp-content/db.php' ), $db );
103
- }
104
-
105
- if ( $sitewide ) {
106
- update_site_option( 'active_sitewide_plugins', get_site_option( 'active_sitewide_plugins' ) );
107
- } else {
108
- update_option( 'active_plugins', get_option( 'active_plugins' ) );
109
- }
110
-
111
- }
112
-
113
- public function deactivate() {
114
-
115
- if ( $admins = QM_Util::get_admins() ) {
116
- $admins->remove_cap( 'view_query_monitor' );
117
- }
118
-
119
- # Only delete db.php if it belongs to Query Monitor
120
- if ( class_exists( 'QM_DB' ) ) {
121
- unlink( WP_CONTENT_DIR . '/db.php' );
122
- }
123
-
124
- }
125
-
126
- public function action_init() {
127
-
128
- load_plugin_textdomain( 'query-monitor', false, dirname( $this->plugin_base() ) . '/languages' );
129
-
130
- }
131
-
132
- public function filter_active_plugins( $plugins ) {
133
-
134
- if ( empty( $plugins ) ) {
135
- return $plugins;
136
- }
137
-
138
- $f = preg_quote( basename( $this->plugin_base() ) );
139
-
140
- return array_merge(
141
- preg_grep( '/' . $f . '$/', $plugins ),
142
- preg_grep( '/' . $f . '$/', $plugins, PREG_GREP_INVERT )
143
- );
144
-
145
- }
146
-
147
- public function filter_active_sitewide_plugins( $plugins ) {
148
-
149
- if ( empty( $plugins ) ) {
150
- return $plugins;
151
- }
152
-
153
- $f = $this->plugin_base();
154
-
155
- if ( isset( $plugins[$f] ) ) {
156
-
157
- unset( $plugins[$f] );
158
-
159
- return array_merge( array(
160
- $f => time(),
161
- ), $plugins );
162
-
163
- } else {
164
- return $plugins;
165
- }
166
-
167
- }
168
-
169
- public static function symlink_warning() {
170
- $db = WP_CONTENT_DIR . '/db.php';
171
- trigger_error( sprintf(
172
- esc_html__( 'The symlink at %s is no longer pointing to the correct location. Please remove the symlink, then deactivate and reactivate Query Monitor.', 'query-monitor' ),
173
- '<code>' . esc_html( $db ) . '</code>'
174
- ), E_USER_WARNING );
175
- }
176
-
177
- public static function init( $file = null ) {
178
-
179
- static $instance = null;
180
-
181
- if ( ! $instance ) {
182
- $instance = new QueryMonitor( $file );
183
- }
184
-
185
- return $instance;
186
-
187
- }
188
-
189
- }
190
-
191
  QueryMonitor::init( __FILE__ );
2
  /*
3
  Plugin Name: Query Monitor
4
  Description: Monitoring of database queries, hooks, conditionals and more.
5
+ Version: 2.11.2
6
+ Plugin URI: https://github.com/johnbillion/query-monitor
7
  Author: John Blackbourn
8
  Author URI: https://johnblackbourn.com/
9
  Text Domain: query-monitor
26
 
27
  defined( 'ABSPATH' ) or die();
28
 
29
+ $qm_dir = dirname( __FILE__ );
30
+
31
+ # No autoloaders for us. See https://github.com/johnbillion/query-monitor/issues/7
32
+ foreach ( array( 'Plugin', 'Activation', 'Util' ) as $qm_class ) {
33
+ require_once "{$qm_dir}/classes/{$qm_class}.php";
34
+ }
35
+
36
+ QM_Activation::init( __FILE__ );
37
+
38
  if ( defined( 'QM_DISABLED' ) and QM_DISABLED ) {
39
  return;
40
  }
50
  return;
51
  }
52
 
53
+ foreach ( array( 'QueryMonitor', 'Backtrace', 'Collectors', 'Collector', 'Dispatchers', 'Dispatcher', 'Output', 'Timer' ) as $qm_class ) {
 
 
54
  require_once "{$qm_dir}/classes/{$qm_class}.php";
55
  }
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  QueryMonitor::init( __FILE__ );
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.5
6
- Stable tag: 2.11.1
7
  License: GPLv2 or later
8
 
9
  View debugging and performance information on database queries, hooks, conditionals, HTTP requests, redirects and more.
@@ -174,391 +174,4 @@ No, I do not accept donations. If you like the plugin, I'd love for you to [leav
174
 
175
  == Changelog ==
176
 
177
- = 2.11.1 =
178
-
179
- * Fix Undefined index: `cache_misses`.
180
- * Don't load QM during cron requests because we've no persistent storage yet and no means of outputting data that's collected.
181
- * Tweak some colours to bring them inline with the WordPress admin area colours.
182
- * Better handling for HTTP requests which don't include the `ssl` argument for any reason.
183
-
184
- = 2.11.0 =
185
-
186
- * Template parts used in the current request are now listed along with the template file.
187
- * Fix the REST API output for embedded requests and internal API calls.
188
- * Enable QM's output to appear in customiser preview responses.
189
- * Add support for the AMP plugin by Automattic, which short-circuits template output.
190
- * Highlight the fact when an HTTP request has disabled certificate verification.
191
- * Take into account custom content directory locations that are outside of ABSPATH when removing leading paths from file names.
192
- * Even more fallback support for when jQuery is broken or isn't available.
193
- * Introduce a collector for the object cache. Only outputs an overview at the moment.
194
- * Better formatting in the Duplicate Queries panel.
195
- * Introduce a fallback method of detecting errors in queries when `QM_DB` is not in use.
196
- * Improve the initial state of QM's output when the admin toolbar is not in use.
197
-
198
- = 2.10.0 =
199
-
200
- * Add a new panel which lists duplicated database queries.
201
- * Add support for displaying QM's output when viewing an embed.
202
- * Differentiate regular plugins from mu-plugins when displaying components.
203
- * Ensure early errors are always reported regardless of system level error reporting.
204
- * Ensure that script and style dependency highlighting is restricted to the scripts and styles tables, respectively.
205
- * Rearrange the Environment section output a little.
206
- * Various minor tweaks.
207
-
208
- = 2.9.1 =
209
-
210
- * Query callers and query components can now be clicked to filter the main query list by that caller or component.
211
- * Add support for pausing Jetpack's Infinite Scroll module when viewing QM output in the footer.
212
- * Add support for WordPress.com VIP Go shared plugins as an explicit component.
213
- * Send nocache headers when QM is active.
214
- * Various minor tweaks.
215
-
216
- = 2.9.0 =
217
-
218
- * Introduce a new panel which displays all matching rewrite rules for the current request.
219
- * Remove the deprecated `is_comments_popup()` from the list of conditionals.
220
- * Improve the display of scripts and styles which are blocked by Airplane Mode (0.1.4 and later).
221
- * Gracefully handle enqueued assets which are deregistered late without being unenqueued.
222
- * Add a filter to hide the extended query information prompt.
223
- * Various minor bugfixes and code quality tweaks.
224
-
225
- = 2.8.1 =
226
- * Correctly detect the file name and line number responsible for loading translation files in plugins which use `load_textdomain()`.
227
- * Correct the visibility of the `before_output()` method in the REST dispatcher.
228
- * Load the languages collector early so it catches plugins which load their translation files when they initialise.
229
- * Remove an erroneous double quote.
230
- * Remove connection as param in `mysqli_get_client_version()`.
231
- * Various CSS fixes.
232
-
233
- = 2.8.0 =
234
- * A new Languages component for debugging languages and text domains. Thanks, @MPolleke!
235
- * REST API debugging in the form of HTTP headers when performing an authenticated REST API request. Shows PHP errors when relevant, along with an overview of memory usage, processing time, database query number, and database query time.
236
- * Various visual improvements, including displaying the relevant file name below stack trace functions, and a more visible stack trace expansion toggle.
237
- * Add `is_embed()`, `is_comment_feed()`, and `is_user_admin()` to the list of conditional functions.
238
- * Add HHVM, SAPI, and MySQL client info to the Environment component.
239
- * QM is now not loaded at all on the CLI.
240
- * Avoid an issue with the CloudFlare Flexible SSL plugin.
241
- * Improve the output of Multisite's `$current_blog` and `$current_site` in the Request component.
242
- * Fully handle Windows paths when detecting a file component.
243
- * Don't display the symlink warning when using a secondary instance of WPDB.
244
- * Whole bunch of internal structure refactoring, escaping, and other misc tweaks.
245
-
246
- = 2.7.4 =
247
- * An unknown component now gets marked as such, not as Core.
248
- * Support for invokable objects in action and filter callbacks.
249
- * Fix fatal error when activating Debug Bar plugin after Query Monitor has already been activated.
250
- * Implement escaping inside `QM_Output_Html::format_url()` which can deal with unsafe output. Thanks to Stephen Harris for the responsible disclosure.
251
-
252
- = 2.7.3 =
253
- * Improvements to the shutdown handler for PHP errors, so it handles syntax and compilation errors too.
254
-
255
- = 2.7.2 =
256
- * Implement a shutdown handler for PHP errors to avoid fatals being unintentionally hidden when `display_errors` is on.
257
- * Don't attempt to do anything with scripts and styles if a corresponding header action hasn't fired.
258
- * Don't sort the enqueued scripts and styles, so they're output in the order in which they're enqueued.
259
- * For the time being, let's not load QM when using the CLI because we've no persistent storage and no means of outputting collected data on the CLI.
260
- * Call static methods using their class name, not a variable. Fixes compatibility with PHP 5.2.
261
-
262
- = 2.7.1 =
263
- * Display a warning (rather than triggering a fatal error) for scripts and style dependencies which have gone missing during the duration of the page load.
264
- * Tweak some more Debug Bar add-on styles.
265
- * Ensure erroneous non-SELECT queries are also highlighted in red.
266
- * Further tweaks to QM's output if JavaScript isn't available for any reason.
267
- * Add PHP4-style constructors to the Debug Bar classes to avoid fatals with Debug Bar add-ons which are explicitly using them.
268
- * In the event that QM's JavaScript doesn't get enqueued, force the QM output to display so users can at least debug the issue.
269
- * Remove the abstract `output()` methods from abstract classes which implement `QM_Output` to avoid PHP bug #43200.
270
- * Fixing a notice in the admin component when `get_current_screen()` isn't an object.
271
-
272
- = 2.7.0 =
273
- * Detect broken dependencies for scripts and styles.
274
- * Calculate and output the dependents of scripts and styles.
275
- * Add transparent support for Debug Bar add-on panels.
276
- * Add support for WordPress.com VIP plugins in the component detection.
277
- * Sortable and filterable columns for HTTP requests.
278
- * Display a warning when something's hooked onto the `all` action.
279
- * Clearer output for the template file and component names when a child theme is in use.
280
- * Move the current blog information to the Request component. Display current site information if we're running a multi-network.
281
- * Allow default error handlers, such as error logging, to continue to function as expected.
282
- * Don't skip outputting the calling function name in the database error list.
283
- * New namespaced filter names for a bunch of filterable things.
284
- * Add a `qm/process` filter to allow users to disable QM's processing and output.
285
- * Display the value of `WP_HTTP_BLOCK_EXTERNAL` and `WP_ACCESSIBLE_HOSTS` in the HTTP component.
286
- * New storage and registration mechanisms for collectors, dispatchers, and output handlers.
287
- * CSS tweaks to better match wp-admin styles.
288
-
289
- = 2.6.10 =
290
- * Add compatibility with PHP 5.3.6 and lower. `DirectoryIterator::getExtension()` isn't available on this version (and also as it's part of SPL it can be disabled).
291
- * Simplify the admin CSS to avoid QM's output being covered by the admin menu.
292
- * Add support for footer styles in the scripts and styles component.
293
- * Update the authentication JavaScript so it works cross-protocol.
294
-
295
- = 2.6.9 =
296
- * New Scripts & Styles component
297
- * Support for the new `is_customize_preview()` conditional
298
- * More robust handling of HTTP requests short-circuited with `pre_http_request`
299
- * Introduce a `query_monitor_silent_http_error_codes` filter to allow certain `WP_Error` codes to be silenced in HTTP requests
300
- * Split SQL queries on LEFT, OUTER, and RIGHT too
301
- * Gracefully avoid fatal errors if a site is moved and the db.php symlink is no longer pointing to the correct location
302
- * Pause Infinite Scroll when Query Monitor is viewed
303
- * Support the new admin menu behaviour in WP 4.1
304
- * Fix the positioning of output when using the Twenty Fifteen theme
305
- * Switch to an AJAX call for setting and clearing QM's authentication cookie
306
-
307
- = 2.6.8 =
308
- * RTL layout tweaks
309
- * Correct the component detection logic so it's more accurate
310
- * Re-implement output on the login screen which went missing
311
- * Display a few more proxy and debugging related constants
312
-
313
- = 2.6.7 =
314
- * Use an actual authentication cookie instead of a nonce in the Authentication component
315
- * Implement some extra methods of determining the current user/group
316
- * Move the loading of dispatchers to the `plugins_loaded` hook so plugins can add their own
317
- * Misc performance improvements
318
-
319
- = 2.6.6 =
320
- * More robust support for alternative database drivers (including `mysqli` in core)
321
- * Avoid warnings and notices when a custom database class is in place and it's not saving queries (ie. HyperDB)
322
- * Better handling when certain functions (such as `memory_get_peak_usage()`) are disabled
323
-
324
- = 2.6.5 =
325
- * Avoid the "Class 'QM_Backtrace' not found" error
326
- * Correct the layout of the Slow Queries and Query Errors panels
327
- * Move back-compat CSS into its own file
328
- * Huge simplification of code in `db.php` by using `parent::query()`
329
- * Misc visual tweaks
330
-
331
- = 2.6.4 =
332
- * Introduce sortable columns for database query times and numbers
333
- * Display the queried object in the Request panel
334
- * Fix the admin menu behaviour when viewing QM output
335
- * Fixes for output buffering and AJAX requests
336
- * Several bits of code cleanup
337
-
338
- = 2.6.3 =
339
- * Clickable stack traces and file names if you've configured Xdebug's `file_link_format` setting
340
- * Show the number of times each PHP error has been triggered
341
- * Visual bugfixes when using Firefox
342
- * Fix a bug which was preventing AJAX debugging from being output
343
- * Fix a fatal error when using PHP 5.2 on Windows
344
- * Display HTTP proxy information when appropriate
345
- * Introduce the `QM_DISABLE` constant for unconditionally disabling Query Monitor
346
- * Always return true from our PHP error handler to suppress unwanted PHP error output (eg. from Xdebug)
347
- * Internals: Much more robust logic and even more separation of data collection and output
348
- * Internals: Many performance improvements
349
-
350
- = 2.6.2 =
351
- * Fix two fundamental stability and compatibility issues (great news)
352
- * Various visual tweaks
353
- * Handle some uncommon use cases of the HTTP API
354
-
355
- = 2.6.1 =
356
- * Remove a file that was accidentally committed to the wordpress.org repo
357
-
358
- = 2.6 =
359
- * Toggleable stack traces for queries
360
- * Show deprecated errors in the PHP Errors panel
361
- * Replace the Query Vars panel with a Request panel with more information
362
- * Display a warning when `db.php` isn't in place
363
- * Fix some PHP 5.2 compatibility
364
- * Considerable restructuring of the underlying code to increase abstraction
365
-
366
- = 2.5.6 =
367
- * Fix the "Invalid header" issue. Woo!
368
-
369
- = 2.5.5 =
370
- * Better layout for the Hooks panel
371
- * Fix some AJAX issues
372
- * Fix some output buffer compatibility issues which were causing fatal errors
373
-
374
- = 2.5.4 =
375
- * Avoid a fatal error when strict errors are triggered at compile time
376
- * Avoid a warning when PDO or Mysqli is in use
377
- * Updated CSS for WordPress 3.8. Retains support for default 3.7 and MP6 on 3.7
378
- * Tweak PHP error_reporting in the Environment component
379
-
380
- = 2.5.3 =
381
- * Show an inline error when a hook has an invalid action
382
- * Show a warning in the admin toolbar when HTTP requests fail
383
- * Fix the time shown when filtering queries
384
- * Fix empty stack traces (regression at some point)
385
-
386
- = 2.5.2 =
387
- * Prevent uncaught exceptions with static method actions
388
- * Misc formatting tweaks
389
-
390
- = 2.5.1 =
391
- * Un-break query filtering
392
- * Performance improvements
393
-
394
- = 2.5 =
395
- * Display the component for HTTP requests, transients, PHP errors, and hook actions
396
- * Improved visual appearance and layout
397
- * Add an action component filter to the Hooks panel
398
- * Log errors returned in the `pre_http_request` filter
399
- * `QM_DB_LIMIT` is now a soft limit
400
- * Performance improvements
401
-
402
- = 2.4.2 =
403
- * Add a hook name filter to the Hooks panel
404
- * Update db.php to match latest wp-db.php
405
- * Avoid fatal error if the plugin is manually deleted
406
- * Add the new `is_main_network()` conditional
407
- * Lots more tweaks
408
-
409
- = 2.4.1 =
410
- * Un-break all the things
411
-
412
- = 2.4 =
413
- * New Redirect component
414
- * Add support for strict errors
415
- * Display the call stack for HTTP requests
416
- * Display the call stack for transients
417
- * Remove pre-3.0 back-compat code
418
- * Many other bugfixes and tweaks
419
-
420
- = 2.3.1 =
421
- * Compat with Xdebug
422
- * Display the call stack for PHP errors
423
-
424
- = 2.3 =
425
- * Introduce AJAX debugging (just PHP errors for now)
426
- * Visual refresh
427
- * Add theme and stylesheet into to the Theme panel
428
-
429
- = 2.2.8 =
430
- * Add error reporting to the Environment panel
431
-
432
- = 2.2.7 =
433
- * Don't output QM in the theme customizer
434
-
435
- = 2.2.6 =
436
- * Add the database query time to the admin toolbar
437
- * Various trace and JavaScript errors
438
-
439
- = 2.2.5 =
440
- * Load QM before other plugins
441
- * Show QM output on the log in screen
442
-
443
- = 2.2.4 =
444
- * Add filtering to the query panel
445
-
446
- = 2.2.3 =
447
- * Show component information indicating whether a plugin, theme or core was responsible for each database query
448
- * New Query Component panel showing components ordered by total query time
449
-
450
- = 2.2.2 =
451
- * Show memory usage as a percentage of the memory limit
452
- * Show page generation time as percentage of the limit, if it's high
453
- * Show a few bits of server information in the Environment panel
454
- * Log PHP settings as early as possible and highlight when the values have been altered at runtime
455
-
456
- = 2.2.1 =
457
- * A few formatting and layout tweaks
458
-
459
- = 2.2 =
460
- * Breakdown queries by type in the Overview and Query Functions panels
461
- * Show the HTTP transport order of preference in the HTTP panel
462
- * Highlight database errors and slow database queries in their own panels
463
- * Add a few PHP enviroment variables to the Environment panel (more to come)
464
-
465
- = 2.1.8 =
466
- * Change i18n text domain
467
- * Hide Authentication panel for non-JS
468
- * Show database info in Overview panel
469
-
470
- = 2.1.7 =
471
- * Full WordPress 3.4 compatibility
472
-
473
- = 2.1.6 =
474
- * Small tweaks to conditionals and HTTP components
475
- * Allow filtering of ignore_class, ignore_func and show_arg on QM and QM DB
476
-
477
- = 2.1.5 =
478
- * Tweak a few conditional outputs
479
- * Full support for all WPDB instances
480
- * Tweak query var output
481
- * Initial code for data logging before redirects (incomplete)
482
-
483
- = 2.1.4 =
484
- * Add full support for multiple DB instances to the Environment component
485
- * Improve PHP error function stack
486
-
487
- = 2.1.3 =
488
- * Fix display of wp_admin_bar instantiated queries
489
- * Fix function trace for HTTP calls and transients
490
-
491
- = 2.1.2 =
492
- * Lots more behind the scenes improvements
493
- * Better future-proof CSS
494
- * Complete separation of data/presentation in db_queries
495
- * Complete support for multiple database connections
496
-
497
- = 2.1.1 =
498
- * Lots of behind the scenes improvements
499
- * More separation of data from presentation
500
- * Fewer cross-component dependencies
501
- * Nicer way of doing menu items, classes & title
502
-
503
- = 2.1 =
504
- * Let's split everything up into components. Lots of optimisations to come.
505
-
506
- = 2.0.3 =
507
- * Localisation improvements
508
-
509
- = 2.0.2 =
510
- * Admin bar tweaks for WordPress 3.3
511
- * Add some missing l10n
512
- * Prevent some PHP notices
513
-
514
- = 2.0.1 =
515
- * Just a few rearrangements
516
-
517
- = 2.0 =
518
- * Show warnings next to MySQL variables with sub-optimal values
519
-
520
- = 1.9.3 =
521
- * Fix list of non-default query vars
522
- * Fix list of admin screen column names in 3.3
523
- * Lots of other misc tweaks
524
- * Add RTL support
525
-
526
- = 1.9.2 =
527
- * Lots of interface improvements
528
- * Show counts for transients, HTTP requests and custom query vars in the admin menu
529
- * Add backtrace to PHP error output
530
- * Hide repeated identical PHP errors
531
- * Filter out calls to _deprecated_*() and trigger_error() in backtraces
532
- * Show do_action_ref_array() and apply_filters_ref_array() parameter in backtraces
533
- * Remove the 'component' code
534
- * Remove the object cache output
535
- * Add a 'qm_template' filter so themes that do crazy things can report the correct template file
536
-
537
- = 1.9.1 =
538
- * Display all custom column filter names on admin screens that contain columns
539
-
540
- = 1.9 =
541
- * Display more accurate $current_screen values
542
- * Display a warning message about bug with $typenow and $current_screen values
543
- * Improve PHP error backtrace
544
-
545
- = 1.8 =
546
- * Introduce a 'view_query_monitor' capability for finer grained permissions control
547
-
548
- = 1.7.11 =
549
- * List body classes with the template output
550
- * Display calling function in PHP warnings and notices
551
- * Fix admin bar CSS when displaying notices
552
- * Remove pointless non-existant filter code
553
-
554
- = 1.7.10.1 =
555
- * Fix a formatting error in the transient table
556
-
557
- = 1.7.10 =
558
- * Tweaks to counts, HTTP output and transient output
559
- * Upgrade routine which adds a symlink to db.php in wp-content/db.php
560
-
561
- = 1.7.9 =
562
- * PHP warning and notice handling
563
- * Add some new template conditionals
564
- * Tweaks to counts, HTTP output and transient output
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.11.2
7
  License: GPLv2 or later
8
 
9
  View debugging and performance information on database queries, hooks, conditionals, HTTP requests, redirects and more.
174
 
175
  == Changelog ==
176
 
177
+ See [changelog.md](https://github.com/johnbillion/query-monitor/blob/master/changelog.md) for Query Monitor's changelog.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wp-content/db.php CHANGED
@@ -40,7 +40,7 @@ if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
40
  return;
41
  }
42
 
43
- # No autoloaders for us. See https://github.com/johnbillion/QueryMonitor/issues/7
44
  $qm_dir = dirname( dirname( __FILE__ ) );
45
  if ( ! is_readable( $backtrace = "{$qm_dir}/classes/Backtrace.php" ) ) {
46
  return;
@@ -85,6 +85,10 @@ class QM_DB extends wpdb {
85
  */
86
  function query( $query ) {
87
  if ( ! $this->ready ) {
 
 
 
 
88
  return false;
89
  }
90
 
40
  return;
41
  }
42
 
43
+ # No autoloaders for us. See https://github.com/johnbillion/query-monitor/issues/7
44
  $qm_dir = dirname( dirname( __FILE__ ) );
45
  if ( ! is_readable( $backtrace = "{$qm_dir}/classes/Backtrace.php" ) ) {
46
  return;
85
  */
86
  function query( $query ) {
87
  if ( ! $this->ready ) {
88
+ if ( isset( $this->check_current_query ) ) {
89
+ // This property was introduced in WP 4.2
90
+ $this->check_current_query = true;
91
+ }
92
  return false;
93
  }
94