Query Monitor - Version 2.13.0

Version Description

Download this release

Release Info

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

Code changes from version 2.12.0 to 2.13.0

assets/query-monitor.css CHANGED
@@ -26,7 +26,7 @@ GNU General Public License for more details.
26
  background-color: #f60;
27
  }
28
 
29
- #wp-admin-bar-query-monitor-deprecated,
30
  #wp-admin-bar-query-monitor-stricts {
31
  background-color: #555 !important;
32
  }
@@ -78,7 +78,7 @@ GNU General Public License for more details.
78
  }
79
 
80
  body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover):not(.hover) .ab-label,
81
- #wp-admin-bar-query-monitor-deprecated a,
82
  #wp-admin-bar-query-monitor-stricts a,
83
  #wp-admin-bar-query-monitor-notices a,
84
  #wp-admin-bar-query-monitor-expensive a,
@@ -89,6 +89,7 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
89
 
90
  #wp-admin-bar-query-monitor small {
91
  font-size: 11px !important;
 
92
  }
93
 
94
  #wp-admin-bar-query-monitor.hover a small,
@@ -286,7 +287,8 @@ body.wp-admin.folded #qm {
286
  }
287
 
288
  .qm td,
289
- .qm th {
 
290
  background: #fff !important;
291
  box-sizing: border-box !important;
292
  text-align: left !important;
@@ -303,11 +305,9 @@ body.wp-admin.folded #qm {
303
  -webkit-font-smoothing: auto !important;
304
  }
305
 
306
- .qm .qm-totally-legit-spacer td {
307
- background-color: #f1f1f1 !important;
308
- border-right-color: #f1f1f1 !important;
309
- border-left-color: #f1f1f1 !important;
310
- height: 20px !important;
311
  }
312
 
313
  .qm tbody tr:hover th,
@@ -369,20 +369,16 @@ body.wp-admin.folded #qm {
369
  padding: 0 !important;
370
  }
371
 
372
- .qm ol {
373
- margin: 0 !important;
374
- padding: 0 0 0 30px !important;
375
- list-style: decimal !important;
376
- }
377
-
378
  .qm ul {
379
  margin: 0 !important;
380
- padding: 0 0 0 10px !important;
381
  list-style: none !important;
382
  }
383
 
384
  .qm li {
385
- margin-bottom: 2px !important;
 
386
  }
387
 
388
  .qm pre {
@@ -603,6 +599,17 @@ select.qm-filter {
603
  content: "\25bc" !important;
604
  }
605
 
 
 
 
 
 
 
 
 
 
 
 
606
  /* RTL */
607
 
608
  html[dir="rtl"] .qm-ltr {
26
  background-color: #f60;
27
  }
28
 
29
+ #wp-admin-bar-query-monitor-deprecateds,
30
  #wp-admin-bar-query-monitor-stricts {
31
  background-color: #555 !important;
32
  }
78
  }
79
 
80
  body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover):not(.hover) .ab-label,
81
+ #wp-admin-bar-query-monitor-deprecateds a,
82
  #wp-admin-bar-query-monitor-stricts a,
83
  #wp-admin-bar-query-monitor-notices a,
84
  #wp-admin-bar-query-monitor-expensive a,
89
 
90
  #wp-admin-bar-query-monitor small {
91
  font-size: 11px !important;
92
+ text-transform: uppercase !important;
93
  }
94
 
95
  #wp-admin-bar-query-monitor.hover a small,
287
  }
288
 
289
  .qm td,
290
+ .qm th,
291
+ .qm caption {
292
  background: #fff !important;
293
  box-sizing: border-box !important;
294
  text-align: left !important;
305
  -webkit-font-smoothing: auto !important;
306
  }
307
 
308
+ .qm caption,
309
+ .qm th[scope=col] {
310
+ border-bottom-width: 0 !important;
 
 
311
  }
312
 
313
  .qm tbody tr:hover th,
369
  padding: 0 !important;
370
  }
371
 
372
+ .qm ol,
 
 
 
 
 
373
  .qm ul {
374
  margin: 0 !important;
375
+ padding: 0 !important;
376
  list-style: none !important;
377
  }
378
 
379
  .qm li {
380
+ margin: 0 !important;
381
+ padding: 0 !important;
382
  }
383
 
384
  .qm pre {
599
  content: "\25bc" !important;
600
  }
601
 
602
+ .qm .screen-reader-text {
603
+ position: absolute !important;
604
+ margin: -1px !important;
605
+ padding: 0 !important;
606
+ height: 1px !important;
607
+ width: 1px !important;
608
+ overflow: hidden !important;
609
+ clip: rect(0 0 0 0) !important;
610
+ border: 0 !important;
611
+ }
612
+
613
  /* RTL */
614
 
615
  html[dir="rtl"] .qm-ltr {
classes/Backtrace.php CHANGED
@@ -23,6 +23,7 @@ class QM_Backtrace {
23
  'ExtQuery' => true,
24
  'W3_Db' => true,
25
  'Debug_Bar_PHP' => true,
 
26
  );
27
  protected static $ignore_method = array();
28
  protected static $ignore_func = array(
23
  'ExtQuery' => true,
24
  'W3_Db' => true,
25
  'Debug_Bar_PHP' => true,
26
+ 'WP_Hook' => true,
27
  );
28
  protected static $ignore_method = array();
29
  protected static $ignore_func = array(
classes/Collector.php CHANGED
@@ -44,7 +44,7 @@ abstract class QM_Collector {
44
 
45
  $sql = str_replace( array( "\r\n", "\r", "\n" ), ' ', $sql );
46
  $sql = str_replace( array( "\t", '`' ), '', $sql );
47
- $sql = preg_replace( '/[ ]+/', ' ', $sql );
48
  $sql = trim( $sql );
49
 
50
  $this->data['dupes'][ $sql ][] = $i;
@@ -105,6 +105,17 @@ abstract class QM_Collector {
105
  }
106
  }
107
 
 
 
 
 
 
 
 
 
 
 
 
108
  public function process() {}
109
 
110
  public function tear_down() {}
44
 
45
  $sql = str_replace( array( "\r\n", "\r", "\n" ), ' ', $sql );
46
  $sql = str_replace( array( "\t", '`' ), '', $sql );
47
+ $sql = preg_replace( '/ +/', ' ', $sql );
48
  $sql = trim( $sql );
49
 
50
  $this->data['dupes'][ $sql ][] = $i;
105
  }
106
  }
107
 
108
+ public static function format_user( WP_User $user_object ) {
109
+ $user = get_object_vars( $user_object->data );
110
+ unset(
111
+ $user['user_pass'],
112
+ $user['user_activation_key']
113
+ );
114
+ $user['roles'] = $user_object->roles;
115
+
116
+ return $user;
117
+ }
118
+
119
  public function process() {}
120
 
121
  public function tear_down() {}
collectors/admin.php CHANGED
@@ -26,14 +26,73 @@ class QM_Collector_Admin extends QM_Collector {
26
 
27
  global $pagenow;
28
 
29
- if ( isset( $_GET['page'] ) && get_current_screen() !== null ) {
30
- $this->data['base'] = get_current_screen()->base;
 
 
31
  } else {
32
  $this->data['base'] = $pagenow;
33
  }
34
 
35
  $this->data['pagenow'] = $pagenow;
36
- $this->data['current_screen'] = get_current_screen();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
  }
39
 
26
 
27
  global $pagenow;
28
 
29
+ $current_screen = get_current_screen();
30
+
31
+ if ( isset( $_GET['page'] ) && $current_screen !== null ) {
32
+ $this->data['base'] = $current_screen->base;
33
  } else {
34
  $this->data['base'] = $pagenow;
35
  }
36
 
37
  $this->data['pagenow'] = $pagenow;
38
+ $this->data['current_screen'] = ( $current_screen ) ? get_object_vars( $current_screen ) : null;
39
+
40
+ $screens = array(
41
+ 'edit' => true,
42
+ 'edit-comments' => true,
43
+ 'edit-tags' => true,
44
+ 'link-manager' => true,
45
+ 'plugins' => true,
46
+ 'plugins-network' => true,
47
+ 'sites-network' => true,
48
+ 'themes-network' => true,
49
+ 'upload' => true,
50
+ 'users' => true,
51
+ 'users-network' => true,
52
+ );
53
+
54
+ if ( ! empty( $this->data['current_screen'] ) and isset( $screens[ $this->data['current_screen']['base'] ] ) ) {
55
+
56
+ $list_table = array();
57
+
58
+ # And now, WordPress' legendary inconsistency comes into play:
59
+
60
+ if ( !empty( $this->data['current_screen']['taxonomy'] ) ) {
61
+ $list_table['column'] = $this->data['current_screen']['taxonomy'];
62
+ } else if ( !empty( $this->data['current_screen']['post_type'] ) ) {
63
+ $list_table['column'] = $this->data['current_screen']['post_type'] . '_posts';
64
+ } else {
65
+ $list_table['column'] = $this->data['current_screen']['base'];
66
+ }
67
+
68
+ if ( !empty( $this->data['current_screen']['post_type'] ) and empty( $this->data['current_screen']['taxonomy'] ) ) {
69
+ $list_table['columns'] = $this->data['current_screen']['post_type'] . '_posts';
70
+ } else {
71
+ $list_table['columns'] = $this->data['current_screen']['id'];
72
+ }
73
+
74
+ if ( 'edit-comments' === $list_table['column'] ) {
75
+ $list_table['column'] = 'comments';
76
+ } else if ( 'upload' === $list_table['column'] ) {
77
+ $list_table['column'] = 'media';
78
+ } else if ( 'link-manager' === $list_table['column'] ) {
79
+ $list_table['column'] = 'link';
80
+ }
81
+
82
+ $list_table['sortables'] = $this->data['current_screen']['id'];
83
+
84
+ $this->data['list_table'] = array(
85
+ 'columns_filter' => "manage_{$list_table['columns']}_columns",
86
+ 'sortables_filter' => "manage_{$list_table['sortables']}_sortable_columns",
87
+ 'column_action' => "manage_{$list_table['column']}_custom_column",
88
+ );
89
+ $this->data['list_table_markup'] = array(
90
+ 'columns_filter' => 'manage_<span class="qm-current">' . esc_html( $list_table['columns'] ) . '</span>_columns',
91
+ 'sortables_filter' => 'manage_<span class="qm-current">' . esc_html( $list_table['sortables'] ) . '</span>_sortable_columns',
92
+ 'column_action' => 'manage_<span class="qm-current">' . esc_html( $list_table['column'] ) . '</span>_custom_column',
93
+ );
94
+
95
+ }
96
 
97
  }
98
 
collectors/overview.php CHANGED
@@ -24,11 +24,12 @@ class QM_Collector_Overview extends QM_Collector {
24
 
25
  public function process() {
26
 
27
- $this->data['time'] = self::timer_stop_float();
28
  $this->data['time_limit'] = ini_get( 'max_execution_time' );
 
29
 
30
  if ( !empty( $this->data['time_limit'] ) ) {
31
- $this->data['time_usage'] = ( 100 / $this->data['time_limit'] ) * $this->data['time'];
32
  } else {
33
  $this->data['time_usage'] = 0;
34
  }
@@ -41,6 +42,18 @@ class QM_Collector_Overview extends QM_Collector {
41
  $this->data['memory'] = 0;
42
  }
43
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  $this->data['memory_limit'] = QM_Util::convert_hr_to_bytes( ini_get( 'memory_limit' ) );
45
  $this->data['memory_usage'] = ( 100 / $this->data['memory_limit'] ) * $this->data['memory'];
46
 
24
 
25
  public function process() {
26
 
27
+ $this->data['time_taken'] = self::timer_stop_float();
28
  $this->data['time_limit'] = ini_get( 'max_execution_time' );
29
+ $this->data['time_start'] = $GLOBALS['timestart'];
30
 
31
  if ( !empty( $this->data['time_limit'] ) ) {
32
+ $this->data['time_usage'] = ( 100 / $this->data['time_limit'] ) * $this->data['time_taken'];
33
  } else {
34
  $this->data['time_usage'] = 0;
35
  }
42
  $this->data['memory'] = 0;
43
  }
44
 
45
+ if ( is_user_logged_in() ) {
46
+ $this->data['current_user'] = self::format_user( wp_get_current_user() );
47
+ } else {
48
+ $this->data['current_user'] = false;
49
+ }
50
+
51
+ if ( function_exists( 'current_user_switched' ) && current_user_switched() ) {
52
+ $this->data['switched_user'] = self::format_user( current_user_switched() );
53
+ } else {
54
+ $this->data['switched_user'] = false;
55
+ }
56
+
57
  $this->data['memory_limit'] = QM_Util::convert_hr_to_bytes( ini_get( 'memory_limit' ) );
58
  $this->data['memory_usage'] = ( 100 / $this->data['memory_limit'] ) * $this->data['memory'];
59
 
collectors/php_errors.php CHANGED
@@ -30,6 +30,7 @@ if ( defined( 'E_USER_DEPRECATED' ) ) {
30
  class QM_Collector_PHP_Errors extends QM_Collector {
31
 
32
  public $id = 'php_errors';
 
33
  private $display_errors = null;
34
  private static $unexpected_error;
35
  private static $wordpress_couldnt;
@@ -44,6 +45,7 @@ class QM_Collector_PHP_Errors extends QM_Collector {
44
  set_error_handler( array( $this, 'error_handler' ) );
45
  register_shutdown_function( array( $this, 'shutdown_handler' ) );
46
 
 
47
  $this->display_errors = ini_get( 'display_errors' );
48
  ini_set( 'display_errors', 0 );
49
 
@@ -82,6 +84,11 @@ class QM_Collector_PHP_Errors extends QM_Collector {
82
  return false;
83
  }
84
 
 
 
 
 
 
85
  if ( ! isset( self::$unexpected_error ) ) {
86
  // These strings are from core. They're passed through `__()` as variables so they get translated at runtime
87
  // but do not get seen by GlotPress when it populates its database of translatable strings for QM.
30
  class QM_Collector_PHP_Errors extends QM_Collector {
31
 
32
  public $id = 'php_errors';
33
+ private $error_reporting = null;
34
  private $display_errors = null;
35
  private static $unexpected_error;
36
  private static $wordpress_couldnt;
45
  set_error_handler( array( $this, 'error_handler' ) );
46
  register_shutdown_function( array( $this, 'shutdown_handler' ) );
47
 
48
+ $this->error_reporting = error_reporting();
49
  $this->display_errors = ini_get( 'display_errors' );
50
  ini_set( 'display_errors', 0 );
51
 
84
  return false;
85
  }
86
 
87
+ if ( error_reporting() === 0 && $this->error_reporting !== 0 ) {
88
+ // This is most likely an @-suppressed error
89
+ $type .= '-suppressed';
90
+ }
91
+
92
  if ( ! isset( self::$unexpected_error ) ) {
93
  // These strings are from core. They're passed through `__()` as variables so they get translated at runtime
94
  // but do not get seen by GlotPress when it populates its database of translatable strings for QM.
collectors/request.php CHANGED
@@ -103,7 +103,7 @@ class QM_Collector_Request extends QM_Collector {
103
  case is_a( $qo, 'WP_Post' ):
104
  // Single post
105
  /* translators: 1: Post type name, 2: Post ID */
106
- $this->data['queried_object']['title'] = sprintf( __( 'Single %s: #%d', 'query-monitor' ),
107
  get_post_type_object( $qo->post_type )->labels->singular_name,
108
  $qo->ID
109
  );
103
  case is_a( $qo, 'WP_Post' ):
104
  // Single post
105
  /* translators: 1: Post type name, 2: Post ID */
106
+ $this->data['queried_object']['title'] = sprintf( __( 'Single %1$s: #%2$d', 'query-monitor' ),
107
  get_post_type_object( $qo->post_type )->labels->singular_name,
108
  $qo->ID
109
  );
collectors/theme.php CHANGED
@@ -27,6 +27,55 @@ class QM_Collector_Theme extends QM_Collector {
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 ) {
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
+ add_action( 'template_redirect', array( $this, 'action_template_redirect' ) );
31
+ }
32
+
33
+ public static function get_query_template_names() {
34
+ return array(
35
+ 'embed' => 'is_embed',
36
+ '404' => 'is_404',
37
+ 'search' => 'is_search',
38
+ 'front_page' => 'is_front_page',
39
+ 'home' => 'is_home',
40
+ 'post_type_archive' => 'is_post_type_archive',
41
+ 'taxonomy' => 'is_tax',
42
+ 'attachment' => 'is_attachment',
43
+ 'single' => 'is_single',
44
+ 'page' => 'is_page',
45
+ 'singular' => 'is_singular',
46
+ 'category' => 'is_category',
47
+ 'tag' => 'is_tag',
48
+ 'author' => 'is_author',
49
+ 'date' => 'is_date',
50
+ 'archive' => 'is_archive',
51
+ 'paged' => 'is_paged',
52
+ 'index' => '__return_true',
53
+ );
54
+ }
55
+
56
+ // https://core.trac.wordpress.org/ticket/14310
57
+ public function action_template_redirect() {
58
+
59
+ foreach ( self::get_query_template_names() as $template => $conditional ) {
60
+
61
+ if ( call_user_func( $conditional ) ) {
62
+ add_filter( "{$template}_template_hierarchy", array( $this, 'filter_template_hierarchy' ), 999 );
63
+ call_user_func( "get_{$template}_template" );
64
+ remove_filter( "{$template}_template_hierarchy", array( $this, 'filter_template_hierarchy' ), 999 );
65
+ }
66
+
67
+ }
68
+
69
+ }
70
+
71
+ public function filter_template_hierarchy( array $templates ) {
72
+ if ( ! isset( $this->data['template_hierarchy'] ) ) {
73
+ $this->data['template_hierarchy'] = array();
74
+ }
75
+
76
+ $this->data['template_hierarchy'] = array_merge( $this->data['template_hierarchy'], $templates );
77
+
78
+ return $templates;
79
  }
80
 
81
  public function filter_body_class( array $class ) {
output/headers/overview.php CHANGED
@@ -21,7 +21,7 @@ class QM_Output_Headers_Overview extends QM_Output_Headers {
21
  $data = $this->collector->get_data();
22
  $headers = array();
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' ),
21
  $data = $this->collector->get_data();
22
  $headers = array();
23
 
24
+ $headers['time_taken'] = number_format_i18n( $data['time_taken'], 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' ),
output/html/admin.php CHANGED
@@ -31,88 +31,50 @@ class QM_Output_Html_Admin extends QM_Output_Html {
31
 
32
  echo '<div class="qm qm-half" id="' . esc_attr( $this->collector->id() ) . '">';
33
  echo '<table cellspacing="0">';
34
- echo '<thead>';
 
35
  echo '<tr>';
36
- echo '<th colspan="2">' . esc_html( $this->collector->name() ) . '</th>';
 
 
37
  echo '</tr>';
38
  echo '</thead>';
39
  echo '<tbody>';
40
 
41
- echo '<tr>';
42
- echo '<td class="qm-ltr">get_current_screen()</td>';
43
- echo '<td class="qm-has-inner">';
44
 
45
- echo '<table class="qm-inner" cellspacing="0">';
46
- echo '<tbody>';
47
  foreach ( $data['current_screen'] as $key => $value ) {
48
  echo '<tr>';
 
 
 
 
 
49
  echo '<th>' . esc_html( $key ) . '</th>';
50
  echo '<td>' . esc_html( $value ) . '</td>';
51
  echo '</tr>';
52
- }
53
- echo '</tbody>';
54
- echo '</table>';
55
 
56
- echo '</td>';
57
- echo '</tr>';
58
 
59
  echo '<tr>';
60
- echo '<td class="qm-ltr">$pagenow</td>';
61
- echo '<td>' . esc_html( $data['pagenow'] ) . '</td>';
62
  echo '</tr>';
63
 
64
- $screens = array(
65
- 'edit' => true,
66
- 'edit-comments' => true,
67
- 'edit-tags' => true,
68
- 'link-manager' => true,
69
- 'plugins' => true,
70
- 'plugins-network' => true,
71
- 'sites-network' => true,
72
- 'themes-network' => true,
73
- 'upload' => true,
74
- 'users' => true,
75
- 'users-network' => true,
76
- );
77
-
78
- // @TODO a lot of this logic can move to the collector
79
- if ( !empty( $data['current_screen'] ) and isset( $screens[$data['current_screen']->base] ) ) {
80
-
81
- # And now, WordPress' legendary inconsistency comes into play:
82
-
83
- if ( !empty( $data['current_screen']->taxonomy ) ) {
84
- $col = $data['current_screen']->taxonomy;
85
- } else if ( !empty( $data['current_screen']->post_type ) ) {
86
- $col = $data['current_screen']->post_type . '_posts';
87
- } else {
88
- $col = $data['current_screen']->base;
89
- }
90
-
91
- if ( !empty( $data['current_screen']->post_type ) and empty( $data['current_screen']->taxonomy ) ) {
92
- $cols = $data['current_screen']->post_type . '_posts';
93
- } else {
94
- $cols = $data['current_screen']->id;
95
- }
96
-
97
- if ( 'edit-comments' === $col ) {
98
- $col = 'comments';
99
- } else if ( 'upload' === $col ) {
100
- $col = 'media';
101
- } else if ( 'link-manager' === $col ) {
102
- $col = 'link';
103
- }
104
 
105
  echo '<tr>';
106
- echo '<td rowspan="2">' . esc_html__( 'Column Filters', 'query-monitor' ) . '</td>';
107
- echo '<td colspan="2">manage_<span class="qm-current">' . esc_html( $cols ) . '</span>_columns</td>';
108
  echo '</tr>';
109
  echo '<tr>';
110
- echo '<td colspan="2">manage_<span class="qm-current">' . esc_html( $data['current_screen']->id ) . '</span>_sortable_columns</td>';
111
  echo '</tr>';
112
 
113
  echo '<tr>';
114
- echo '<td rowspan="1">' . esc_html__( 'Column Action', 'query-monitor' ) . '</td>';
115
- echo '<td colspan="2">manage_<span class="qm-current">' . esc_html( $col ) . '</span>_custom_column</td>';
116
  echo '</tr>';
117
 
118
  }
31
 
32
  echo '<div class="qm qm-half" id="' . esc_attr( $this->collector->id() ) . '">';
33
  echo '<table cellspacing="0">';
34
+ echo '<caption>' . esc_html( $this->collector->name() ) . '</caption>';
35
+ echo '<thead class="screen-reader-text">';
36
  echo '<tr>';
37
+ echo '<th>' . esc_html__( 'Data', 'query-monitor' ) . '</th>';
38
+ echo '<th>' . esc_html__( 'Property', 'query-monitor' ) . '</th>';
39
+ echo '<th>' . esc_html__( 'Value', 'query-monitor' ) . '</th>';
40
  echo '</tr>';
41
  echo '</thead>';
42
  echo '<tbody>';
43
 
44
+ $first = true;
 
 
45
 
 
 
46
  foreach ( $data['current_screen'] as $key => $value ) {
47
  echo '<tr>';
48
+
49
+ if ( $first ) {
50
+ echo '<th class="qm-ltr" rowspan="' . count( $data['current_screen'] ) . '">get_current_screen()</th>';
51
+ }
52
+
53
  echo '<th>' . esc_html( $key ) . '</th>';
54
  echo '<td>' . esc_html( $value ) . '</td>';
55
  echo '</tr>';
 
 
 
56
 
57
+ $first = false;
58
+ }
59
 
60
  echo '<tr>';
61
+ echo '<th class="qm-ltr">$pagenow</th>';
62
+ echo '<td colspan="2">' . esc_html( $data['pagenow'] ) . '</td>';
63
  echo '</tr>';
64
 
65
+ if ( ! empty( $data['list_table'] ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
 
67
  echo '<tr>';
68
+ echo '<th rowspan="2">' . esc_html__( 'Column Filters', 'query-monitor' ) . '</th>';
69
+ echo '<td colspan="2">' . $data['list_table_markup']['columns_filter'] . '</td>'; // WPCS: XSS ok;
70
  echo '</tr>';
71
  echo '<tr>';
72
+ echo '<td colspan="2">' . $data['list_table_markup']['sortables_filter'] . '</td>'; // WPCS: XSS ok;
73
  echo '</tr>';
74
 
75
  echo '<tr>';
76
+ echo '<th>' . esc_html__( 'Column Action', 'query-monitor' ) . '</th>';
77
+ echo '<td colspan="2">' . $data['list_table_markup']['column_action'] . '</td>'; // WPCS: XSS ok;
78
  echo '</tr>';
79
 
80
  }
output/html/assets.php CHANGED
@@ -30,42 +30,38 @@ class QM_Output_Html_Assets extends QM_Output_Html {
30
  return;
31
  }
32
 
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' ),
54
- ) as $type => $type_label ) {
55
 
 
 
 
56
  echo '<thead>';
57
-
58
- if ( 'scripts' !== $type ) {
59
- echo '<tr class="qm-totally-legit-spacer">';
60
- echo '<td colspan="6"></td>';
61
- echo '</tr>';
62
- }
63
-
64
  echo '<tr>';
65
- echo '<th colspan="2">' . esc_html( $type_label ) . '</th>';
66
- echo '<th>' . esc_html__( 'Dependencies', 'query-monitor' ) . '</th>';
67
- echo '<th>' . esc_html__( 'Dependents', 'query-monitor' ) . '</th>';
68
- echo '<th>' . esc_html__( 'Version', 'query-monitor' ) . '</th>';
 
69
  echo '</tr>';
70
  echo '</thead>';
71
  echo '<tbody>';
@@ -78,16 +74,17 @@ class QM_Output_Html_Assets extends QM_Output_Html {
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
  }
85
 
86
  echo '</tbody>';
 
 
87
 
88
  }
89
 
90
- echo '</table>';
91
  echo '</div>';
92
 
93
  }
@@ -114,7 +111,7 @@ class QM_Output_Html_Assets extends QM_Output_Html {
114
 
115
  if ( $first ) {
116
  $rowspan = count( $handles );
117
- echo '<th rowspan="' . esc_attr( $rowspan ) . '" class="qm-nowrap">' . esc_html( $label ) . '</th>';
118
  }
119
 
120
  $this->dependency_row( $dependencies->query( $handle ), $dependencies, $type );
@@ -172,7 +169,7 @@ class QM_Output_Html_Assets extends QM_Output_Html {
172
  $highlight_deps = array_map( array( $this, '_prefix_type' ), $deps );
173
  $highlight_dependents = array_map( array( $this, '_prefix_type' ), $dependents );
174
 
175
- echo '<td class="qm-wrap">' . esc_html( $dependency->handle ) . '<br><span class="qm-info">&nbsp;';
176
  if ( is_wp_error( $source ) ) {
177
  printf( '<span class="qm-warn">%s</span>',
178
  esc_html( $src )
@@ -181,8 +178,8 @@ class QM_Output_Html_Assets extends QM_Output_Html {
181
  echo esc_html( $src );
182
  }
183
  echo '</span></td>';
184
- echo '<td class="qm-nowrap qm-highlighter" data-qm-highlight="' . esc_attr( implode( ' ', $highlight_deps ) ) . '">' . implode( '<br>', array_map( 'esc_html', $deps ) ) . '</td>';
185
- echo '<td class="qm-nowrap qm-highlighter" data-qm-highlight="' . esc_attr( implode( ' ', $highlight_dependents ) ) . '">' . implode( '<br>', array_map( 'esc_html', $dependents ) ) . '</td>';
186
  echo '<td>' . esc_html( $ver ) . '</td>';
187
 
188
  }
@@ -226,15 +223,24 @@ class QM_Output_Html_Assets extends QM_Output_Html {
226
  public function admin_menu( array $menu ) {
227
 
228
  $data = $this->collector->get_data();
229
- $args = array(
230
- 'title' => esc_html( $this->collector->name() ),
 
231
  );
232
 
233
- if ( !empty( $data['broken'] ) or !empty( $data['missing'] ) ) {
234
- $args['meta']['classname'] = 'qm-error';
235
- }
 
 
 
236
 
237
- $menu[] = $this->menu( $args );
 
 
 
 
 
238
 
239
  return $menu;
240
 
30
  return;
31
  }
32
 
33
+ echo '<div id="' . esc_attr( $this->collector->id() ) . '">';
 
34
 
35
  $position_labels = array(
36
+ 'missing' => __( 'Missing', 'query-monitor' ),
37
+ 'broken' => __( 'Broken Dependencies', 'query-monitor' ),
38
+ 'header' => __( 'Header', 'query-monitor' ),
39
+ 'footer' => __( 'Footer', 'query-monitor' ),
40
+ );
41
+
42
+ $type_labels = array(
43
  'scripts' => array(
44
+ 'singular' => __( 'Script', 'query-monitor' ),
45
+ 'plural' => __( 'Scripts', 'query-monitor' ),
 
 
46
  ),
47
  'styles' => array(
48
+ 'singular' => __( 'Style', 'query-monitor' ),
49
+ 'plural' => __( 'Styles', 'query-monitor' ),
 
 
50
  ),
51
  );
52
 
53
+ foreach ( $type_labels as $type => $type_label ) {
 
 
 
54
 
55
+ echo '<div class="qm" id="' . esc_attr( $this->collector->id() ) . '-' . esc_attr( $type ) . '">';
56
+ echo '<table cellspacing="0">';
57
+ echo '<caption>' . esc_html( $type_label['plural'] ) . '</caption>';
58
  echo '<thead>';
 
 
 
 
 
 
 
59
  echo '<tr>';
60
+ echo '<th scope="col">' . esc_html__( 'Position', 'query-monitor' ) . '</th>';
61
+ echo '<th scope="col">' . esc_html( $type_label['singular'] ) . '</th>';
62
+ echo '<th scope="col">' . esc_html__( 'Dependencies', 'query-monitor' ) . '</th>';
63
+ echo '<th scope="col">' . esc_html__( 'Dependents', 'query-monitor' ) . '</th>';
64
+ echo '<th scope="col">' . esc_html__( 'Version', 'query-monitor' ) . '</th>';
65
  echo '</tr>';
66
  echo '</thead>';
67
  echo '<tbody>';
74
  ) as $position ) {
75
 
76
  if ( isset( $data[ $position ][ $type ] ) ) {
77
+ $this->dependency_rows( $data[ $position ][ $type ], $data['raw'][ $type ], $position_labels[ $position ], $type );
78
  }
79
 
80
  }
81
 
82
  echo '</tbody>';
83
+ echo '</table>';
84
+ echo '</div>';
85
 
86
  }
87
 
 
88
  echo '</div>';
89
 
90
  }
111
 
112
  if ( $first ) {
113
  $rowspan = count( $handles );
114
+ echo '<th scope="row" rowspan="' . esc_attr( $rowspan ) . '" class="qm-nowrap">' . esc_html( $label ) . '</th>';
115
  }
116
 
117
  $this->dependency_row( $dependencies->query( $handle ), $dependencies, $type );
169
  $highlight_deps = array_map( array( $this, '_prefix_type' ), $deps );
170
  $highlight_dependents = array_map( array( $this, '_prefix_type' ), $dependents );
171
 
172
+ echo '<th scope="row" class="qm-wrap">' . esc_html( $dependency->handle ) . '<br><span class="qm-info">&nbsp;';
173
  if ( is_wp_error( $source ) ) {
174
  printf( '<span class="qm-warn">%s</span>',
175
  esc_html( $src )
178
  echo esc_html( $src );
179
  }
180
  echo '</span></td>';
181
+ echo '<td class="qm-nowrap qm-highlighter" data-qm-highlight="' . esc_attr( implode( ' ', $highlight_deps ) ) . '"><ul><li>' . implode( '</li><li>', array_map( 'esc_html', $deps ) ) . '</li></ul></td>';
182
+ echo '<td class="qm-nowrap qm-highlighter" data-qm-highlight="' . esc_attr( implode( ' ', $highlight_dependents ) ) . '"><ul><li>' . implode( '</li><li>', array_map( 'esc_html', $dependents ) ) . '</li></ul></td>';
183
  echo '<td>' . esc_html( $ver ) . '</td>';
184
 
185
  }
223
  public function admin_menu( array $menu ) {
224
 
225
  $data = $this->collector->get_data();
226
+ $labels = array(
227
+ 'scripts' => __( 'Scripts', 'query-monitor' ),
228
+ 'styles' => __( 'Styles', 'query-monitor' ),
229
  );
230
 
231
+ foreach ( $labels as $type => $label ) {
232
+ $args = array(
233
+ 'title' => esc_html( $label ),
234
+ 'id' => esc_attr( "query-monitor-{$this->collector->id}-{$type}" ),
235
+ 'href' => esc_attr( '#' . $this->collector->id() . '-' . $type )
236
+ );
237
 
238
+ if ( ! empty( $data['broken'][ $type ] ) or ! empty( $data['missing'][ $type ] ) ) {
239
+ $args['meta']['classname'] = 'qm-error';
240
+ }
241
+
242
+ $menu[] = $this->menu( $args );
243
+ }
244
 
245
  return $menu;
246
 
output/html/conditionals.php CHANGED
@@ -30,11 +30,7 @@ class QM_Output_Html_Conditionals extends QM_Output_Html {
30
 
31
  echo '<div class="qm" id="' . esc_attr( $this->collector->id() ) . '">';
32
  echo '<table cellspacing="0">';
33
- echo '<thead>';
34
- echo '<tr>';
35
- echo '<th colspan="' . absint( $cols ) . '">' . esc_html( $this->collector->name() ) . '</th>';
36
- echo '</tr>';
37
- echo '</thead>';
38
  echo '<tbody>';
39
 
40
  foreach ( $data['conds']['true'] as $cond ) {
30
 
31
  echo '<div class="qm" id="' . esc_attr( $this->collector->id() ) . '">';
32
  echo '<table cellspacing="0">';
33
+ echo '<caption>' . esc_html( $this->collector->name() ) . '</caption>';
 
 
 
 
34
  echo '<tbody>';
35
 
36
  foreach ( $data['conds']['true'] as $cond ) {
output/html/db_callers.php CHANGED
@@ -34,21 +34,19 @@ class QM_Output_Html_DB_Callers extends QM_Output_Html {
34
 
35
  echo '<div class="qm qm-half" id="' . esc_attr( $this->collector->id() ) . '">';
36
  echo '<table cellspacing="0" class="qm-sortable">';
 
37
  echo '<thead>';
38
  echo '<tr>';
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">';
46
  echo esc_html( $type_name );
47
  echo $this->build_sorter(); // WPCS: XSS ok;
48
  echo '</th>';
49
  }
50
 
51
- echo '<th class="qm-num qm-sorted-desc">';
52
  esc_html_e( 'Time', 'query-monitor' );
53
  echo $this->build_sorter(); // WPCS: XSS ok;
54
  echo '</th>';
@@ -64,7 +62,7 @@ class QM_Output_Html_DB_Callers extends QM_Output_Html {
64
  $stime = number_format_i18n( $row['ltime'], 4 );
65
 
66
  echo '<tr>';
67
- echo '<td class="qm-ltr"><a href="#" class="qm-filter-trigger" data-qm-target="db_queries-wpdb" data-qm-filter="caller" data-qm-value="' . esc_attr( $row['caller'] ) . '">' . esc_html( $row['caller'] ) . '</a></td>';
68
 
69
  foreach ( $data['types'] as $type_name => $type_count ) {
70
  if ( isset( $row['types'][$type_name] ) ) {
34
 
35
  echo '<div class="qm qm-half" id="' . esc_attr( $this->collector->id() ) . '">';
36
  echo '<table cellspacing="0" class="qm-sortable">';
37
+ echo '<caption>' . esc_html( $this->collector->name() ) . '</caption>';
38
  echo '<thead>';
39
  echo '<tr>';
40
+ echo '<th scope="col">' . esc_html__( 'Caller', 'query-monitor' ) . '</th>';
 
 
 
41
 
42
  foreach ( $data['types'] as $type_name => $type_count ) {
43
+ echo '<th scope="col" class="qm-num">';
44
  echo esc_html( $type_name );
45
  echo $this->build_sorter(); // WPCS: XSS ok;
46
  echo '</th>';
47
  }
48
 
49
+ echo '<th scope="col" class="qm-num qm-sorted-desc">';
50
  esc_html_e( 'Time', 'query-monitor' );
51
  echo $this->build_sorter(); // WPCS: XSS ok;
52
  echo '</th>';
62
  $stime = number_format_i18n( $row['ltime'], 4 );
63
 
64
  echo '<tr>';
65
+ echo '<th scope="row" class="qm-ltr"><a href="#" class="qm-filter-trigger" data-qm-target="db_queries-wpdb" data-qm-filter="caller" data-qm-value="' . esc_attr( $row['caller'] ) . '">' . esc_html( $row['caller'] ) . '</a></th>';
66
 
67
  foreach ( $data['types'] as $type_name => $type_count ) {
68
  if ( isset( $row['types'][$type_name] ) ) {
output/html/db_components.php CHANGED
@@ -35,23 +35,21 @@ class QM_Output_Html_DB_Components extends QM_Output_Html {
35
 
36
  echo '<div class="qm qm-half" id="' . esc_attr( $this->collector->id() ) . '">';
37
  echo '<table cellspacing="0" class="qm-sortable">';
 
38
  echo '<thead>';
39
- echo '<tr>';
40
- echo '<th colspan="' . esc_attr( $span ) . '">' . esc_html( $this->collector->name() ) . '</th>';
41
- echo '</tr>';
42
 
43
  if ( !empty( $data['times'] ) ) {
44
  echo '<tr>';
45
- echo '<th>' . esc_html__( 'Component', 'query-monitor' ) . '</th>';
46
 
47
  foreach ( $data['types'] as $type_name => $type_count ) {
48
- echo '<th class="qm-num">';
49
  echo esc_html( $type_name );
50
  echo $this->build_sorter(); // WPCS: XSS ok;
51
  echo '</th>';
52
  }
53
 
54
- echo '<th class="qm-num qm-sorted-desc">';
55
  esc_html_e( 'Time', 'query-monitor' );
56
  echo $this->build_sorter(); // WPCS: XSS ok;
57
  echo '</th>';
@@ -69,7 +67,7 @@ class QM_Output_Html_DB_Components extends QM_Output_Html {
69
  $total_calls += $row['calls'];
70
 
71
  echo '<tr>';
72
- echo '<td><a href="#" class="qm-filter-trigger" data-qm-target="db_queries-wpdb" data-qm-filter="component" data-qm-value="' . esc_attr( $row['component'] ) . '">' . esc_html( $row['component'] ) . '</a></td>';
73
 
74
  foreach ( $data['types'] as $type_name => $type_count ) {
75
  if ( isset( $row['types'][$type_name] ) ) {
35
 
36
  echo '<div class="qm qm-half" id="' . esc_attr( $this->collector->id() ) . '">';
37
  echo '<table cellspacing="0" class="qm-sortable">';
38
+ echo '<caption>' . esc_html( $this->collector->name() ) . '</caption>';
39
  echo '<thead>';
 
 
 
40
 
41
  if ( !empty( $data['times'] ) ) {
42
  echo '<tr>';
43
+ echo '<th scope="col">' . esc_html__( 'Component', 'query-monitor' ) . '</th>';
44
 
45
  foreach ( $data['types'] as $type_name => $type_count ) {
46
+ echo '<th scope="col" class="qm-num">';
47
  echo esc_html( $type_name );
48
  echo $this->build_sorter(); // WPCS: XSS ok;
49
  echo '</th>';
50
  }
51
 
52
+ echo '<th scope="col" class="qm-num qm-sorted-desc">';
53
  esc_html_e( 'Time', 'query-monitor' );
54
  echo $this->build_sorter(); // WPCS: XSS ok;
55
  echo '</th>';
67
  $total_calls += $row['calls'];
68
 
69
  echo '<tr>';
70
+ echo '<th scope="row"><a href="#" class="qm-filter-trigger" data-qm-target="db_queries-wpdb" data-qm-filter="component" data-qm-value="' . esc_attr( $row['component'] ) . '">' . esc_html( $row['component'] ) . '</a></th>';
71
 
72
  foreach ( $data['types'] as $type_name => $type_count ) {
73
  if ( isset( $row['types'][$type_name] ) ) {
output/html/db_dupes.php CHANGED
@@ -33,19 +33,17 @@ class QM_Output_Html_DB_Dupes extends QM_Output_Html {
33
 
34
  echo '<div class="qm" id="' . esc_attr( $this->collector->id() ) . '">';
35
  echo '<table cellspacing="0">';
 
36
  echo '<thead>';
37
- echo '<tr>';
38
- echo '<th colspan="' . absint( $colspan ) . '">' . esc_html( $this->collector->name() ) . '</th>';
39
- echo '</tr>';
40
 
41
  echo '<tr>';
42
- echo '<th>' . esc_html__( 'Query', 'query-monitor' ) . '</th>';
43
- echo '<th class="qm-num">' . esc_html__( 'Count', 'query-monitor' ) . '</th>';
44
- echo '<th>' . esc_html__( 'Callers', 'query-monitor' ) . '</th>';
45
  if ( ! empty( $data['dupe_components'] ) ) {
46
  echo '<th>' . esc_html__( 'Components', 'query-monitor' ) . '</th>';
47
  }
48
- echo '<th>' . esc_html__( 'Potential Troublemakers', 'query-monitor' ) . '</th>';
49
  echo '</tr>';
50
 
51
  echo '</thead>';
33
 
34
  echo '<div class="qm" id="' . esc_attr( $this->collector->id() ) . '">';
35
  echo '<table cellspacing="0">';
36
+ echo '<caption>' . esc_html( $this->collector->name() ) . '</caption>';
37
  echo '<thead>';
 
 
 
38
 
39
  echo '<tr>';
40
+ echo '<th scope="col">' . esc_html__( 'Query', 'query-monitor' ) . '</th>';
41
+ echo '<th scope="col" class="qm-num">' . esc_html__( 'Count', 'query-monitor' ) . '</th>';
42
+ echo '<th scope="col">' . esc_html__( 'Callers', 'query-monitor' ) . '</th>';
43
  if ( ! empty( $data['dupe_components'] ) ) {
44
  echo '<th>' . esc_html__( 'Components', 'query-monitor' ) . '</th>';
45
  }
46
+ echo '<th scope="col">' . esc_html__( 'Potential Troublemakers', 'query-monitor' ) . '</th>';
47
  echo '</tr>';
48
 
49
  echo '</thead>';
output/html/db_queries.php CHANGED
@@ -52,16 +52,12 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
52
 
53
  echo '<div class="qm qm-queries" id="' . esc_attr( $this->collector->id() ) . '-wpdb">';
54
  echo '<table cellspacing="0">';
55
- echo '<thead>';
56
- echo '<tr>';
57
- echo '<th>' . esc_html__( 'Database Queries', 'query-monitor' ) . '</th>';
58
- echo '</tr>';
59
- echo '</thead>';
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>'
67
  );
@@ -77,15 +73,13 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
77
 
78
  echo '<div class="qm qm-queries" id="qm-query-errors">';
79
  echo '<table cellspacing="0">';
 
80
  echo '<thead>';
81
  echo '<tr>';
82
- echo '<th colspan="4">' . esc_html__( 'Database Errors', 'query-monitor' ) . '</th>';
83
- echo '</tr>';
84
- echo '<tr>';
85
- echo '<th>' . esc_html__( 'Query', 'query-monitor' ) . '</th>';
86
- echo '<th>' . esc_html__( 'Call Stack', 'query-monitor' ) . '</th>';
87
- echo '<th>' . esc_html__( 'Component', 'query-monitor' ) . '</th>';
88
- echo '<th>' . esc_html__( 'Error', 'query-monitor' ) . '</th>';
89
  echo '</tr>';
90
  echo '</thead>';
91
  echo '<tbody>';
@@ -106,15 +100,13 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
106
 
107
  echo '<div class="qm qm-queries" id="qm-query-expensive">';
108
  echo '<table cellspacing="0">';
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
  );
116
- echo '</th>';
117
- echo '</tr>';
118
  echo '<tr>';
119
  echo '<th scope="col">' . esc_html__( 'Query', 'query-monitor' ) . '</th>';
120
  echo '<th scope="col">' . esc_html__( 'Caller', 'query-monitor' ) . '</th>';
@@ -127,7 +119,7 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
127
  echo '<th scope="col" class="qm-num">' . esc_html__( 'Rows', 'query-monitor' ) . '</th>';
128
  }
129
 
130
- echo '<th class="qm-num">' . esc_html__( 'Time', 'query-monitor' ) . '</th>';
131
  echo '</tr>';
132
  echo '</thead>';
133
  echo '<tbody>';
@@ -155,11 +147,9 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
155
 
156
  echo '<div class="qm qm-queries" id="' . esc_attr( $this->collector->id() . '-' . sanitize_title_with_dashes( $name ) ) . '">';
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
 
164
  if ( !empty( $db->rows ) ) {
165
 
@@ -362,22 +352,23 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
362
  }
363
 
364
  if ( isset( $cols['caller'] ) ) {
365
- echo "<td class='qm-row-caller qm-ltr qm-has-toggle qm-nowrap'><div class='qm-toggler'>";
366
 
367
- echo $caller_name; // WPCS: XSS ok.
368
 
369
  if ( ! empty( $stack ) ) {
370
  echo '<button class="qm-toggle" data-on="+" data-off="-">+</button>';
371
- echo '<div class="qm-toggled">' . implode( '<br>', $stack ) . '</div>'; // WPCS: XSS ok.
372
  }
373
 
374
- echo '</div></td>';
375
  }
376
 
377
  if ( isset( $cols['stack'] ) ) {
378
- echo '<td class="qm-row-caller qm-row-stack qm-nowrap qm-ltr">';
379
- echo $caller_name; // WPCS: XSS ok.
380
- echo '<br>' . implode( '<br>', $stack ) . '</td>'; // WPCS: XSS ok.
 
381
  }
382
 
383
  if ( isset( $cols['component'] ) ) {
@@ -413,17 +404,22 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
413
  foreach ( $data['dbs'] as $key => $db ) {
414
  $title[] = sprintf(
415
  /* translators: %s: Database query time in seconds */
416
- '%s' . _x( '%s<small>S</small>', 'Query time', 'query-monitor' ),
417
  ( count( $data['dbs'] ) > 1 ? '&bull;&nbsp;&nbsp;&nbsp;' : '' ),
418
  number_format_i18n( $db->total_time, 4 )
419
  );
420
  $title[] = sprintf(
421
  /* translators: %s: Number of database queries */
422
- _x( '%s<small>Q</small>', 'Query count', 'query-monitor' ),
423
  number_format_i18n( $db->total_qs )
424
  );
425
  }
426
  }
 
 
 
 
 
427
  return $title;
428
  }
429
 
52
 
53
  echo '<div class="qm qm-queries" id="' . esc_attr( $this->collector->id() ) . '-wpdb">';
54
  echo '<table cellspacing="0">';
55
+ echo '<caption>' . esc_html( $this->collector->name() ) . '</caption>';
 
 
 
 
56
  echo '<tbody>';
57
  echo '<tr>';
58
  echo '<td class="qm-warn">';
59
  /* translators: 1: Name of PHP constant, 2: Value of PHP constant */
60
+ printf( esc_html__( 'No database queries were logged because the %1$s constant is set to %2$s', 'query-monitor' ),
61
  '<code>SAVEQUERIES</code>',
62
  '<code>false</code>'
63
  );
73
 
74
  echo '<div class="qm qm-queries" id="qm-query-errors">';
75
  echo '<table cellspacing="0">';
76
+ echo '<caption>' . esc_html__( 'Database Errors', 'query-monitor' ) . '</caption>';
77
  echo '<thead>';
78
  echo '<tr>';
79
+ echo '<th scope="col">' . esc_html__( 'Query', 'query-monitor' ) . '</th>';
80
+ echo '<th scope="col">' . esc_html__( 'Call Stack', 'query-monitor' ) . '</th>';
81
+ echo '<th scope="col">' . esc_html__( 'Component', 'query-monitor' ) . '</th>';
82
+ echo '<th scope="col">' . esc_html__( 'Error', 'query-monitor' ) . '</th>';
 
 
 
83
  echo '</tr>';
84
  echo '</thead>';
85
  echo '<tbody>';
100
 
101
  echo '<div class="qm qm-queries" id="qm-query-expensive">';
102
  echo '<table cellspacing="0">';
103
+ echo '<caption>';
 
 
104
  /* translators: %s: Database query time in seconds */
105
  printf( esc_html__( 'Slow Database Queries (above %ss)', 'query-monitor' ),
106
  '<span class="qm-expensive">' . esc_html( number_format_i18n( QM_DB_EXPENSIVE, $dp ) ) . '</span>'
107
  );
108
+ echo '</caption>';
109
+ echo '<thead>';
110
  echo '<tr>';
111
  echo '<th scope="col">' . esc_html__( 'Query', 'query-monitor' ) . '</th>';
112
  echo '<th scope="col">' . esc_html__( 'Caller', 'query-monitor' ) . '</th>';
119
  echo '<th scope="col" class="qm-num">' . esc_html__( 'Rows', 'query-monitor' ) . '</th>';
120
  }
121
 
122
+ echo '<th scope="col" class="qm-num">' . esc_html__( 'Time', 'query-monitor' ) . '</th>';
123
  echo '</tr>';
124
  echo '</thead>';
125
  echo '<tbody>';
147
 
148
  echo '<div class="qm qm-queries" id="' . esc_attr( $this->collector->id() . '-' . sanitize_title_with_dashes( $name ) ) . '">';
149
  echo '<table cellspacing="0" class="qm-sortable">';
 
 
150
  /* translators: %s: Name of database controller */
151
+ echo '<caption>' . esc_html( sprintf( __( '%s Queries', 'query-monitor' ), $name ) ) . '</caption>';
152
+ echo '<thead>';
153
 
154
  if ( !empty( $db->rows ) ) {
155
 
352
  }
353
 
354
  if ( isset( $cols['caller'] ) ) {
355
+ echo "<td class='qm-row-caller qm-ltr qm-has-toggle qm-nowrap'><ol class='qm-toggler'>";
356
 
357
+ echo "<li>{$caller_name}</li>"; // WPCS: XSS ok.
358
 
359
  if ( ! empty( $stack ) ) {
360
  echo '<button class="qm-toggle" data-on="+" data-off="-">+</button>';
361
+ echo '<div class="qm-toggled"><li>' . implode( '</li><li>', $stack ) . '</li></div>'; // WPCS: XSS ok.
362
  }
363
 
364
+ echo '</ol></td>';
365
  }
366
 
367
  if ( isset( $cols['stack'] ) ) {
368
+ echo '<td class="qm-row-caller qm-row-stack qm-nowrap qm-ltr"><ol>';
369
+ echo "<li>{$caller_name}</li>"; // WPCS: XSS ok.
370
+ echo '<li>' . implode( '</li><li>', $stack ) . '</li>'; // WPCS: XSS ok.
371
+ echo '</ol></td>';
372
  }
373
 
374
  if ( isset( $cols['component'] ) ) {
404
  foreach ( $data['dbs'] as $key => $db ) {
405
  $title[] = sprintf(
406
  /* translators: %s: Database query time in seconds */
407
+ '%s' . esc_html_x( '%s S', 'Query time', 'query-monitor' ),
408
  ( count( $data['dbs'] ) > 1 ? '&bull;&nbsp;&nbsp;&nbsp;' : '' ),
409
  number_format_i18n( $db->total_time, 4 )
410
  );
411
  $title[] = sprintf(
412
  /* translators: %s: Number of database queries */
413
+ esc_html_x( '%s Q', 'Query count', 'query-monitor' ),
414
  number_format_i18n( $db->total_qs )
415
  );
416
  }
417
  }
418
+
419
+ foreach ( $title as &$t ) {
420
+ $t = preg_replace( '#\s?([^0-9,\.]+)#', '<small>$1</small>', $t );
421
+ }
422
+
423
  return $title;
424
  }
425
 
output/html/debug_bar.php CHANGED
@@ -27,11 +27,7 @@ class QM_Output_Html_Debug_Bar extends QM_Output_Html {
27
 
28
  echo '<div class="qm qm-debug-bar" id="' . esc_attr( $this->collector->id() ) . '">';
29
  echo '<table cellspacing="0">';
30
- echo '<thead>';
31
- echo '<tr>';
32
- echo '<th>' . esc_html( $this->collector->name() ) . '</th>';
33
- echo '</tr>';
34
- echo '</thead>';
35
  echo '<tbody>';
36
 
37
  echo '<tr>';
27
 
28
  echo '<div class="qm qm-debug-bar" id="' . esc_attr( $this->collector->id() ) . '">';
29
  echo '<table cellspacing="0">';
30
+ echo '<caption>' . esc_html( $this->collector->name() ) . '</caption>';
 
 
 
 
31
  echo '<tbody>';
32
 
33
  echo '<tr>';
output/html/environment.php CHANGED
@@ -29,32 +29,34 @@ class QM_Output_Html_Environment extends QM_Output_Html {
29
 
30
  echo '<div class="qm qm-third">';
31
  echo '<table cellspacing="0">';
32
- echo '<thead>';
 
33
  echo '<tr>';
34
- echo '<th colspan="2">PHP</th>';
 
35
  echo '</tr>';
36
  echo '</thead>';
37
  echo '<tbody>';
38
 
39
  echo '<tr>';
40
- echo '<td>version</td>';
41
  echo '<td>' . esc_html( $data['php']['version'] ) . '</td>';
42
  echo '</tr>';
43
 
44
  echo '<tr>';
45
- echo '<td>sapi</td>';
46
  echo '<td>' . esc_html( $data['php']['sapi'] ) . '</td>';
47
  echo '</tr>';
48
 
49
  if ( isset( $data['php']['hhvm'] ) ) {
50
  echo '<tr>';
51
- echo '<td>hhvm</td>';
52
  echo '<td>' . esc_html( $data['php']['hhvm'] ) . '</td>';
53
  echo '</tr>';
54
  }
55
 
56
  echo '<tr>';
57
- echo '<td>user</td>';
58
  if ( !empty( $data['php']['user'] ) ) {
59
  echo '<td>' . esc_html( $data['php']['user'] ) . '</td>';
60
  } else {
@@ -65,7 +67,7 @@ class QM_Output_Html_Environment extends QM_Output_Html {
65
  foreach ( $data['php']['variables'] as $key => $val ) {
66
 
67
  echo '<tr>';
68
- echo '<td>' . esc_html( $key ) . '</td>';
69
  echo '<td class="qm-wrap">';
70
  echo esc_html( $val['after'] );
71
 
@@ -84,13 +86,13 @@ class QM_Output_Html_Environment extends QM_Output_Html {
84
  echo '</tr>';
85
  }
86
 
87
- $error_levels = implode( '<br>&nbsp;', array_map( 'esc_html', $this->collector->get_error_levels( $data['php']['error_reporting'] ) ) );
88
 
89
  echo '<tr>';
90
- echo '<td>error_reporting</td>';
91
- echo '<td class="qm-wrap">' . esc_html( $data['php']['error_reporting'] ) . '<br><span class="qm-info">&nbsp;';
92
- echo $error_levels; // WPCS: XSS ok.
93
- echo '</span></td>';
94
  echo '</tr>';
95
 
96
  echo '</tbody>';
@@ -110,9 +112,11 @@ class QM_Output_Html_Environment extends QM_Output_Html {
110
 
111
  echo '<div class="qm qm-third">';
112
  echo '<table cellspacing="0">';
113
- echo '<thead>';
 
114
  echo '<tr>';
115
- echo '<th colspan="2">' . esc_html( $name ) . '</th>';
 
116
  echo '</tr>';
117
  echo '</thead>';
118
  echo '<tbody>';
@@ -120,7 +124,7 @@ class QM_Output_Html_Environment extends QM_Output_Html {
120
  foreach ( $db['info'] as $key => $value ) {
121
 
122
  echo '<tr>';
123
- echo '<td>' . esc_html( $key ) . '</td>';
124
 
125
  if ( ! isset( $value ) ) {
126
  echo '<td><span class="qm-warn">' . esc_html__( 'Unknown', 'query-monitor' ) . '</span></td>';
@@ -147,7 +151,7 @@ class QM_Output_Html_Environment extends QM_Output_Html {
147
 
148
  if ( ( true === $db['vars'][$key] ) and empty( $val ) ) {
149
  $show_warning = true;
150
- } else if ( is_string( $db['vars'][$key] ) and ( $val !== $db['vars'][$key] ) ) {
151
  $show_warning = true;
152
  }
153
 
@@ -172,7 +176,7 @@ class QM_Output_Html_Environment extends QM_Output_Html {
172
  echo '<tr class="' . esc_attr( $class ) . '"">';
173
  }
174
 
175
- echo '<td>' . esc_html( $key ) . '</td>';
176
  echo '<td class="qm-wrap">';
177
  echo esc_html( $val );
178
  echo $append; // WPCS: XSS ok.
@@ -194,9 +198,11 @@ class QM_Output_Html_Environment extends QM_Output_Html {
194
 
195
  echo '<div class="qm qm-third" style="float:right !important">';
196
  echo '<table cellspacing="0">';
197
- echo '<thead>';
 
198
  echo '<tr>';
199
- echo '<th colspan="2">WordPress</th>';
 
200
  echo '</tr>';
201
  echo '</thead>';
202
  echo '<tbody>';
@@ -204,7 +210,7 @@ class QM_Output_Html_Environment extends QM_Output_Html {
204
  foreach ( $data['wp'] as $key => $val ) {
205
 
206
  echo '<tr>';
207
- echo '<td>' . esc_html( $key ) . '</td>';
208
  echo '<td class="qm-wrap">' . esc_html( $val ) . '</td>';
209
  echo '</tr>';
210
 
@@ -216,20 +222,22 @@ class QM_Output_Html_Environment extends QM_Output_Html {
216
 
217
  echo '<div class="qm qm-third">';
218
  echo '<table cellspacing="0">';
219
- echo '<thead>';
 
220
  echo '<tr>';
221
- echo '<th colspan="2">' . esc_html__( 'Server', 'query-monitor' ) . '</th>';
 
222
  echo '</tr>';
223
  echo '</thead>';
224
  echo '<tbody>';
225
 
226
  echo '<tr>';
227
- echo '<td>' . esc_html__( 'software', 'query-monitor' ) . '</td>';
228
  echo '<td class="qm-wrap">' . esc_html( $data['server']['name'] ) . '</td>';
229
  echo '</tr>';
230
 
231
  echo '<tr>';
232
- echo '<td>' . esc_html__( 'version', 'query-monitor' ) . '</td>';
233
  if ( !empty( $data['server']['version'] ) ) {
234
  echo '<td class="qm-wrap">' . esc_html( $data['server']['version'] ) . '</td>';
235
  } else {
@@ -238,7 +246,7 @@ class QM_Output_Html_Environment extends QM_Output_Html {
238
  echo '</tr>';
239
 
240
  echo '<tr>';
241
- echo '<td>' . esc_html__( 'address', 'query-monitor' ) . '</td>';
242
  if ( !empty( $data['server']['address'] ) ) {
243
  echo '<td class="qm-wrap">' . esc_html( $data['server']['address'] ) . '</td>';
244
  } else {
@@ -247,7 +255,7 @@ class QM_Output_Html_Environment extends QM_Output_Html {
247
  echo '</tr>';
248
 
249
  echo '<tr>';
250
- echo '<td>' . esc_html__( 'host', 'query-monitor' ) . '</td>';
251
  echo '<td class="qm-wrap">' . esc_html( $data['server']['host'] ) . '</td>';
252
  echo '</tr>';
253
 
29
 
30
  echo '<div class="qm qm-third">';
31
  echo '<table cellspacing="0">';
32
+ echo '<caption>PHP</caption>';
33
+ echo '<thead class="screen-reader-text">';
34
  echo '<tr>';
35
+ echo '<th scope="col">' . esc_html__( 'Property', 'query-monitor' ) . '</th>';
36
+ echo '<th scope="col">' . esc_html__( 'Value', 'query-monitor' ) . '</th>';
37
  echo '</tr>';
38
  echo '</thead>';
39
  echo '<tbody>';
40
 
41
  echo '<tr>';
42
+ echo '<th scope="row">version</th>';
43
  echo '<td>' . esc_html( $data['php']['version'] ) . '</td>';
44
  echo '</tr>';
45
 
46
  echo '<tr>';
47
+ echo '<th scope="row">sapi</th>';
48
  echo '<td>' . esc_html( $data['php']['sapi'] ) . '</td>';
49
  echo '</tr>';
50
 
51
  if ( isset( $data['php']['hhvm'] ) ) {
52
  echo '<tr>';
53
+ echo '<th scope="row">hhvm</th>';
54
  echo '<td>' . esc_html( $data['php']['hhvm'] ) . '</td>';
55
  echo '</tr>';
56
  }
57
 
58
  echo '<tr>';
59
+ echo '<th scope="row">user</th>';
60
  if ( !empty( $data['php']['user'] ) ) {
61
  echo '<td>' . esc_html( $data['php']['user'] ) . '</td>';
62
  } else {
67
  foreach ( $data['php']['variables'] as $key => $val ) {
68
 
69
  echo '<tr>';
70
+ echo '<th scope="row">' . esc_html( $key ) . '</th>';
71
  echo '<td class="qm-wrap">';
72
  echo esc_html( $val['after'] );
73
 
86
  echo '</tr>';
87
  }
88
 
89
+ $error_levels = implode( '</li><li>&nbsp;', array_map( 'esc_html', $this->collector->get_error_levels( $data['php']['error_reporting'] ) ) );
90
 
91
  echo '<tr>';
92
+ echo '<th scope="row">error_reporting</th>';
93
+ echo '<td class="qm-wrap">' . esc_html( $data['php']['error_reporting'] );
94
+ echo "<ul class='qm-info'><li>&nbsp;{$error_levels}</li></ul>"; // WPCS: XSS ok.
95
+ echo '</td>';
96
  echo '</tr>';
97
 
98
  echo '</tbody>';
112
 
113
  echo '<div class="qm qm-third">';
114
  echo '<table cellspacing="0">';
115
+ echo '<caption>' . esc_html( $name ) . '</caption>';
116
+ echo '<thead class="screen-reader-text">';
117
  echo '<tr>';
118
+ echo '<th scope="col">' . esc_html__( 'Property', 'query-monitor' ) . '</th>';
119
+ echo '<th scope="col">' . esc_html__( 'Value', 'query-monitor' ) . '</th>';
120
  echo '</tr>';
121
  echo '</thead>';
122
  echo '<tbody>';
124
  foreach ( $db['info'] as $key => $value ) {
125
 
126
  echo '<tr>';
127
+ echo '<th scope="row">' . esc_html( $key ) . '</th>';
128
 
129
  if ( ! isset( $value ) ) {
130
  echo '<td><span class="qm-warn">' . esc_html__( 'Unknown', 'query-monitor' ) . '</span></td>';
151
 
152
  if ( ( true === $db['vars'][$key] ) and empty( $val ) ) {
153
  $show_warning = true;
154
+ } elseif ( is_string( $db['vars'][$key] ) and ( $val !== $db['vars'][$key] ) ) {
155
  $show_warning = true;
156
  }
157
 
176
  echo '<tr class="' . esc_attr( $class ) . '"">';
177
  }
178
 
179
+ echo '<th scope="row">' . esc_html( $key ) . '</th>';
180
  echo '<td class="qm-wrap">';
181
  echo esc_html( $val );
182
  echo $append; // WPCS: XSS ok.
198
 
199
  echo '<div class="qm qm-third" style="float:right !important">';
200
  echo '<table cellspacing="0">';
201
+ echo '<caption>WordPress</caption>';
202
+ echo '<thead class="screen-reader-text">';
203
  echo '<tr>';
204
+ echo '<th scope="col">' . esc_html__( 'Property', 'query-monitor' ) . '</th>';
205
+ echo '<th scope="col">' . esc_html__( 'Value', 'query-monitor' ) . '</th>';
206
  echo '</tr>';
207
  echo '</thead>';
208
  echo '<tbody>';
210
  foreach ( $data['wp'] as $key => $val ) {
211
 
212
  echo '<tr>';
213
+ echo '<th scope="row">' . esc_html( $key ) . '</th>';
214
  echo '<td class="qm-wrap">' . esc_html( $val ) . '</td>';
215
  echo '</tr>';
216
 
222
 
223
  echo '<div class="qm qm-third">';
224
  echo '<table cellspacing="0">';
225
+ echo '<caption>' . esc_html__( 'Server', 'query-monitor' ) . '</caption>';
226
+ echo '<thead class="screen-reader-text">';
227
  echo '<tr>';
228
+ echo '<th scope="col">' . esc_html__( 'Property', 'query-monitor' ) . '</th>';
229
+ echo '<th scope="col">' . esc_html__( 'Value', 'query-monitor' ) . '</th>';
230
  echo '</tr>';
231
  echo '</thead>';
232
  echo '<tbody>';
233
 
234
  echo '<tr>';
235
+ echo '<th scope="row">' . esc_html__( 'software', 'query-monitor' ) . '</th>';
236
  echo '<td class="qm-wrap">' . esc_html( $data['server']['name'] ) . '</td>';
237
  echo '</tr>';
238
 
239
  echo '<tr>';
240
+ echo '<th scope="row">' . esc_html__( 'version', 'query-monitor' ) . '</th>';
241
  if ( !empty( $data['server']['version'] ) ) {
242
  echo '<td class="qm-wrap">' . esc_html( $data['server']['version'] ) . '</td>';
243
  } else {
246
  echo '</tr>';
247
 
248
  echo '<tr>';
249
+ echo '<th scope="row">' . esc_html__( 'address', 'query-monitor' ) . '</th>';
250
  if ( !empty( $data['server']['address'] ) ) {
251
  echo '<td class="qm-wrap">' . esc_html( $data['server']['address'] ) . '</td>';
252
  } else {
255
  echo '</tr>';
256
 
257
  echo '<tr>';
258
+ echo '<th scope="row">' . esc_html__( 'host', 'query-monitor' ) . '</th>';
259
  echo '<td class="qm-wrap">' . esc_html( $data['server']['host'] ) . '</td>';
260
  echo '</tr>';
261
 
output/html/hooks.php CHANGED
@@ -39,12 +39,13 @@ class QM_Output_Html_Hooks extends QM_Output_Html {
39
 
40
  echo '<div class="qm" id="' . esc_attr( $this->collector->id() ) . '">';
41
  echo '<table cellspacing="0">';
 
42
  echo '<thead>';
43
  echo '<tr>';
44
- echo '<th>';
45
  echo $this->build_filter( 'name', $data['parts'], __( 'Hook', 'query-monitor' ) ); // WPCS: XSS ok.
46
  echo '</th>';
47
- echo '<th colspan="3">';
48
  echo $this->build_filter( 'component', $data['components'], __( 'Actions', 'query-monitor' ), 'subject' ); // WPCS: XSS ok.
49
  echo '</th>';
50
  echo '</tr>';
@@ -101,7 +102,7 @@ class QM_Output_Html_Hooks extends QM_Output_Html {
101
 
102
  if ( $first ) {
103
 
104
- echo "<th rowspan='" . absint( $rowspan ) . "' class='qm-nowrap'>";
105
  echo $hook_name; // WPCS: XSS ok.
106
  if ( 'all' === $hook['name'] ) {
107
  echo '<br><span class="qm-warn">';
@@ -145,7 +146,7 @@ class QM_Output_Html_Hooks extends QM_Output_Html {
145
 
146
  } else {
147
  echo "<tr{$attr}>"; // WPCS: XSS ok.
148
- echo '<th>';
149
  echo $hook_name; // WPCS: XSS ok.
150
  echo '</th>';
151
  echo '<td colspan="3">&nbsp;</td>';
39
 
40
  echo '<div class="qm" id="' . esc_attr( $this->collector->id() ) . '">';
41
  echo '<table cellspacing="0">';
42
+ echo '<caption class="screen-reader-text">' . esc_html__( 'Hooks', 'query-monitor' ) . '</caption>';
43
  echo '<thead>';
44
  echo '<tr>';
45
+ echo '<th scope="col">';
46
  echo $this->build_filter( 'name', $data['parts'], __( 'Hook', 'query-monitor' ) ); // WPCS: XSS ok.
47
  echo '</th>';
48
+ echo '<th scope="col" colspan="3">';
49
  echo $this->build_filter( 'component', $data['components'], __( 'Actions', 'query-monitor' ), 'subject' ); // WPCS: XSS ok.
50
  echo '</th>';
51
  echo '</tr>';
102
 
103
  if ( $first ) {
104
 
105
+ echo '<th scope="row" rowspan="' . absint( $rowspan ) . '" class="qm-nowrap">';
106
  echo $hook_name; // WPCS: XSS ok.
107
  if ( 'all' === $hook['name'] ) {
108
  echo '<br><span class="qm-warn">';
146
 
147
  } else {
148
  echo "<tr{$attr}>"; // WPCS: XSS ok.
149
+ echo '<th scope="row">';
150
  echo $hook_name; // WPCS: XSS ok.
151
  echo '</th>';
152
  echo '<td colspan="3">&nbsp;</td>';
output/html/http.php CHANGED
@@ -30,28 +30,6 @@ class QM_Output_Html_HTTP extends QM_Output_Html {
30
 
31
  echo '<div class="qm" id="' . esc_attr( $this->collector->id() ) . '">';
32
  echo '<table cellspacing="0" class="qm-sortable">';
33
- echo '<thead>';
34
- echo '<tr>';
35
- echo '<th class="qm-sorted-asc">&nbsp;';
36
- echo $this->build_sorter(); // WPCS: XSS ok.
37
- echo '</th>';
38
- echo '<th scope="col">' . esc_html__( 'HTTP Request', 'query-monitor' ) . '</th>';
39
- echo '<th scope="col">';
40
- echo $this->build_filter( 'type', array_keys( $data['types'] ), __( 'Response', 'query-monitor' ) ); // WPCS: XSS ok.
41
- echo '</th>';
42
- echo '<th scope="col">' . esc_html__( 'Transport', 'query-monitor' ) . '</th>';
43
- echo '<th scope="col">' . esc_html__( 'Call Stack', 'query-monitor' ) . '</th>';
44
- echo '<th scope="col">';
45
- echo $this->build_filter( 'component', wp_list_pluck( $data['component_times'], 'component' ), __( 'Component', 'query-monitor' ) ); // WPCS: XSS ok.
46
- echo '</th>';
47
- echo '<th scope="col" class="qm-num">' . esc_html__( 'Timeout', 'query-monitor' );
48
- echo $this->build_sorter(); // WPCS: XSS ok.
49
- echo '</th>';
50
- echo '<th scope="col" class="qm-num">' . esc_html__( 'Time', 'query-monitor' );
51
- echo $this->build_sorter(); // WPCS: XSS ok.
52
- echo '</th>';
53
- echo '</tr>';
54
- echo '</thead>';
55
 
56
  $vars = array();
57
 
@@ -63,6 +41,30 @@ class QM_Output_Html_HTTP extends QM_Output_Html {
63
 
64
  if ( !empty( $data['http'] ) ) {
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  echo '<tbody>';
67
  $i = 0;
68
 
@@ -117,12 +119,6 @@ class QM_Output_Html_HTTP extends QM_Output_Html {
117
  }
118
  }
119
 
120
- if ( isset( $row['transport'] ) ) {
121
- $transport = $row['transport'];
122
- } else {
123
- $transport = '';
124
- }
125
-
126
  $component = $row['component'];
127
 
128
  $stack = array();
@@ -159,10 +155,6 @@ class QM_Output_Html_HTTP extends QM_Output_Html {
159
  '<td>%s</td>',
160
  esc_html( $response )
161
  );
162
- printf(
163
- '<td>%s</td>',
164
- esc_html( $transport )
165
- );
166
  printf( // WPCS: XSS ok.
167
  '<td class="qm-nowrap qm-ltr">%s</td>',
168
  implode( '<br>', $stack )
@@ -197,7 +189,7 @@ class QM_Output_Html_HTTP extends QM_Output_Html {
197
 
198
  echo '<tr>';
199
  printf(
200
- '<td colspan="7">%s</td>',
201
  implode( '<br>', array_map( 'esc_html', $vars ) )
202
  );
203
  echo '<td class="qm-num">' . esc_html( $total_stime ) . '</td>';
@@ -206,14 +198,20 @@ class QM_Output_Html_HTTP extends QM_Output_Html {
206
 
207
  } else {
208
 
 
 
 
 
 
 
209
  echo '<tbody>';
210
  echo '<tr>';
211
- echo '<td colspan="8" style="text-align:center !important"><em>' . esc_html__( 'none', 'query-monitor' ) . '</em></td>';
212
  echo '</tr>';
213
  if ( !empty( $vars ) ) {
214
  echo '<tr>';
215
  printf(
216
- '<td colspan="8">%s</td>',
217
  implode( '<br>', array_map( 'esc_html', $vars ) )
218
  );
219
  echo '</tr>';
30
 
31
  echo '<div class="qm" id="' . esc_attr( $this->collector->id() ) . '">';
32
  echo '<table cellspacing="0" class="qm-sortable">';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
  $vars = array();
35
 
41
 
42
  if ( !empty( $data['http'] ) ) {
43
 
44
+ echo '<caption class="screen-reader-text">' . esc_html__( 'HTTP Requests', 'query-monitor' ) . '</caption>';
45
+
46
+ echo '<thead>';
47
+ echo '<tr>';
48
+ echo '<th scope="col" class="qm-sorted-asc">&nbsp;';
49
+ echo $this->build_sorter(); // WPCS: XSS ok.
50
+ echo '</th>';
51
+ echo '<th scope="col">' . esc_html__( 'HTTP Request', 'query-monitor' ) . '</th>';
52
+ echo '<th scope="col">';
53
+ echo $this->build_filter( 'type', array_keys( $data['types'] ), __( 'Response', 'query-monitor' ) ); // WPCS: XSS ok.
54
+ echo '</th>';
55
+ echo '<th scope="col">' . esc_html__( 'Call Stack', 'query-monitor' ) . '</th>';
56
+ echo '<th scope="col">';
57
+ echo $this->build_filter( 'component', wp_list_pluck( $data['component_times'], 'component' ), __( 'Component', 'query-monitor' ) ); // WPCS: XSS ok.
58
+ echo '</th>';
59
+ echo '<th scope="col" class="qm-num">' . esc_html__( 'Timeout', 'query-monitor' );
60
+ echo $this->build_sorter(); // WPCS: XSS ok.
61
+ echo '</th>';
62
+ echo '<th scope="col" class="qm-num">' . esc_html__( 'Time', 'query-monitor' );
63
+ echo $this->build_sorter(); // WPCS: XSS ok.
64
+ echo '</th>';
65
+ echo '</tr>';
66
+ echo '</thead>';
67
+
68
  echo '<tbody>';
69
  $i = 0;
70
 
119
  }
120
  }
121
 
 
 
 
 
 
 
122
  $component = $row['component'];
123
 
124
  $stack = array();
155
  '<td>%s</td>',
156
  esc_html( $response )
157
  );
 
 
 
 
158
  printf( // WPCS: XSS ok.
159
  '<td class="qm-nowrap qm-ltr">%s</td>',
160
  implode( '<br>', $stack )
189
 
190
  echo '<tr>';
191
  printf(
192
+ '<td colspan="6">%s</td>',
193
  implode( '<br>', array_map( 'esc_html', $vars ) )
194
  );
195
  echo '<td class="qm-num">' . esc_html( $total_stime ) . '</td>';
198
 
199
  } else {
200
 
201
+ echo '<thead>';
202
+ echo '<tr>';
203
+ echo '<th scope="col">' . esc_html__( 'HTTP Requests', 'query-monitor' ) . '</th>';
204
+ echo '</tr>';
205
+ echo '</thead>';
206
+
207
  echo '<tbody>';
208
  echo '<tr>';
209
+ echo '<td style="text-align:center !important"><em>' . esc_html__( 'none', 'query-monitor' ) . '</em></td>';
210
  echo '</tr>';
211
  if ( !empty( $vars ) ) {
212
  echo '<tr>';
213
  printf(
214
+ '<td>%s</td>',
215
  implode( '<br>', array_map( 'esc_html', $vars ) )
216
  );
217
  echo '</tr>';
output/html/languages.php CHANGED
@@ -33,14 +33,12 @@ class QM_Output_Html_Languages extends QM_Output_Html {
33
 
34
  echo '<div class="qm" id="' . esc_attr( $this->collector->id() ) . '">';
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 '<th>' . esc_html__( 'Text Domain', 'query-monitor' ) . '</th>';
46
  echo '<th>' . esc_html__( 'Caller', 'query-monitor' ) . '</th>';
33
 
34
  echo '<div class="qm" id="' . esc_attr( $this->collector->id() ) . '">';
35
  echo '<table cellspacing="0">';
36
+ echo '<caption>' . esc_html( sprintf(
 
 
37
  /* translators: %s: Name of current language */
38
  __( 'Language Setting: %s', 'query-monitor' ),
39
  $data['locale']
40
+ ) ) . '</caption>';
41
+ echo '<thead>';
42
  echo '<tr>';
43
  echo '<th>' . esc_html__( 'Text Domain', 'query-monitor' ) . '</th>';
44
  echo '<th>' . esc_html__( 'Caller', 'query-monitor' ) . '</th>';
output/html/overview.php CHANGED
@@ -48,7 +48,7 @@ class QM_Output_Html_Overview extends QM_Output_Html {
48
 
49
  echo '<div class="qm" id="' . esc_attr( $this->collector->id() ) . '">';
50
  echo '<table cellspacing="0">';
51
-
52
  echo '<thead>';
53
  echo '<tr>';
54
  echo '<th scope="col">' . esc_html__( 'Page generation time', 'query-monitor' ) . '</th>';
@@ -66,9 +66,10 @@ class QM_Output_Html_Overview extends QM_Output_Html {
66
  echo '<tbody>';
67
  echo '<tr>';
68
  echo '<td>';
69
- echo esc_html( number_format_i18n( $data['time'], 4 ) );
70
  echo '<br><span class="qm-info">';
71
  echo esc_html( sprintf(
 
72
  __( '%1$s%% of %2$ss limit', 'query-monitor' ),
73
  number_format_i18n( $data['time_usage'], 1 ),
74
  number_format_i18n( $data['time_limit'] )
@@ -81,11 +82,13 @@ class QM_Output_Html_Overview extends QM_Output_Html {
81
  } else {
82
  echo '<td>';
83
  echo esc_html( sprintf(
 
84
  __( '%s kB', 'query-monitor' ),
85
  number_format_i18n( $data['memory'] / 1024 )
86
  ) );
87
  echo '<br><span class="qm-info">';
88
  echo esc_html( sprintf(
 
89
  __( '%1$s%% of %2$s kB limit', 'query-monitor' ),
90
  number_format_i18n( $data['memory_usage'], 1 ),
91
  number_format_i18n( $data['memory_limit'] / 1024 )
@@ -116,11 +119,11 @@ class QM_Output_Html_Overview extends QM_Output_Html {
116
  __( '%s%% hit rate', 'query-monitor' ),
117
  number_format_i18n( $cache_hit_percentage, 1 )
118
  ) );
119
- echo '<br>' . esc_html( sprintf(
120
- /* translators: %s: External object cache status */
121
- __( 'External object cache: %s'),
122
- ( $cache_data['ext_object_cache'] ? 'true' : 'false' )
123
- ) );
124
  echo '</td>';
125
  }
126
 
@@ -139,19 +142,24 @@ class QM_Output_Html_Overview extends QM_Output_Html {
139
  if ( empty( $data['memory'] ) ) {
140
  $memory = '??';
141
  } else {
142
- $memory = number_format_i18n( ( $data['memory'] / 1024 / 1024 ), 2 );
143
  }
144
 
145
  $title[] = sprintf(
146
  /* translators: %s: Page load time in seconds */
147
- _x( '%s<small>S</small>', 'Page load time', 'query-monitor' ),
148
- number_format_i18n( $data['time'], 2 )
149
  );
150
  $title[] = sprintf(
151
- /* translators: %s: Memory usage in megabytes */
152
- _x( '%s<small>MB</small>', 'Memory usage', 'query-monitor' ),
153
  $memory
154
  );
 
 
 
 
 
155
  return $title;
156
  }
157
 
48
 
49
  echo '<div class="qm" id="' . esc_attr( $this->collector->id() ) . '">';
50
  echo '<table cellspacing="0">';
51
+ echo '<caption class="screen-reader-text">' . esc_html( $this->collector->name() ). '</caption>';
52
  echo '<thead>';
53
  echo '<tr>';
54
  echo '<th scope="col">' . esc_html__( 'Page generation time', 'query-monitor' ) . '</th>';
66
  echo '<tbody>';
67
  echo '<tr>';
68
  echo '<td>';
69
+ echo esc_html( number_format_i18n( $data['time_taken'], 4 ) );
70
  echo '<br><span class="qm-info">';
71
  echo esc_html( sprintf(
72
+ /* translators: 1: Percentage of time limit used, 2: Time limit in seconds*/
73
  __( '%1$s%% of %2$ss limit', 'query-monitor' ),
74
  number_format_i18n( $data['time_usage'], 1 ),
75
  number_format_i18n( $data['time_limit'] )
82
  } else {
83
  echo '<td>';
84
  echo esc_html( sprintf(
85
+ /* translators: %s: Memory used in kilobytes */
86
  __( '%s kB', 'query-monitor' ),
87
  number_format_i18n( $data['memory'] / 1024 )
88
  ) );
89
  echo '<br><span class="qm-info">';
90
  echo esc_html( sprintf(
91
+ /* translators: 1: Percentage of memory limit used, 2: Memory limit in kilobytes*/
92
  __( '%1$s%% of %2$s kB limit', 'query-monitor' ),
93
  number_format_i18n( $data['memory_usage'], 1 ),
94
  number_format_i18n( $data['memory_limit'] / 1024 )
119
  __( '%s%% hit rate', 'query-monitor' ),
120
  number_format_i18n( $cache_hit_percentage, 1 )
121
  ) );
122
+ echo '<br><span class="qm-info">';
123
+ echo ( $cache_data['ext_object_cache'] )
124
+ ? esc_html__( 'External object cache in use', 'query-monitor' )
125
+ : esc_html__( 'External object cache not in use', 'query-monitor' );
126
+ echo '</span>';
127
  echo '</td>';
128
  }
129
 
142
  if ( empty( $data['memory'] ) ) {
143
  $memory = '??';
144
  } else {
145
+ $memory = number_format_i18n( ( $data['memory'] / 1024 ), 0 );
146
  }
147
 
148
  $title[] = sprintf(
149
  /* translators: %s: Page load time in seconds */
150
+ esc_html_x( '%s S', 'Page load time', 'query-monitor' ),
151
+ number_format_i18n( $data['time_taken'], 2 )
152
  );
153
  $title[] = sprintf(
154
+ /* translators: %s: Memory usage in kilobytes */
155
+ esc_html_x( '%s kB', 'Memory usage', 'query-monitor' ),
156
  $memory
157
  );
158
+
159
+ foreach ( $title as &$t ) {
160
+ $t = preg_replace( '#\s?([^0-9,\.]+)#', '<small>$1</small>', $t );
161
+ }
162
+
163
  return $title;
164
  }
165
 
output/html/php_errors.php CHANGED
@@ -32,22 +32,27 @@ class QM_Output_Html_PHP_Errors extends QM_Output_Html {
32
 
33
  echo '<div class="qm" id="' . esc_attr( $this->collector->id() ) . '">';
34
  echo '<table cellspacing="0">';
 
35
  echo '<thead>';
36
  echo '<tr>';
37
- echo '<th colspan="2">' . esc_html__( 'PHP Error', 'query-monitor' ) . '</th>';
38
- echo '<th class="qm-num">' . esc_html__( 'Count', 'query-monitor' ) . '</th>';
39
- echo '<th>' . esc_html__( 'Location', 'query-monitor' ) . '</th>';
40
- echo '<th>' . esc_html__( 'Call Stack', 'query-monitor' ) . '</th>';
41
- echo '<th>' . esc_html__( 'Component', 'query-monitor' ) . '</th>';
42
  echo '</tr>';
43
  echo '</thead>';
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 ) {
@@ -55,7 +60,7 @@ class QM_Output_Html_PHP_Errors extends QM_Output_Html {
55
  if ( isset( $data['errors'][$type] ) ) {
56
 
57
  echo '<tr>';
58
- echo '<td rowspan="' . count( $data['errors'][$type] ) . '">' . esc_html( $title ) . '</td>';
59
  $first = true;
60
 
61
  foreach ( $data['errors'][$type] as $error ) {
@@ -67,7 +72,7 @@ class QM_Output_Html_PHP_Errors extends QM_Output_Html {
67
  $component = $error->trace->get_component();
68
  $message = wp_strip_all_tags( $error->message );
69
 
70
- echo '<td>' . esc_html( $message ) . '</td>';
71
  echo '<td>' . esc_html( number_format_i18n( $error->calls ) ) . '</td>';
72
  echo '<td>';
73
  echo self::output_filename( $error->filename . ':' . $error->line, $error->file, $error->line ); // WPCS: XSS ok.
@@ -134,46 +139,43 @@ class QM_Output_Html_PHP_Errors extends QM_Output_Html {
134
 
135
  $data = $this->collector->get_data();
136
 
137
- if ( isset( $data['errors']['warning'] ) ) {
138
- $menu[] = $this->menu( array(
139
- 'id' => 'query-monitor-warnings',
140
- 'title' => esc_html( sprintf(
141
- /* translators: %s: Number of PHP warnings */
142
- __( 'PHP Warnings (%s)', 'query-monitor' ),
143
- number_format_i18n( count( $data['errors']['warning'] ) )
144
- ) )
145
- ) );
146
- }
147
- if ( isset( $data['errors']['notice'] ) ) {
148
- $menu[] = $this->menu( array(
149
- 'id' => 'query-monitor-notices',
150
- 'title' => esc_html( sprintf(
151
- /* translators: %s: Number of PHP notices */
152
- __( 'PHP Notices (%s)', 'query-monitor' ),
153
- number_format_i18n( count( $data['errors']['notice'] ) )
154
- ) )
155
- ) );
156
- }
157
- if ( isset( $data['errors']['strict'] ) ) {
158
- $menu[] = $this->menu( array(
159
- 'id' => 'query-monitor-stricts',
160
- 'title' => esc_html( sprintf(
161
- /* translators: %s: Number of strict PHP errors */
162
- __( 'PHP Stricts (%s)', 'query-monitor' ),
163
- number_format_i18n( count( $data['errors']['strict'] ) )
164
- ) )
165
- ) );
166
- }
167
- if ( isset( $data['errors']['deprecated'] ) ) {
168
  $menu[] = $this->menu( array(
169
- 'id' => 'query-monitor-deprecated',
170
  'title' => esc_html( sprintf(
171
- /* translators: %s: Number of deprecated PHP errors */
172
- __( 'PHP Deprecated (%s)', 'query-monitor' ),
173
- number_format_i18n( count( $data['errors']['deprecated'] ) )
174
  ) )
175
  ) );
176
  }
 
177
  return $menu;
178
 
179
  }
32
 
33
  echo '<div class="qm" id="' . esc_attr( $this->collector->id() ) . '">';
34
  echo '<table cellspacing="0">';
35
+ echo '<caption class="screen-reader-text">' . esc_html( 'PHP Errors', 'query-monitor' ) . '</caption>';
36
  echo '<thead>';
37
  echo '<tr>';
38
+ echo '<th scope="col" colspan="2">' . esc_html__( 'PHP Error', 'query-monitor' ) . '</th>';
39
+ echo '<th scope="col" class="qm-num">' . esc_html__( 'Count', 'query-monitor' ) . '</th>';
40
+ echo '<th scope="col">' . esc_html__( 'Location', 'query-monitor' ) . '</th>';
41
+ echo '<th scope="col">' . esc_html__( 'Call Stack', 'query-monitor' ) . '</th>';
42
+ echo '<th scope="col">' . esc_html__( 'Component', 'query-monitor' ) . '</th>';
43
  echo '</tr>';
44
  echo '</thead>';
45
  echo '<tbody>';
46
 
47
  $types = array(
48
+ 'warning' => _x( 'Warning', 'PHP error level', 'query-monitor' ),
49
+ 'notice' => _x( 'Notice', 'PHP error level', 'query-monitor' ),
50
+ 'strict' => _x( 'Strict', 'PHP error level', 'query-monitor' ),
51
+ 'deprecated' => _x( 'Deprecated', 'PHP error level', 'query-monitor' ),
52
+ 'warning-suppressed' => _x( 'Warning (Suppressed)', 'Suppressed PHP error level', 'query-monitor' ),
53
+ 'notice-suppressed' => _x( 'Notice (Suppressed)', 'Suppressed PHP error level', 'query-monitor' ),
54
+ 'strict-suppressed' => _x( 'Strict (Suppressed)', 'Suppressed PHP error level', 'query-monitor' ),
55
+ 'deprecated-suppressed' => _x( 'Deprecated (Suppressed)', 'Suppressed PHP error level', 'query-monitor' ),
56
  );
57
 
58
  foreach ( $types as $type => $title ) {
60
  if ( isset( $data['errors'][$type] ) ) {
61
 
62
  echo '<tr>';
63
+ echo '<th scope="row" rowspan="' . count( $data['errors'][$type] ) . '">' . esc_html( $title ) . '</th>';
64
  $first = true;
65
 
66
  foreach ( $data['errors'][$type] as $error ) {
72
  $component = $error->trace->get_component();
73
  $message = wp_strip_all_tags( $error->message );
74
 
75
+ echo '<th scope="row">' . esc_html( $message ) . '</th>';
76
  echo '<td>' . esc_html( number_format_i18n( $error->calls ) ) . '</td>';
77
  echo '<td>';
78
  echo self::output_filename( $error->filename . ':' . $error->line, $error->file, $error->line ); // WPCS: XSS ok.
139
 
140
  $data = $this->collector->get_data();
141
 
142
+ $types = array(
143
+ /* translators: %s: Number of PHP warnings */
144
+ 'warning' => _x( 'Warnings (%s)', 'PHP error level', 'query-monitor' ),
145
+ /* translators: %s: Number of PHP notices */
146
+ 'notice' => _x( 'Notices (%s)', 'PHP error level', 'query-monitor' ),
147
+ /* translators: %s: Number of strict PHP errors */
148
+ 'strict' => _x( 'Stricts (%s)', 'PHP error level', 'query-monitor' ),
149
+ /* translators: %s: Number of deprecated PHP errors */
150
+ 'deprecated' => _x( 'Deprecated (%s)', 'PHP error level', 'query-monitor' ),
151
+ );
152
+
153
+ foreach ( $types as $type => $label ) {
154
+
155
+ $count = 0;
156
+
157
+ if ( isset( $data['errors']["{$type}-suppressed"] ) ) {
158
+ $key = "{$type}-suppressed";
159
+ $count = count( $data['errors'][ $key ] );
160
+ }
161
+ if ( isset( $data['errors'][ $type ] ) ) {
162
+ $key = $type;
163
+ $count += count( $data['errors'][ $key ] );
164
+ }
165
+
166
+ if ( ! $count ) {
167
+ continue;
168
+ }
169
+
 
 
 
170
  $menu[] = $this->menu( array(
171
+ 'id' => "query-monitor-{$key}s",
172
  'title' => esc_html( sprintf(
173
+ $label,
174
+ number_format_i18n( $count )
 
175
  ) )
176
  ) );
177
  }
178
+
179
  return $menu;
180
 
181
  }
output/html/request.php CHANGED
@@ -27,6 +27,13 @@ class QM_Output_Html_Request extends QM_Output_Html {
27
 
28
  echo '<div class="qm qm-half" id="' . esc_attr( $this->collector->id() ) . '">';
29
  echo '<table cellspacing="0">';
 
 
 
 
 
 
 
30
  echo '<tbody>';
31
 
32
  foreach ( array(
27
 
28
  echo '<div class="qm qm-half" id="' . esc_attr( $this->collector->id() ) . '">';
29
  echo '<table cellspacing="0">';
30
+ echo '<caption class="screen-reader-text">' . esc_html( $this->collector->name() ) . '</caption>';
31
+ echo '<thead class="screen-reader-text">';
32
+ echo '<tr>';
33
+ echo '<th scope="col">' . esc_html__( 'Property', 'query-monitor' ) . '</th>';
34
+ echo '<th scope="col" colspan="2">' . esc_html__( 'Value', 'query-monitor' ) . '</th>';
35
+ echo '</tr>';
36
+ echo '</thead>';
37
  echo '<tbody>';
38
 
39
  foreach ( array(
output/html/rewrites.php CHANGED
@@ -28,9 +28,11 @@ class QM_Output_Html_Rewrites extends QM_Output_Html {
28
  echo '<div class="qm qm-half" id="' . esc_attr( $this->collector->id() ) . '">';
29
  echo '<table cellspacing="0">';
30
 
31
- echo '<thead>';
 
32
  echo '<tr>';
33
- echo '<th valign="top" colspan="2">' . esc_html__( 'Matching Rewrite Rules', 'query-monitor' ) . '</th>';
 
34
  echo '</tr>';
35
  echo '</thead>';
36
 
@@ -43,8 +45,8 @@ class QM_Output_Html_Rewrites extends QM_Output_Html {
43
  $query = str_replace( 'index.php?', '', $query );
44
 
45
  echo '<tr>';
46
- echo '<td valign="top">' . esc_html( $rule ) . '</td>';
47
- echo '<td valign="top">';
48
  echo self::format_url( $query ); // WPCS: XSS ok.
49
  echo '</td>';
50
  echo '</tr>';
@@ -54,7 +56,7 @@ class QM_Output_Html_Rewrites extends QM_Output_Html {
54
  } else {
55
 
56
  echo '<tr>';
57
- echo '<td valign="top" colspan="2"><em>' . esc_html__( 'None', 'query-monitor' ) . '</em></td>';
58
  echo '</tr>';
59
 
60
  }
28
  echo '<div class="qm qm-half" id="' . esc_attr( $this->collector->id() ) . '">';
29
  echo '<table cellspacing="0">';
30
 
31
+ echo '<caption>' . esc_html__( 'Matching Rewrite Rules', 'query-monitor' ) . '</caption>';
32
+ echo '<thead class="screen-reader-text">';
33
  echo '<tr>';
34
+ echo '<th scope="col">' . esc_html__( 'Rule', 'query-monitor' ) . '</th>';
35
+ echo '<th scope="col">' . esc_html__( 'Query', 'query-monitor' ) . '</th>';
36
  echo '</tr>';
37
  echo '</thead>';
38
 
45
  $query = str_replace( 'index.php?', '', $query );
46
 
47
  echo '<tr>';
48
+ echo '<td>' . esc_html( $rule ) . '</td>';
49
+ echo '<td>';
50
  echo self::format_url( $query ); // WPCS: XSS ok.
51
  echo '</td>';
52
  echo '</tr>';
56
  } else {
57
 
58
  echo '<tr>';
59
+ echo '<td colspan="2"><em>' . esc_html__( 'None', 'query-monitor' ) . '</em></td>';
60
  echo '</tr>';
61
 
62
  }
output/html/theme.php CHANGED
@@ -31,10 +31,18 @@ class QM_Output_Html_Theme extends QM_Output_Html {
31
 
32
  echo '<div class="qm qm-half" id="' . esc_attr( $this->collector->id() ) . '">';
33
  echo '<table cellspacing="0">';
 
 
 
 
 
 
 
34
  echo '<tbody>';
35
 
36
  echo '<tr>';
37
- echo '<th>' . esc_html__( 'Template File', 'query-monitor' ) . '</th>';
 
38
  if ( ! empty( $data['template_path'] ) ) {
39
 
40
  if ( $data['is_child_theme'] ) {
@@ -49,72 +57,65 @@ class QM_Output_Html_Theme extends QM_Output_Html {
49
 
50
  echo '</tr>';
51
 
52
- if ( ! empty( $data['template_parts'] ) ) {
53
 
54
- $count = count( $data['template_parts'] );
55
  echo '<tr>';
56
- echo '<th rowspan="' . absint( $count ) . '">' . esc_html__( 'Template Parts', 'query-monitor' ) . '</th>';
 
 
 
 
 
 
 
 
 
 
57
  if ( $data['is_child_theme'] ) {
58
  $parts = $data['theme_template_parts'];
59
  } else {
60
  $parts = $data['template_parts'];
61
  }
62
- $first = true;
63
-
64
- foreach ( $parts as $filename => $display ) {
65
-
66
- if ( ! $first ) {
67
- echo '<tr>';
68
- }
69
 
70
- echo '<td>' . self::output_filename( $display, $filename ) . '</td>'; // WPCS: XSS ok.
71
- echo '</tr>';
72
-
73
- $first = false;
74
 
 
 
75
  }
76
 
 
 
77
  } else {
78
- echo '<tr>';
79
- echo '<th>' . esc_html__( 'Template Parts', 'query-monitor' ) . '</th>';
80
  echo '<td><em>' . esc_html__( 'None', 'query-monitor' ) . '</em></td>';
81
- echo '</tr>';
82
  }
83
 
84
- if ( ! empty( $data['timber_files'] ) ) {
85
 
86
- $count = count( $data['timber_files'] );
87
  echo '<tr>';
88
- echo '<th rowspan="' . absint( $count ) . '">' . esc_html__( 'Timber Files', 'query-monitor' ) . '</th>';
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'] ) {
108
- echo '<th>' . esc_html__( 'Child Theme', 'query-monitor' ) . '</th>';
109
  } else {
110
- echo '<th>' . esc_html__( 'Theme', 'query-monitor' ) . '</th>';
111
  }
112
  echo '<td>' . esc_html( $data['stylesheet'] ) . '</td>';
113
  echo '</tr>';
114
 
115
  if ( $data['is_child_theme'] ) {
116
  echo '<tr>';
117
- echo '<th>' . esc_html__( 'Parent Theme', 'query-monitor' ) . '</th>';
118
  echo '<td>' . esc_html( $data['template'] ) . '</td>';
119
  echo '</tr>';
120
  }
@@ -122,22 +123,15 @@ class QM_Output_Html_Theme extends QM_Output_Html {
122
  if ( !empty( $data['body_class'] ) ) {
123
 
124
  echo '<tr>';
125
- echo '<th rowspan="' . count( $data['body_class'] ) . '">' . esc_html__( 'Body Classes', 'query-monitor' ) . '</th>';
126
- $first = true;
127
 
128
  foreach ( $data['body_class'] as $class ) {
129
-
130
- if ( !$first ) {
131
- echo '<tr>';
132
- }
133
-
134
- echo '<td>' . esc_html( $class ) . '</td>';
135
- echo '</tr>';
136
-
137
- $first = false;
138
-
139
  }
140
 
 
 
141
  }
142
 
143
  echo '</tbody>';
31
 
32
  echo '<div class="qm qm-half" id="' . esc_attr( $this->collector->id() ) . '">';
33
  echo '<table cellspacing="0">';
34
+ echo '<caption>' . esc_html( $this->collector->name() ) . '</caption>';
35
+ echo '<thead>';
36
+ echo '<tr class="screen-reader-text">';
37
+ echo '<th scope="col">' . esc_html__( 'Data', 'query-monitor' ) . '</th>';
38
+ echo '<th scope="col">' . esc_html__( 'Value', 'query-monitor' ) . '</th>';
39
+ echo '</tr>';
40
+ echo '</thead>';
41
  echo '<tbody>';
42
 
43
  echo '<tr>';
44
+ echo '<th scope="row">' . esc_html__( 'Template File', 'query-monitor' ) . '</th>';
45
+
46
  if ( ! empty( $data['template_path'] ) ) {
47
 
48
  if ( $data['is_child_theme'] ) {
57
 
58
  echo '</tr>';
59
 
60
+ if ( ! empty( $data['template_hierarchy'] ) ) {
61
 
 
62
  echo '<tr>';
63
+ echo '<th scope="row">' . esc_html__( 'Template Hierarchy', 'query-monitor' ) . '</th>';
64
+ echo '<td><ul><li>' . implode( '</li><li>', array_map( 'esc_html', $data['template_hierarchy'] ) ) . '</li></ul></td>';
65
+ echo '</tr>';
66
+
67
+ }
68
+
69
+ echo '<tr>';
70
+ echo '<th scope="row">' . esc_html__( 'Template Parts', 'query-monitor' ) . '</th>';
71
+
72
+ if ( ! empty( $data['template_parts'] ) ) {
73
+
74
  if ( $data['is_child_theme'] ) {
75
  $parts = $data['theme_template_parts'];
76
  } else {
77
  $parts = $data['template_parts'];
78
  }
 
 
 
 
 
 
 
79
 
80
+ echo '<td><ul>';
 
 
 
81
 
82
+ foreach ( $parts as $filename => $display ) {
83
+ echo '<li>' . self::output_filename( $display, $filename ) . '</li>'; // WPCS: XSS ok.
84
  }
85
 
86
+ echo '</ul></td>';
87
+
88
  } else {
 
 
89
  echo '<td><em>' . esc_html__( 'None', 'query-monitor' ) . '</em></td>';
 
90
  }
91
 
92
+ echo '</tr>';
93
 
94
+ if ( ! empty( $data['timber_files'] ) ) {
95
  echo '<tr>';
96
+ echo '<th scope="row">' . esc_html__( 'Timber Files', 'query-monitor' ) . '</th>';
97
+ echo '<td><ul>';
98
 
99
  foreach ( $data['timber_files'] as $filename ) {
100
+ echo '<li>' . self::output_filename( $filename ) . '</li>'; // WPCS: XSS ok.
 
 
 
 
 
 
 
 
 
101
  }
102
 
103
+ echo '</ul></td>';
104
+ echo '</tr>';
105
  }
106
 
107
  echo '<tr>';
108
  if ( $data['is_child_theme'] ) {
109
+ echo '<th scope="row">' . esc_html__( 'Child Theme', 'query-monitor' ) . '</th>';
110
  } else {
111
+ echo '<th scope="row">' . esc_html__( 'Theme', 'query-monitor' ) . '</th>';
112
  }
113
  echo '<td>' . esc_html( $data['stylesheet'] ) . '</td>';
114
  echo '</tr>';
115
 
116
  if ( $data['is_child_theme'] ) {
117
  echo '<tr>';
118
+ echo '<th scope="row">' . esc_html__( 'Parent Theme', 'query-monitor' ) . '</th>';
119
  echo '<td>' . esc_html( $data['template'] ) . '</td>';
120
  echo '</tr>';
121
  }
123
  if ( !empty( $data['body_class'] ) ) {
124
 
125
  echo '<tr>';
126
+ echo '<th scope="row">' . esc_html__( 'Body Classes', 'query-monitor' ) . '</th>';
127
+ echo '<td><ul>';
128
 
129
  foreach ( $data['body_class'] as $class ) {
130
+ echo '<li>' . esc_html( $class ) . '</li>';
 
 
 
 
 
 
 
 
 
131
  }
132
 
133
+ echo '</ul></td>';
134
+ echo '</tr>';
135
  }
136
 
137
  echo '</tbody>';
output/html/transients.php CHANGED
@@ -27,22 +27,25 @@ class QM_Output_Html_Transients extends QM_Output_Html {
27
 
28
  echo '<div class="qm" id="' . esc_attr( $this->collector->id() ) . '">';
29
  echo '<table cellspacing="0">';
30
- echo '<thead>';
31
- echo '<tr>';
32
- echo '<th>' . esc_html__( 'Transient Set', 'query-monitor' ) . '</th>';
33
- if ( is_multisite() ) {
34
- echo '<th>' . esc_html__( 'Type', 'query-monitor' ) . '</th>';
35
- }
36
- if ( !empty( $data['trans'] ) and isset( $data['trans'][0]['expiration'] ) ) {
37
- echo '<th>' . esc_html__( 'Expiration', 'query-monitor' ) . '</th>';
38
- }
39
- echo '<th>' . esc_html__( 'Call Stack', 'query-monitor' ) . '</th>';
40
- echo '<th>' . esc_html__( 'Component', 'query-monitor' ) . '</th>';
41
- echo '</tr>';
42
- echo '</thead>';
43
 
44
  if ( !empty( $data['trans'] ) ) {
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  echo '<tbody>';
47
 
48
  foreach ( $data['trans'] as $row ) {
@@ -104,9 +107,15 @@ class QM_Output_Html_Transients extends QM_Output_Html {
104
 
105
  } else {
106
 
 
 
 
 
 
 
107
  echo '<tbody>';
108
  echo '<tr>';
109
- echo '<td colspan="4" style="text-align:center !important"><em>' . esc_html__( 'none', 'query-monitor' ) . '</em></td>';
110
  echo '</tr>';
111
  echo '</tbody>';
112
 
27
 
28
  echo '<div class="qm" id="' . esc_attr( $this->collector->id() ) . '">';
29
  echo '<table cellspacing="0">';
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
  if ( !empty( $data['trans'] ) ) {
32
 
33
+ echo '<caption class="screen-reader-text">' . esc_html__( 'Transients', 'query-monitor' ) . '</caption>';
34
+
35
+ echo '<thead>';
36
+ echo '<tr>';
37
+ echo '<th scope="col">' . esc_html__( 'Transient Set', 'query-monitor' ) . '</th>';
38
+ if ( is_multisite() ) {
39
+ echo '<th>' . esc_html__( 'Type', 'query-monitor' ) . '</th>';
40
+ }
41
+ if ( !empty( $data['trans'] ) and isset( $data['trans'][0]['expiration'] ) ) {
42
+ echo '<th scope="col">' . esc_html__( 'Expiration', 'query-monitor' ) . '</th>';
43
+ }
44
+ echo '<th scope="col">' . esc_html__( 'Call Stack', 'query-monitor' ) . '</th>';
45
+ echo '<th scope="col">' . esc_html__( 'Component', 'query-monitor' ) . '</th>';
46
+ echo '</tr>';
47
+ echo '</thead>';
48
+
49
  echo '<tbody>';
50
 
51
  foreach ( $data['trans'] as $row ) {
107
 
108
  } else {
109
 
110
+ echo '<thead>';
111
+ echo '<tr>';
112
+ echo '<th>' . esc_html__( 'Transients Set', 'query-monitor' ) . '</th>';
113
+ echo '</tr>';
114
+ echo '</thead>';
115
+
116
  echo '<tbody>';
117
  echo '<tr>';
118
+ echo '<td style="text-align:center !important"><em>' . esc_html__( 'none', 'query-monitor' ) . '</em></td>';
119
  echo '</tr>';
120
  echo '</tbody>';
121
 
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.12.0
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.0
6
  Plugin URI: https://github.com/johnbillion/query-monitor
7
  Author: John Blackbourn
8
  Author URI: https://johnblackbourn.com/
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: johnbillion
3
  Tags: ajax, debug, debug-bar, debugging, development, developer, performance, profiler, profiling, queries, query monitor, rest-api
4
  Requires at least: 3.7
5
  Tested up to: 4.6
6
- Stable tag: 2.12.0
7
  License: GPLv2 or later
8
 
9
  View debugging and performance information on database queries, hooks, conditionals, HTTP requests, redirects and more.
@@ -38,6 +38,7 @@ Filtering queries by component or calling function makes it easy to see which pl
38
  = Theme =
39
 
40
  * Shows the template filename for the current request
 
41
  * Shows all template parts used on the current request
42
  * Shows the available body classes for the current request
43
  * Shows the active theme name
@@ -71,7 +72,7 @@ Filtering queries by component or calling function makes it easy to see which pl
71
  = HTTP Requests =
72
 
73
  * Shows all HTTP requests performed on the current request (as long as they use WordPress' HTTP API)
74
- * Shows the response code, call stack, transport, component, timeout, and time taken
75
  * Highlights erroneous responses, such as failed requests and anything without a `200` response code
76
 
77
  = Redirects =
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.0
7
  License: GPLv2 or later
8
 
9
  View debugging and performance information on database queries, hooks, conditionals, HTTP requests, redirects and more.
38
  = Theme =
39
 
40
  * Shows the template filename for the current request
41
+ * Shows the complete template hierarchy for the current request (WordPress 4.7+)
42
  * Shows all template parts used on the current request
43
  * Shows the available body classes for the current request
44
  * Shows the active theme name
72
  = HTTP Requests =
73
 
74
  * Shows all HTTP requests performed on the current request (as long as they use WordPress' HTTP API)
75
+ * Shows the response code, call stack, component, timeout, and time taken
76
  * Highlights erroneous responses, such as failed requests and anything without a `200` response code
77
 
78
  = Redirects =