Query Monitor - Version 3.7.0

Version Description

Download this release

Release Info

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

Code changes from version 3.6.8 to 3.7.0

Files changed (73) hide show
  1. assets/query-monitor-dark.css +11 -7
  2. assets/query-monitor.css +27 -23
  3. classes/Backtrace.php +2 -0
  4. classes/Collector.php +8 -0
  5. collectors/admin.php +2 -0
  6. collectors/assets.php +2 -0
  7. collectors/assets_scripts.php +2 -0
  8. collectors/assets_styles.php +2 -0
  9. collectors/block_editor.php +2 -0
  10. collectors/cache.php +2 -0
  11. collectors/caps.php +3 -0
  12. collectors/conditionals.php +2 -0
  13. collectors/db_callers.php +2 -0
  14. collectors/db_components.php +2 -0
  15. collectors/db_dupes.php +3 -6
  16. collectors/db_queries.php +2 -0
  17. collectors/debug_bar.php +2 -0
  18. collectors/environment.php +2 -0
  19. collectors/hooks.php +5 -1
  20. collectors/http.php +2 -4
  21. collectors/languages.php +2 -0
  22. collectors/logger.php +2 -0
  23. collectors/overview.php +28 -11
  24. collectors/php_errors.php +2 -0
  25. collectors/raw_request.php +2 -0
  26. collectors/redirects.php +2 -0
  27. collectors/request.php +2 -0
  28. collectors/theme.php +2 -0
  29. collectors/timing.php +2 -0
  30. collectors/transients.php +3 -1
  31. dispatchers/AJAX.php +6 -1
  32. dispatchers/Html.php +2 -1
  33. dispatchers/REST.php +2 -0
  34. dispatchers/REST_Envelope.php +69 -0
  35. dispatchers/Redirect.php +2 -0
  36. dispatchers/WP_Die.php +2 -0
  37. output/Raw.php +14 -0
  38. output/headers/overview.php +2 -0
  39. output/headers/php_errors.php +3 -0
  40. output/headers/redirects.php +3 -0
  41. output/html/admin.php +2 -0
  42. output/html/assets.php +2 -0
  43. output/html/assets_scripts.php +2 -0
  44. output/html/assets_styles.php +2 -0
  45. output/html/block_editor.php +2 -0
  46. output/html/caps.php +2 -0
  47. output/html/conditionals.php +2 -0
  48. output/html/db_callers.php +2 -0
  49. output/html/db_components.php +2 -0
  50. output/html/db_dupes.php +2 -0
  51. output/html/db_queries.php +2 -0
  52. output/html/debug_bar.php +2 -0
  53. output/html/environment.php +2 -0
  54. output/html/headers.php +2 -0
  55. output/html/hooks.php +5 -1
  56. output/html/http.php +3 -0
  57. output/html/languages.php +2 -0
  58. output/html/logger.php +2 -0
  59. output/html/overview.php +36 -10
  60. output/html/php_errors.php +2 -0
  61. output/html/request.php +2 -0
  62. output/html/theme.php +2 -0
  63. output/html/timing.php +2 -0
  64. output/html/transients.php +2 -0
  65. output/raw/cache.php +47 -0
  66. output/raw/conditionals.php +36 -0
  67. output/raw/db_queries.php +118 -0
  68. output/raw/http.php +67 -0
  69. output/raw/logger.php +58 -0
  70. output/raw/transients.php +66 -0
  71. query-monitor.php +2 -2
  72. readme.txt +345 -6
  73. wp-content/db.php +1 -1
assets/query-monitor-dark.css CHANGED
@@ -134,7 +134,7 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
134
  -webkit-font-smoothing: auto !important;
135
  font-style: normal !important;
136
  font-weight: normal !important;
137
- letter-spacing: normal !important;
138
  line-height: 18px !important;
139
  margin: 0 !important;
140
  min-height: auto !important;
@@ -216,7 +216,7 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
216
  -webkit-font-smoothing: auto !important;
217
  font-style: normal !important;
218
  font-weight: normal !important;
219
- letter-spacing: normal !important;
220
  line-height: 18px !important;
221
  margin: 0 !important;
222
  min-height: auto !important;
@@ -592,7 +592,7 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
592
  #query-monitor-main .qm td.qm-num {
593
  font-family: Menlo, Monaco, Consolas, monospace !important;
594
  font-size: 11px !important;
595
- line-height: 18px !important;
596
  }
597
  #query-monitor-main .qm td.qm-row-sql {
598
  min-width: 25em !important;
@@ -705,7 +705,7 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
705
  #query-monitor-main .qm pre {
706
  font-family: Menlo, Monaco, Consolas, monospace !important;
707
  font-size: 11px !important;
708
- line-height: 18px !important;
709
  }
710
  #query-monitor-main .qm pre {
711
  background: transparent !important;
@@ -933,7 +933,7 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
933
  font-family: dashicons !important;
934
  font-size: 14px !important;
935
  left: 2px !important;
936
- line-height: 15px !important;
937
  position: relative !important;
938
  text-decoration: none !important;
939
  top: 2px !important;
@@ -997,6 +997,7 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
997
  /* Some themes use Select2 etc on all selects. This hides that. */
998
  display: none !important;
999
  }
 
1000
  #query-monitor-main .qm select.qm-filter {
1001
  -webkit-appearance: menulist !important;
1002
  -moz-appearance: menulist !important;
@@ -1008,15 +1009,18 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
1008
  display: block !important;
1009
  float: none !important;
1010
  height: auto !important;
1011
- letter-spacing: normal !important;
1012
  margin: 0 0 0 5px !important;
1013
  max-width: 12em !important;
1014
  outline: 1px solid #50626f !important;
1015
  padding: 0 !important;
1016
  width: auto !important;
1017
  }
 
 
 
1018
  #query-monitor-main .qm select.qm-filter:hover {
1019
- background: #32373c !important;
1020
  }
1021
  #query-monitor-main .qm-hide,
1022
  #query-monitor-main .qm-hide-scripts-dependencies,
134
  -webkit-font-smoothing: auto !important;
135
  font-style: normal !important;
136
  font-weight: normal !important;
137
+ letter-spacing: -0.1px !important;
138
  line-height: 18px !important;
139
  margin: 0 !important;
140
  min-height: auto !important;
216
  -webkit-font-smoothing: auto !important;
217
  font-style: normal !important;
218
  font-weight: normal !important;
219
+ letter-spacing: -0.1px !important;
220
  line-height: 18px !important;
221
  margin: 0 !important;
222
  min-height: auto !important;
592
  #query-monitor-main .qm td.qm-num {
593
  font-family: Menlo, Monaco, Consolas, monospace !important;
594
  font-size: 11px !important;
595
+ line-height: 19px !important;
596
  }
597
  #query-monitor-main .qm td.qm-row-sql {
598
  min-width: 25em !important;
705
  #query-monitor-main .qm pre {
706
  font-family: Menlo, Monaco, Consolas, monospace !important;
707
  font-size: 11px !important;
708
+ line-height: 19px !important;
709
  }
710
  #query-monitor-main .qm pre {
711
  background: transparent !important;
933
  font-family: dashicons !important;
934
  font-size: 14px !important;
935
  left: 2px !important;
936
+ line-height: 13px !important;
937
  position: relative !important;
938
  text-decoration: none !important;
939
  top: 2px !important;
997
  /* Some themes use Select2 etc on all selects. This hides that. */
998
  display: none !important;
999
  }
1000
+ #query-monitor-main .qm-title-heading select,
1001
  #query-monitor-main .qm select.qm-filter {
1002
  -webkit-appearance: menulist !important;
1003
  -moz-appearance: menulist !important;
1009
  display: block !important;
1010
  float: none !important;
1011
  height: auto !important;
1012
+ letter-spacing: -0.1px !important;
1013
  margin: 0 0 0 5px !important;
1014
  max-width: 12em !important;
1015
  outline: 1px solid #50626f !important;
1016
  padding: 0 !important;
1017
  width: auto !important;
1018
  }
1019
+ #query-monitor-main .qm-title-heading select {
1020
+ max-width: unset !important;
1021
+ }
1022
  #query-monitor-main .qm select.qm-filter:hover {
1023
+ background: #373c42 !important;
1024
  }
1025
  #query-monitor-main .qm-hide,
1026
  #query-monitor-main .qm-hide-scripts-dependencies,
assets/query-monitor.css CHANGED
@@ -127,14 +127,14 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
127
  box-shadow: none !important;
128
  box-sizing: border-box !important;
129
  clear: both !important;
130
- color: #222 !important;
131
  float: none !important;
132
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
133
  font-size: 12px !important;
134
  -webkit-font-smoothing: auto !important;
135
  font-style: normal !important;
136
  font-weight: normal !important;
137
- letter-spacing: normal !important;
138
  line-height: 18px !important;
139
  margin: 0 !important;
140
  min-height: auto !important;
@@ -209,14 +209,14 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
209
  box-shadow: none !important;
210
  box-sizing: border-box !important;
211
  clear: both !important;
212
- color: #222 !important;
213
  float: none !important;
214
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
215
  font-size: 12px !important;
216
  -webkit-font-smoothing: auto !important;
217
  font-style: normal !important;
218
  font-weight: normal !important;
219
- letter-spacing: normal !important;
220
  line-height: 18px !important;
221
  margin: 0 !important;
222
  min-height: auto !important;
@@ -248,7 +248,7 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
248
  }
249
  #query-monitor-main ::selection {
250
  background-color: #B9D6FB !important;
251
- color: #222 !important;
252
  }
253
  #query-monitor-main strong,
254
  #query-monitor-main b {
@@ -417,7 +417,7 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
417
  background: #f3f3f3 !important;
418
  border-bottom: 1px solid #ddd !important;
419
  border-right: 1px solid #aaa !important;
420
- color: #333 !important;
421
  cursor: pointer !important;
422
  display: block !important;
423
  padding: 6px 32px 6px 10px !important;
@@ -428,7 +428,7 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
428
  #query-monitor-main #qm-panel-menu li button:focus,
429
  #query-monitor-main #qm-panel-menu li button:hover {
430
  background: #cde !important;
431
- color: #222 !important;
432
  }
433
  #query-monitor-main #qm-panel-menu li button:focus {
434
  text-decoration: underline !important;
@@ -444,15 +444,15 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
444
  }
445
  #query-monitor-main #qm-panel-menu li.qm-current-menu button {
446
  background: #def !important;
447
- color: #222 !important;
448
  }
449
  #query-monitor-main #qm-panel-menu li.qm-current-menu button:focus {
450
  background: #f7fbff !important;
451
- color: #222 !important;
452
  }
453
  #query-monitor-main #qm-panel-menu li.qm-current-menu button:hover {
454
  background: #cde !important;
455
- color: #222 !important;
456
  }
457
  #query-monitor-main #qm-panel-menu li li button::before {
458
  content: "└" !important;
@@ -519,7 +519,7 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
519
  border: none !important;
520
  border-collapse: collapse !important;
521
  box-shadow: 0px 1px 0px 0px #aaa !important;
522
- color: #222 !important;
523
  margin: 0 !important;
524
  table-layout: auto !important;
525
  width: 100% !important;
@@ -592,7 +592,7 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
592
  #query-monitor-main .qm td.qm-num {
593
  font-family: Menlo, Monaco, Consolas, monospace !important;
594
  font-size: 11px !important;
595
- line-height: 18px !important;
596
  }
597
  #query-monitor-main .qm td.qm-row-sql {
598
  min-width: 25em !important;
@@ -705,7 +705,7 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
705
  #query-monitor-main .qm pre {
706
  font-family: Menlo, Monaco, Consolas, monospace !important;
707
  font-size: 11px !important;
708
- line-height: 18px !important;
709
  }
710
  #query-monitor-main .qm pre {
711
  background: transparent !important;
@@ -869,13 +869,13 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
869
  #query-monitor-main .qm tbody tr.qm-highlight th,
870
  #query-monitor-main .qm tbody tr.qm-highlight td {
871
  background-color: #ffd !important;
872
- color: #222 !important;
873
  }
874
  #query-monitor-main .qm tbody tr.qm-odd td.qm-highlight,
875
  #query-monitor-main .qm tbody tr.qm-odd.qm-highlight th,
876
  #query-monitor-main .qm tbody tr.qm-odd.qm-highlight td {
877
  background-color: #ffffc9 !important;
878
- color: #222 !important;
879
  }
880
  #query-monitor-main .qm tbody tr.qm-odd.qm-hovered th,
881
  #query-monitor-main .qm tbody tr.qm-odd.qm-hovered td,
@@ -889,7 +889,7 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
889
  }
890
  #query-monitor-main .qm thead th.qm-filtered select.qm-filter {
891
  background-color: #ffd !important;
892
- color: #222 !important;
893
  }
894
  #query-monitor-main .qm button.qm-filter-trigger,
895
  #query-monitor-main .qm button.qm-filter-trigger code,
@@ -933,7 +933,7 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
933
  font-family: dashicons !important;
934
  font-size: 14px !important;
935
  left: 2px !important;
936
- line-height: 15px !important;
937
  position: relative !important;
938
  text-decoration: none !important;
939
  top: 2px !important;
@@ -976,7 +976,7 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
976
  width: auto !important;
977
  }
978
  #query-monitor-main .qm label {
979
- color: #222 !important;
980
  cursor: pointer !important;
981
  font-size: 12px !important;
982
  font-style: normal !important;
@@ -997,26 +997,30 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
997
  /* Some themes use Select2 etc on all selects. This hides that. */
998
  display: none !important;
999
  }
 
1000
  #query-monitor-main .qm select.qm-filter {
1001
  -webkit-appearance: menulist !important;
1002
  -moz-appearance: menulist !important;
1003
  appearance: menulist !important;
1004
  background: #fff !important;
1005
  border: none !important;
1006
- color: #222 !important;
1007
  cursor: pointer !important;
1008
  display: block !important;
1009
  float: none !important;
1010
  height: auto !important;
1011
- letter-spacing: normal !important;
1012
  margin: 0 0 0 5px !important;
1013
  max-width: 12em !important;
1014
  outline: 1px solid #aaa !important;
1015
  padding: 0 !important;
1016
  width: auto !important;
1017
  }
 
 
 
1018
  #query-monitor-main .qm select.qm-filter:hover {
1019
- background: #f3f3f3 !important;
1020
  }
1021
  #query-monitor-main .qm-hide,
1022
  #query-monitor-main .qm-hide-scripts-dependencies,
@@ -1063,7 +1067,7 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
1063
  }
1064
  #query-monitor-main .qm .qm-sorted-desc .qm-sort-arrow,
1065
  #query-monitor-main .qm .qm-sorted-asc .qm-sort-arrow {
1066
- color: #222 !important;
1067
  }
1068
  #query-monitor-main .qm thead th.qm-sortable-column:hover .qm-sort-arrow {
1069
  color: #0073aa !important;
@@ -1187,7 +1191,7 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
1187
  margin-bottom: 50px !important;
1188
  }
1189
  #query-monitor-main.qm-broken .qm button.qm-filter-trigger {
1190
- color: #222 !important;
1191
  cursor: text !important;
1192
  }
1193
  #query-monitor-main.qm-broken .qm button.qm-filter-trigger:after {
127
  box-shadow: none !important;
128
  box-sizing: border-box !important;
129
  clear: both !important;
130
+ color: #444 !important;
131
  float: none !important;
132
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
133
  font-size: 12px !important;
134
  -webkit-font-smoothing: auto !important;
135
  font-style: normal !important;
136
  font-weight: normal !important;
137
+ letter-spacing: -0.1px !important;
138
  line-height: 18px !important;
139
  margin: 0 !important;
140
  min-height: auto !important;
209
  box-shadow: none !important;
210
  box-sizing: border-box !important;
211
  clear: both !important;
212
+ color: #444 !important;
213
  float: none !important;
214
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
215
  font-size: 12px !important;
216
  -webkit-font-smoothing: auto !important;
217
  font-style: normal !important;
218
  font-weight: normal !important;
219
+ letter-spacing: -0.1px !important;
220
  line-height: 18px !important;
221
  margin: 0 !important;
222
  min-height: auto !important;
248
  }
249
  #query-monitor-main ::selection {
250
  background-color: #B9D6FB !important;
251
+ color: #444 !important;
252
  }
253
  #query-monitor-main strong,
254
  #query-monitor-main b {
417
  background: #f3f3f3 !important;
418
  border-bottom: 1px solid #ddd !important;
419
  border-right: 1px solid #aaa !important;
420
+ color: #444 !important;
421
  cursor: pointer !important;
422
  display: block !important;
423
  padding: 6px 32px 6px 10px !important;
428
  #query-monitor-main #qm-panel-menu li button:focus,
429
  #query-monitor-main #qm-panel-menu li button:hover {
430
  background: #cde !important;
431
+ color: #444 !important;
432
  }
433
  #query-monitor-main #qm-panel-menu li button:focus {
434
  text-decoration: underline !important;
444
  }
445
  #query-monitor-main #qm-panel-menu li.qm-current-menu button {
446
  background: #def !important;
447
+ color: #444 !important;
448
  }
449
  #query-monitor-main #qm-panel-menu li.qm-current-menu button:focus {
450
  background: #f7fbff !important;
451
+ color: #444 !important;
452
  }
453
  #query-monitor-main #qm-panel-menu li.qm-current-menu button:hover {
454
  background: #cde !important;
455
+ color: #444 !important;
456
  }
457
  #query-monitor-main #qm-panel-menu li li button::before {
458
  content: "└" !important;
519
  border: none !important;
520
  border-collapse: collapse !important;
521
  box-shadow: 0px 1px 0px 0px #aaa !important;
522
+ color: #444 !important;
523
  margin: 0 !important;
524
  table-layout: auto !important;
525
  width: 100% !important;
592
  #query-monitor-main .qm td.qm-num {
593
  font-family: Menlo, Monaco, Consolas, monospace !important;
594
  font-size: 11px !important;
595
+ line-height: 19px !important;
596
  }
597
  #query-monitor-main .qm td.qm-row-sql {
598
  min-width: 25em !important;
705
  #query-monitor-main .qm pre {
706
  font-family: Menlo, Monaco, Consolas, monospace !important;
707
  font-size: 11px !important;
708
+ line-height: 19px !important;
709
  }
710
  #query-monitor-main .qm pre {
711
  background: transparent !important;
869
  #query-monitor-main .qm tbody tr.qm-highlight th,
870
  #query-monitor-main .qm tbody tr.qm-highlight td {
871
  background-color: #ffd !important;
872
+ color: #444 !important;
873
  }
874
  #query-monitor-main .qm tbody tr.qm-odd td.qm-highlight,
875
  #query-monitor-main .qm tbody tr.qm-odd.qm-highlight th,
876
  #query-monitor-main .qm tbody tr.qm-odd.qm-highlight td {
877
  background-color: #ffffc9 !important;
878
+ color: #444 !important;
879
  }
880
  #query-monitor-main .qm tbody tr.qm-odd.qm-hovered th,
881
  #query-monitor-main .qm tbody tr.qm-odd.qm-hovered td,
889
  }
890
  #query-monitor-main .qm thead th.qm-filtered select.qm-filter {
891
  background-color: #ffd !important;
892
+ color: #444 !important;
893
  }
894
  #query-monitor-main .qm button.qm-filter-trigger,
895
  #query-monitor-main .qm button.qm-filter-trigger code,
933
  font-family: dashicons !important;
934
  font-size: 14px !important;
935
  left: 2px !important;
936
+ line-height: 13px !important;
937
  position: relative !important;
938
  text-decoration: none !important;
939
  top: 2px !important;
976
  width: auto !important;
977
  }
978
  #query-monitor-main .qm label {
979
+ color: #444 !important;
980
  cursor: pointer !important;
981
  font-size: 12px !important;
982
  font-style: normal !important;
997
  /* Some themes use Select2 etc on all selects. This hides that. */
998
  display: none !important;
999
  }
1000
+ #query-monitor-main .qm-title-heading select,
1001
  #query-monitor-main .qm select.qm-filter {
1002
  -webkit-appearance: menulist !important;
1003
  -moz-appearance: menulist !important;
1004
  appearance: menulist !important;
1005
  background: #fff !important;
1006
  border: none !important;
1007
+ color: #444 !important;
1008
  cursor: pointer !important;
1009
  display: block !important;
1010
  float: none !important;
1011
  height: auto !important;
1012
+ letter-spacing: -0.1px !important;
1013
  margin: 0 0 0 5px !important;
1014
  max-width: 12em !important;
1015
  outline: 1px solid #aaa !important;
1016
  padding: 0 !important;
1017
  width: auto !important;
1018
  }
1019
+ #query-monitor-main .qm-title-heading select {
1020
+ max-width: unset !important;
1021
+ }
1022
  #query-monitor-main .qm select.qm-filter:hover {
1023
+ background: #eef3fa !important;
1024
  }
1025
  #query-monitor-main .qm-hide,
1026
  #query-monitor-main .qm-hide-scripts-dependencies,
1067
  }
1068
  #query-monitor-main .qm .qm-sorted-desc .qm-sort-arrow,
1069
  #query-monitor-main .qm .qm-sorted-asc .qm-sort-arrow {
1070
+ color: #444 !important;
1071
  }
1072
  #query-monitor-main .qm thead th.qm-sortable-column:hover .qm-sort-arrow {
1073
  color: #0073aa !important;
1191
  margin-bottom: 50px !important;
1192
  }
1193
  #query-monitor-main.qm-broken .qm button.qm-filter-trigger {
1194
+ color: #444 !important;
1195
  cursor: text !important;
1196
  }
1197
  #query-monitor-main.qm-broken .qm button.qm-filter-trigger:after {
classes/Backtrace.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  if ( ! class_exists( 'QM_Backtrace' ) ) {
9
  class QM_Backtrace {
10
 
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  if ( ! class_exists( 'QM_Backtrace' ) ) {
11
  class QM_Backtrace {
12
 
classes/Collector.php CHANGED
@@ -221,6 +221,10 @@ abstract class QM_Collector {
221
  }
222
 
223
  public static function hide_qm() {
 
 
 
 
224
  if ( null === self::$hide_qm ) {
225
  self::$hide_qm = QM_HIDE_SELF;
226
  }
@@ -233,6 +237,10 @@ abstract class QM_Collector {
233
  return ( 'query-monitor' !== $component->context );
234
  }
235
 
 
 
 
 
236
  public function process() {}
237
 
238
  public function post_process() {}
221
  }
222
 
223
  public static function hide_qm() {
224
+ if ( ! defined( 'QM_HIDE_SELF' ) ) {
225
+ return false;
226
+ }
227
+
228
  if ( null === self::$hide_qm ) {
229
  self::$hide_qm = QM_HIDE_SELF;
230
  }
237
  return ( 'query-monitor' !== $component->context );
238
  }
239
 
240
+ public function filter_dupe_items( $items ) {
241
+ return ( count( $items ) > 1 );
242
+ }
243
+
244
  public function process() {}
245
 
246
  public function post_process() {}
collectors/admin.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Collector_Admin extends QM_Collector {
9
 
10
  public $id = 'response';
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Collector_Admin extends QM_Collector {
11
 
12
  public $id = 'response';
collectors/assets.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  abstract class QM_Collector_Assets extends QM_Collector {
9
 
10
  public function __construct() {
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  abstract class QM_Collector_Assets extends QM_Collector {
11
 
12
  public function __construct() {
collectors/assets_scripts.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Collector_Assets_Scripts extends QM_Collector_Assets {
9
 
10
  public $id = 'assets_scripts';
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Collector_Assets_Scripts extends QM_Collector_Assets {
11
 
12
  public $id = 'assets_scripts';
collectors/assets_styles.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Collector_Assets_Styles extends QM_Collector_Assets {
9
 
10
  public $id = 'assets_styles';
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Collector_Assets_Styles extends QM_Collector_Assets {
11
 
12
  public $id = 'assets_styles';
collectors/block_editor.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Collector_Block_Editor extends QM_Collector {
9
 
10
  public $id = 'block_editor';
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Collector_Block_Editor extends QM_Collector {
11
 
12
  public $id = 'block_editor';
collectors/cache.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Collector_Cache extends QM_Collector {
9
 
10
  public $id = 'cache';
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Collector_Cache extends QM_Collector {
11
 
12
  public $id = 'cache';
collectors/caps.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Collector_Caps extends QM_Collector {
9
 
10
  public $id = 'caps';
@@ -57,6 +59,7 @@ class QM_Collector_Caps extends QM_Collector {
57
  public function tear_down() {
58
  remove_filter( 'user_has_cap', array( $this, 'filter_user_has_cap' ), 9999 );
59
  remove_filter( 'map_meta_cap', array( $this, 'filter_map_meta_cap' ), 9999 );
 
60
  }
61
 
62
  /**
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Collector_Caps extends QM_Collector {
11
 
12
  public $id = 'caps';
59
  public function tear_down() {
60
  remove_filter( 'user_has_cap', array( $this, 'filter_user_has_cap' ), 9999 );
61
  remove_filter( 'map_meta_cap', array( $this, 'filter_map_meta_cap' ), 9999 );
62
+ parent::tear_down();
63
  }
64
 
65
  /**
collectors/conditionals.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Collector_Conditionals extends QM_Collector {
9
 
10
  public $id = 'conditionals';
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Collector_Conditionals extends QM_Collector {
11
 
12
  public $id = 'conditionals';
collectors/db_callers.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Collector_DB_Callers extends QM_Collector {
9
 
10
  public $id = 'db_callers';
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Collector_DB_Callers extends QM_Collector {
11
 
12
  public $id = 'db_callers';
collectors/db_components.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Collector_DB_Components extends QM_Collector {
9
 
10
  public $id = 'db_components';
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Collector_DB_Components extends QM_Collector {
11
 
12
  public $id = 'db_components';
collectors/db_dupes.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Collector_DB_Dupes extends QM_Collector {
9
 
10
  public $id = 'db_dupes';
@@ -20,7 +22,7 @@ class QM_Collector_DB_Dupes extends QM_Collector {
20
  }
21
 
22
  // Filter out SQL queries that do not have dupes
23
- $this->data['dupes'] = array_filter( $dbq->data['dupes'], array( $this, '_filter_dupe_queries' ) );
24
 
25
  // Ignore dupes from `WP_Query->set_found_posts()`
26
  unset( $this->data['dupes']['SELECT FOUND_ROWS()'] );
@@ -88,11 +90,6 @@ class QM_Collector_DB_Dupes extends QM_Collector {
88
  }
89
 
90
  }
91
-
92
- public function _filter_dupe_queries( $queries ) {
93
- return ( count( $queries ) > 1 );
94
- }
95
-
96
  }
97
 
98
  function register_qm_collector_db_dupes( array $collectors, QueryMonitor $qm ) {
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Collector_DB_Dupes extends QM_Collector {
11
 
12
  public $id = 'db_dupes';
22
  }
23
 
24
  // Filter out SQL queries that do not have dupes
25
+ $this->data['dupes'] = array_filter( $dbq->data['dupes'], array( $this, 'filter_dupe_items' ) );
26
 
27
  // Ignore dupes from `WP_Query->set_found_posts()`
28
  unset( $this->data['dupes']['SELECT FOUND_ROWS()'] );
90
  }
91
 
92
  }
 
 
 
 
 
93
  }
94
 
95
  function register_qm_collector_db_dupes( array $collectors, QueryMonitor $qm ) {
collectors/db_queries.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  if ( ! defined( 'SAVEQUERIES' ) ) {
9
  define( 'SAVEQUERIES', true );
10
  }
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  if ( ! defined( 'SAVEQUERIES' ) ) {
11
  define( 'SAVEQUERIES', true );
12
  }
collectors/debug_bar.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  final class QM_Collector_Debug_Bar extends QM_Collector {
9
 
10
  public $id = 'debug_bar';
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  final class QM_Collector_Debug_Bar extends QM_Collector {
11
 
12
  public $id = 'debug_bar';
collectors/environment.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Collector_Environment extends QM_Collector {
9
 
10
  public $id = 'environment';
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Collector_Environment extends QM_Collector {
11
 
12
  public $id = 'environment';
collectors/hooks.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Collector_Hooks extends QM_Collector {
9
 
10
  public $id = 'hooks';
@@ -25,7 +27,9 @@ class QM_Collector_Hooks extends QM_Collector {
25
  $hooks[] = QM_Hook::process( 'all', $wp_filter, self::$hide_qm, self::$hide_core );
26
  }
27
 
28
- if ( defined( 'QM_SHOW_ALL_HOOKS' ) && QM_SHOW_ALL_HOOKS ) {
 
 
29
  // Show all hooks
30
  $hook_names = array_keys( $wp_filter );
31
  } else {
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Collector_Hooks extends QM_Collector {
11
 
12
  public $id = 'hooks';
27
  $hooks[] = QM_Hook::process( 'all', $wp_filter, self::$hide_qm, self::$hide_core );
28
  }
29
 
30
+ $this->data['all_hooks'] = defined( 'QM_SHOW_ALL_HOOKS' ) && QM_SHOW_ALL_HOOKS;
31
+
32
+ if ( $this->data['all_hooks'] ) {
33
  // Show all hooks
34
  $hook_names = array_keys( $wp_filter );
35
  } else {
collectors/http.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Collector_HTTP extends QM_Collector {
9
 
10
  public $id = 'http';
@@ -259,10 +261,6 @@ class QM_Collector_HTTP extends QM_Collector {
259
  $http['ltime'] = ( $http['end'] - $http['start'] );
260
 
261
  if ( isset( $http['info'] ) ) {
262
- if ( isset( $http['info']['total_time'] ) ) {
263
- $http['ltime'] = $http['info']['total_time'];
264
- }
265
-
266
  if ( ! empty( $http['info']['url'] ) ) {
267
  if ( rtrim( $http['url'], '/' ) !== rtrim( $http['info']['url'], '/' ) ) {
268
  $http['redirected_to'] = $http['info']['url'];
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Collector_HTTP extends QM_Collector {
11
 
12
  public $id = 'http';
261
  $http['ltime'] = ( $http['end'] - $http['start'] );
262
 
263
  if ( isset( $http['info'] ) ) {
 
 
 
 
264
  if ( ! empty( $http['info']['url'] ) ) {
265
  if ( rtrim( $http['url'], '/' ) !== rtrim( $http['info']['url'], '/' ) ) {
266
  $http['redirected_to'] = $http['info']['url'];
collectors/languages.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Collector_Languages extends QM_Collector {
9
 
10
  public $id = 'languages';
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Collector_Languages extends QM_Collector {
11
 
12
  public $id = 'languages';
collectors/logger.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Collector_Logger extends QM_Collector {
9
 
10
  public $id = 'logger';
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Collector_Logger extends QM_Collector {
11
 
12
  public $id = 'logger';
collectors/overview.php CHANGED
@@ -5,21 +5,27 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Collector_Overview extends QM_Collector {
9
 
10
  public $id = 'overview';
11
 
12
- public function process() {
 
 
13
 
14
- $this->data['time_taken'] = self::timer_stop_float();
15
- $this->data['time_limit'] = ini_get( 'max_execution_time' );
16
- $this->data['time_start'] = $GLOBALS['timestart'];
 
17
 
18
- if ( ! empty( $this->data['time_limit'] ) ) {
19
- $this->data['time_usage'] = ( 100 / $this->data['time_limit'] ) * $this->data['time_taken'];
20
- } else {
21
- $this->data['time_usage'] = 0;
22
- }
 
23
 
24
  if ( function_exists( 'memory_get_peak_usage' ) ) {
25
  $this->data['memory'] = memory_get_peak_usage();
@@ -28,17 +34,28 @@ class QM_Collector_Overview extends QM_Collector {
28
  } else {
29
  $this->data['memory'] = 0;
30
  }
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  if ( is_user_logged_in() ) {
33
  $this->data['current_user'] = self::format_user( wp_get_current_user() );
34
  } else {
35
- $this->data['current_user'] = false;
36
  }
37
 
38
  if ( function_exists( 'current_user_switched' ) && current_user_switched() ) {
39
  $this->data['switched_user'] = self::format_user( current_user_switched() );
40
  } else {
41
- $this->data['switched_user'] = false;
42
  }
43
 
44
  $this->data['memory_limit'] = QM_Util::convert_hr_to_bytes( ini_get( 'memory_limit' ) );
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Collector_Overview extends QM_Collector {
11
 
12
  public $id = 'overview';
13
 
14
+ public function __construct() {
15
+ add_action( 'shutdown', array( $this, 'process_timing' ), 0 );
16
+ }
17
 
18
+ public function tear_down() {
19
+ remove_action( 'shutdown', array( $this, 'process_timing' ), 0 );
20
+ parent::tear_down();
21
+ }
22
 
23
+ /**
24
+ * Processes the timing and memory related stats as early as possible, so the
25
+ * data isn't skewed by collectors that are processed before this one.
26
+ */
27
+ public function process_timing() {
28
+ $this->data['time_taken'] = self::timer_stop_float();
29
 
30
  if ( function_exists( 'memory_get_peak_usage' ) ) {
31
  $this->data['memory'] = memory_get_peak_usage();
34
  } else {
35
  $this->data['memory'] = 0;
36
  }
37
+ }
38
+
39
+ public function process() {
40
+ $this->data['time_limit'] = ini_get( 'max_execution_time' );
41
+ $this->data['time_start'] = $GLOBALS['timestart'];
42
+
43
+ if ( ! empty( $this->data['time_limit'] ) ) {
44
+ $this->data['time_usage'] = ( 100 / $this->data['time_limit'] ) * $this->data['time_taken'];
45
+ } else {
46
+ $this->data['time_usage'] = 0;
47
+ }
48
 
49
  if ( is_user_logged_in() ) {
50
  $this->data['current_user'] = self::format_user( wp_get_current_user() );
51
  } else {
52
+ $this->data['current_user'] = null;
53
  }
54
 
55
  if ( function_exists( 'current_user_switched' ) && current_user_switched() ) {
56
  $this->data['switched_user'] = self::format_user( current_user_switched() );
57
  } else {
58
+ $this->data['switched_user'] = null;
59
  }
60
 
61
  $this->data['memory_limit'] = QM_Util::convert_hr_to_bytes( ini_get( 'memory_limit' ) );
collectors/php_errors.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  define( 'QM_ERROR_FATALS', E_ERROR | E_PARSE | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR );
9
 
10
  class QM_Collector_PHP_Errors extends QM_Collector {
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  define( 'QM_ERROR_FATALS', E_ERROR | E_PARSE | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR );
11
 
12
  class QM_Collector_PHP_Errors extends QM_Collector {
collectors/raw_request.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  class QM_Collector_Raw_Request extends QM_Collector {
4
 
5
  public $id = 'raw_request';
1
  <?php
2
 
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
  class QM_Collector_Raw_Request extends QM_Collector {
6
 
7
  public $id = 'raw_request';
collectors/redirects.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Collector_Redirects extends QM_Collector {
9
 
10
  public $id = 'redirects';
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Collector_Redirects extends QM_Collector {
11
 
12
  public $id = 'redirects';
collectors/request.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Collector_Request extends QM_Collector {
9
 
10
  public $id = 'request';
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Collector_Request extends QM_Collector {
11
 
12
  public $id = 'request';
collectors/theme.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Collector_Theme extends QM_Collector {
9
 
10
  public $id = 'response';
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Collector_Theme extends QM_Collector {
11
 
12
  public $id = 'response';
collectors/timing.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Collector_Timing extends QM_Collector {
9
 
10
  public $id = 'timing';
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Collector_Timing extends QM_Collector {
11
 
12
  public $id = 'timing';
collectors/transients.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Collector_Transients extends QM_Collector {
9
 
10
  public $id = 'transients';
@@ -16,9 +18,9 @@ class QM_Collector_Transients extends QM_Collector {
16
  }
17
 
18
  public function tear_down() {
19
- parent::tear_down();
20
  remove_action( 'setted_site_transient', array( $this, 'action_setted_site_transient' ), 10 );
21
  remove_action( 'setted_transient', array( $this, 'action_setted_blog_transient' ), 10 );
 
22
  }
23
 
24
  public function action_setted_site_transient( $transient, $value, $expiration ) {
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Collector_Transients extends QM_Collector {
11
 
12
  public $id = 'transients';
18
  }
19
 
20
  public function tear_down() {
 
21
  remove_action( 'setted_site_transient', array( $this, 'action_setted_site_transient' ), 10 );
22
  remove_action( 'setted_transient', array( $this, 'action_setted_blog_transient' ), 10 );
23
+ parent::tear_down();
24
  }
25
 
26
  public function action_setted_site_transient( $transient, $value, $expiration ) {
dispatchers/AJAX.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Dispatcher_AJAX extends QM_Dispatcher {
9
 
10
  public $id = 'ajax';
@@ -12,8 +14,10 @@ class QM_Dispatcher_AJAX extends QM_Dispatcher {
12
  public function __construct( QM_Plugin $qm ) {
13
  parent::__construct( $qm );
14
 
 
 
 
15
  add_action( 'shutdown', array( $this, 'dispatch' ), 0 );
16
-
17
  }
18
 
19
  public function init() {
@@ -23,6 +27,7 @@ class QM_Dispatcher_AJAX extends QM_Dispatcher {
23
  }
24
 
25
  if ( QM_Util::is_ajax() ) {
 
26
  ob_start();
27
  }
28
 
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Dispatcher_AJAX extends QM_Dispatcher {
11
 
12
  public $id = 'ajax';
14
  public function __construct( QM_Plugin $qm ) {
15
  parent::__construct( $qm );
16
 
17
+ // This dispatcher needs to run on a priority lower than 1 so it can output
18
+ // its headers before wp_ob_end_flush_all() flushes all the output buffers:
19
+ // https://github.com/WordPress/wordpress-develop/blob/0a3a3c5119897c6d551a42ae9b5dbfa4f576f2c9/src/wp-includes/default-filters.php#L382
20
  add_action( 'shutdown', array( $this, 'dispatch' ), 0 );
 
21
  }
22
 
23
  public function init() {
27
  }
28
 
29
  if ( QM_Util::is_ajax() ) {
30
+ // Start an output buffer for Ajax requests so headers can be output at the end:
31
  ob_start();
32
  }
33
 
dispatchers/Html.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Dispatcher_Html extends QM_Dispatcher {
9
 
10
  /**
@@ -33,7 +35,6 @@ class QM_Dispatcher_Html extends QM_Dispatcher {
33
  add_action( 'wp_footer', array( $this, 'action_footer' ) );
34
  add_action( 'admin_footer', array( $this, 'action_footer' ) );
35
  add_action( 'login_footer', array( $this, 'action_footer' ) );
36
- add_action( 'embed_footer', array( $this, 'action_footer' ) );
37
  add_action( 'gp_footer', array( $this, 'action_footer' ) );
38
 
39
  parent::__construct( $qm );
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Dispatcher_Html extends QM_Dispatcher {
11
 
12
  /**
35
  add_action( 'wp_footer', array( $this, 'action_footer' ) );
36
  add_action( 'admin_footer', array( $this, 'action_footer' ) );
37
  add_action( 'login_footer', array( $this, 'action_footer' ) );
 
38
  add_action( 'gp_footer', array( $this, 'action_footer' ) );
39
 
40
  parent::__construct( $qm );
dispatchers/REST.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Dispatcher_REST extends QM_Dispatcher {
9
 
10
  public $id = 'rest';
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Dispatcher_REST extends QM_Dispatcher {
11
 
12
  public $id = 'rest';
dispatchers/REST_Envelope.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * REST API enveloped request dispatcher.
4
+ *
5
+ * @package query-monitor
6
+ */
7
+
8
+ class QM_Dispatcher_REST_Envelope extends QM_Dispatcher {
9
+
10
+ public $id = 'rest_envelope';
11
+
12
+ public function __construct( QM_Plugin $qm ) {
13
+ parent::__construct( $qm );
14
+
15
+ add_filter( 'rest_envelope_response', array( $this, 'filter_rest_envelope_response' ), 999, 2 );
16
+ }
17
+
18
+ /**
19
+ * Filters the enveloped form of a REST API response to add QM's data.
20
+ *
21
+ * @param array $envelope Envelope data.
22
+ * @param WP_REST_Response $response Original response data.
23
+ * @return array Envelope data.
24
+ */
25
+ public function filter_rest_envelope_response( array $envelope, WP_REST_Response $response ) {
26
+ if ( ! $this->should_dispatch() ) {
27
+ return $envelope;
28
+ }
29
+
30
+ $data = array();
31
+
32
+ $this->before_output();
33
+
34
+ /* @var QM_Output_Raw[] */
35
+ foreach ( $this->get_outputters( 'raw' ) as $id => $output ) {
36
+ $data[ $id ] = $output->output();
37
+ }
38
+
39
+ $this->after_output();
40
+
41
+ $envelope['qm'] = $data;
42
+
43
+ return $envelope;
44
+ }
45
+
46
+ protected function before_output() {
47
+ require_once $this->qm->plugin_path( 'output/Raw.php' );
48
+
49
+ foreach ( glob( $this->qm->plugin_path( 'output/raw/*.php' ) ) as $file ) {
50
+ include_once $file;
51
+ }
52
+ }
53
+
54
+ public function is_active() {
55
+ if ( ! self::user_can_view() ) {
56
+ return false;
57
+ }
58
+
59
+ return true;
60
+ }
61
+
62
+ }
63
+
64
+ function register_qm_dispatcher_rest_envelope( array $dispatchers, QM_Plugin $qm ) {
65
+ $dispatchers['rest_envelope'] = new QM_Dispatcher_REST_Envelope( $qm );
66
+ return $dispatchers;
67
+ }
68
+
69
+ add_filter( 'qm/dispatchers', 'register_qm_dispatcher_rest_envelope', 10, 2 );
dispatchers/Redirect.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Dispatcher_Redirect extends QM_Dispatcher {
9
 
10
  public $id = 'redirect';
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Dispatcher_Redirect extends QM_Dispatcher {
11
 
12
  public $id = 'redirect';
dispatchers/WP_Die.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Dispatcher_WP_Die extends QM_Dispatcher {
9
 
10
  public $id = 'wp_die';
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Dispatcher_WP_Die extends QM_Dispatcher {
11
 
12
  public $id = 'wp_die';
output/Raw.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Abstract output class for raw output encoded as JSON.
4
+ *
5
+ * @package query-monitor
6
+ */
7
+
8
+ abstract class QM_Output_Raw extends QM_Output {
9
+
10
+ public function output() {
11
+ return $this->get_output();
12
+ }
13
+
14
+ }
output/headers/overview.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Output_Headers_Overview extends QM_Output_Headers {
9
 
10
  /**
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Headers_Overview extends QM_Output_Headers {
11
 
12
  /**
output/headers/php_errors.php CHANGED
@@ -4,6 +4,9 @@
4
  *
5
  * @package query-monitor
6
  */
 
 
 
7
  class QM_Output_Headers_PHP_Errors extends QM_Output_Headers {
8
 
9
  /**
4
  *
5
  * @package query-monitor
6
  */
7
+
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Headers_PHP_Errors extends QM_Output_Headers {
11
 
12
  /**
output/headers/redirects.php CHANGED
@@ -4,6 +4,9 @@
4
  *
5
  * @package query-monitor
6
  */
 
 
 
7
  class QM_Output_Headers_Redirects extends QM_Output_Headers {
8
 
9
  /**
4
  *
5
  * @package query-monitor
6
  */
7
+
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Headers_Redirects extends QM_Output_Headers {
11
 
12
  /**
output/html/admin.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Output_Html_Admin extends QM_Output_Html {
9
 
10
  /**
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Html_Admin extends QM_Output_Html {
11
 
12
  /**
output/html/assets.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  abstract class QM_Output_Html_Assets extends QM_Output_Html {
9
 
10
  /**
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  abstract class QM_Output_Html_Assets extends QM_Output_Html {
11
 
12
  /**
output/html/assets_scripts.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Output_Html_Assets_Scripts extends QM_Output_Html_Assets {
9
 
10
  /**
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Html_Assets_Scripts extends QM_Output_Html_Assets {
11
 
12
  /**
output/html/assets_styles.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Output_Html_Assets_Styles extends QM_Output_Html_Assets {
9
 
10
  /**
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Html_Assets_Styles extends QM_Output_Html_Assets {
11
 
12
  /**
output/html/block_editor.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Output_Html_Block_Editor extends QM_Output_Html {
9
 
10
  /**
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Html_Block_Editor extends QM_Output_Html {
11
 
12
  /**
output/html/caps.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Output_Html_Caps extends QM_Output_Html {
9
 
10
  /**
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Html_Caps extends QM_Output_Html {
11
 
12
  /**
output/html/conditionals.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Output_Html_Conditionals extends QM_Output_Html {
9
 
10
  /**
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Html_Conditionals extends QM_Output_Html {
11
 
12
  /**
output/html/db_callers.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Output_Html_DB_Callers extends QM_Output_Html {
9
 
10
  /**
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Html_DB_Callers extends QM_Output_Html {
11
 
12
  /**
output/html/db_components.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Output_Html_DB_Components extends QM_Output_Html {
9
 
10
  /**
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Html_DB_Components extends QM_Output_Html {
11
 
12
  /**
output/html/db_dupes.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Output_Html_DB_Dupes extends QM_Output_Html {
9
 
10
  /**
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Html_DB_Dupes extends QM_Output_Html {
11
 
12
  /**
output/html/db_queries.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Output_Html_DB_Queries extends QM_Output_Html {
9
 
10
  /**
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Html_DB_Queries extends QM_Output_Html {
11
 
12
  /**
output/html/debug_bar.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Output_Html_Debug_Bar extends QM_Output_Html {
9
 
10
  /**
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Html_Debug_Bar extends QM_Output_Html {
11
 
12
  /**
output/html/environment.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Output_Html_Environment extends QM_Output_Html {
9
 
10
  /**
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Html_Environment extends QM_Output_Html {
11
 
12
  /**
output/html/headers.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Output_Html_Headers extends QM_Output_Html {
9
 
10
  /**
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Html_Headers extends QM_Output_Html {
11
 
12
  /**
output/html/hooks.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Output_Html_Hooks extends QM_Output_Html {
9
 
10
  /**
@@ -33,13 +35,15 @@ class QM_Output_Html_Hooks extends QM_Output_Html {
33
 
34
  $this->before_tabular_output();
35
 
 
 
36
  echo '<thead>';
37
  echo '<tr>';
38
  echo '<th scope="col" class="qm-filterable-column">';
39
  echo $this->build_filter( 'name', $data['parts'], __( 'Hook', 'query-monitor' ) ); // WPCS: XSS ok.
40
  echo '</th>';
41
  echo '<th scope="col">' . esc_html__( 'Priority', 'query-monitor' ) . '</th>';
42
- echo '<th scope="col">' . esc_html__( 'Action', 'query-monitor' ) . '</th>';
43
  echo '<th scope="col" class="qm-filterable-column">';
44
  echo $this->build_filter( 'component', $data['components'], __( 'Component', 'query-monitor' ), array(
45
  'highlight' => 'subject',
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Html_Hooks extends QM_Output_Html {
11
 
12
  /**
35
 
36
  $this->before_tabular_output();
37
 
38
+ $callback_label = $data['all_hooks'] ? __( 'Callback', 'query-monitor' ) : __( 'Action', 'query-monitor' );
39
+
40
  echo '<thead>';
41
  echo '<tr>';
42
  echo '<th scope="col" class="qm-filterable-column">';
43
  echo $this->build_filter( 'name', $data['parts'], __( 'Hook', 'query-monitor' ) ); // WPCS: XSS ok.
44
  echo '</th>';
45
  echo '<th scope="col">' . esc_html__( 'Priority', 'query-monitor' ) . '</th>';
46
+ echo '<th scope="col">' . esc_html( $callback_label ) . '</th>';
47
  echo '<th scope="col" class="qm-filterable-column">';
48
  echo $this->build_filter( 'component', $data['components'], __( 'Component', 'query-monitor' ), array(
49
  'highlight' => 'subject',
output/html/http.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Output_Html_HTTP extends QM_Output_Html {
9
 
10
  /**
@@ -142,6 +144,7 @@ class QM_Output_Html_HTTP extends QM_Output_Html {
142
  'wp_remote_fopen',
143
  'download_url',
144
  'vip_safe_wp_remote_get',
 
145
  'wpcom_vip_file_get_contents',
146
  ), true );
147
  }
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Html_HTTP extends QM_Output_Html {
11
 
12
  /**
144
  'wp_remote_fopen',
145
  'download_url',
146
  'vip_safe_wp_remote_get',
147
+ 'vip_safe_wp_remote_request',
148
  'wpcom_vip_file_get_contents',
149
  ), true );
150
  }
output/html/languages.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Output_Html_Languages extends QM_Output_Html {
9
 
10
  /**
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Html_Languages extends QM_Output_Html {
11
 
12
  /**
output/html/logger.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Output_Html_Logger extends QM_Output_Html {
9
 
10
  /**
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Html_Logger extends QM_Output_Html {
11
 
12
  /**
output/html/overview.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Output_Html_Overview extends QM_Output_Html {
9
 
10
  /**
@@ -34,12 +36,12 @@ class QM_Output_Html_Overview extends QM_Output_Html {
34
  $db_queries_data = $db_queries->get_data();
35
  if ( isset( $db_queries_data['types'] ) && isset( $db_queries_data['total_time'] ) ) {
36
  $db_query_num = $db_queries_data['types'];
37
- $db_query_time = $db_queries_data['total_time'];
38
  }
39
  }
40
 
41
  $raw_request = QM_Collectors::get( 'raw_request' );
42
  $cache = QM_Collectors::get( 'cache' );
 
43
 
44
  $qm_broken = __( 'A JavaScript problem on the page is preventing Query Monitor from working correctly. jQuery may have been blocked from loading.', 'query-monitor' );
45
  $ajax_errors = __( 'PHP errors were triggered during an Ajax request. See your browser developer console for details.', 'query-monitor' );
@@ -163,18 +165,16 @@ class QM_Output_Html_Overview extends QM_Output_Html {
163
  echo '</p>';
164
  echo '</section>';
165
 
166
- if ( isset( $db_queries_data ) ) {
167
- echo '<section>';
168
- echo '<h3>' . esc_html__( 'Database Query Time', 'query-monitor' ) . '</h3>';
169
- echo '<p>';
170
- echo esc_html( number_format_i18n( $db_queries_data['total_time'], 4 ) );
171
- echo '</p>';
172
- echo '</section>';
173
- }
174
-
175
  if ( isset( $db_query_num ) && isset( $db_queries_data ) ) {
176
  echo '<section>';
177
  echo '<h3>' . esc_html__( 'Database Queries', 'query-monitor' ) . '</h3>';
 
 
 
 
 
 
 
178
  echo '<p>';
179
 
180
  if ( ! isset( $db_query_num['SELECT'] ) || count( $db_query_num ) > 1 ) {
@@ -198,6 +198,32 @@ class QM_Output_Html_Overview extends QM_Output_Html {
198
  echo '</section>';
199
  }
200
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
  if ( $cache ) {
202
  echo '<section>';
203
  echo '<h3>' . esc_html__( 'Object Cache', 'query-monitor' ) . '</h3>';
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Html_Overview extends QM_Output_Html {
11
 
12
  /**
36
  $db_queries_data = $db_queries->get_data();
37
  if ( isset( $db_queries_data['types'] ) && isset( $db_queries_data['total_time'] ) ) {
38
  $db_query_num = $db_queries_data['types'];
 
39
  }
40
  }
41
 
42
  $raw_request = QM_Collectors::get( 'raw_request' );
43
  $cache = QM_Collectors::get( 'cache' );
44
+ $http = QM_Collectors::get( 'http' );
45
 
46
  $qm_broken = __( 'A JavaScript problem on the page is preventing Query Monitor from working correctly. jQuery may have been blocked from loading.', 'query-monitor' );
47
  $ajax_errors = __( 'PHP errors were triggered during an Ajax request. See your browser developer console for details.', 'query-monitor' );
165
  echo '</p>';
166
  echo '</section>';
167
 
 
 
 
 
 
 
 
 
 
168
  if ( isset( $db_query_num ) && isset( $db_queries_data ) ) {
169
  echo '<section>';
170
  echo '<h3>' . esc_html__( 'Database Queries', 'query-monitor' ) . '</h3>';
171
+
172
+ if ( isset( $db_queries_data ) ) {
173
+ echo '<p>';
174
+ echo esc_html( number_format_i18n( $db_queries_data['total_time'], 4 ) );
175
+ echo '</p>';
176
+ }
177
+
178
  echo '<p>';
179
 
180
  if ( ! isset( $db_query_num['SELECT'] ) || count( $db_query_num ) > 1 ) {
198
  echo '</section>';
199
  }
200
 
201
+ if ( $http ) {
202
+ echo '<section>';
203
+ echo '<h3>' . esc_html__( 'HTTP API Calls', 'query-monitor' ) . '</h3>';
204
+
205
+ $http_data = $http->get_data();
206
+
207
+ if ( ! empty( $http_data['http'] ) ) {
208
+ printf(
209
+ '<p>%s</p>',
210
+ esc_html( number_format_i18n( $http_data['ltime'], 4 ) )
211
+ );
212
+ printf(
213
+ '<button class="qm-filter-trigger" data-qm-target="http" data-qm-filter="type" data-qm-value="">%1$s: %2$s</button>',
214
+ esc_html( _x( 'Total', 'HTTP API calls', 'query-monitor' ) ),
215
+ esc_html( number_format_i18n( count( $http_data['http'] ) ) )
216
+ );
217
+ } else {
218
+ printf(
219
+ '<p><em>%s</em></p>',
220
+ esc_html__( 'None', 'query-monitor' )
221
+ );
222
+ }
223
+
224
+ echo '</section>';
225
+ }
226
+
227
  if ( $cache ) {
228
  echo '<section>';
229
  echo '<h3>' . esc_html__( 'Object Cache', 'query-monitor' ) . '</h3>';
output/html/php_errors.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Output_Html_PHP_Errors extends QM_Output_Html {
9
 
10
  /**
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Html_PHP_Errors extends QM_Output_Html {
11
 
12
  /**
output/html/request.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Output_Html_Request extends QM_Output_Html {
9
 
10
  /**
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Html_Request extends QM_Output_Html {
11
 
12
  /**
output/html/theme.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Output_Html_Theme extends QM_Output_Html {
9
 
10
  /**
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Html_Theme extends QM_Output_Html {
11
 
12
  /**
output/html/timing.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Output_Html_Timing extends QM_Output_Html {
9
 
10
  /**
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Html_Timing extends QM_Output_Html {
11
 
12
  /**
output/html/transients.php CHANGED
@@ -5,6 +5,8 @@
5
  * @package query-monitor
6
  */
7
 
 
 
8
  class QM_Output_Html_Transients extends QM_Output_Html {
9
 
10
  /**
5
  * @package query-monitor
6
  */
7
 
8
+ defined( 'ABSPATH' ) || exit;
9
+
10
  class QM_Output_Html_Transients extends QM_Output_Html {
11
 
12
  /**
output/raw/cache.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Raw cache output.
4
+ *
5
+ * @package query-monitor
6
+ */
7
+
8
+ class QM_Output_Raw_Cache extends QM_Output_Raw {
9
+
10
+ /**
11
+ * Collector instance.
12
+ *
13
+ * @var QM_Collector_Cache Collector.
14
+ */
15
+ protected $collector;
16
+
17
+ public function name() {
18
+ return __( 'Object Cache', 'query-monitor' );
19
+ }
20
+
21
+ public function get_output() {
22
+ $output = array(
23
+ 'hit_percentage' => null,
24
+ 'hits' => null,
25
+ 'misses' => null,
26
+ );
27
+ $data = $this->collector->get_data();
28
+
29
+ if ( isset( $data['stats'] ) && isset( $data['cache_hit_percentage'] ) ) {
30
+ $output['hit_percentage'] = (float) number_format_i18n( $data['cache_hit_percentage'], 1 );
31
+ $output['hits'] = (int) number_format_i18n( $data['stats']['cache_hits'], 0 );
32
+ $output['misses'] = (int) number_format_i18n( $data['stats']['cache_misses'], 0 );
33
+ }
34
+
35
+ return $output;
36
+ }
37
+ }
38
+
39
+ function register_qm_output_raw_cache( array $output, QM_Collectors $collectors ) {
40
+ $collector = QM_Collectors::get( 'cache' );
41
+ if ( $collector ) {
42
+ $output['cache'] = new QM_Output_Raw_Cache( $collector );
43
+ }
44
+ return $output;
45
+ }
46
+
47
+ add_filter( 'qm/outputter/raw', 'register_qm_output_raw_cache', 30, 2 );
output/raw/conditionals.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Raw conditionals output.
4
+ *
5
+ * @package query-monitor
6
+ */
7
+
8
+ class QM_Output_Raw_Conditionals extends QM_Output_Raw {
9
+
10
+ /**
11
+ * Collector instance.
12
+ *
13
+ * @var QM_Collector_Conditionals Collector.
14
+ */
15
+ protected $collector;
16
+
17
+ public function name() {
18
+ return __( 'Conditionals', 'query-monitor' );
19
+ }
20
+
21
+ public function get_output() {
22
+ $data = $this->collector->get_data();
23
+
24
+ return $data['conds']['true'];
25
+ }
26
+ }
27
+
28
+ function register_qm_output_raw_conditionals( array $output, QM_Collectors $collectors ) {
29
+ $collector = QM_Collectors::get( 'conditionals' );
30
+ if ( $collector ) {
31
+ $output['conditionals'] = new QM_Output_Raw_Conditionals( $collector );
32
+ }
33
+ return $output;
34
+ }
35
+
36
+ add_filter( 'qm/outputter/raw', 'register_qm_output_raw_conditionals', 20, 2 );
output/raw/db_queries.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Raw database query output.
4
+ *
5
+ * @package query-monitor
6
+ */
7
+
8
+ class QM_Output_Raw_DB_Queries extends QM_Output_Raw {
9
+
10
+ /**
11
+ * Collector instance.
12
+ *
13
+ * @var QM_Collector_DB_Queries Collector.
14
+ */
15
+ protected $collector;
16
+
17
+ public $query_row = 0;
18
+
19
+ public function name() {
20
+ return __( 'Database Queries', 'query-monitor' );
21
+ }
22
+
23
+ public function get_output() {
24
+ $output = array();
25
+ $data = $this->collector->get_data();
26
+
27
+ if ( empty( $data['dbs'] ) ) {
28
+ return $output;
29
+ }
30
+
31
+ $dbs = array();
32
+
33
+ foreach ( $data['dbs'] as $name => $db ) {
34
+ $dbs[ $name ] = $this->output_queries( $name, $db, $data );
35
+ }
36
+
37
+ $output['dbs'] = $dbs;
38
+
39
+ if ( ! empty( $data['errors'] ) ) {
40
+ $output['errors'] = array(
41
+ 'total' => count( $data['errors'] ),
42
+ 'errors' => $data['errors'],
43
+ );
44
+ }
45
+
46
+ if ( ! empty( $data['dupes'] ) ) {
47
+ $dupes = $data['dupes'];
48
+
49
+ // Filter out SQL queries that do not have dupes
50
+ $dupes = array_filter( $dupes, array( $this->collector, 'filter_dupe_items' ) );
51
+
52
+ // Ignore dupes from `WP_Query->set_found_posts()`
53
+ unset( $dupes['SELECT FOUND_ROWS()'] );
54
+
55
+ $output['dupes'] = array(
56
+ 'total' => count( $dupes ),
57
+ 'queries' => $dupes,
58
+ );
59
+ }
60
+
61
+ return $output;
62
+ }
63
+
64
+ protected function output_queries( $name, stdClass $db, array $data ) {
65
+ $this->query_row = 0;
66
+
67
+ $output = array();
68
+
69
+ if ( empty( $db->rows ) ) {
70
+ return $output;
71
+ }
72
+
73
+ foreach ( $db->rows as $row ) {
74
+ $output[] = $this->output_query_row( $row );
75
+ }
76
+
77
+ return array(
78
+ 'total' => $db->total_qs,
79
+ 'time' => (float) number_format_i18n( $db->total_time, 4 ),
80
+ 'queries' => $output,
81
+ );
82
+ }
83
+
84
+ protected function output_query_row( array $row ) {
85
+ $output = array();
86
+
87
+ $output['i'] = ++$this->query_row;
88
+ $output['sql'] = $row['sql'];
89
+ $output['time'] = (float) number_format_i18n( $row['ltime'], 4 );
90
+
91
+ if ( isset( $row['trace'] ) ) {
92
+ $stack = array();
93
+ $filtered_trace = $row['trace']->get_display_trace();
94
+
95
+ foreach ( $filtered_trace as $item ) {
96
+ $stack[] = $item['display'];
97
+ }
98
+ } else {
99
+ $stack = explode( ', ', $row['stack'] );
100
+ $stack = array_reverse( $stack );
101
+ }
102
+
103
+ $output['stack'] = $stack;
104
+ $output['result'] = $row['result'];
105
+
106
+ return $output;
107
+ }
108
+ }
109
+
110
+ function register_qm_output_raw_db_queries( array $output, QM_Collectors $collectors ) {
111
+ $collector = QM_Collectors::get( 'db_queries' );
112
+ if ( $collector ) {
113
+ $output['db_queries'] = new QM_Output_Raw_DB_Queries( $collector );
114
+ }
115
+ return $output;
116
+ }
117
+
118
+ add_filter( 'qm/outputter/raw', 'register_qm_output_raw_db_queries', 20, 2 );
output/raw/http.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Raw HTTP API request output.
4
+ *
5
+ * @package query-monitor
6
+ */
7
+
8
+ class QM_Output_Raw_HTTP extends QM_Output_Raw {
9
+
10
+ /**
11
+ * Collector instance.
12
+ *
13
+ * @var QM_Collector_HTTP Collector.
14
+ */
15
+ protected $collector;
16
+
17
+ public function name() {
18
+ return __( 'HTTP API Calls', 'query-monitor' );
19
+ }
20
+
21
+ public function get_output() {
22
+ $output = array();
23
+ $data = $this->collector->get_data();
24
+
25
+ if ( empty( $data['http'] ) ) {
26
+ return $output;
27
+ }
28
+
29
+ $requests = array();
30
+
31
+ foreach ( $data['http'] as $http ) {
32
+ $stack = array();
33
+
34
+ if ( isset( $http['trace'] ) ) {
35
+ $filtered_trace = $http['trace']->get_display_trace();
36
+
37
+ foreach ( $filtered_trace as $item ) {
38
+ $stack[] = $item['display'];
39
+ }
40
+ }
41
+
42
+ $requests[] = array(
43
+ 'url' => $http['url'],
44
+ 'method' => $http['args']['method'],
45
+ 'response' => $http['response']['response'],
46
+ 'time' => (float) number_format_i18n( $http['end'] - $http['start'], 4 ),
47
+ 'stack' => $stack,
48
+ );
49
+ }
50
+
51
+ $output['total'] = count( $requests );
52
+ $output['time'] = (float) number_format_i18n( $data['ltime'], 4 );
53
+ $output['requests'] = $requests;
54
+
55
+ return $output;
56
+ }
57
+ }
58
+
59
+ function register_qm_output_raw_http( array $output, QM_Collectors $collectors ) {
60
+ $collector = QM_Collectors::get( 'http' );
61
+ if ( $collector ) {
62
+ $output['http'] = new QM_Output_Raw_HTTP( $collector );
63
+ }
64
+ return $output;
65
+ }
66
+
67
+ add_filter( 'qm/outputter/raw', 'register_qm_output_raw_http', 30, 2 );
output/raw/logger.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Raw logger output.
4
+ *
5
+ * @package query-monitor
6
+ */
7
+
8
+ class QM_Output_Raw_Logger extends QM_Output_Raw {
9
+
10
+ /**
11
+ * Collector instance.
12
+ *
13
+ * @var QM_Collector_Logger Collector.
14
+ */
15
+ protected $collector;
16
+
17
+ public function name() {
18
+ return __( 'Logs', 'query-monitor' );
19
+ }
20
+
21
+ public function get_output() {
22
+ $output = array();
23
+ $data = $this->collector->get_data();
24
+
25
+ if ( empty( $data['logs'] ) ) {
26
+ return $output;
27
+ }
28
+
29
+ foreach ( $data['logs'] as $log ) {
30
+ $stack = array();
31
+
32
+ if ( isset( $log['trace'] ) ) {
33
+ $filtered_trace = $log['trace']->get_display_trace();
34
+
35
+ foreach ( $filtered_trace as $item ) {
36
+ $stack[] = $item['display'];
37
+ }
38
+ }
39
+
40
+ $output[ $log['level'] ][] = array(
41
+ 'message' => $log['message'],
42
+ 'stack' => $stack,
43
+ );
44
+ }
45
+
46
+ return $output;
47
+ }
48
+ }
49
+
50
+ function register_qm_output_raw_logger( array $output, QM_Collectors $collectors ) {
51
+ $collector = QM_Collectors::get( 'logger' );
52
+ if ( $collector ) {
53
+ $output['logger'] = new QM_Output_Raw_Logger( $collector );
54
+ }
55
+ return $output;
56
+ }
57
+
58
+ add_filter( 'qm/outputter/raw', 'register_qm_output_raw_logger', 30, 2 );
output/raw/transients.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Raw transients output.
4
+ *
5
+ * @package query-monitor
6
+ */
7
+
8
+ class QM_Output_Raw_Transients extends QM_Output_Raw {
9
+
10
+ /**
11
+ * Collector instance.
12
+ *
13
+ * @var QM_Collector_Transients Collector.
14
+ */
15
+ protected $collector;
16
+
17
+ public function name() {
18
+ return __( 'Transients', 'query-monitor' );
19
+ }
20
+
21
+ public function get_output() {
22
+ $output = array();
23
+ $data = $this->collector->get_data();
24
+
25
+ if ( empty( $data['trans'] ) ) {
26
+ return $output;
27
+ }
28
+
29
+ $transients = array();
30
+
31
+ foreach ( $data['trans'] as $transient ) {
32
+ $stack = array();
33
+
34
+ if ( isset( $transient['filtered_trace'] ) ) {
35
+ $filtered_trace = $transient['filtered_trace'];
36
+
37
+ foreach ( $filtered_trace as $item ) {
38
+ $stack[] = $item['display'];
39
+ }
40
+ }
41
+
42
+ $transients[] = array(
43
+ 'name' => $transient['name'],
44
+ 'type' => $transient['type'],
45
+ 'size' => $transient['size_formatted'],
46
+ 'expiration' => $transient['expiration'],
47
+ 'stack' => $stack,
48
+ );
49
+ }
50
+
51
+ $output['total'] = count( $transients );
52
+ $output['transients'] = $transients;
53
+
54
+ return $output;
55
+ }
56
+ }
57
+
58
+ function register_qm_output_raw_transients( array $output, QM_Collectors $collectors ) {
59
+ $collector = QM_Collectors::get( 'transients' );
60
+ if ( $collector ) {
61
+ $output['transients'] = new QM_Output_Raw_Transients( $collector );
62
+ }
63
+ return $output;
64
+ }
65
+
66
+ add_filter( 'qm/outputter/raw', 'register_qm_output_raw_transients', 30, 2 );
query-monitor.php CHANGED
@@ -10,7 +10,7 @@
10
  *
11
  * Plugin Name: Query Monitor
12
  * Description: The Developer Tools Panel for WordPress.
13
- * Version: 3.6.8
14
  * Plugin URI: https://querymonitor.com/
15
  * Author: John Blackbourn
16
  * Author URI: https://querymonitor.com/
@@ -29,7 +29,7 @@
29
  * GNU General Public License for more details.
30
  */
31
 
32
- defined( 'ABSPATH' ) || die();
33
 
34
  $qm_dir = dirname( __FILE__ );
35
 
10
  *
11
  * Plugin Name: Query Monitor
12
  * Description: The Developer Tools Panel for WordPress.
13
+ * Version: 3.7.0
14
  * Plugin URI: https://querymonitor.com/
15
  * Author: John Blackbourn
16
  * Author URI: https://querymonitor.com/
29
  * GNU General Public License for more details.
30
  */
31
 
32
+ defined( 'ABSPATH' ) || exit;
33
 
34
  $qm_dir = dirname( __FILE__ );
35
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: johnbillion
3
  Tags: debug, debug-bar, debugging, development, developer, performance, profiler, queries, query monitor, rest-api
4
  Requires at least: 3.7
5
  Tested up to: 5.7
6
- Stable tag: 3.6.8
7
  License: GPLv2 or later
8
  Requires PHP: 5.3
9
  Donate link: https://johnblackbourn.com/donations/
@@ -39,7 +39,7 @@ In addition:
39
 
40
  * Whenever a redirect occurs, Query Monitor adds an HTTP header containing the call stack, so you can use your favourite HTTP inspector or browser developer tools to trace what triggered the redirect.
41
  * The response from any jQuery-initiated Ajax request on the page will contain various debugging information in its headers. PHP errors also get output to the browser's developer console.
42
- * The response from an authenticated WordPress REST API request will contain various debugging information in its headers, as long as the authenticated user has permission to view Query Monitor's output.
43
 
44
  By default, Query Monitor's output is only shown to Administrators on single-site installations, and Super Admins on Multisite installations.
45
 
@@ -92,7 +92,7 @@ Query Monitor's memory usage typically accounts for around 10% of the total memo
92
 
93
  [A list of add-on plugins for Query Monitor can be found here.](https://github.com/johnbillion/query-monitor/wiki/Query-Monitor-Add-on-Plugins)
94
 
95
- In addition, Query Monitor transparently supports add-ons for the Debug Bar plugin. If you have any Debug Bar add-ons installed, just deactivate Debug Bar and the add-ons will show up in Query Monitor's menu.
96
 
97
  ### Where can I suggest a new feature or report a bug?
98
 
@@ -106,6 +106,8 @@ Yes, the [Altis Developer Tools](https://www.altis-dxp.com/resources/developer-d
106
 
107
  Yes, it's included as part of the VIP Go platform. However, a user needs to be granted the `view_query_monitor` capability to see Query Monitor even if they're an administrator.
108
 
 
 
109
  ### I'm using multiple instances of `wpdb`. How do I get my additional instances to show up in Query Monitor?
110
 
111
  You'll need to hook into the `qm/collect/db_objects` filter and add an item to the array containing your `wpdb` instance. For example:
@@ -123,10 +125,347 @@ Yes. You can enable this on the Settings panel.
123
 
124
  ### Do you accept donations?
125
 
126
- ### Do you accept donations?
127
-
128
  [I am accepting sponsorships via the GitHub Sponsors program](https://johnblackbourn.com/donations/) and any support you can give will help me maintain this plugin and keep it free for everyone.
129
 
130
  In addition, if you like the plugin then I'd love for you to [leave a review](https://wordpress.org/support/view/plugin-reviews/query-monitor). Tell all your friends about it too!
131
 
132
- <!-- changelog -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  Tags: debug, debug-bar, debugging, development, developer, performance, profiler, queries, query monitor, rest-api
4
  Requires at least: 3.7
5
  Tested up to: 5.7
6
+ Stable tag: 3.7.0
7
  License: GPLv2 or later
8
  Requires PHP: 5.3
9
  Donate link: https://johnblackbourn.com/donations/
39
 
40
  * Whenever a redirect occurs, Query Monitor adds an HTTP header containing the call stack, so you can use your favourite HTTP inspector or browser developer tools to trace what triggered the redirect.
41
  * The response from any jQuery-initiated Ajax request on the page will contain various debugging information in its headers. PHP errors also get output to the browser's developer console.
42
+ * The response from an authenticated WordPress REST API request will contain an overview of performance information and PHP errors in its headers, as long as the authenticated user has permission to view Query Monitor's output. An [an enveloped REST API request](https://developer.wordpress.org/rest-api/using-the-rest-api/global-parameters/#_envelope) will include even more debugging information in the `qm` property of the response.
43
 
44
  By default, Query Monitor's output is only shown to Administrators on single-site installations, and Super Admins on Multisite installations.
45
 
92
 
93
  [A list of add-on plugins for Query Monitor can be found here.](https://github.com/johnbillion/query-monitor/wiki/Query-Monitor-Add-on-Plugins)
94
 
95
+ In addition, Query Monitor transparently supports add-ons for the Debug Bar plugin. If you have any Debug Bar add-ons installed, deactivate Debug Bar and the add-ons will show up in Query Monitor's menu.
96
 
97
  ### Where can I suggest a new feature or report a bug?
98
 
106
 
107
  Yes, it's included as part of the VIP Go platform. However, a user needs to be granted the `view_query_monitor` capability to see Query Monitor even if they're an administrator.
108
 
109
+ Please note that information about database queries and the environment is somewhat restricted on VIP. This is a platform restriction and not a Query Monitor issue.
110
+
111
  ### I'm using multiple instances of `wpdb`. How do I get my additional instances to show up in Query Monitor?
112
 
113
  You'll need to hook into the `qm/collect/db_objects` filter and add an item to the array containing your `wpdb` instance. For example:
125
 
126
  ### Do you accept donations?
127
 
 
 
128
  [I am accepting sponsorships via the GitHub Sponsors program](https://johnblackbourn.com/donations/) and any support you can give will help me maintain this plugin and keep it free for everyone.
129
 
130
  In addition, if you like the plugin then I'd love for you to [leave a review](https://wordpress.org/support/view/plugin-reviews/query-monitor). Tell all your friends about it too!
131
 
132
+ ## Changelog ##
133
+
134
+ ### 3.7.0 ###
135
+
136
+ * <a href="https://querymonitor.com/blog/2021/05/debugging-wordpress-rest-api-requests/">Introduce debugging output in a `qm` property in enveloped REST API responses</a>
137
+ * Add HTTP API call information to the overview panel
138
+ * Don't show QM output inside WordPress embeds as nobody uses this
139
+ * Don't try to access the `QM_HIDE_SELF` constant before it's defined
140
+ * Process the timing and memory related stats as early as possible so the data isn't too skewed
141
+
142
+
143
+ ### 3.6.8 ###
144
+
145
+ * Add WordPress memory usage statistic to Overview panel
146
+ * Add block context information to the Blocks panel
147
+ * Fix row highlighting of TH cells
148
+ * Fix some panel resizing bugs
149
+
150
+
151
+ ### 3.6.7 ###
152
+
153
+ * Implement a `QM_DB_SYMLINK` constant to prevent the `db.php` symlink being put into place.
154
+ * Remove a dependency on `SAVEQUERIES` in the query collector.
155
+ * Remove invalid `scope` attributes on table cells.
156
+
157
+
158
+ ### 3.6.6 ###
159
+
160
+ * PHP 8 fix.
161
+ * Improve the display for various empty values when logging.
162
+ * Don't display child menus until the parent menu is active. Makes the menu clearer.
163
+ * Detect local host names in HTTP API requests and don't mark them as ignoring certificate verification.
164
+ * Prevent the text in toggle buttons from being selected when selecting data in tables.
165
+ * Remove support for the Dark Mode plugin which isn't Dark Mode any more.
166
+
167
+
168
+ ### 3.6.5 ###
169
+
170
+ * Always show the Logs panel, with a link to help docs.
171
+ * Whole bunch of improvements to QM's "broken" state handling.
172
+ * Remove usage of deprecated jQuery methods.
173
+ * Add support for Altis dependencies as components.
174
+ * Add `innodb_buffer_pool_size` variable to the mysql environment list.
175
+ * Preformat the Logger output
176
+ * Fix the PHP version check.
177
+
178
+
179
+ ### 3.6.4 ###
180
+
181
+ * Correct an error introduced in 3.6.2 with the extra early error handling (ironic).
182
+
183
+ ### 3.6.3 ###
184
+
185
+ * Correct the size of the close icon.
186
+
187
+ ### 3.6.2 ###
188
+
189
+ * Capture and display the most recent PHP error that occurred before QM loaded.
190
+ * Add support for the environment type added in WP 5.5.
191
+ * Avoid a potentially blank translation for some plural forms.
192
+ * Increase some contrast in dark mode.
193
+ * Combine the response-related sections of the Request panel.
194
+ * Add extra sanity checking when attempting to fetch the posix user information.
195
+
196
+ ### 3.6.1 ###
197
+
198
+ * Adjust the bottom margin when the QM panel is open so QM doesn't cover the bottom of the page. Works more often than not.
199
+ * Prevent QM from triggering a fatal itself if a fatal occurs before the HTML dispatcher is loaded.
200
+ * Add an informational message to the template output when template hooks are in use.
201
+ * Fix errors caused by missing user or group IDs when collecting environment data.
202
+ * Add TextMate to list of supported editors.
203
+ * Demote some cache warnings to informational messages.
204
+ * Support passing backtrace to `QM_Backtrace`.
205
+
206
+
207
+ ### 3.6.0 ###
208
+
209
+ * Improvements to the UI when a fatal error occurs, including an admin toolbar warning.
210
+ * Improvements to the UI when QM is running in "broken" mode due to missing jQuery or an unrecoverable JavaScript error.
211
+ * Don't display fatal errors if error display is off and the user cannot view QM.
212
+ * Improvements to the visual appearance of the `wp_die()` output.
213
+ * Simplify re-throwing a caught exception so QM doesn't get the blame for fatal errors, eg. in the WordPress core fatal error handler.
214
+ * Add support for logging a variable of any type in the logger, as a replacement for var dumping.
215
+ * Don't show a message for errors in Ajax calls that have already occurred on the main page load.
216
+ * Don't dispatch QM during an iframed request, eg the plugin info modal or an upgrader action.
217
+ * Hide QM itself from various panels by default to remove noise. Can be controlled via the existing `QM_HIDE_SELF` configuration constant.
218
+ * Support for the new `is_favicon()` conditional added in WP 5.4.
219
+ * Fix the side panel resizing functionality.
220
+ * Add a WP-CLI command for creating the symlink to the db file.
221
+ * Add filters to `QM_Util::get_file_dirs()` and `get_file_component()` to allow support for non-standard plugin and theme locations.
222
+ * Add an action that fires when QM enqueues its assets, so add-on plugins can enqueue theirs only when necessary.
223
+
224
+
225
+ ### 3.5.2 ###
226
+
227
+ * Add support for exposing [Full Site Editing](https://github.com/WordPress/gutenberg/issues?q=label%3A%22%5BFeature%5D+Full+Site+Editing%22) blocks in the Block Editor panel.
228
+
229
+ ### 3.5.1 ###
230
+
231
+ * Defer population of the `found_formatted` property because this can fire before WPML has initialised its locale proxy. Fixes #485.
232
+ * Ensure all error types are accounted for when populating the panel menu error count. Fixes #486.
233
+
234
+
235
+ ### 3.5.0 ###
236
+
237
+ * Add an editor selection UI on the Settings panel.
238
+ * Improve the output of missing asset dependencies.
239
+ * Improve the output of unsuccessful template parts.
240
+ * Handle non-boolean constants such as `WP_DEBUG_LOG`, which now accepts a path too.
241
+ * Add support for touch devices when resizing the panel. (Works alright-ish, probably needs some animation frame work.)
242
+ * Apply the same styles to notices, deprecated, and strict errors.
243
+ * Some more style resets for compatibility with popular themes.
244
+ * Style changes to bring QM inline with WP 5.3's improved button and focus styles.
245
+ * More colour contrast and dark mode tweaks.
246
+ * Add permalink-related filters to the concerned filters for the Request panel.
247
+ * Fix and improve the admin toolbar menu hover colours.
248
+ * Add the error count to the panel menu.
249
+ * Remove unnecessary use of plural forms added in 3.4.0.
250
+ * More CSS resets to avoid overly tall filters in Firefox.
251
+ * Improved styling for warning rows.
252
+ * Display the log count in the menu item.
253
+
254
+
255
+ ### 3.4.0 ###
256
+
257
+ * Introduce an exception handler so a stack trace can be shown for fatal errors in PHP >= 7.
258
+ * Add separate persistence of QM window for front-end and admin area.
259
+ * Add the request and response HTTP headers to the Request panel.
260
+ * Introduce Started and Stopped columns in the Timings panel.
261
+ * By popular demand, revert back to closest first ordering of stack traces so they're inline with most other dev tools out there.
262
+ * Show the script handle in addition to the text domain in the Languages panel.
263
+ * Improve the panel menu highlighting colours.
264
+ * Better presentation of the default and current values for the settings constants.
265
+ * Truncate long host names in the Scripts and Styles panels.
266
+ * Add some more of the admin screen globals to the admin collector.
267
+ * Switch back to using a monospace font in numeric data cells.
268
+ * Allow dark mode to be enabled with `QM_DARK_MODE`.
269
+ * Display the total query count even when `SAVEQUERIES` is defined as false.
270
+ * Allow proper plural forms to be used wherever a phrase includes a numeric value.
271
+ * More style resetting for compatibility with Twenty Twenty.
272
+ * Avoid a division by zero when cache hits is 0.
273
+ * Switch to (mostly) CSS for the child menu item marker.
274
+
275
+
276
+ ### 3.3.7 ###
277
+
278
+ * Expose instances where a requested template part was not loaded.
279
+ * Update the docs for multiple `wpdb` instances.
280
+ * Various accessibility improvements.
281
+ * Remove the RDBMS info as it's not at all reliable.
282
+
283
+
284
+ ### 3.3.6 ###
285
+
286
+ * Fix a compatibility issue where QM and the fatal error protection in WordPress 5.2+ were handling syntax errors differently.
287
+ * Fix some bugs with the icons for the panel controls.
288
+
289
+ ### 3.3.5 ###
290
+
291
+ * Add support for the new `get_template_part` action in WP 5.2.
292
+ * Add a friendly error message when the PHP version requirement isn't met.
293
+ * Add support for the new privacy policy conditional in WP 5.2.
294
+ * Add support for the new privacy policy template in WP 5.2.
295
+
296
+ ### 3.3.4 ###
297
+
298
+ * Updated CSS to avoid conflicts with themes using `ul`, `nav`, and `li` styling.
299
+ * Don't define `ajaxurl` if there are no Debug Bar panels to show.
300
+ * New icon for QM! By [Tubagus Didin Asrori](https://www.instagram.com/asrorigus/).
301
+ * Push the close button a bit further away from the edge of the screen to avoid scrollbar interference on macOS.
302
+ * Fix clash with object cache plugins that keep their hit and miss stats private.
303
+ * Add missing asset position counters.
304
+
305
+ ### 3.3.3 ###
306
+
307
+ * Add scripts and styles counts to admin menu items.
308
+ * Group the cache logic together to avoid calling cache related functionality when it's not available. Fixes #418.
309
+ * Switch to installing the test suite as Composer dependencies.
310
+
311
+ ### 3.3.2 ###
312
+
313
+ * Improve the accuracy of the `ver` parameter for enqueued scripts and styles.
314
+ * Separate and simplify the output for the object cache and opcode cache statuses. Fixes #413.
315
+ * Better formatting when no object cache stats are available.
316
+
317
+
318
+ ### 3.3.1 ###
319
+
320
+ * Move the hook processing into its own class and out of the collector, so it can be re-used even if the Hooks collector isn't in use. Fixes #399.
321
+ * Increase the sidebar layout to 100% height when there's no admin toolbar.
322
+ * Update the QM element ID in the "worst case scenario" JS. Fixes #398.
323
+ * Improve the layout of the Settings panel.
324
+ * Force the `Core` and `Non-Core` filter items to the bottom of the list, so plugins and themes takes precedence.
325
+ * Add an entry for the Settings screen to the narrow view nav menu.
326
+ * Add the admin notice hooks to the list of concerned actions for the Admin Screen panel.
327
+
328
+ ### 3.3.0 ###
329
+
330
+ New features! Read about them here: https://querymonitor.com/blog/2019/02/new-features-in-query-monitor-3-3/
331
+
332
+ * Introduce sub-menus for displaying Hooks in Use for each panel.
333
+ * Output the call stack and responsible component when `wp_die()` is called.
334
+ * Support for JavaScript (Jed) translations in WordPress 5.0+.
335
+ * Add render timing for blocks using the new hooks introduced in WordPress 5.1.
336
+ * Introduce a toggle to display QM on the side of the window.
337
+ * Allow non-string values to be used in the logger message. They'll be presented as JSON formatted strings.
338
+ * Allow boolean values to be used in log message contexts.
339
+ * Add some margin to the Close button so it doesn't get covered up so much by scroll bars.
340
+ * Prefix QM's cookie name with `wp-` to ensure interoperability with caches and proxies.
341
+ * Separate the Scripts and Styles collector and outputter so they're actually two separate panels.
342
+ * Add support for opcode cache detection separate from the object cache detection.
343
+ * Rename the main QM container to get around the fact that its name clashes with the plugin rows in older versions of WordPress.
344
+ * Avoid using `wp_parse_url()` as it was only introduced in WP 4.4.
345
+
346
+
347
+ ### 3.2.2 ###
348
+
349
+ * Support for nested content blocks (eg. in columns).
350
+ * Hide long innerHTML content of blocks behind a toggle.
351
+ * Add validation of the referenced media file in media blocks.
352
+ * Ensure asset URLs include the `ver` query arg.
353
+ * Tweak the warning colours.
354
+ * Coding standards.
355
+ * Layout tweaks.
356
+
357
+
358
+ ### 3.2.1 ###
359
+
360
+ * Fix a fatal error for < 5.0 sites that are not running the Gutenberg plugin.
361
+
362
+ ### 3.2.0 ###
363
+
364
+ * Add a new `Blocks` panel for debugging blocks in post content. Supports WordPress 5.0 and the Gutenberg plugin.
365
+ * Display the number of times that each template part was included.
366
+ * Allow the scripts and styles output to be filtered based on Dependencies and Dependents.
367
+ * Remove the `Pin` button in favour of always pinning QM when it's open.
368
+ * Add a "Settings" link to the Plugins screen that opens the settings panel.
369
+ * Add a link to the Add-ons page on the wiki.
370
+ * Add some more verbose and visible error notices for suboptimal PHP configuration directives.
371
+ * Add support for identifying any RDBMS, not just MySQL and MariaDB.
372
+ * Perform the PHP version check earlier on so that fewer parts of QM need to be compatible with PHP 5.2.
373
+ * Highlight plain `http` requests to the HTTP API as insecure.
374
+ * Ensure the `Template` admin menu is always shown, even if the template file name isn't known.
375
+ * Adjust the JS and CSS asset source to not include the host.
376
+ * Add a warning for insecure JS and CSS assets.
377
+ * Remove before and after pseudo-elements in the style reset.
378
+ * Show as much theme and template information as possible, even if QM doesn't know the template name.
379
+ * Highlight non-core rows when filtering the Hooks & Actions panel by Non-Core.
380
+ * Add a filter for environment constants.
381
+ * Min width CSS for buttons.
382
+ * First pass at documenting filters and hooks.
383
+ * More coding standards updates.
384
+
385
+ ### 3.1.1 ###
386
+
387
+ * Add a dark mode for the UI which is used via the Dark Mode plugin.
388
+ * Display Query Monitor's output in the user's selected language, instead of the site language.
389
+ * Add extended support for the Members and User Role Editor plugins.
390
+ * Fix link hover and focus styles.
391
+ * Reset some more CSS styles.
392
+
393
+ ### 3.1.0 ###
394
+
395
+ **Main changes:**
396
+
397
+ * Lots of accessibility improvements.
398
+ * Switch to system default fonts to match the WordPress admin area fonts.
399
+ * [Implement a PSR-3 compatible logger](https://querymonitor.com/blog/2018/07/profiling-and-logging/).
400
+ * UI improvements for mobile/touch/narrow devices.
401
+ * Various improvements to the layout of the Scripts and Styles panels.
402
+ * Prevent the "overscroll" behaviour that causes the main page to scroll when scrolling to the end of a panel.
403
+ * Remove the second table footer when filtering tables.
404
+ * Add a settings panel with information about all of the available configuration constants.
405
+
406
+ **All other changes:**
407
+
408
+ * Show a warning message in the Overview panel when a PHP error is trigger during an Ajax request.
409
+ * Display a warning when time or memory usage is above 75% of the respective limit.
410
+ * Template Part file string normalization so template parts are correctly shown on Windows systems.
411
+ * Don't output toggle links or a blank HTTP API transport if not necessary.
412
+ * Add a human readable representation of transient timeouts, and prevent some wrapping.
413
+ * Add a tear down for the capability checks collector so that cap checks performed between QM's processing and output don't break things.
414
+ * Remove the ability to sort the HTTP API Calls table. This removes a column, increasing the available horizontal space.
415
+ * Handle a bunch more known object types when displaying parameter values.
416
+ * Allow PHP errors to be filtered by level.
417
+ * Shorten the displayed names of long namespaced symbols by initialising the inner portions of the name.
418
+ * Combine the Location and Caller columns for PHP Errors to save some horizontal space.
419
+ * Don't wrap text in the PHP error type column.
420
+ * Improve the authentication cookie toggle so it dynamically reflects the current state.
421
+ * For now, force QM to use ltr text direction.
422
+ * Clarify terminology around the number of enqueued assets.
423
+ * Add fallback support for `wp_cache_get_stats()` to fetch cache stats.
424
+ * Improve the message shown when no queries are performed.
425
+ * Pluck stats from cache controllers that implement a `getStats()` method and return a nested array of stats for each server.
426
+ * Rename the `QM_HIDE_CORE_HOOKS` configuration constant to `QM_HIDE_CORE_ACTIONS`.
427
+ * Better handling of environments with unlimited execution time or memory limit. Adds a warning for both.
428
+ * When an external cache isn't in use, provide some helpful info if an appropriate extension is installed.
429
+
430
+
431
+ ### 3.0.1 ###
432
+
433
+ * Add even more hardening to the JS handling to prevent problems when jQuery is broken.
434
+ * Remove the old `no-js` styles which don't work well with the new UI.
435
+ * Correct the logic for showing the `Non-Core` component filter option.
436
+ * Add another VIP function to the list of functions that call the HTTP API.
437
+ * Add an inline warning highlight to capability checks that are empty or of a non-string type.
438
+ * Add support for WordPress.com VIP Client MU plugins.
439
+ * Add support for displaying laps as part of the timing information.
440
+ * Add full support for namespaced Debug Bar add-on panels.
441
+ * Switch back to depending on `jquery` instead of `jquery-core`.
442
+ * Don't assume `php_uname()` is always callable. Add info about the host OS too.
443
+ * Reset inline height attribute when the panel is closed.
444
+
445
+ ### 3.0.0 ###
446
+
447
+ * Brand new UI that resembles familiar web developer tools. Lots of related improvements and fixes.
448
+ * Introduce some basic timing functionality in a Timings panel. See #282 for usage.
449
+ * Introduce a `QM_NO_JQUERY` constant for running QM without jQuery as a dependency.
450
+ * Greater resilience to JavaScript errors.
451
+ * Allow the Scripts and Styles panel to be filtered by host name.
452
+ * Expose information about redirects that occurred in HTTP API requests.
453
+ * Expose more debugging information for HTTP API requests.
454
+ * Don't enable the Capability Checks panel by default as it's very memory intensive.
455
+ * Allow PHP errors to be silenced according to their component. See `qm/collect/php_error_levels` and `qm/collect/hide_silenced_php_errors` filters.
456
+ * Hide all file paths and stack traces behind toggles by default.
457
+ * Remove support for the AMP for WordPress plugin.
458
+ * Add associative keys to the array passed to the `qm/built-in-collectors` filter.
459
+ * Drop support for PHP 5.2.
460
+ * Generally improve performance and reduce memory usage.
461
+
462
+ ### 2.17.0 ###
463
+
464
+ * Add the current user object to the Request panel.
465
+ * A few improvements to the appearance of the overall layout.
466
+ * Use relative positioning in place of the nasty absolute position hack needed for some themes.
467
+ * Ensure the `get_*_template()` function exists before calling it.
468
+ * Add a `QM_DISABLE_ERROR_HANDLER` constant to disable QM's error handling.
469
+ * Switch to runtime filtering of user capabilities instead of granting the `view_query_monitor` cap upon activation.
470
+ * Correct a bunch of inline docs and code standards.
471
+
wp-content/db.php CHANGED
@@ -12,7 +12,7 @@
12
  * @package query-monitor
13
  */
14
 
15
- defined( 'ABSPATH' ) || die();
16
 
17
  if ( defined( 'QM_DISABLED' ) && QM_DISABLED ) {
18
  return;
12
  * @package query-monitor
13
  */
14
 
15
+ defined( 'ABSPATH' ) || exit;
16
 
17
  if ( defined( 'QM_DISABLED' ) && QM_DISABLED ) {
18
  return;