Query Monitor - Version 2.15.0

Version Description

Download this release

Release Info

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

Code changes from version 2.14.0 to 2.15.0

Files changed (64) hide show
  1. assets/compat.css +1 -1
  2. assets/query-monitor.css +42 -18
  3. assets/query-monitor.js +6 -3
  4. classes/Activation.php +7 -7
  5. classes/Backtrace.php +8 -4
  6. classes/Collector.php +1 -9
  7. classes/Collectors.php +1 -1
  8. classes/Dispatcher.php +1 -1
  9. classes/Dispatchers.php +1 -1
  10. classes/Output.php +1 -1
  11. classes/Plugin.php +1 -1
  12. classes/QueryMonitor.php +1 -1
  13. classes/Util.php +43 -6
  14. classes/debug_bar.php +1 -1
  15. classes/debug_bar_panel.php +1 -1
  16. collectors/admin.php +2 -2
  17. collectors/assets.php +2 -2
  18. collectors/cache.php +2 -2
  19. collectors/conditionals.php +2 -2
  20. collectors/db_callers.php +2 -2
  21. collectors/db_components.php +2 -2
  22. collectors/db_dupes.php +1 -1
  23. collectors/db_queries.php +6 -2
  24. collectors/debug_bar.php +6 -5
  25. collectors/environment.php +26 -8
  26. collectors/hooks.php +11 -9
  27. collectors/http.php +3 -3
  28. collectors/languages.php +3 -2
  29. collectors/overview.php +1 -1
  30. collectors/php_errors.php +6 -5
  31. collectors/redirects.php +1 -1
  32. collectors/request.php +11 -3
  33. collectors/rewrites.php +1 -1
  34. collectors/theme.php +2 -2
  35. collectors/transients.php +5 -5
  36. dispatchers/AJAX.php +1 -1
  37. dispatchers/Html.php +1 -1
  38. dispatchers/REST.php +1 -1
  39. dispatchers/Redirect.php +1 -1
  40. output/Headers.php +1 -1
  41. output/Html.php +2 -2
  42. output/headers/overview.php +1 -1
  43. output/headers/php_errors.php +1 -1
  44. output/headers/redirects.php +1 -1
  45. output/html/admin.php +6 -3
  46. output/html/assets.php +11 -6
  47. output/html/conditionals.php +1 -1
  48. output/html/db_callers.php +1 -1
  49. output/html/db_components.php +10 -3
  50. output/html/db_queries.php +11 -13
  51. output/html/debug_bar.php +1 -1
  52. output/html/environment.php +32 -5
  53. output/html/hooks.php +15 -7
  54. output/html/http.php +10 -10
  55. output/html/languages.php +29 -20
  56. output/html/overview.php +15 -6
  57. output/html/php_errors.php +12 -12
  58. output/html/request.php +29 -3
  59. output/html/rewrites.php +1 -1
  60. output/html/theme.php +2 -2
  61. output/html/transients.php +29 -27
  62. query-monitor.php +2 -2
  63. readme.txt +1 -7
  64. wp-content/db.php +3 -2
assets/compat.css CHANGED
@@ -1,5 +1,5 @@
1
  /*
2
- Copyright 2009-2016 John Blackbourn
3
 
4
  This program is free software; you can redistribute it and/or modify
5
  it under the terms of the GNU General Public License as published by
1
  /*
2
+ Copyright 2009-2017 John Blackbourn
3
 
4
  This program is free software; you can redistribute it and/or modify
5
  it under the terms of the GNU General Public License as published by
assets/query-monitor.css CHANGED
@@ -1,5 +1,5 @@
1
  /*
2
- Copyright 2009-2016 John Blackbourn
3
 
4
  This program is free software; you can redistribute it and/or modify
5
  it under the terms of the GNU General Public License as published by
@@ -60,6 +60,13 @@ GNU General Public License for more details.
60
  background-color: #c00;
61
  }
62
 
 
 
 
 
 
 
 
63
  #wpadminbar .qm-warning > a {
64
  color: #fff !important;
65
  }
@@ -201,7 +208,7 @@ body.wp-admin.folded #qm {
201
  font-style: normal !important;
202
  font-weight: normal !important;
203
  font-size: 11px !important;
204
- line-height: 16px !important;
205
  font-family: Menlo, Monaco, Consolas, monospace !important;
206
  list-style: none !important;
207
  padding: 0 !important;
@@ -297,7 +304,7 @@ body.wp-admin.folded #qm {
297
  font-style: normal !important;
298
  font-weight: normal !important;
299
  font-size: 11px !important;
300
- line-height: 16px !important;
301
  font-family: Menlo, Monaco, Consolas, monospace !important;
302
  border: 1px solid #e8e8e8 !important;
303
  padding: 4px 6px 3px !important;
@@ -318,18 +325,17 @@ body.wp-admin.folded #qm {
318
  caption-side: top !important;
319
  }
320
 
 
321
  .qm tbody tr:hover th,
322
  .qm tbody tr:hover td {
323
- background: #f9f9f9 !important;
324
  }
325
 
326
  .qm-debug-bar tbody tr:hover th,
327
  .qm-debug-bar tbody tr:hover td,
328
  #qm-conditionals tbody tr:hover td,
329
  #qm-overview tbody tr:hover td,
330
- #qm-authentication tbody tr:hover td,
331
- .qm tbody tr:hover th[rowspan],
332
- .qm tbody tr:hover td[rowspan] {
333
  background: #fff !important;
334
  }
335
 
@@ -360,7 +366,7 @@ body.wp-admin.folded #qm {
360
  font-style: normal !important;
361
  font-weight: normal !important;
362
  font-size: 11px !important;
363
- line-height: 16px !important;
364
  font-family: Menlo, Monaco, Consolas, monospace !important;
365
  margin: 0 !important;
366
  }
@@ -402,19 +408,29 @@ body.wp-admin.folded #qm {
402
  font-style: normal !important;
403
  font-weight: normal !important;
404
  font-size: 11px !important;
405
- line-height: 16px !important;
406
  font-family: Menlo, Monaco, Consolas, monospace !important;
 
407
  }
408
 
409
  .qm li::before {
410
  content: '' !important;
411
  }
412
 
 
 
 
 
 
 
 
 
 
413
  .qm pre {
414
  font-style: normal !important;
415
  font-weight: normal !important;
416
  font-size: 11px !important;
417
- line-height: 16px !important;
418
  font-family: Menlo, Monaco, Consolas, monospace !important;
419
  color: inherit !important;
420
  background: transparent !important;
@@ -427,7 +443,7 @@ body.wp-admin.folded #qm {
427
  font-style: normal !important;
428
  font-weight: normal !important;
429
  font-size: 11px !important;
430
- line-height: 16px !important;
431
  font-family: Menlo, Monaco, Consolas, monospace !important;
432
  color: inherit !important;
433
  background: #f1f1f1 !important;
@@ -468,7 +484,7 @@ body.wp-admin.folded #qm {
468
  font-style: normal !important;
469
  font-weight: normal !important;
470
  font-size: 11px !important;
471
- line-height: 16px !important;
472
  font-family: Menlo, Monaco, Consolas, monospace !important;
473
  }
474
 
@@ -506,7 +522,7 @@ body.wp-admin.folded #qm {
506
  .qm .qm-toggle,
507
  html[dir="rtl"] .qm .qm-ltr .qm-toggle {
508
  color: #0073aa !important;
509
- padding: 4px 7px 3px !important;
510
  border-top: none !important;
511
  border-right: none !important;
512
  border-left: 1px solid #e8e8e8 !important;
@@ -514,7 +530,7 @@ html[dir="rtl"] .qm .qm-ltr .qm-toggle {
514
  font-style: normal !important;
515
  font-weight: normal !important;
516
  font-size: 11px !important;
517
- line-height: 16px !important;
518
  font-family: Menlo, Monaco, Consolas, monospace !important;
519
  position: absolute !important;
520
  top: 0 !important;
@@ -541,6 +557,14 @@ html[dir="rtl"] .qm .qm-ltr .qm-toggle {
541
  color: #f00 !important;
542
  }
543
 
 
 
 
 
 
 
 
 
544
  .qm tbody tr td.qm-highlight,
545
  .qm .qm-highlight td {
546
  background-color: #ffd !important;
@@ -580,7 +604,7 @@ select.qm-filter {
580
  font-style: normal !important;
581
  font-weight: normal !important;
582
  font-size: 11px !important;
583
- line-height: 16px !important;
584
  font-family: Menlo, Monaco, Consolas, monospace !important;
585
  margin: 4px 0 2px !important;
586
  border: 1px solid #ccc !important;
@@ -741,7 +765,7 @@ html[dir="rtl"] .qm .qm-toggle {
741
  font-style: normal !important;
742
  font-weight: normal !important;
743
  font-size: 11px !important;
744
- line-height: 16px !important;
745
  font-family: Menlo, Monaco, Consolas, monospace !important;
746
  }
747
 
@@ -761,7 +785,7 @@ html[dir="rtl"] .qm .qm-toggle {
761
  font-style: normal !important;
762
  font-weight: normal !important;
763
  font-size: 11px !important;
764
- line-height: 16px !important;
765
  font-family: Menlo, Monaco, Consolas, monospace !important;
766
  }
767
 
@@ -771,7 +795,7 @@ html[dir="rtl"] .qm .qm-toggle {
771
  padding: 5px 10px 15px !important;
772
  clear: none !important;
773
  text-align: center !important;
774
- font-size: 16px !important;
775
  margin: 3px 8px 15px 0 !important;
776
  }
777
 
1
  /*
2
+ Copyright 2009-2017 John Blackbourn
3
 
4
  This program is free software; you can redistribute it and/or modify
5
  it under the terms of the GNU General Public License as published by
60
  background-color: #c00;
61
  }
62
 
63
+ .qm .qm-php-error-warning td,
64
+ .qm .qm-php-error-warning th,
65
+ .qm .qm-php-error-warning-suppressed td,
66
+ .qm .qm-php-error-warning-suppressed th {
67
+ color: #c00 !important;
68
+ }
69
+
70
  #wpadminbar .qm-warning > a {
71
  color: #fff !important;
72
  }
208
  font-style: normal !important;
209
  font-weight: normal !important;
210
  font-size: 11px !important;
211
+ line-height: 18px !important;
212
  font-family: Menlo, Monaco, Consolas, monospace !important;
213
  list-style: none !important;
214
  padding: 0 !important;
304
  font-style: normal !important;
305
  font-weight: normal !important;
306
  font-size: 11px !important;
307
+ line-height: 18px !important;
308
  font-family: Menlo, Monaco, Consolas, monospace !important;
309
  border: 1px solid #e8e8e8 !important;
310
  padding: 4px 6px 3px !important;
325
  caption-side: top !important;
326
  }
327
 
328
+ .qm tbody.qm-group:hover th,
329
  .qm tbody tr:hover th,
330
  .qm tbody tr:hover td {
331
+ background: #f7f7f7 !important;
332
  }
333
 
334
  .qm-debug-bar tbody tr:hover th,
335
  .qm-debug-bar tbody tr:hover td,
336
  #qm-conditionals tbody tr:hover td,
337
  #qm-overview tbody tr:hover td,
338
+ #qm-authentication tbody tr:hover td {
 
 
339
  background: #fff !important;
340
  }
341
 
366
  font-style: normal !important;
367
  font-weight: normal !important;
368
  font-size: 11px !important;
369
+ line-height: 18px !important;
370
  font-family: Menlo, Monaco, Consolas, monospace !important;
371
  margin: 0 !important;
372
  }
408
  font-style: normal !important;
409
  font-weight: normal !important;
410
  font-size: 11px !important;
411
+ line-height: 18px !important;
412
  font-family: Menlo, Monaco, Consolas, monospace !important;
413
+ margin-left: 0 !important;
414
  }
415
 
416
  .qm li::before {
417
  content: '' !important;
418
  }
419
 
420
+ .qm .qm-has-toggle ol.qm-numbered li {
421
+ list-style: none !important;
422
+ }
423
+
424
+ .qm .qm-toggled-on ol.qm-numbered li,
425
+ .qm ol.qm-numbered li {
426
+ list-style: decimal inside !important;
427
+ }
428
+
429
  .qm pre {
430
  font-style: normal !important;
431
  font-weight: normal !important;
432
  font-size: 11px !important;
433
+ line-height: 18px !important;
434
  font-family: Menlo, Monaco, Consolas, monospace !important;
435
  color: inherit !important;
436
  background: transparent !important;
443
  font-style: normal !important;
444
  font-weight: normal !important;
445
  font-size: 11px !important;
446
+ line-height: 18px !important;
447
  font-family: Menlo, Monaco, Consolas, monospace !important;
448
  color: inherit !important;
449
  background: #f1f1f1 !important;
484
  font-style: normal !important;
485
  font-weight: normal !important;
486
  font-size: 11px !important;
487
+ line-height: 18px !important;
488
  font-family: Menlo, Monaco, Consolas, monospace !important;
489
  }
490
 
522
  .qm .qm-toggle,
523
  html[dir="rtl"] .qm .qm-ltr .qm-toggle {
524
  color: #0073aa !important;
525
+ padding: 4px 9px 3px !important;
526
  border-top: none !important;
527
  border-right: none !important;
528
  border-left: 1px solid #e8e8e8 !important;
530
  font-style: normal !important;
531
  font-weight: normal !important;
532
  font-size: 11px !important;
533
+ line-height: 18px !important;
534
  font-family: Menlo, Monaco, Consolas, monospace !important;
535
  position: absolute !important;
536
  top: 0 !important;
557
  color: #f00 !important;
558
  }
559
 
560
+ .qm .dashicons {
561
+ font-size: 16px !important;
562
+ width: 16px !important;
563
+ height: 16px !important;
564
+ margin-right: 0.3em !important;
565
+ }
566
+
567
+ select.qm-filter.qm-highlight,
568
  .qm tbody tr td.qm-highlight,
569
  .qm .qm-highlight td {
570
  background-color: #ffd !important;
604
  font-style: normal !important;
605
  font-weight: normal !important;
606
  font-size: 11px !important;
607
+ line-height: 18px !important;
608
  font-family: Menlo, Monaco, Consolas, monospace !important;
609
  margin: 4px 0 2px !important;
610
  border: 1px solid #ccc !important;
765
  font-style: normal !important;
766
  font-weight: normal !important;
767
  font-size: 11px !important;
768
+ line-height: 18px !important;
769
  font-family: Menlo, Monaco, Consolas, monospace !important;
770
  }
771
 
785
  font-style: normal !important;
786
  font-weight: normal !important;
787
  font-size: 11px !important;
788
+ line-height: 18px !important;
789
  font-family: Menlo, Monaco, Consolas, monospace !important;
790
  }
791
 
795
  padding: 5px 10px 15px !important;
796
  clear: none !important;
797
  text-align: center !important;
798
+ font-size: 18px !important;
799
  margin: 3px 8px 15px 0 !important;
800
  }
801
 
assets/query-monitor.js CHANGED
@@ -1,5 +1,5 @@
1
  /*
2
- Copyright 2009-2016 John Blackbourn
3
 
4
  This program is free software; you can redistribute it and/or modify
5
  it under the terms of the GNU General Public License as published by
@@ -168,6 +168,9 @@ jQuery( function($) {
168
  tr.filter('[data-qm-'+hilite+'*="' + val + '"]').addClass('qm-highlight');
169
  }
170
  tr.not('[data-qm-' + filter + '*="' + val + '"]').addClass('qm-hide-' + filter);
 
 
 
171
  }
172
 
173
  var matches = tr.filter(':visible');
@@ -188,8 +191,8 @@ jQuery( function($) {
188
  var filter = $(this).data('qm-filter'),
189
  value = $(this).data('qm-value'),
190
  target = $(this).data('qm-target');
191
- $('#qm-' + target).find('.qm-filter').not('[data-filter="' + filter + '"]').val('').change();
192
- $('#qm-' + target).find('[data-filter="' + filter + '"]').val(value).change();
193
  $('html, body').scrollTop( $(this).closest('.qm').offset().top );
194
  $('html, body').animate({
195
  scrollTop: $('#qm-' + target).offset().top
1
  /*
2
+ Copyright 2009-2017 John Blackbourn
3
 
4
  This program is free software; you can redistribute it and/or modify
5
  it under the terms of the GNU General Public License as published by
168
  tr.filter('[data-qm-'+hilite+'*="' + val + '"]').addClass('qm-highlight');
169
  }
170
  tr.not('[data-qm-' + filter + '*="' + val + '"]').addClass('qm-hide-' + filter);
171
+ $(this).addClass('qm-highlight');
172
+ } else {
173
+ $(this).removeClass('qm-highlight');
174
  }
175
 
176
  var matches = tr.filter(':visible');
191
  var filter = $(this).data('qm-filter'),
192
  value = $(this).data('qm-value'),
193
  target = $(this).data('qm-target');
194
+ $('#qm-' + target).find('.qm-filter').not('[data-filter="' + filter + '"]').val('').removeClass('qm-highlight').change();
195
+ $('#qm-' + target).find('[data-filter="' + filter + '"]').val(value).addClass('qm-highlight').change();
196
  $('html, body').scrollTop( $(this).closest('.qm').offset().top );
197
  $('html, body').animate({
198
  scrollTop: $('#qm-' + target).offset().top
classes/Activation.php CHANGED
@@ -1,6 +1,6 @@
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
@@ -23,7 +23,7 @@ class QM_Activation extends QM_Plugin {
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:
@@ -38,13 +38,13 @@ class QM_Activation extends QM_Plugin {
38
  }
39
 
40
  if ( ! file_exists( $db = WP_CONTENT_DIR . '/db.php' ) && function_exists( 'symlink' ) ) {
41
- @symlink( plugin_dir_path( $this->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
  }
@@ -56,8 +56,8 @@ class QM_Activation extends QM_Plugin {
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
  }
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
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:
38
  }
39
 
40
  if ( ! file_exists( $db = WP_CONTENT_DIR . '/db.php' ) && function_exists( 'symlink' ) ) {
41
+ @symlink( plugin_dir_path( $this->file ) . 'wp-content/db.php', $db ); // @codingStandardsIgnoreLine
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
  }
56
  }
57
 
58
  # Only delete db.php if it belongs to Query Monitor
59
+ if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && class_exists( 'QM_DB' ) ) {
60
+ unlink( WP_CONTENT_DIR . '/db.php' ); // @codingStandardsIgnoreLine
61
  }
62
 
63
  }
classes/Backtrace.php CHANGED
@@ -1,6 +1,6 @@
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
@@ -73,7 +73,7 @@ class QM_Backtrace {
73
  * If error_handler() is in the trace, QM fails later when it tries
74
  * to get $lowest['file'] in get_filtered_trace()
75
  */
76
- if ( $this->trace[0]['function'] === 'error_handler' ) {
77
  $this->ignore( 1 );
78
  }
79
 
@@ -151,6 +151,10 @@ class QM_Backtrace {
151
  return $this->trace;
152
  }
153
 
 
 
 
 
154
  public function get_filtered_trace() {
155
 
156
  if ( !isset( $this->filtered_trace ) ) {
@@ -158,7 +162,7 @@ class QM_Backtrace {
158
  $trace = array_map( array( $this, 'filter_trace' ), $this->trace );
159
  $trace = array_values( array_filter( $trace ) );
160
 
161
- if ( empty( $trace ) && !empty($this->trace) ) {
162
  $lowest = $this->trace[0];
163
  $file = QM_Util::standard_dir( $lowest['file'], '' );
164
  $lowest['calling_file'] = $lowest['file'];
@@ -189,7 +193,7 @@ class QM_Backtrace {
189
  public function ignore_current_filter() {
190
 
191
  if ( isset( $this->trace[2] ) and isset( $this->trace[2]['function'] ) ) {
192
- if ( in_array( $this->trace[2]['function'], array( 'apply_filters', 'do_action' ) ) ) {
193
  $this->ignore( 3 ); # Ignore filter and action callbacks
194
  }
195
  }
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
73
  * If error_handler() is in the trace, QM fails later when it tries
74
  * to get $lowest['file'] in get_filtered_trace()
75
  */
76
+ if ( 'error_handler' === $this->trace[0]['function'] ) {
77
  $this->ignore( 1 );
78
  }
79
 
151
  return $this->trace;
152
  }
153
 
154
+ public function get_display_trace() {
155
+ return array_reverse( $this->get_filtered_trace() );
156
+ }
157
+
158
  public function get_filtered_trace() {
159
 
160
  if ( !isset( $this->filtered_trace ) ) {
162
  $trace = array_map( array( $this, 'filter_trace' ), $this->trace );
163
  $trace = array_values( array_filter( $trace ) );
164
 
165
+ if ( empty( $trace ) && ! empty( $this->trace ) ) {
166
  $lowest = $this->trace[0];
167
  $file = QM_Util::standard_dir( $lowest['file'], '' );
168
  $lowest['calling_file'] = $lowest['file'];
193
  public function ignore_current_filter() {
194
 
195
  if ( isset( $this->trace[2] ) and isset( $this->trace[2]['function'] ) ) {
196
+ if ( in_array( $this->trace[2]['function'], array( 'apply_filters', 'do_action' ), true ) ) {
197
  $this->ignore( 3 ); # Ignore filter and action callbacks
198
  }
199
  }
classes/Collector.php CHANGED
@@ -1,6 +1,6 @@
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
@@ -97,14 +97,6 @@ abstract class QM_Collector {
97
  $this->id = $id;
98
  }
99
 
100
- public static function sort_ltime( $a, $b ) {
101
- if ( $a['ltime'] == $b['ltime'] ) {
102
- return 0;
103
- } else {
104
- return ( $a['ltime'] > $b['ltime'] ) ? -1 : 1;
105
- }
106
- }
107
-
108
  public static function format_user( WP_User $user_object ) {
109
  $user = get_object_vars( $user_object->data );
110
  unset(
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
97
  $this->id = $id;
98
  }
99
 
 
 
 
 
 
 
 
 
100
  public static function format_user( WP_User $user_object ) {
101
  $user = get_object_vars( $user_object->data );
102
  unset(
classes/Collectors.php CHANGED
@@ -1,6 +1,6 @@
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
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
classes/Dispatcher.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-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
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
classes/Dispatchers.php CHANGED
@@ -1,6 +1,6 @@
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
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
classes/Output.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-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
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
classes/Plugin.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-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
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
classes/QueryMonitor.php CHANGED
@@ -1,6 +1,6 @@
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
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
classes/Util.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-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
@@ -21,6 +21,7 @@ class QM_Util {
21
  protected static $file_dirs = array();
22
  protected static $abspath = null;
23
  protected static $contentpath = null;
 
24
 
25
  private function __construct() {}
26
 
@@ -34,7 +35,7 @@ class QM_Util {
34
 
35
  if ( $bytes ) {
36
  $last = strtolower( substr( $size, -1 ) );
37
- $pos = strpos( ' kmg', $last, 1);
38
  if ( $pos ) {
39
  $bytes *= pow( 1024, $pos );
40
  }
@@ -78,6 +79,7 @@ class QM_Util {
78
  public static function get_file_dirs() {
79
  if ( empty( self::$file_dirs ) ) {
80
  self::$file_dirs['plugin'] = self::standard_dir( WP_PLUGIN_DIR );
 
81
  self::$file_dirs['go-plugin'] = self::standard_dir( WPMU_PLUGIN_DIR . '/shared-plugins' );
82
  self::$file_dirs['mu-plugin'] = self::standard_dir( WPMU_PLUGIN_DIR );
83
  self::$file_dirs['vip-plugin'] = self::standard_dir( get_theme_root() . '/vip/plugins' );
@@ -101,7 +103,8 @@ class QM_Util {
101
  }
102
 
103
  foreach ( self::get_file_dirs() as $type => $dir ) {
104
- if ( $dir && ( 0 === strpos( $file, $dir ) ) ) {
 
105
  break;
106
  }
107
  }
@@ -111,14 +114,16 @@ class QM_Util {
111
  switch ( $type ) {
112
  case 'plugin':
113
  case 'mu-plugin':
114
- $plug = plugin_basename( $file );
 
 
115
  if ( strpos( $plug, '/' ) ) {
116
  $plug = explode( '/', $plug );
117
  $plug = reset( $plug );
118
  } else {
119
  $plug = basename( $plug );
120
  }
121
- if ( 'mu-plugin' === $type ) {
122
  /* translators: %s: Plugin name */
123
  $name = sprintf( __( 'MU Plugin: %s', 'query-monitor' ), $plug );
124
  } else {
@@ -262,7 +267,7 @@ class QM_Util {
262
  if ( self::is_ajax() ) {
263
  return true;
264
  }
265
- if ( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) and 'xmlhttprequest' === strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) ) {
266
  return true;
267
  }
268
  return false;
@@ -287,10 +292,12 @@ class QM_Util {
287
  return false;
288
  }
289
 
 
290
  $num_sites = $wpdb->get_var( "
291
  SELECT COUNT(*)
292
  FROM {$wpdb->site}
293
  " );
 
294
 
295
  return ( $num_sites > 1 );
296
  }
@@ -323,5 +330,35 @@ class QM_Util {
323
  return $type;
324
  }
325
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
326
  }
327
  }
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
21
  protected static $file_dirs = array();
22
  protected static $abspath = null;
23
  protected static $contentpath = null;
24
+ protected static $sort_field = null;
25
 
26
  private function __construct() {}
27
 
35
 
36
  if ( $bytes ) {
37
  $last = strtolower( substr( $size, -1 ) );
38
+ $pos = strpos( ' kmg', $last, 1 );
39
  if ( $pos ) {
40
  $bytes *= pow( 1024, $pos );
41
  }
79
  public static function get_file_dirs() {
80
  if ( empty( self::$file_dirs ) ) {
81
  self::$file_dirs['plugin'] = self::standard_dir( WP_PLUGIN_DIR );
82
+ self::$file_dirs['mu-vendor'] = self::standard_dir( WPMU_PLUGIN_DIR . '/vendor' );
83
  self::$file_dirs['go-plugin'] = self::standard_dir( WPMU_PLUGIN_DIR . '/shared-plugins' );
84
  self::$file_dirs['mu-plugin'] = self::standard_dir( WPMU_PLUGIN_DIR );
85
  self::$file_dirs['vip-plugin'] = self::standard_dir( get_theme_root() . '/vip/plugins' );
103
  }
104
 
105
  foreach ( self::get_file_dirs() as $type => $dir ) {
106
+ // this slash makes paths such as plugins-mu match mu-plugin not plugin
107
+ if ( $dir && ( 0 === strpos( $file, trailingslashit( $dir ) ) ) ) {
108
  break;
109
  }
110
  }
114
  switch ( $type ) {
115
  case 'plugin':
116
  case 'mu-plugin':
117
+ case 'mu-vendor':
118
+ $plug = str_replace( '/vendor/', '/', $file );
119
+ $plug = plugin_basename( $plug );
120
  if ( strpos( $plug, '/' ) ) {
121
  $plug = explode( '/', $plug );
122
  $plug = reset( $plug );
123
  } else {
124
  $plug = basename( $plug );
125
  }
126
+ if ( 'plugin' !== $type ) {
127
  /* translators: %s: Plugin name */
128
  $name = sprintf( __( 'MU Plugin: %s', 'query-monitor' ), $plug );
129
  } else {
267
  if ( self::is_ajax() ) {
268
  return true;
269
  }
270
+ if ( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && 'xmlhttprequest' === strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) ) {
271
  return true;
272
  }
273
  return false;
292
  return false;
293
  }
294
 
295
+ // @codingStandardsIgnoreStart
296
  $num_sites = $wpdb->get_var( "
297
  SELECT COUNT(*)
298
  FROM {$wpdb->site}
299
  " );
300
+ // @codingStandardsIgnoreEnd
301
 
302
  return ( $num_sites > 1 );
303
  }
330
  return $type;
331
  }
332
 
333
+ public static function sort( array &$array, $field ) {
334
+ self::$sort_field = $field;
335
+ usort( $array, array( __CLASS__, '_sort' ) );
336
+ }
337
+
338
+ public static function rsort( array &$array, $field ) {
339
+ self::$sort_field = $field;
340
+ usort( $array, array( __CLASS__, '_rsort' ) );
341
+ }
342
+
343
+ private static function _rsort( $a, $b ) {
344
+ $field = self::$sort_field;
345
+
346
+ if ( $a[ $field ] == $b[ $field ] ) {
347
+ return 0;
348
+ } else {
349
+ return ( $a[ $field ] > $b[ $field ] ) ? -1 : 1;
350
+ }
351
+ }
352
+
353
+ private static function _sort( $a, $b ) {
354
+ $field = self::$sort_field;
355
+
356
+ if ( $a[ $field ] == $b[ $field ] ) {
357
+ return 0;
358
+ } else {
359
+ return ( $a[ $field ] > $b[ $field ] ) ? 1 : -1;
360
+ }
361
+ }
362
+
363
  }
364
  }
classes/debug_bar.php CHANGED
@@ -1,6 +1,6 @@
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
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
classes/debug_bar_panel.php CHANGED
@@ -1,6 +1,6 @@
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
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
collectors/admin.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-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
@@ -28,7 +28,7 @@ class QM_Collector_Admin extends QM_Collector {
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;
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
28
 
29
  $current_screen = get_current_screen();
30
 
31
+ if ( isset( $_GET['page'] ) && null !== $current_screen ) {
32
  $this->data['base'] = $current_screen->base;
33
  } else {
34
  $this->data['base'] = $pagenow;
collectors/assets.php CHANGED
@@ -1,6 +1,6 @@
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
@@ -86,7 +86,7 @@ class QM_Collector_Assets extends QM_Collector {
86
  $this->data['missing'][ $type ] = array_unique( $missing );
87
  foreach ( $this->data['missing'][ $type ] as $handle ) {
88
  $raw->add( $handle, false );
89
- if ( false !== ( $key = array_search( $handle, $raw->done ) ) ) {
90
  unset( $raw->done[ $key ] );
91
  }
92
  }
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
86
  $this->data['missing'][ $type ] = array_unique( $missing );
87
  foreach ( $this->data['missing'][ $type ] as $handle ) {
88
  $raw->add( $handle, false );
89
+ if ( false !== ( $key = array_search( $handle, $raw->done, true ) ) ) {
90
  unset( $raw->done[ $key ] );
91
  }
92
  }
collectors/cache.php CHANGED
@@ -1,6 +1,6 @@
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
@@ -54,7 +54,7 @@ class QM_Collector_Cache extends QM_Collector {
54
  $this->data['cache_hit_percentage'] = ( 100 / $total ) * $this->data['stats']['cache_hits'];
55
  }
56
 
57
- $this->data['display_hit_rate_warning'] = ( 100 == $this->data['cache_hit_percentage'] );
58
 
59
  }
60
 
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
54
  $this->data['cache_hit_percentage'] = ( 100 / $total ) * $this->data['stats']['cache_hits'];
55
  }
56
 
57
+ $this->data['display_hit_rate_warning'] = ( 100 === $this->data['cache_hit_percentage'] );
58
 
59
  }
60
 
collectors/conditionals.php CHANGED
@@ -1,6 +1,6 @@
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
@@ -73,7 +73,7 @@ class QM_Collector_Conditionals extends QM_Collector {
73
  if ( ( 'is_sticky' === $cond ) and !get_post( $id = null ) ) {
74
  # Special case for is_sticky to prevent PHP notices
75
  $false[] = $cond;
76
- } else if ( ! is_multisite() and in_array( $cond, array( 'is_main_network', 'is_main_site' ) ) ) {
77
  # Special case for multisite conditionals to prevent them from being annoying on single site installs
78
  $na[] = $cond;
79
  } else {
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
73
  if ( ( 'is_sticky' === $cond ) and !get_post( $id = null ) ) {
74
  # Special case for is_sticky to prevent PHP notices
75
  $false[] = $cond;
76
+ } else if ( ! is_multisite() && in_array( $cond, array( 'is_main_network', 'is_main_site' ), true ) ) {
77
  # Special case for multisite conditionals to prevent them from being annoying on single site installs
78
  $na[] = $cond;
79
  } else {
collectors/db_callers.php CHANGED
@@ -1,6 +1,6 @@
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
@@ -27,7 +27,7 @@ class QM_Collector_DB_Callers extends QM_Collector {
27
  if ( $dbq = QM_Collectors::get( 'db_queries' ) ) {
28
  if ( isset( $dbq->data['times'] ) ) {
29
  $this->data['times'] = $dbq->data['times'];
30
- usort( $this->data['times'], 'QM_Collector::sort_ltime' );
31
  }
32
  if ( isset( $dbq->data['types'] ) ) {
33
  $this->data['types'] = $dbq->data['types'];
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
27
  if ( $dbq = QM_Collectors::get( 'db_queries' ) ) {
28
  if ( isset( $dbq->data['times'] ) ) {
29
  $this->data['times'] = $dbq->data['times'];
30
+ QM_Util::rsort( $this->data['times'], 'ltime' );
31
  }
32
  if ( isset( $dbq->data['types'] ) ) {
33
  $this->data['types'] = $dbq->data['types'];
collectors/db_components.php CHANGED
@@ -1,6 +1,6 @@
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
@@ -27,7 +27,7 @@ class QM_Collector_DB_Components extends QM_Collector {
27
  if ( $dbq = QM_Collectors::get( 'db_queries' ) ) {
28
  if ( isset( $dbq->data['component_times'] ) ) {
29
  $this->data['times'] = $dbq->data['component_times'];
30
- usort( $this->data['times'], 'QM_Collector::sort_ltime' );
31
  }
32
  if ( isset( $dbq->data['types'] ) ) {
33
  $this->data['types'] = $dbq->data['types'];
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
27
  if ( $dbq = QM_Collectors::get( 'db_queries' ) ) {
28
  if ( isset( $dbq->data['component_times'] ) ) {
29
  $this->data['times'] = $dbq->data['component_times'];
30
+ QM_Util::rsort( $this->data['times'], 'ltime' );
31
  }
32
  if ( isset( $dbq->data['types'] ) ) {
33
  $this->data['types'] = $dbq->data['types'];
collectors/db_dupes.php CHANGED
@@ -1,6 +1,6 @@
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
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
collectors/db_queries.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-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
@@ -215,9 +215,13 @@ class QM_Collector_DB_Queries extends QM_Collector {
215
  $this->data['total_qs'] += $total_qs;
216
  $this->data['total_time'] += $total_time;
217
 
 
 
 
 
218
  # @TODO put errors in here too:
219
  # @TODO proper class instead of (object)
220
- $this->data['dbs'][$id] = (object) compact( 'rows', 'types', 'has_result', 'has_trace', 'total_time', 'total_qs' );
221
 
222
  }
223
 
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
215
  $this->data['total_qs'] += $total_qs;
216
  $this->data['total_time'] += $total_time;
217
 
218
+ $has_main_query = wp_list_filter( $rows, array(
219
+ 'is_main_query' => true,
220
+ ) );
221
+
222
  # @TODO put errors in here too:
223
  # @TODO proper class instead of (object)
224
+ $this->data['dbs'][$id] = (object) compact( 'rows', 'types', 'has_result', 'has_trace', 'total_time', 'total_qs', 'has_main_query' );
225
 
226
  }
227
 
collectors/debug_bar.php CHANGED
@@ -1,6 +1,6 @@
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
@@ -74,7 +74,7 @@ function register_qm_collectors_debug_bar() {
74
  foreach ( $debug_bar->panels as $panel ) {
75
  $panel_id = strtolower( get_class( $panel ) );
76
 
77
- if ( in_array( $panel_id, $redundant ) ) {
78
  continue;
79
  }
80
 
@@ -88,6 +88,7 @@ function register_qm_collectors_debug_bar() {
88
  }
89
 
90
  function qm_debug_bar_being_activated() {
 
91
 
92
  if ( ! is_admin() ) {
93
  return false;
@@ -103,7 +104,7 @@ function qm_debug_bar_being_activated() {
103
  return false;
104
  }
105
 
106
- if ( 'activate' === $_GET['action'] && false !== strpos( $_GET['plugin'], 'debug-bar.php' ) ) {
107
  return true;
108
  }
109
 
@@ -113,14 +114,14 @@ function qm_debug_bar_being_activated() {
113
  return false;
114
  }
115
 
116
- if ( 'activate-selected' === $_POST['action'] && in_array( 'debug-bar/debug-bar.php', $_POST['checked'] ) ) {
117
  return true;
118
  }
119
 
120
  }
121
 
122
  return false;
123
-
124
  }
125
 
126
  add_action( 'init', 'register_qm_collectors_debug_bar' );
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
74
  foreach ( $debug_bar->panels as $panel ) {
75
  $panel_id = strtolower( get_class( $panel ) );
76
 
77
+ if ( in_array( $panel_id, $redundant, true ) ) {
78
  continue;
79
  }
80
 
88
  }
89
 
90
  function qm_debug_bar_being_activated() {
91
+ // @codingStandardsIgnoreStart
92
 
93
  if ( ! is_admin() ) {
94
  return false;
104
  return false;
105
  }
106
 
107
+ if ( 'activate' === $_GET['action'] && false !== strpos( wp_unslash( $_GET['plugin'] ), 'debug-bar.php' ) ) {
108
  return true;
109
  }
110
 
114
  return false;
115
  }
116
 
117
+ if ( 'activate-selected' === wp_unslash( $_POST['action'] ) && in_array( 'debug-bar/debug-bar.php', wp_unslash( $_POST['checked'] ), true ) ) {
118
  return true;
119
  }
120
 
121
  }
122
 
123
  return false;
124
+ // @codingStandardsIgnoreEnd
125
  }
126
 
127
  add_action( 'init', 'register_qm_collectors_debug_bar' );
collectors/environment.php CHANGED
@@ -1,6 +1,6 @@
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
@@ -169,6 +169,20 @@ class QM_Collector_Environment extends QM_Collector {
169
  $this->data['php']['variables'][$setting]['after'] = ini_get( $setting );
170
  }
171
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  $this->data['php']['error_reporting'] = error_reporting();
173
 
174
  $this->data['wp'] = array(
@@ -188,8 +202,12 @@ class QM_Collector_Environment extends QM_Collector {
188
  $this->data['wp']['SUNRISE'] = self::format_bool_constant( 'SUNRISE' );
189
  }
190
 
191
- $server = explode( ' ', $_SERVER['SERVER_SOFTWARE'] );
192
- $server = explode( '/', reset( $server ) );
 
 
 
 
193
 
194
  if ( isset( $server[1] ) ) {
195
  $server_version = $server[1];
@@ -197,8 +215,8 @@ class QM_Collector_Environment extends QM_Collector {
197
  $server_version = null;
198
  }
199
 
200
- if ( isset( $_SERVER['SERVER_ADDR'] ) ) {
201
- $address = $_SERVER['SERVER_ADDR'];
202
  } else {
203
  $address = null;
204
  }
@@ -229,12 +247,12 @@ class QM_Collector_Environment extends QM_Collector {
229
  }
230
  }
231
 
232
- if ( empty( $php_u ) and isset( $_SERVER['USER'] ) ) {
233
- $php_u = $_SERVER['USER'];
234
  }
235
 
236
  if ( empty( $php_u ) and function_exists( 'exec' ) ) {
237
- $php_u = exec( 'whoami' );
238
  }
239
 
240
  if ( empty( $php_u ) and function_exists( 'getenv' ) ) {
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
169
  $this->data['php']['variables'][$setting]['after'] = ini_get( $setting );
170
  }
171
 
172
+ if ( is_callable( 'get_loaded_extensions' ) ) {
173
+ $this->data['php']['extensions'] = get_loaded_extensions();
174
+ } else {
175
+ $this->data['php']['extensions'] = array();
176
+ }
177
+
178
+ if ( defined( 'SORT_FLAG_CASE' ) ) {
179
+ $sort_flags = SORT_STRING | SORT_FLAG_CASE;
180
+ } else {
181
+ $sort_flags = SORT_STRING;
182
+ }
183
+
184
+ sort( $this->data['php']['extensions'], $sort_flags );
185
+
186
  $this->data['php']['error_reporting'] = error_reporting();
187
 
188
  $this->data['wp'] = array(
202
  $this->data['wp']['SUNRISE'] = self::format_bool_constant( 'SUNRISE' );
203
  }
204
 
205
+ if ( isset( $_SERVER['SERVER_SOFTWARE'] ) ) { // WPCS: input var ok
206
+ $server = explode( ' ', wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ); // WPCS: sanitization ok, input var ok
207
+ $server = explode( '/', reset( $server ) );
208
+ } else {
209
+ $server = array( '' );
210
+ }
211
 
212
  if ( isset( $server[1] ) ) {
213
  $server_version = $server[1];
215
  $server_version = null;
216
  }
217
 
218
+ if ( isset( $_SERVER['SERVER_ADDR'] ) ) { // WPCS: input var ok
219
+ $address = wp_unslash( $_SERVER['SERVER_ADDR'] ); // WPCS: sanitization ok, input var ok
220
  } else {
221
  $address = null;
222
  }
247
  }
248
  }
249
 
250
+ if ( empty( $php_u ) and isset( $_SERVER['USER'] ) ) { // WPCS: input var ok
251
+ $php_u = wp_unslash( $_SERVER['USER'] ); // WPCS: sanitization ok, input var ok
252
  }
253
 
254
  if ( empty( $php_u ) and function_exists( 'exec' ) ) {
255
+ $php_u = exec( 'whoami' ); // @codingStandardsIgnoreLine
256
  }
257
 
258
  if ( empty( $php_u ) and function_exists( 'getenv' ) ) {
collectors/hooks.php CHANGED
@@ -1,6 +1,6 @@
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
@@ -17,17 +17,19 @@ GNU General Public License for more details.
17
  class QM_Collector_Hooks extends QM_Collector {
18
 
19
  public $id = 'hooks';
 
 
20
 
21
  public function name() {
22
- return __( 'Hooks', 'query-monitor' );
23
  }
24
 
25
  public function process() {
26
 
27
  global $wp_actions, $wp_filter;
28
 
29
- $this->hide_qm = ( defined( 'QM_HIDE_SELF' ) and QM_HIDE_SELF );
30
- $this->hide_core = ( defined( 'QM_HIDE_CORE_HOOKS' ) and QM_HIDE_CORE_HOOKS );
31
 
32
  if ( is_admin() and ( $admin = QM_Collectors::get( 'admin' ) ) ) {
33
  $this->data['screen'] = $admin->data['base'];
@@ -38,7 +40,7 @@ class QM_Collector_Hooks extends QM_Collector {
38
  $hooks = $all_parts = $components = array();
39
 
40
  if ( has_filter( 'all' ) ) {
41
- $hooks['all'] = $this->process_action( 'all', $wp_filter );
42
  }
43
 
44
  if ( defined( 'QM_SHOW_ALL_HOOKS' ) && QM_SHOW_ALL_HOOKS ) {
@@ -51,7 +53,7 @@ class QM_Collector_Hooks extends QM_Collector {
51
 
52
  foreach ( $hook_names as $name ) {
53
 
54
- $hooks[$name] = $this->process_action( $name, $wp_filter );
55
 
56
  $all_parts = array_merge( $all_parts, $hooks[$name]['parts'] );
57
  $components = array_merge( $components, $hooks[$name]['components'] );
@@ -64,7 +66,7 @@ class QM_Collector_Hooks extends QM_Collector {
64
 
65
  }
66
 
67
- protected function process_action( $name, array $wp_filter ) {
68
 
69
  $actions = $components = array();
70
 
@@ -81,8 +83,8 @@ class QM_Collector_Hooks extends QM_Collector {
81
 
82
  if ( isset( $callback['component'] ) ) {
83
  if (
84
- ( $this->hide_qm and 'query-monitor' === $callback['component']->context )
85
- or ( $this->hide_core and 'core' === $callback['component']->context )
86
  ) {
87
  continue;
88
  }
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
17
  class QM_Collector_Hooks extends QM_Collector {
18
 
19
  public $id = 'hooks';
20
+ protected static $hide_core;
21
+ protected static $hide_qm;
22
 
23
  public function name() {
24
+ return __( 'Hooks & Actions', 'query-monitor' );
25
  }
26
 
27
  public function process() {
28
 
29
  global $wp_actions, $wp_filter;
30
 
31
+ self::$hide_qm = ( defined( 'QM_HIDE_SELF' ) && QM_HIDE_SELF );
32
+ self::$hide_core = ( defined( 'QM_HIDE_CORE_HOOKS' ) && QM_HIDE_CORE_HOOKS );
33
 
34
  if ( is_admin() and ( $admin = QM_Collectors::get( 'admin' ) ) ) {
35
  $this->data['screen'] = $admin->data['base'];
40
  $hooks = $all_parts = $components = array();
41
 
42
  if ( has_filter( 'all' ) ) {
43
+ $hooks['all'] = self::process_action( 'all', $wp_filter, self::$hide_qm, self::$hide_core );
44
  }
45
 
46
  if ( defined( 'QM_SHOW_ALL_HOOKS' ) && QM_SHOW_ALL_HOOKS ) {
53
 
54
  foreach ( $hook_names as $name ) {
55
 
56
+ $hooks[$name] = self::process_action( $name, $wp_filter, self::$hide_qm, self::$hide_core );
57
 
58
  $all_parts = array_merge( $all_parts, $hooks[$name]['parts'] );
59
  $components = array_merge( $components, $hooks[$name]['components'] );
66
 
67
  }
68
 
69
+ public static function process_action( $name, array $wp_filter, $hide_qm = false, $hide_core = false ) {
70
 
71
  $actions = $components = array();
72
 
83
 
84
  if ( isset( $callback['component'] ) ) {
85
  if (
86
+ ( $hide_qm && 'query-monitor' === $callback['component']->context )
87
+ || ( $hide_core && 'core' === $callback['component']->context )
88
  ) {
89
  continue;
90
  }
collectors/http.php CHANGED
@@ -1,6 +1,6 @@
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
@@ -19,7 +19,7 @@ class QM_Collector_HTTP extends QM_Collector {
19
  public $id = 'http';
20
 
21
  public function name() {
22
- return __( 'HTTP Requests', 'query-monitor' );
23
  }
24
 
25
  public function __construct() {
@@ -182,7 +182,7 @@ class QM_Collector_HTTP extends QM_Collector {
182
  }
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' );
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
19
  public $id = 'http';
20
 
21
  public function name() {
22
+ return __( 'HTTP API Requests', 'query-monitor' );
23
  }
24
 
25
  public function __construct() {
182
  }
183
 
184
  if ( is_wp_error( $http['response'] ) ) {
185
+ if ( ! in_array( $http['response']->get_error_code(), $silent, true ) ) {
186
  $this->data['errors']['alert'][] = $key;
187
  }
188
  $http['type'] = __( 'Error', 'query-monitor' );
collectors/languages.php CHANGED
@@ -1,6 +1,6 @@
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
@@ -32,6 +32,7 @@ class QM_Collector_Languages extends QM_Collector {
32
 
33
  public function process() {
34
  $this->data['locale'] = get_locale();
 
35
  }
36
 
37
  /**
@@ -80,7 +81,7 @@ class QM_Collector_Languages extends QM_Collector {
80
  $caller['line'] = $filtered[0]['line'];
81
  }
82
 
83
- $this->data['languages'][] = array(
84
  'caller' => $caller,
85
  'domain' => $domain,
86
  'mofile' => $mofile,
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
32
 
33
  public function process() {
34
  $this->data['locale'] = get_locale();
35
+ ksort( $this->data['languages'] );
36
  }
37
 
38
  /**
81
  $caller['line'] = $filtered[0]['line'];
82
  }
83
 
84
+ $this->data['languages'][ $domain ][] = array(
85
  'caller' => $caller,
86
  'domain' => $domain,
87
  'mofile' => $mofile,
collectors/overview.php CHANGED
@@ -1,6 +1,6 @@
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
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
collectors/php_errors.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-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
@@ -86,7 +86,7 @@ class QM_Collector_PHP_Errors extends QM_Collector {
86
  return false;
87
  }
88
 
89
- if ( error_reporting() === 0 && $this->error_reporting !== 0 ) {
90
  // This is most likely an @-suppressed error
91
  $type .= '-suppressed';
92
  }
@@ -96,8 +96,8 @@ class QM_Collector_PHP_Errors extends QM_Collector {
96
  // but do not get seen by GlotPress when it populates its database of translatable strings for QM.
97
  $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>.';
98
  $wordpress_couldnt = '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)';
99
- self::$unexpected_error = __( $unexpected_error );
100
- self::$wordpress_couldnt = __( $wordpress_couldnt );
101
  }
102
 
103
  // Intentionally skip reporting these core warnings. They're a distraction when developing offline.
@@ -167,7 +167,8 @@ class QM_Collector_PHP_Errors extends QM_Collector {
167
 
168
  } else {
169
 
170
- printf( '<br /><b>%1$s</b>: %2$s in <b>%3$s</b> on line <b>%4$d</b><br />',
 
171
  htmlentities( $error ),
172
  htmlentities( $e['message'] ),
173
  htmlentities( $e['file'] ),
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
86
  return false;
87
  }
88
 
89
+ if ( 0 === error_reporting() && 0 !== $this->error_reporting ) {
90
  // This is most likely an @-suppressed error
91
  $type .= '-suppressed';
92
  }
96
  // but do not get seen by GlotPress when it populates its database of translatable strings for QM.
97
  $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>.';
98
  $wordpress_couldnt = '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)';
99
+ self::$unexpected_error = call_user_func( '__', $unexpected_error );
100
+ self::$wordpress_couldnt = call_user_func( '__', $wordpress_couldnt );
101
  }
102
 
103
  // Intentionally skip reporting these core warnings. They're a distraction when developing offline.
167
 
168
  } else {
169
 
170
+ printf( // WPCS: XSS ok.
171
+ '<br /><b>%1$s</b>: %2$s in <b>%3$s</b> on line <b>%4$d</b><br />',
172
  htmlentities( $error ),
173
  htmlentities( $e['message'] ),
174
  htmlentities( $e['file'] ),
collectors/redirects.php CHANGED
@@ -1,6 +1,6 @@
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
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
collectors/request.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-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
@@ -51,7 +51,11 @@ class QM_Collector_Request extends QM_Collector {
51
  }
52
 
53
  if ( is_admin() ) {
54
- $this->data['request']['request'] = $_SERVER['REQUEST_URI'];
 
 
 
 
55
  foreach ( array( 'query_string' ) as $item ) {
56
  $this->data['request'][$item] = $wp->$item;
57
  }
@@ -146,7 +150,11 @@ class QM_Collector_Request extends QM_Collector {
146
  $this->data['queried_object']['data'] = $qo;
147
  }
148
 
149
- $this->data['request_method'] = strtoupper( $_SERVER['REQUEST_METHOD'] );
 
 
 
 
150
 
151
  }
152
 
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
51
  }
52
 
53
  if ( is_admin() ) {
54
+ if ( isset( $_SERVER['REQUEST_URI'] ) ) {
55
+ $this->data['request']['request'] = wp_unslash( $_SERVER['REQUEST_URI'] ); // @codingStandardsIgnoreLine
56
+ } else {
57
+ $this->data['request']['request'] = '';
58
+ }
59
  foreach ( array( 'query_string' ) as $item ) {
60
  $this->data['request'][$item] = $wp->$item;
61
  }
150
  $this->data['queried_object']['data'] = $qo;
151
  }
152
 
153
+ if ( isset( $_SERVER['REQUEST_METHOD'] ) ) {
154
+ $this->data['request_method'] = strtoupper( wp_unslash( $_SERVER['REQUEST_METHOD'] ) ); // @codingStandardsIgnoreLine
155
+ } else {
156
+ $this->data['request_method'] = '';
157
+ }
158
 
159
  }
160
 
collectors/rewrites.php CHANGED
@@ -1,6 +1,6 @@
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
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
collectors/theme.php CHANGED
@@ -1,6 +1,6 @@
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
@@ -153,7 +153,7 @@ class QM_Collector_Theme extends QM_Collector {
153
 
154
  $this->data['stylesheet'] = get_stylesheet();
155
  $this->data['template'] = get_template();
156
- $this->data['is_child_theme'] = ( $this->data['stylesheet'] != $this->data['template'] );
157
 
158
  if ( isset( $this->data['body_class'] ) ) {
159
  asort( $this->data['body_class'] );
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
153
 
154
  $this->data['stylesheet'] = get_stylesheet();
155
  $this->data['template'] = get_template();
156
+ $this->data['is_child_theme'] = ( $this->data['stylesheet'] !== $this->data['template'] );
157
 
158
  if ( isset( $this->data['body_class'] ) ) {
159
  asort( $this->data['body_class'] );
collectors/transients.php CHANGED
@@ -1,6 +1,6 @@
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
@@ -24,7 +24,6 @@ class QM_Collector_Transients extends QM_Collector {
24
 
25
  public function __construct() {
26
  parent::__construct();
27
- # See http://core.trac.wordpress.org/ticket/24583
28
  add_action( 'setted_site_transient', array( $this, 'action_setted_site_transient' ), 10, 3 );
29
  add_action( 'setted_transient', array( $this, 'action_setted_blog_transient' ), 10, 3 );
30
  }
@@ -35,15 +34,15 @@ class QM_Collector_Transients extends QM_Collector {
35
  remove_action( 'setted_transient', array( $this, 'action_setted_blog_transient' ), 10 );
36
  }
37
 
38
- public function action_setted_site_transient( $transient, $value = null, $expiration = null ) {
39
  $this->setted_transient( $transient, 'site', $value, $expiration );
40
  }
41
 
42
- public function action_setted_blog_transient( $transient, $value = null, $expiration = null ) {
43
  $this->setted_transient( $transient, 'blog', $value, $expiration );
44
  }
45
 
46
- public function setted_transient( $transient, $type, $value = null, $expiration = null ) {
47
  $trace = new QM_Backtrace( array(
48
  'ignore_items' => 1 # Ignore the action_setted_(site|blog)_transient method
49
  ) );
@@ -53,6 +52,7 @@ class QM_Collector_Transients extends QM_Collector {
53
  'type' => $type,
54
  'value' => $value,
55
  'expiration' => $expiration,
 
56
  );
57
  }
58
 
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
24
 
25
  public function __construct() {
26
  parent::__construct();
 
27
  add_action( 'setted_site_transient', array( $this, 'action_setted_site_transient' ), 10, 3 );
28
  add_action( 'setted_transient', array( $this, 'action_setted_blog_transient' ), 10, 3 );
29
  }
34
  remove_action( 'setted_transient', array( $this, 'action_setted_blog_transient' ), 10 );
35
  }
36
 
37
+ public function action_setted_site_transient( $transient, $value, $expiration ) {
38
  $this->setted_transient( $transient, 'site', $value, $expiration );
39
  }
40
 
41
+ public function action_setted_blog_transient( $transient, $value, $expiration ) {
42
  $this->setted_transient( $transient, 'blog', $value, $expiration );
43
  }
44
 
45
+ public function setted_transient( $transient, $type, $value, $expiration ) {
46
  $trace = new QM_Backtrace( array(
47
  'ignore_items' => 1 # Ignore the action_setted_(site|blog)_transient method
48
  ) );
52
  'type' => $type,
53
  'value' => $value,
54
  'expiration' => $expiration,
55
+ 'size' => strlen( maybe_serialize( $value ) ),
56
  );
57
  }
58
 
dispatchers/AJAX.php CHANGED
@@ -1,6 +1,6 @@
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
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
dispatchers/Html.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-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
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
dispatchers/REST.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-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
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
dispatchers/Redirect.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-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
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
output/Headers.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-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
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
output/Html.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-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
@@ -101,7 +101,7 @@ abstract class QM_Output_Html extends QM_Output {
101
 
102
  $filter_id = 'qm-filter-' . $this->collector->id . '-' . $name;
103
 
104
- $out = '<label for="' . esc_attr( $filter_id ) .'">' . esc_html( $label ) . '</label>';
105
  $out .= '<select id="' . esc_attr( $filter_id ) . '" class="qm-filter" data-filter="' . esc_attr( $name ) . '" data-highlight="' . esc_attr( $args['highlight'] ) . '">';
106
  $out .= '<option value="">' . esc_html_x( 'All', '"All" option for filters', 'query-monitor' ) . '</option>';
107
 
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
101
 
102
  $filter_id = 'qm-filter-' . $this->collector->id . '-' . $name;
103
 
104
+ $out = '<label for="' . esc_attr( $filter_id ) . '">' . esc_html( $label ) . '</label>';
105
  $out .= '<select id="' . esc_attr( $filter_id ) . '" class="qm-filter" data-filter="' . esc_attr( $name ) . '" data-highlight="' . esc_attr( $args['highlight'] ) . '">';
106
  $out .= '<option value="">' . esc_html_x( 'All', '"All" option for filters', 'query-monitor' ) . '</option>';
107
 
output/headers/overview.php CHANGED
@@ -1,6 +1,6 @@
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
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
output/headers/php_errors.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-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
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
output/headers/redirects.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-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
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
output/html/admin.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-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
@@ -39,7 +39,7 @@ class QM_Output_Html_Admin extends QM_Output_Html {
39
  echo '<th>' . esc_html__( 'Value', 'query-monitor' ) . '</th>';
40
  echo '</tr>';
41
  echo '</thead>';
42
- echo '<tbody>';
43
 
44
  $first = true;
45
 
@@ -50,13 +50,16 @@ class QM_Output_Html_Admin extends QM_Output_Html {
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>';
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
39
  echo '<th>' . esc_html__( 'Value', 'query-monitor' ) . '</th>';
40
  echo '</tr>';
41
  echo '</thead>';
42
+ echo '<tbody class="qm-group">';
43
 
44
  $first = true;
45
 
50
  echo '<th class="qm-ltr" rowspan="' . count( $data['current_screen'] ) . '">get_current_screen()</th>';
51
  }
52
 
53
+ echo '<td>' . esc_html( $key ) . '</td>';
54
  echo '<td>' . esc_html( $value ) . '</td>';
55
  echo '</tr>';
56
 
57
  $first = false;
58
  }
59
 
60
+ echo '</tbody>';
61
+
62
+ echo '<tbody>';
63
  echo '<tr>';
64
  echo '<th class="qm-ltr">$pagenow</th>';
65
  echo '<td colspan="2">' . esc_html( $data['pagenow'] ) . '</td>';
output/html/assets.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
@@ -64,7 +64,6 @@ class QM_Output_Html_Assets extends QM_Output_Html {
64
  echo '<th scope="col">' . esc_html__( 'Version', 'query-monitor' ) . '</th>';
65
  echo '</tr>';
66
  echo '</thead>';
67
- echo '<tbody>';
68
 
69
  foreach ( array(
70
  'missing',
@@ -79,7 +78,6 @@ class QM_Output_Html_Assets extends QM_Output_Html {
79
 
80
  }
81
 
82
- echo '</tbody>';
83
  echo '</table>';
84
  echo '</div>';
85
 
@@ -94,16 +92,20 @@ class QM_Output_Html_Assets extends QM_Output_Html {
94
  $first = true;
95
 
96
  if ( empty( $handles ) ) {
 
97
  echo '<tr>';
98
  echo '<td class="qm-nowrap">' . esc_html( $label ) . '</td>';
99
  echo '<td colspan="5"><em>' . esc_html__( 'none', 'query-monitor' ) . '</em></td>';
100
  echo '</tr>';
 
101
  return;
102
  }
103
 
 
 
104
  foreach ( $handles as $handle ) {
105
 
106
- if ( in_array( $handle, $dependencies->done ) ) {
107
  echo '<tr data-qm-subject="' . esc_attr( $type . '-' . $handle ) . '">';
108
  } else {
109
  echo '<tr data-qm-subject="' . esc_attr( $type . '-' . $handle ) . '" class="qm-warn">';
@@ -117,9 +119,12 @@ class QM_Output_Html_Assets extends QM_Output_Html {
117
  $this->dependency_row( $dependencies->query( $handle ), $dependencies, $type );
118
 
119
  echo '</tr>';
 
120
  $first = false;
121
  }
122
 
 
 
123
  }
124
 
125
  protected function dependency_row( _WP_Dependency $dependency, WP_Dependencies $dependencies, $type ) {
@@ -169,7 +174,7 @@ class QM_Output_Html_Assets extends QM_Output_Html {
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 qm-ltr">' . esc_html( $dependency->handle ) . '<br><span class="qm-info qm-supplemental">';
173
  if ( is_wp_error( $source ) ) {
174
  printf( '<span class="qm-warn">%s</span>',
175
  esc_html( $src )
@@ -196,7 +201,7 @@ class QM_Output_Html_Assets extends QM_Output_Html {
196
 
197
  foreach ( $handles as $handle ) {
198
  if ( $item = $dependencies->query( $handle ) ) {
199
- if ( in_array( $dependency->handle, $item->deps ) ) {
200
  $dependents[] = $handle;
201
  }
202
  }
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
64
  echo '<th scope="col">' . esc_html__( 'Version', 'query-monitor' ) . '</th>';
65
  echo '</tr>';
66
  echo '</thead>';
 
67
 
68
  foreach ( array(
69
  'missing',
78
 
79
  }
80
 
 
81
  echo '</table>';
82
  echo '</div>';
83
 
92
  $first = true;
93
 
94
  if ( empty( $handles ) ) {
95
+ echo '<tbody>';
96
  echo '<tr>';
97
  echo '<td class="qm-nowrap">' . esc_html( $label ) . '</td>';
98
  echo '<td colspan="5"><em>' . esc_html__( 'none', 'query-monitor' ) . '</em></td>';
99
  echo '</tr>';
100
+ echo '</tbody>';
101
  return;
102
  }
103
 
104
+ echo '<tbody class="qm-group">';
105
+
106
  foreach ( $handles as $handle ) {
107
 
108
+ if ( in_array( $handle, $dependencies->done, true ) ) {
109
  echo '<tr data-qm-subject="' . esc_attr( $type . '-' . $handle ) . '">';
110
  } else {
111
  echo '<tr data-qm-subject="' . esc_attr( $type . '-' . $handle ) . '" class="qm-warn">';
119
  $this->dependency_row( $dependencies->query( $handle ), $dependencies, $type );
120
 
121
  echo '</tr>';
122
+
123
  $first = false;
124
  }
125
 
126
+ echo '</tbody>';
127
+
128
  }
129
 
130
  protected function dependency_row( _WP_Dependency $dependency, WP_Dependencies $dependencies, $type ) {
174
  $highlight_deps = array_map( array( $this, '_prefix_type' ), $deps );
175
  $highlight_dependents = array_map( array( $this, '_prefix_type' ), $dependents );
176
 
177
+ echo '<td class="qm-wrap qm-ltr">' . esc_html( $dependency->handle ) . '<br><span class="qm-info qm-supplemental">';
178
  if ( is_wp_error( $source ) ) {
179
  printf( '<span class="qm-warn">%s</span>',
180
  esc_html( $src )
201
 
202
  foreach ( $handles as $handle ) {
203
  if ( $item = $dependencies->query( $handle ) ) {
204
+ if ( in_array( $dependency->handle, $item->deps, true ) ) {
205
  $dependents[] = $handle;
206
  }
207
  }
output/html/conditionals.php CHANGED
@@ -1,6 +1,6 @@
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
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
output/html/db_callers.php CHANGED
@@ -1,6 +1,6 @@
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
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
output/html/db_components.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-2016 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
@@ -94,7 +94,7 @@ class QM_Output_Html_DB_Components extends QM_Output_Html {
94
  echo '<td class="qm-num">' . esc_html( number_format_i18n( $type_count ) ) . '</td>';
95
  }
96
 
97
- echo '<td class="qm-num">' . esc_html( $total_stime ) . '</td>';
98
  echo '</tr>';
99
  echo '</tfoot>';
100
 
@@ -102,7 +102,14 @@ class QM_Output_Html_DB_Components extends QM_Output_Html {
102
 
103
  echo '<tbody>';
104
  echo '<tr>';
105
- echo '<td colspan="' . esc_attr( $span ) . '" style="text-align:center !important"><em>' . esc_html__( 'Unknown', 'query-monitor' ) . '</em></td>';
 
 
 
 
 
 
 
106
  echo '</tr>';
107
  echo '</tbody>';
108
 
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
94
  echo '<td class="qm-num">' . esc_html( number_format_i18n( $type_count ) ) . '</td>';
95
  }
96
 
97
+ echo '<td class="qm-num">' . esc_html( $total_stime ) . '</td>';
98
  echo '</tr>';
99
  echo '</tfoot>';
100
 
102
 
103
  echo '<tbody>';
104
  echo '<tr>';
105
+ echo '<td colspan="' . esc_attr( $span ) . '" style="text-align:center !important">';
106
+ echo '<em>' . esc_html__( 'Unknown', 'query-monitor' ) . '</em>';
107
+ printf(
108
+ '&nbsp;<span class="qm-info">(<a href="%s" target="_blank">%s</a>)</span>',
109
+ 'https://github.com/johnbillion/query-monitor/wiki/db.php-Symlink',
110
+ esc_html__( 'Help', 'query-monitor' )
111
+ );
112
+ echo '</td>';
113
  echo '</tr>';
114
  echo '</tbody>';
115
 
output/html/db_queries.php CHANGED
@@ -1,6 +1,6 @@
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
@@ -163,7 +163,7 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
163
  */
164
  if ( apply_filters( 'qm/show_extended_query_prompt', true ) && ! $db->has_trace && ( '$wpdb' === $name ) ) {
165
  echo '<tr>';
166
- echo '<td colspan="' . absint( $span ) . '" class="qm-warn">';
167
  if ( file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
168
  /* translators: 1: Symlink file name, 2: URL to wiki page */
169
  $message = __( 'Extended query information such as the component and affected rows is not available. A conflicting %1$s file is present. <a href="%2$s" target="_blank">See this wiki page for more information.</a>', 'query-monitor' );
@@ -195,17 +195,15 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
195
  echo '<th scope="col">';
196
 
197
  $prepend = array();
198
- $has_main_query = wp_list_filter( $db->rows, array(
199
- 'is_main_query' => true,
200
- ) );
201
 
202
- if ( $has_main_query ) {
203
  $prepend['qm-main-query'] = __( 'Main Query', 'query-monitor' );
204
  }
205
 
206
- echo $this->build_filter( 'caller', wp_list_pluck( $data['times'], 'caller' ), __( 'Caller', 'query-monitor' ), array(
207
  'prepend' => $prepend,
208
- ) ); // WPCS: XSS ok;
 
209
  echo '</th>';
210
 
211
  if ( $db->has_trace ) {
@@ -315,8 +313,8 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
315
  $caller = $row['trace']->get_caller();
316
  $caller_name = self::output_filename( $row['caller'], $caller['calling_file'], $caller['calling_line'] );
317
  $stack = array();
318
- $filtered_trace = $row['trace']->get_filtered_trace();
319
- array_shift( $filtered_trace );
320
 
321
  foreach ( $filtered_trace as $item ) {
322
  $stack[] = self::output_filename( $item['display'], $item['calling_file'], $item['calling_line'] );
@@ -375,15 +373,15 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
375
  }
376
 
377
  if ( isset( $cols['caller'] ) ) {
378
- echo "<td class='qm-row-caller qm-ltr qm-has-toggle qm-nowrap'><ol class='qm-toggler'>";
379
-
380
- echo "<li>{$caller_name}</li>"; // WPCS: XSS ok.
381
 
382
  if ( ! empty( $stack ) ) {
383
  echo '<button class="qm-toggle" data-on="+" data-off="-">+</button>';
384
  echo '<div class="qm-toggled"><li>' . implode( '</li><li>', $stack ) . '</li></div>'; // WPCS: XSS ok.
385
  }
386
 
 
 
387
  echo '</ol>';
388
  if ( $row['is_main_query'] ) {
389
  printf(
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
163
  */
164
  if ( apply_filters( 'qm/show_extended_query_prompt', true ) && ! $db->has_trace && ( '$wpdb' === $name ) ) {
165
  echo '<tr>';
166
+ echo '<td colspan="' . absint( $span ) . '" class="qm-warn"><span class="dashicons dashicons-warning"></span>';
167
  if ( file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
168
  /* translators: 1: Symlink file name, 2: URL to wiki page */
169
  $message = __( 'Extended query information such as the component and affected rows is not available. A conflicting %1$s file is present. <a href="%2$s" target="_blank">See this wiki page for more information.</a>', 'query-monitor' );
195
  echo '<th scope="col">';
196
 
197
  $prepend = array();
 
 
 
198
 
199
+ if ( $db->has_main_query ) {
200
  $prepend['qm-main-query'] = __( 'Main Query', 'query-monitor' );
201
  }
202
 
203
+ $args = array(
204
  'prepend' => $prepend,
205
+ );
206
+ echo $this->build_filter( 'caller', wp_list_pluck( $data['times'], 'caller' ), __( 'Caller', 'query-monitor' ), $args ); // WPCS: XSS ok.
207
  echo '</th>';
208
 
209
  if ( $db->has_trace ) {
313
  $caller = $row['trace']->get_caller();
314
  $caller_name = self::output_filename( $row['caller'], $caller['calling_file'], $caller['calling_line'] );
315
  $stack = array();
316
+ $filtered_trace = $row['trace']->get_display_trace();
317
+ array_pop( $filtered_trace );
318
 
319
  foreach ( $filtered_trace as $item ) {
320
  $stack[] = self::output_filename( $item['display'], $item['calling_file'], $item['calling_line'] );
373
  }
374
 
375
  if ( isset( $cols['caller'] ) ) {
376
+ echo "<td class='qm-row-caller qm-ltr qm-has-toggle qm-nowrap'><ol class='qm-toggler qm-numbered'>";
 
 
377
 
378
  if ( ! empty( $stack ) ) {
379
  echo '<button class="qm-toggle" data-on="+" data-off="-">+</button>';
380
  echo '<div class="qm-toggled"><li>' . implode( '</li><li>', $stack ) . '</li></div>'; // WPCS: XSS ok.
381
  }
382
 
383
+ echo "<li>{$caller_name}</li>"; // WPCS: XSS ok.
384
+
385
  echo '</ol>';
386
  if ( $row['is_main_query'] ) {
387
  printf(
output/html/debug_bar.php CHANGED
@@ -1,6 +1,6 @@
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
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
output/html/environment.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2009-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
@@ -91,7 +91,7 @@ class QM_Output_Html_Environment extends QM_Output_Html {
91
 
92
  foreach ( $error_levels as $level => $reported ) {
93
  if ( $reported ) {
94
- $out[] = '<span class="qm-true">' . esc_html( $level ) . '&nbsp;&#x2713;</span>';
95
  } else {
96
  $out[] = '<span class="qm-false">' . esc_html( $level ) . '</span>';
97
  }
@@ -100,12 +100,39 @@ class QM_Output_Html_Environment extends QM_Output_Html {
100
  $error_levels = implode( '</li><li>', $out );
101
 
102
  echo '<tr>';
103
- echo '<th scope="row">error_reporting</th>';
104
- echo '<td class="qm-wrap">' . esc_html( $data['php']['error_reporting'] );
 
 
 
 
 
 
 
105
  echo "<ul class='qm-info qm-supplemental'><li>{$error_levels}</li></ul>"; // WPCS: XSS ok.
106
- echo '</td>';
 
 
107
  echo '</tr>';
108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  echo '</tbody>';
110
  echo '</table>';
111
  echo '</div>';
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
91
 
92
  foreach ( $error_levels as $level => $reported ) {
93
  if ( $reported ) {
94
+ $out[] = esc_html( $level ) . '&nbsp;&#x2713;';
95
  } else {
96
  $out[] = '<span class="qm-false">' . esc_html( $level ) . '</span>';
97
  }
100
  $error_levels = implode( '</li><li>', $out );
101
 
102
  echo '<tr>';
103
+ echo '<th scope="row">' . esc_html__( 'Error Reporting', 'query-monitor' ) . '</th>';
104
+ echo '<td class="qm-has-toggle qm-ltr"><div class="qm-toggler">';
105
+
106
+ printf(
107
+ '%1$s <button class="qm-toggle" data-on="+" data-off="-">+</button>',
108
+ esc_html( $data['php']['error_reporting'] )
109
+ );
110
+
111
+ echo '<div class="qm-toggled">';
112
  echo "<ul class='qm-info qm-supplemental'><li>{$error_levels}</li></ul>"; // WPCS: XSS ok.
113
+ echo '</div>';
114
+
115
+ echo '</div></td>';
116
  echo '</tr>';
117
 
118
+ if ( ! empty( $data['php']['extensions'] ) ) {
119
+ echo '<tr>';
120
+ echo '<th scope="row">' . esc_html__( 'Extensions', 'query-monitor' ) . '</th>';
121
+ echo '<td class="qm-has-toggle qm-ltr"><div class="qm-toggler">';
122
+
123
+ printf(
124
+ '%1$s <button class="qm-toggle" data-on="+" data-off="-">+</button>',
125
+ esc_html( number_format_i18n( count( $data['php']['extensions'] ) ) )
126
+ );
127
+
128
+ echo '<div class="qm-toggled"><ul class="qm-info qm-supplemental"><li>';
129
+ echo implode( '</li><li>', array_map( 'esc_html', $data['php']['extensions'] ) );
130
+ echo '</li></ul></div>';
131
+
132
+ echo '</div></td>';
133
+ echo '</tr>';
134
+ }
135
+
136
  echo '</tbody>';
137
  echo '</table>';
138
  echo '</div>';
output/html/hooks.php CHANGED
@@ -1,6 +1,6 @@
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
@@ -50,9 +50,19 @@ class QM_Output_Html_Hooks extends QM_Output_Html {
50
  echo '</th>';
51
  echo '</tr>';
52
  echo '</thead>';
53
- echo '<tbody>';
54
 
55
- foreach ( $data['hooks'] as $hook ) {
 
 
 
 
 
 
 
 
 
 
 
56
 
57
  if ( !empty( $screen ) ) {
58
 
@@ -153,11 +163,9 @@ class QM_Output_Html_Hooks extends QM_Output_Html {
153
  echo '</tr>';
154
  }
155
 
156
- }
157
 
158
- echo '</tbody>';
159
- echo '</table>';
160
- echo '</div>';
161
 
162
  }
163
 
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
50
  echo '</th>';
51
  echo '</tr>';
52
  echo '</thead>';
 
53
 
54
+ self::output_hook_table( $data['hooks'], $screen );
55
+
56
+ echo '</table>';
57
+ echo '</div>';
58
+
59
+ }
60
+
61
+ public static function output_hook_table( array $hooks, $screen = '' ) {
62
+
63
+ foreach ( $hooks as $hook ) {
64
+
65
+ echo '<tbody class="qm-group">';
66
 
67
  if ( !empty( $screen ) ) {
68
 
163
  echo '</tr>';
164
  }
165
 
166
+ echo '</tbody>';
167
 
168
+ }
 
 
169
 
170
  }
171
 
output/html/http.php CHANGED
@@ -1,6 +1,6 @@
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
@@ -41,7 +41,7 @@ class QM_Output_Html_HTTP extends QM_Output_Html {
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>';
@@ -50,7 +50,7 @@ class QM_Output_Html_HTTP extends QM_Output_Html {
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">';
@@ -122,8 +122,8 @@ class QM_Output_Html_HTTP extends QM_Output_Html {
122
  $component = $row['component'];
123
 
124
  $stack = array();
125
- $filtered_trace = $row['trace']->get_filtered_trace();
126
- array_shift( $filtered_trace );
127
 
128
  foreach ( $filtered_trace as $item ) {
129
  $stack[] = self::output_filename( $item['display'], $item['calling_file'], $item['calling_line'] );
@@ -156,8 +156,8 @@ class QM_Output_Html_HTTP extends QM_Output_Html {
156
  esc_html( $response )
157
  );
158
  printf( // WPCS: XSS ok.
159
- '<td class="qm-nowrap qm-ltr">%s</td>',
160
- implode( '<br>', $stack )
161
  );
162
  printf(
163
  '<td class="qm-nowrap">%s</td>',
@@ -247,9 +247,9 @@ class QM_Output_Html_HTTP extends QM_Output_Html {
247
  $count = isset( $data['http'] ) ? count( $data['http'] ) : 0;
248
 
249
  $title = ( empty( $count ) )
250
- ? __( 'HTTP Requests', 'query-monitor' )
251
- /* translators: %s: Number of HTTP requests */
252
- : __( 'HTTP Requests (%s)', 'query-monitor' );
253
 
254
  $args = array(
255
  'title' => esc_html( sprintf(
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
41
 
42
  if ( !empty( $data['http'] ) ) {
43
 
44
+ echo '<caption class="screen-reader-text">' . esc_html__( 'HTTP API Calls', 'query-monitor' ) . '</caption>';
45
 
46
  echo '<thead>';
47
  echo '<tr>';
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'] ), __( 'Status', '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">';
122
  $component = $row['component'];
123
 
124
  $stack = array();
125
+ $filtered_trace = $row['trace']->get_display_trace();
126
+ array_pop( $filtered_trace );
127
 
128
  foreach ( $filtered_trace as $item ) {
129
  $stack[] = self::output_filename( $item['display'], $item['calling_file'], $item['calling_line'] );
156
  esc_html( $response )
157
  );
158
  printf( // WPCS: XSS ok.
159
+ '<td class="qm-nowrap qm-ltr"><ol class="qm-numbered"><li>%s</li></ol></td>',
160
+ implode( '</li><li>', $stack )
161
  );
162
  printf(
163
  '<td class="qm-nowrap">%s</td>',
247
  $count = isset( $data['http'] ) ? count( $data['http'] ) : 0;
248
 
249
  $title = ( empty( $count ) )
250
+ ? __( 'HTTP API Calls', 'query-monitor' )
251
+ /* translators: %s: Number of calls to the HTTP API */
252
+ : __( 'HTTP API Calls (%s)', 'query-monitor' );
253
 
254
  $args = array(
255
  'title' => esc_html( sprintf(
output/html/languages.php CHANGED
@@ -1,6 +1,6 @@
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
@@ -45,37 +45,46 @@ class QM_Output_Html_Languages extends QM_Output_Html {
45
  echo '<th colspan="2">' . esc_html__( 'MO File', 'query-monitor' ) . '</th>';
46
  echo '</tr>';
47
  echo '</thead>';
48
- echo '<tbody>';
49
 
50
- $not_found_class = ( substr( $data['locale'], 0, 3 ) === "en_" ) ? '' : 'qm-warn';
51
 
52
- foreach ( $data['languages'] as $mofile ) {
 
53
 
54
- echo '<tr>';
55
 
56
- echo '<td class="qm-ltr">' . esc_html( $mofile['domain'] ) . '</td>';
57
- echo '<td class="qm-nowrap qm-ltr">';
58
- echo self::output_filename( $mofile['caller']['display'], $mofile['caller']['file'], $mofile['caller']['line'] ); // WPCS: XSS ok.
59
- echo '</td>';
60
- echo '<td class="qm-ltr">';
61
- echo esc_html( QM_Util::standard_dir( $mofile['mofile'], '' ) );
62
- echo '</td>';
63
 
64
- if ( $mofile['found'] ) {
65
- echo '<td class="qm-nowrap">';
66
- echo esc_html( size_format( $mofile['found'] ) );
 
 
 
67
  echo '</td>';
68
- } else {
69
- echo '<td class="' . esc_attr( $not_found_class ) . '">';
70
- echo esc_html__( 'Not Found', 'query-monitor' );
71
  echo '</td>';
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  }
73
 
74
- echo '</tr>';
75
 
76
  }
77
 
78
- echo '</tbody>';
79
  echo '</table>';
80
  echo '</div>';
81
 
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
45
  echo '<th colspan="2">' . esc_html__( 'MO File', 'query-monitor' ) . '</th>';
46
  echo '</tr>';
47
  echo '</thead>';
 
48
 
49
+ $not_found_class = ( substr( $data['locale'], 0, 3 ) === 'en_' ) ? '' : 'qm-warn';
50
 
51
+ foreach ( $data['languages'] as $textdomain => $mofiles ) {
52
+ $first = true;
53
 
54
+ echo '<tbody class="qm-group">';
55
 
56
+ foreach ( $mofiles as $mofile ) {
57
+ echo '<tr>';
 
 
 
 
 
58
 
59
+ if ( $first ) {
60
+ echo '<th class="qm-ltr" rowspan="' . count( $mofiles ) . '">' . esc_html( $mofile['domain'] ) . '</th>';
61
+ }
62
+
63
+ echo '<td class="qm-nowrap qm-ltr">';
64
+ echo self::output_filename( $mofile['caller']['display'], $mofile['caller']['file'], $mofile['caller']['line'] ); // WPCS: XSS ok.
65
  echo '</td>';
66
+ echo '<td class="qm-ltr">';
67
+ echo esc_html( QM_Util::standard_dir( $mofile['mofile'], '' ) );
 
68
  echo '</td>';
69
+
70
+ if ( $mofile['found'] ) {
71
+ echo '<td class="qm-nowrap">';
72
+ echo esc_html( size_format( $mofile['found'] ) );
73
+ echo '</td>';
74
+ } else {
75
+ echo '<td class="' . esc_attr( $not_found_class ) . '">';
76
+ echo esc_html__( 'Not Found', 'query-monitor' );
77
+ echo '</td>';
78
+ }
79
+
80
+ echo '</tr>';
81
+ $first = false;
82
  }
83
 
84
+ echo '</tbody>';
85
 
86
  }
87
 
 
88
  echo '</table>';
89
  echo '</div>';
90
 
output/html/overview.php CHANGED
@@ -1,6 +1,6 @@
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
@@ -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
- 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>';
@@ -101,11 +101,20 @@ class QM_Output_Html_Overview extends QM_Output_Html {
101
  echo '</td>';
102
  echo '<td>';
103
 
104
- foreach ( $db_query_num as $type_name => $type_count ) {
105
- $db_query_types[] = sprintf( '%1$s: %2$s', $type_name, number_format_i18n( $type_count ) );
 
 
 
 
 
 
 
 
 
106
  }
107
 
108
- echo implode( '<br>', array_map( 'esc_html', $db_query_types ) );
109
 
110
  echo '</td>';
111
  }
@@ -123,7 +132,7 @@ class QM_Output_Html_Overview extends QM_Output_Html {
123
  printf(
124
  '<br><a href="%s">%s</a>',
125
  'https://github.com/johnbillion/query-monitor/wiki/Cache-Hit-Rate',
126
- esc_html__( "Why is this value 100%?", 'query-monitor' )
127
  );
128
  }
129
  echo '<br><span class="qm-info">';
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
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>';
101
  echo '</td>';
102
  echo '<td>';
103
 
104
+ if ( ! isset( $db_query_num['SELECT'] ) || count( $db_query_num ) > 1 ) {
105
+ foreach ( $db_query_num as $type_name => $type_count ) {
106
+ $db_query_types[] = sprintf(
107
+ '<a href="#" class="qm-filter-trigger" data-qm-target="db_queries-wpdb" data-qm-filter="type" data-qm-value="%1$s">%2$s</a>: %3$s',
108
+ esc_attr( $type_name ),
109
+ esc_html( $type_name ),
110
+ esc_html( number_format_i18n( $type_count ) )
111
+ );
112
+ }
113
+
114
+ echo implode( '<br>', $db_query_types ) . '<br>'; // WPCS: XSS ok;
115
  }
116
 
117
+ echo esc_html__( 'Total', 'query-monitor' ) . ': ' . esc_html( number_format_i18n( $db_queries_data['total_qs'] ) );
118
 
119
  echo '</td>';
120
  }
132
  printf(
133
  '<br><a href="%s">%s</a>',
134
  'https://github.com/johnbillion/query-monitor/wiki/Cache-Hit-Rate',
135
+ esc_html__( 'Why is this value 100%?', 'query-monitor' )
136
  );
137
  }
138
  echo '<br><span class="qm-info">';
output/html/php_errors.php CHANGED
@@ -1,6 +1,6 @@
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
@@ -42,7 +42,6 @@ class QM_Output_Html_PHP_Errors extends QM_Output_Html {
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' ),
@@ -59,27 +58,28 @@ class QM_Output_Html_PHP_Errors extends QM_Output_Html {
59
 
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 ) {
67
 
68
  if ( !$first ) {
69
- echo '<tr>';
70
  }
71
 
72
  $component = $error->trace->get_component();
73
  $message = wp_strip_all_tags( $error->message );
74
 
75
- echo '<th scope="row" class="qm-ltr">' . esc_html( $message ) . '</th>';
76
- echo '<td>' . esc_html( number_format_i18n( $error->calls ) ) . '</td>';
77
  echo '<td class="qm-ltr">';
78
  echo self::output_filename( $error->filename . ':' . $error->line, $error->file, $error->line ); // WPCS: XSS ok.
79
  echo '</td>';
80
 
81
  $stack = array();
82
- $filtered_trace = $error->trace->get_filtered_trace();
83
 
84
  // debug_backtrace() (used within QM_Backtrace) doesn't like being used within an error handler so
85
  // we need to handle its somewhat unreliable stack trace items.
@@ -95,9 +95,9 @@ class QM_Output_Html_PHP_Errors extends QM_Output_Html {
95
  }
96
  }
97
 
98
- echo '<td class="qm-row-caller qm-row-stack qm-nowrap qm-ltr">';
99
- echo implode( '<br>', $stack ); // WPCS: XSS ok.
100
- echo '</td>';
101
 
102
  if ( $component ) {
103
  echo '<td class="qm-nowrap">' . esc_html( $component->name ) . '</td>';
@@ -111,11 +111,11 @@ class QM_Output_Html_PHP_Errors extends QM_Output_Html {
111
 
112
  }
113
 
 
114
  }
115
 
116
  }
117
 
118
- echo '</tbody>';
119
  echo '</table>';
120
  echo '</div>';
121
 
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
42
  echo '<th scope="col">' . esc_html__( 'Component', 'query-monitor' ) . '</th>';
43
  echo '</tr>';
44
  echo '</thead>';
 
45
 
46
  $types = array(
47
  'warning' => _x( 'Warning', 'PHP error level', 'query-monitor' ),
58
 
59
  if ( isset( $data['errors'][$type] ) ) {
60
 
61
+ echo '<tbody class="qm-group">';
62
+ echo '<tr class="qm-php-error qm-php-error-' . esc_attr( $type ) . '">';
63
+ echo '<th scope="row" rowspan="' . count( $data['errors'][$type] ) . '"><span class="dashicons dashicons-warning"></span>' . esc_html( $title ) . '</th>';
64
  $first = true;
65
 
66
  foreach ( $data['errors'][$type] as $error ) {
67
 
68
  if ( !$first ) {
69
+ echo '<tr class="qm-php-error qm-php-error-' . esc_attr( $type ) . '">';
70
  }
71
 
72
  $component = $error->trace->get_component();
73
  $message = wp_strip_all_tags( $error->message );
74
 
75
+ echo '<td class="qm-ltr">' . esc_html( $message ) . '</td>';
76
+ echo '<td class="qm-num">' . esc_html( number_format_i18n( $error->calls ) ) . '</td>';
77
  echo '<td class="qm-ltr">';
78
  echo self::output_filename( $error->filename . ':' . $error->line, $error->file, $error->line ); // WPCS: XSS ok.
79
  echo '</td>';
80
 
81
  $stack = array();
82
+ $filtered_trace = $error->trace->get_display_trace();
83
 
84
  // debug_backtrace() (used within QM_Backtrace) doesn't like being used within an error handler so
85
  // we need to handle its somewhat unreliable stack trace items.
95
  }
96
  }
97
 
98
+ echo '<td class="qm-row-caller qm-row-stack qm-nowrap qm-ltr"><ol class="qm-numbered"><li>';
99
+ echo implode( '</li><li>', $stack ); // WPCS: XSS ok.
100
+ echo '</li></ol></td>';
101
 
102
  if ( $component ) {
103
  echo '<td class="qm-nowrap">' . esc_html( $component->name ) . '</td>';
111
 
112
  }
113
 
114
+ echo '</tbody>';
115
  }
116
 
117
  }
118
 
 
119
  echo '</table>';
120
  echo '</div>';
121
 
output/html/request.php CHANGED
@@ -1,6 +1,6 @@
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
@@ -25,6 +25,8 @@ class QM_Output_Html_Request extends QM_Output_Html {
25
 
26
  $data = $this->collector->get_data();
27
 
 
 
28
  echo '<div class="qm qm-half" id="' . esc_attr( $this->collector->id() ) . '">';
29
  echo '<table cellspacing="0">';
30
  echo '<caption class="screen-reader-text">' . esc_html( $this->collector->name() ) . '</caption>';
@@ -63,10 +65,27 @@ class QM_Output_Html_Request extends QM_Output_Html {
63
  echo '</tr>';
64
  }
65
 
 
 
66
  $rowspan = isset( $data['qvars'] ) ? count( $data['qvars'] ) : 1;
67
 
 
68
  echo '<tr>';
69
- echo '<th rowspan="' . absint( $rowspan ) . '">' . esc_html__( 'Query Vars', 'query-monitor' ) . '</th>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
  if ( !empty( $data['qvars'] ) ) {
72
 
@@ -105,8 +124,11 @@ class QM_Output_Html_Request extends QM_Output_Html {
105
 
106
  }
107
 
 
 
108
  if ( ! empty( $data['queried_object'] ) ) {
109
 
 
110
  echo '<tr>';
111
  echo '<th>' . esc_html__( 'Queried Object', 'query-monitor' ) . '</th>';
112
  echo '<td colspan="2" class="qm-has-inner qm-has-toggle qm-ltr"><div class="qm-toggler">';
@@ -123,6 +145,7 @@ class QM_Output_Html_Request extends QM_Output_Html {
123
 
124
  echo '</div></td>';
125
  echo '</tr>';
 
126
 
127
  }
128
 
@@ -130,6 +153,7 @@ class QM_Output_Html_Request extends QM_Output_Html {
130
 
131
  $rowspan = count( $data['multisite'] );
132
 
 
133
  echo '<tr>';
134
  echo '<th rowspan="' . absint( $rowspan ) . '">' . esc_html__( 'Multisite', 'query-monitor' ) . '</th>';
135
 
@@ -154,12 +178,14 @@ class QM_Output_Html_Request extends QM_Output_Html {
154
 
155
  echo '</div></td>';
156
 
 
 
157
  $first = false;
158
 
159
  }
 
160
  }
161
 
162
- echo '</tbody>';
163
  echo '</table>';
164
  echo '</div>';
165
 
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
25
 
26
  $data = $this->collector->get_data();
27
 
28
+ $db_queries = QM_Collectors::get( 'db_queries' );
29
+
30
  echo '<div class="qm qm-half" id="' . esc_attr( $this->collector->id() ) . '">';
31
  echo '<table cellspacing="0">';
32
  echo '<caption class="screen-reader-text">' . esc_html( $this->collector->name() ) . '</caption>';
65
  echo '</tr>';
66
  }
67
 
68
+ echo '</tbody>';
69
+
70
  $rowspan = isset( $data['qvars'] ) ? count( $data['qvars'] ) : 1;
71
 
72
+ echo '<tbody class="qm-group">';
73
  echo '<tr>';
74
+ echo '<th rowspan="' . absint( $rowspan ) . '">';
75
+ esc_html_e( 'Query Vars', 'query-monitor' );
76
+
77
+ if ( $db_queries ) {
78
+ $db_queries_data = $db_queries->get_data();
79
+ if ( ! empty( $db_queries_data['dbs']['$wpdb']->has_main_query ) ) {
80
+ echo '<br>';
81
+ printf(
82
+ '<a href="#" class="qm-filter-trigger" data-qm-target="db_queries-wpdb" data-qm-filter="caller" data-qm-value="qm-main-query">%s</a>',
83
+ esc_html__( 'View Main Query', 'query-monitor' )
84
+ );
85
+ }
86
+ }
87
+
88
+ echo '</th>';
89
 
90
  if ( !empty( $data['qvars'] ) ) {
91
 
124
 
125
  }
126
 
127
+ echo '</tbody>';
128
+
129
  if ( ! empty( $data['queried_object'] ) ) {
130
 
131
+ echo '<tbody class="qm-group">';
132
  echo '<tr>';
133
  echo '<th>' . esc_html__( 'Queried Object', 'query-monitor' ) . '</th>';
134
  echo '<td colspan="2" class="qm-has-inner qm-has-toggle qm-ltr"><div class="qm-toggler">';
145
 
146
  echo '</div></td>';
147
  echo '</tr>';
148
+ echo '</tbody>';
149
 
150
  }
151
 
153
 
154
  $rowspan = count( $data['multisite'] );
155
 
156
+ echo '<tbody class="qm-group">';
157
  echo '<tr>';
158
  echo '<th rowspan="' . absint( $rowspan ) . '">' . esc_html__( 'Multisite', 'query-monitor' ) . '</th>';
159
 
178
 
179
  echo '</div></td>';
180
 
181
+ echo '</tr>';
182
+
183
  $first = false;
184
 
185
  }
186
+ echo '</tbody>';
187
  }
188
 
 
189
  echo '</table>';
190
  echo '</div>';
191
 
output/html/rewrites.php CHANGED
@@ -1,6 +1,6 @@
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
1
  <?php
2
  /*
3
+ Copyright 2009-2017 John Blackbourn
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
output/html/theme.php CHANGED
@@ -1,6 +1,6 @@
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
@@ -61,7 +61,7 @@ class QM_Output_Html_Theme extends QM_Output_Html {
61
 
62
  echo '<tr>';
63
  echo '<th scope="row">' . esc_html__( 'Template Hierarchy', 'query-monitor' ) . '</th>';
64
- echo '<td class="qm-ltr qm-wrap"><ul><li>' . implode( '</li><li>', array_map( 'esc_html', $data['template_hierarchy'] ) ) . '</li></ul></td>';
65
  echo '</tr>';
66
 
67
  }
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
61
 
62
  echo '<tr>';
63
  echo '<th scope="row">' . esc_html__( 'Template Hierarchy', 'query-monitor' ) . '</th>';
64
+ echo '<td class="qm-ltr qm-wrap"><ol class="qm-numbered"><li>' . implode( '</li><li>', array_map( 'esc_html', $data['template_hierarchy'] ) ) . '</li></ol></td>';
65
  echo '</tr>';
66
 
67
  }
output/html/transients.php CHANGED
@@ -1,6 +1,6 @@
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
@@ -30,17 +30,16 @@ class QM_Output_Html_Transients extends QM_Output_Html {
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>';
@@ -68,31 +67,34 @@ class QM_Output_Html_Transients extends QM_Output_Html {
68
  );
69
  }
70
 
71
- if ( isset( $row['expiration'] ) ) {
72
- if ( 0 === $row['expiration'] ) {
73
- printf(
74
- '<td><em>%s</em></td>',
75
- esc_html__( 'none', 'query-monitor' )
76
- );
77
- } else {
78
- printf(
79
- '<td>%s</td>',
80
- esc_html( $row['expiration'] )
81
- );
82
- }
83
  }
84
 
 
 
 
 
 
85
  $stack = array();
86
- $filtered_trace = $row['trace']->get_filtered_trace();
87
- array_shift( $filtered_trace );
88
 
89
  foreach ( $filtered_trace as $item ) {
90
  $stack[] = self::output_filename( $item['display'], $item['calling_file'], $item['calling_line'] );
91
  }
92
 
93
  printf( // WPCS: XSS ok.
94
- '<td class="qm-nowrap qm-ltr">%s</td>',
95
- implode( '<br>', $stack )
96
  );
97
  printf(
98
  '<td class="qm-nowrap">%s</td>',
@@ -109,7 +111,7 @@ class QM_Output_Html_Transients extends QM_Output_Html {
109
 
110
  echo '<thead>';
111
  echo '<tr>';
112
- echo '<th>' . esc_html__( 'Transients Set', 'query-monitor' ) . '</th>';
113
  echo '</tr>';
114
  echo '</thead>';
115
 
@@ -132,9 +134,9 @@ class QM_Output_Html_Transients extends QM_Output_Html {
132
  $count = isset( $data['trans'] ) ? count( $data['trans'] ) : 0;
133
 
134
  $title = ( empty( $count ) )
135
- ? __( 'Transients Set', 'query-monitor' )
136
- /* translators: %s: Number of transient values that were set */
137
- : __( 'Transients Set (%s)', 'query-monitor' );
138
 
139
  $menu[] = $this->menu( array(
140
  'title' => esc_html( sprintf(
1
  <?php
2
  /*
3
+ Copyright 2009-2017 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
30
 
31
  if ( !empty( $data['trans'] ) ) {
32
 
33
+ echo '<caption class="screen-reader-text">' . esc_html__( 'Transient Updates', 'query-monitor' ) . '</caption>';
34
 
35
  echo '<thead>';
36
  echo '<tr>';
37
+ echo '<th scope="col">' . esc_html__( 'Updated Transient', 'query-monitor' ) . '</th>';
38
  if ( is_multisite() ) {
39
+ echo '<th>' . esc_html_x( 'Type', 'transient type', 'query-monitor' ) . '</th>';
 
 
 
40
  }
41
+ echo '<th scope="col">' . esc_html__( 'Expiration', 'query-monitor' ) . '</th>';
42
+ echo '<th scope="col">' . esc_html_x( 'Size', 'size of transient value', 'query-monitor' ) . '</th>';
43
  echo '<th scope="col">' . esc_html__( 'Call Stack', 'query-monitor' ) . '</th>';
44
  echo '<th scope="col">' . esc_html__( 'Component', 'query-monitor' ) . '</th>';
45
  echo '</tr>';
67
  );
68
  }
69
 
70
+ if ( 0 === $row['expiration'] ) {
71
+ printf(
72
+ '<td><em>%s</em></td>',
73
+ esc_html__( 'none', 'query-monitor' )
74
+ );
75
+ } else {
76
+ printf(
77
+ '<td>%s</td>',
78
+ esc_html( $row['expiration'] )
79
+ );
 
 
80
  }
81
 
82
+ printf(
83
+ '<td>~%s</td>',
84
+ esc_html( size_format( $row['size'] ) )
85
+ );
86
+
87
  $stack = array();
88
+ $filtered_trace = $row['trace']->get_display_trace();
89
+ array_pop( $filtered_trace );
90
 
91
  foreach ( $filtered_trace as $item ) {
92
  $stack[] = self::output_filename( $item['display'], $item['calling_file'], $item['calling_line'] );
93
  }
94
 
95
  printf( // WPCS: XSS ok.
96
+ '<td class="qm-nowrap qm-ltr"><ol class="qm-numbered"><li>%s</li></ol></td>',
97
+ implode( '</li><li>', $stack )
98
  );
99
  printf(
100
  '<td class="qm-nowrap">%s</td>',
111
 
112
  echo '<thead>';
113
  echo '<tr>';
114
+ echo '<th>' . esc_html__( 'Transient Updates', 'query-monitor' ) . '</th>';
115
  echo '</tr>';
116
  echo '</thead>';
117
 
134
  $count = isset( $data['trans'] ) ? count( $data['trans'] ) : 0;
135
 
136
  $title = ( empty( $count ) )
137
+ ? __( 'Transient Updates', 'query-monitor' )
138
+ /* translators: %s: Number of transient values that were updated */
139
+ : __( 'Transient Updates (%s)', 'query-monitor' );
140
 
141
  $menu[] = $this->menu( array(
142
  'title' => esc_html( sprintf(
query-monitor.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * User Switching plugin for WordPress
4
  *
5
  * @package query-monitor
6
  * @link https://github.com/johnbillion/query-monitor
@@ -10,7 +10,7 @@
10
  *
11
  * Plugin Name: Query Monitor
12
  * Description: Monitoring of database queries, hooks, conditionals and more.
13
- * Version: 2.14.0
14
  * Plugin URI: https://github.com/johnbillion/query-monitor
15
  * Author: John Blackbourn
16
  * Author URI: https://johnblackbourn.com/
1
  <?php
2
  /**
3
+ * Query Monitor plugin for WordPress
4
  *
5
  * @package query-monitor
6
  * @link https://github.com/johnbillion/query-monitor
10
  *
11
  * Plugin Name: Query Monitor
12
  * Description: Monitoring of database queries, hooks, conditionals and more.
13
+ * Version: 2.15.0
14
  * Plugin URI: https://github.com/johnbillion/query-monitor
15
  * Author: John Blackbourn
16
  * 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.8
6
- Stable tag: 2.14.0
7
  License: GPLv2 or later
8
 
9
  View debugging and performance information on database queries, hooks, conditionals, HTTP requests, redirects and more.
@@ -117,12 +117,6 @@ By default, Query Monitor's output is only shown to Administrators on single-sit
117
 
118
  In addition to this, you can set an authentication cookie which allows you to view Query Monitor output when you're not logged in (or if you're logged in as a non-administrator). See the bottom of Query Monitor's output for details.
119
 
120
- == Installation ==
121
-
122
- Install Query Monitor just like any other plugin.
123
-
124
- If you don't know how to do that, then Query Monitor is not for you.
125
-
126
  == Screenshots ==
127
 
128
  1. The admin toolbar menu showing an overview
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.8
6
+ Stable tag: 2.15.0
7
  License: GPLv2 or later
8
 
9
  View debugging and performance information on database queries, hooks, conditionals, HTTP requests, redirects and more.
117
 
118
  In addition to this, you can set an authentication cookie which allows you to view Query Monitor output when you're not logged in (or if you're logged in as a non-administrator). See the bottom of Query Monitor's output for details.
119
 
 
 
 
 
 
 
120
  == Screenshots ==
121
 
122
  1. The admin toolbar menu showing an overview
wp-content/db.php CHANGED
@@ -9,7 +9,7 @@ additional database query information in Query Monitor's output.
9
 
10
  *********************************************************************
11
 
12
- Copyright 2009-2016 John Blackbourn
13
 
14
  This program is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License as published by
@@ -42,7 +42,8 @@ if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
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;
47
  }
48
  require_once $backtrace;
9
 
10
  *********************************************************************
11
 
12
+ Copyright 2009-2017 John Blackbourn
13
 
14
  This program is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License as published by
42
 
43
  # No autoloaders for us. See https://github.com/johnbillion/query-monitor/issues/7
44
  $qm_dir = dirname( dirname( __FILE__ ) );
45
+ $backtrace = "{$qm_dir}/classes/Backtrace.php";
46
+ if ( ! is_readable( $backtrace ) ) {
47
  return;
48
  }
49
  require_once $backtrace;