Query Monitor - Version 3.6.0

Version Description

Download this release

Release Info

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

Code changes from version 3.5.2 to 3.6.0

assets/query-monitor-dark.css CHANGED
@@ -105,7 +105,6 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
105
  display: none;
106
  }
107
 
108
- #query-monitor-main,
109
  #query-monitor-main dl,
110
  #query-monitor-main dt,
111
  #query-monitor-main dd,
@@ -157,14 +156,12 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
157
  text-transform: none !important;
158
  transition: none !important;
159
  vertical-align: baseline !important;
160
- width: auto !important;
161
  word-break: normal !important;
162
  word-wrap: normal !important;
 
163
  }
164
 
165
- #query-monitor-main::before, #query-monitor-main::after,
166
- #query-monitor-main dl::before,
167
- #query-monitor-main dl::after,
168
  #query-monitor-main dt::before,
169
  #query-monitor-main dt::after,
170
  #query-monitor-main dd::before,
@@ -217,6 +214,34 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
217
  }
218
 
219
  #query-monitor-main {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
  background: #23282d !important;
221
  border-top: 1px solid #50626f !important;
222
  bottom: 0 !important;
@@ -230,6 +255,10 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
230
  z-index: 99998 !important;
231
  }
232
 
 
 
 
 
233
  #query-monitor-main ::selection {
234
  background-color: #B9D6FB !important;
235
  color: #bbc8d4 !important;
@@ -954,6 +983,18 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
954
  color: #fff !important;
955
  }
956
 
 
 
 
 
 
 
 
 
 
 
 
 
957
  #query-monitor-main .qm tbody tr.qm-odd.qm-hovered th,
958
  #query-monitor-main .qm tbody tr.qm-odd.qm-hovered td,
959
  #query-monitor-main .qm tbody tr.qm-odd:hover th,
@@ -970,14 +1011,6 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
970
  color: #bbc8d4 !important;
971
  }
972
 
973
- #query-monitor-main .qm tbody tr td.qm-highlight,
974
- #query-monitor-main .qm tbody tr.qm-highlight td {
975
- background-color: #57572a !important;
976
- border-color: #660 !important;
977
- box-shadow: inset 0 -1px #660 !important;
978
- color: #bbc8d4 !important;
979
- }
980
-
981
  #query-monitor-main .qm button.qm-filter-trigger,
982
  #query-monitor-main .qm button.qm-filter-trigger code,
983
  #query-monitor-main .qm tbody .qm-warn a code,
@@ -1297,24 +1330,95 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
1297
  margin: 0 !important;
1298
  }
1299
 
 
 
 
 
1300
  #query-monitor-main.qm-broken #qm-title {
1301
  cursor: default !important;
1302
  }
1303
 
1304
- #query-monitor-main #qm-broken,
1305
- #query-monitor-main.qm-broken .qm-title-button {
1306
- display: none !important;
1307
  }
1308
 
 
1309
  #query-monitor-main.qm-broken #qm-broken,
1310
  #query-monitor-main.qm-broken .qm {
1311
  display: block !important;
1312
  }
1313
 
 
 
 
 
 
 
1314
  #query-monitor-main.qm-broken .qm {
1315
  margin-bottom: 50px !important;
1316
  }
1317
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1318
  #query-monitor-main.qm-broken #qm-broken h2 {
1319
  padding: 20px !important;
1320
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  display: none;
106
  }
107
 
 
108
  #query-monitor-main dl,
109
  #query-monitor-main dt,
110
  #query-monitor-main dd,
156
  text-transform: none !important;
157
  transition: none !important;
158
  vertical-align: baseline !important;
 
159
  word-break: normal !important;
160
  word-wrap: normal !important;
161
+ width: auto !important;
162
  }
163
 
164
+ #query-monitor-main dl::before, #query-monitor-main dl::after,
 
 
165
  #query-monitor-main dt::before,
166
  #query-monitor-main dt::after,
167
  #query-monitor-main dd::before,
214
  }
215
 
216
  #query-monitor-main {
217
+ background: transparent !important;
218
+ border: none !important;
219
+ border-radius: 0 !important;
220
+ box-shadow: none !important;
221
+ box-sizing: border-box !important;
222
+ clear: both !important;
223
+ color: #bbc8d4 !important;
224
+ float: none !important;
225
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
226
+ font-size: 12px !important;
227
+ -webkit-font-smoothing: auto !important;
228
+ font-style: normal !important;
229
+ font-weight: normal !important;
230
+ letter-spacing: normal !important;
231
+ line-height: 18px !important;
232
+ margin: 0 !important;
233
+ min-height: auto !important;
234
+ outline: none !important;
235
+ padding: 0 !important;
236
+ text-align: left !important;
237
+ text-decoration: none !important;
238
+ text-indent: 0 !important;
239
+ text-shadow: none !important;
240
+ text-transform: none !important;
241
+ transition: none !important;
242
+ vertical-align: baseline !important;
243
+ word-break: normal !important;
244
+ word-wrap: normal !important;
245
  background: #23282d !important;
246
  border-top: 1px solid #50626f !important;
247
  bottom: 0 !important;
255
  z-index: 99998 !important;
256
  }
257
 
258
+ #query-monitor-main::before, #query-monitor-main::after {
259
+ display: none !important;
260
+ }
261
+
262
  #query-monitor-main ::selection {
263
  background-color: #B9D6FB !important;
264
  color: #bbc8d4 !important;
983
  color: #fff !important;
984
  }
985
 
986
+ #query-monitor-main .qm tbody tr td.qm-highlight,
987
+ #query-monitor-main .qm tbody tr.qm-highlight td {
988
+ background-color: #57572a !important;
989
+ color: #bbc8d4 !important;
990
+ }
991
+
992
+ #query-monitor-main .qm tbody tr.qm-odd td.qm-highlight,
993
+ #query-monitor-main .qm tbody tr.qm-odd.qm-highlight td {
994
+ background-color: #494923 !important;
995
+ color: #bbc8d4 !important;
996
+ }
997
+
998
  #query-monitor-main .qm tbody tr.qm-odd.qm-hovered th,
999
  #query-monitor-main .qm tbody tr.qm-odd.qm-hovered td,
1000
  #query-monitor-main .qm tbody tr.qm-odd:hover th,
1011
  color: #bbc8d4 !important;
1012
  }
1013
 
 
 
 
 
 
 
 
 
1014
  #query-monitor-main .qm button.qm-filter-trigger,
1015
  #query-monitor-main .qm button.qm-filter-trigger code,
1016
  #query-monitor-main .qm tbody .qm-warn a code,
1330
  margin: 0 !important;
1331
  }
1332
 
1333
+ #query-monitor-main #qm-broken {
1334
+ display: none !important;
1335
+ }
1336
+
1337
  #query-monitor-main.qm-broken #qm-title {
1338
  cursor: default !important;
1339
  }
1340
 
1341
+ #query-monitor-main.qm-broken #qm-title .qm-title-heading {
1342
+ border-right: none !important;
 
1343
  }
1344
 
1345
+ #query-monitor-main.qm-broken .qm td .qm-toggled,
1346
  #query-monitor-main.qm-broken #qm-broken,
1347
  #query-monitor-main.qm-broken .qm {
1348
  display: block !important;
1349
  }
1350
 
1351
+ #query-monitor-main.qm-broken #qm-panel-menu,
1352
+ #query-monitor-main.qm-broken #qm-settings,
1353
+ #query-monitor-main.qm-broken #qm-title .qm-title-button {
1354
+ display: none !important;
1355
+ }
1356
+
1357
  #query-monitor-main.qm-broken .qm {
1358
  margin-bottom: 50px !important;
1359
  }
1360
 
1361
+ #query-monitor-main.qm-broken .qm button.qm-filter-trigger {
1362
+ color: #bbc8d4 !important;
1363
+ cursor: text !important;
1364
+ }
1365
+
1366
+ #query-monitor-main.qm-broken .qm button.qm-filter-trigger:after {
1367
+ display: none !important;
1368
+ }
1369
+
1370
+ #query-monitor-main.qm-broken .qm button.qm-filter-trigger:focus, #query-monitor-main.qm-broken .qm button.qm-filter-trigger:hover, #query-monitor-main.qm-broken .qm button.qm-filter-trigger:active {
1371
+ text-decoration: none !important;
1372
+ }
1373
+
1374
  #query-monitor-main.qm-broken #qm-broken h2 {
1375
  padding: 20px !important;
1376
  }
1377
+
1378
+ #qm-fatal {
1379
+ margin: 1em !important;
1380
+ border: 2px solid #c00 !important;
1381
+ box-shadow: 0 0 0 2px #fff;
1382
+ background: #fff !important;
1383
+ max-width: 700px !important;
1384
+ clear: both !important;
1385
+ position: absolute !important;
1386
+ z-index: 99999 !important;
1387
+ }
1388
+
1389
+ #qm-fatal h2 {
1390
+ font-size: 12px !important;
1391
+ font-weight: normal !important;
1392
+ padding: 5px !important;
1393
+ background: #f3f3f3 !important;
1394
+ margin: 0 !important;
1395
+ }
1396
+
1397
+ #qm-fatal .dashicons {
1398
+ color: #c00 !important;
1399
+ }
1400
+
1401
+ #qm-fatal ol,
1402
+ #qm-fatal p {
1403
+ font-size: 12px !important;
1404
+ padding: 0 !important;
1405
+ margin: 1em !important;
1406
+ }
1407
+
1408
+ #qm-fatal ol {
1409
+ padding: 0 0 1em 1em !important;
1410
+ }
1411
+
1412
+ #qm-fatal li {
1413
+ margin: 0 0 0.7em !important;
1414
+ list-style: none !important;
1415
+ }
1416
+
1417
+ #qm-fatal .qm-info {
1418
+ color: #666 !important;
1419
+ }
1420
+
1421
+ body#error-page #qm-fatal {
1422
+ margin: 0 !important;
1423
+ border: none !important;
1424
+ }
assets/query-monitor.css CHANGED
@@ -105,7 +105,6 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
105
  display: none;
106
  }
107
 
108
- #query-monitor-main,
109
  #query-monitor-main dl,
110
  #query-monitor-main dt,
111
  #query-monitor-main dd,
@@ -157,14 +156,12 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
157
  text-transform: none !important;
158
  transition: none !important;
159
  vertical-align: baseline !important;
160
- width: auto !important;
161
  word-break: normal !important;
162
  word-wrap: normal !important;
 
163
  }
164
 
165
- #query-monitor-main::before, #query-monitor-main::after,
166
- #query-monitor-main dl::before,
167
- #query-monitor-main dl::after,
168
  #query-monitor-main dt::before,
169
  #query-monitor-main dt::after,
170
  #query-monitor-main dd::before,
@@ -217,6 +214,34 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
217
  }
218
 
219
  #query-monitor-main {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
  background: #fff !important;
221
  border-top: 1px solid #aaa !important;
222
  bottom: 0 !important;
@@ -230,6 +255,10 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
230
  z-index: 99998 !important;
231
  }
232
 
 
 
 
 
233
  #query-monitor-main ::selection {
234
  background-color: #B9D6FB !important;
235
  color: #222 !important;
@@ -954,6 +983,18 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
954
  color: #fff !important;
955
  }
956
 
 
 
 
 
 
 
 
 
 
 
 
 
957
  #query-monitor-main .qm tbody tr.qm-odd.qm-hovered th,
958
  #query-monitor-main .qm tbody tr.qm-odd.qm-hovered td,
959
  #query-monitor-main .qm tbody tr.qm-odd:hover th,
@@ -970,14 +1011,6 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
970
  color: #222 !important;
971
  }
972
 
973
- #query-monitor-main .qm tbody tr td.qm-highlight,
974
- #query-monitor-main .qm tbody tr.qm-highlight td {
975
- background-color: #ffd !important;
976
- border-color: #eec !important;
977
- box-shadow: inset 0 -1px #eec !important;
978
- color: #222 !important;
979
- }
980
-
981
  #query-monitor-main .qm button.qm-filter-trigger,
982
  #query-monitor-main .qm button.qm-filter-trigger code,
983
  #query-monitor-main .qm tbody .qm-warn a code,
@@ -1297,24 +1330,95 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
1297
  margin: 0 !important;
1298
  }
1299
 
 
 
 
 
1300
  #query-monitor-main.qm-broken #qm-title {
1301
  cursor: default !important;
1302
  }
1303
 
1304
- #query-monitor-main #qm-broken,
1305
- #query-monitor-main.qm-broken .qm-title-button {
1306
- display: none !important;
1307
  }
1308
 
 
1309
  #query-monitor-main.qm-broken #qm-broken,
1310
  #query-monitor-main.qm-broken .qm {
1311
  display: block !important;
1312
  }
1313
 
 
 
 
 
 
 
1314
  #query-monitor-main.qm-broken .qm {
1315
  margin-bottom: 50px !important;
1316
  }
1317
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1318
  #query-monitor-main.qm-broken #qm-broken h2 {
1319
  padding: 20px !important;
1320
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  display: none;
106
  }
107
 
 
108
  #query-monitor-main dl,
109
  #query-monitor-main dt,
110
  #query-monitor-main dd,
156
  text-transform: none !important;
157
  transition: none !important;
158
  vertical-align: baseline !important;
 
159
  word-break: normal !important;
160
  word-wrap: normal !important;
161
+ width: auto !important;
162
  }
163
 
164
+ #query-monitor-main dl::before, #query-monitor-main dl::after,
 
 
165
  #query-monitor-main dt::before,
166
  #query-monitor-main dt::after,
167
  #query-monitor-main dd::before,
214
  }
215
 
216
  #query-monitor-main {
217
+ background: transparent !important;
218
+ border: none !important;
219
+ border-radius: 0 !important;
220
+ box-shadow: none !important;
221
+ box-sizing: border-box !important;
222
+ clear: both !important;
223
+ color: #222 !important;
224
+ float: none !important;
225
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
226
+ font-size: 12px !important;
227
+ -webkit-font-smoothing: auto !important;
228
+ font-style: normal !important;
229
+ font-weight: normal !important;
230
+ letter-spacing: normal !important;
231
+ line-height: 18px !important;
232
+ margin: 0 !important;
233
+ min-height: auto !important;
234
+ outline: none !important;
235
+ padding: 0 !important;
236
+ text-align: left !important;
237
+ text-decoration: none !important;
238
+ text-indent: 0 !important;
239
+ text-shadow: none !important;
240
+ text-transform: none !important;
241
+ transition: none !important;
242
+ vertical-align: baseline !important;
243
+ word-break: normal !important;
244
+ word-wrap: normal !important;
245
  background: #fff !important;
246
  border-top: 1px solid #aaa !important;
247
  bottom: 0 !important;
255
  z-index: 99998 !important;
256
  }
257
 
258
+ #query-monitor-main::before, #query-monitor-main::after {
259
+ display: none !important;
260
+ }
261
+
262
  #query-monitor-main ::selection {
263
  background-color: #B9D6FB !important;
264
  color: #222 !important;
983
  color: #fff !important;
984
  }
985
 
986
+ #query-monitor-main .qm tbody tr td.qm-highlight,
987
+ #query-monitor-main .qm tbody tr.qm-highlight td {
988
+ background-color: #ffd !important;
989
+ color: #222 !important;
990
+ }
991
+
992
+ #query-monitor-main .qm tbody tr.qm-odd td.qm-highlight,
993
+ #query-monitor-main .qm tbody tr.qm-odd.qm-highlight td {
994
+ background-color: #ffffc9 !important;
995
+ color: #222 !important;
996
+ }
997
+
998
  #query-monitor-main .qm tbody tr.qm-odd.qm-hovered th,
999
  #query-monitor-main .qm tbody tr.qm-odd.qm-hovered td,
1000
  #query-monitor-main .qm tbody tr.qm-odd:hover th,
1011
  color: #222 !important;
1012
  }
1013
 
 
 
 
 
 
 
 
 
1014
  #query-monitor-main .qm button.qm-filter-trigger,
1015
  #query-monitor-main .qm button.qm-filter-trigger code,
1016
  #query-monitor-main .qm tbody .qm-warn a code,
1330
  margin: 0 !important;
1331
  }
1332
 
1333
+ #query-monitor-main #qm-broken {
1334
+ display: none !important;
1335
+ }
1336
+
1337
  #query-monitor-main.qm-broken #qm-title {
1338
  cursor: default !important;
1339
  }
1340
 
1341
+ #query-monitor-main.qm-broken #qm-title .qm-title-heading {
1342
+ border-right: none !important;
 
1343
  }
1344
 
1345
+ #query-monitor-main.qm-broken .qm td .qm-toggled,
1346
  #query-monitor-main.qm-broken #qm-broken,
1347
  #query-monitor-main.qm-broken .qm {
1348
  display: block !important;
1349
  }
1350
 
1351
+ #query-monitor-main.qm-broken #qm-panel-menu,
1352
+ #query-monitor-main.qm-broken #qm-settings,
1353
+ #query-monitor-main.qm-broken #qm-title .qm-title-button {
1354
+ display: none !important;
1355
+ }
1356
+
1357
  #query-monitor-main.qm-broken .qm {
1358
  margin-bottom: 50px !important;
1359
  }
1360
 
1361
+ #query-monitor-main.qm-broken .qm button.qm-filter-trigger {
1362
+ color: #222 !important;
1363
+ cursor: text !important;
1364
+ }
1365
+
1366
+ #query-monitor-main.qm-broken .qm button.qm-filter-trigger:after {
1367
+ display: none !important;
1368
+ }
1369
+
1370
+ #query-monitor-main.qm-broken .qm button.qm-filter-trigger:focus, #query-monitor-main.qm-broken .qm button.qm-filter-trigger:hover, #query-monitor-main.qm-broken .qm button.qm-filter-trigger:active {
1371
+ text-decoration: none !important;
1372
+ }
1373
+
1374
  #query-monitor-main.qm-broken #qm-broken h2 {
1375
  padding: 20px !important;
1376
  }
1377
+
1378
+ #qm-fatal {
1379
+ margin: 1em !important;
1380
+ border: 2px solid #c00 !important;
1381
+ box-shadow: 0 0 0 2px #fff;
1382
+ background: #fff !important;
1383
+ max-width: 700px !important;
1384
+ clear: both !important;
1385
+ position: absolute !important;
1386
+ z-index: 99999 !important;
1387
+ }
1388
+
1389
+ #qm-fatal h2 {
1390
+ font-size: 12px !important;
1391
+ font-weight: normal !important;
1392
+ padding: 5px !important;
1393
+ background: #f3f3f3 !important;
1394
+ margin: 0 !important;
1395
+ }
1396
+
1397
+ #qm-fatal .dashicons {
1398
+ color: #c00 !important;
1399
+ }
1400
+
1401
+ #qm-fatal ol,
1402
+ #qm-fatal p {
1403
+ font-size: 12px !important;
1404
+ padding: 0 !important;
1405
+ margin: 1em !important;
1406
+ }
1407
+
1408
+ #qm-fatal ol {
1409
+ padding: 0 0 1em 1em !important;
1410
+ }
1411
+
1412
+ #qm-fatal li {
1413
+ margin: 0 0 0.7em !important;
1414
+ list-style: none !important;
1415
+ }
1416
+
1417
+ #qm-fatal .qm-info {
1418
+ color: #666 !important;
1419
+ }
1420
+
1421
+ body#error-page #qm-fatal {
1422
+ margin: 0 !important;
1423
+ border: none !important;
1424
+ }
assets/query-monitor.js CHANGED
@@ -65,8 +65,50 @@ if ( window.jQuery ) {
65
 
66
  container.removeClass('qm-no-js').addClass('qm-js');
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  var link_click = function(e){
69
  var href = $( this ).attr('href') || $( this ).data('qm-href');
 
 
 
 
 
70
  show_panel( href );
71
  $(href).focus();
72
  $('#wp-admin-bar-query-monitor').removeClass('hover');
@@ -321,7 +363,18 @@ if ( window.jQuery ) {
321
  error = $.parseJSON( response.getResponseHeader( 'X-QM-php_errors-error-' + key ) );
322
 
323
  if ( window.console ) {
324
- console.error( error );
 
 
 
 
 
 
 
 
 
 
 
325
  }
326
 
327
  if ( $('#wp-admin-bar-query-monitor').length ) {
65
 
66
  container.removeClass('qm-no-js').addClass('qm-js');
67
 
68
+ if ( $('#qm-fatal').length ) {
69
+ console.error(qm_l10n.fatal_error + ': ' + $('#qm-fatal').attr('data-qm-message') );
70
+
71
+ if ( $('#wp-admin-bar-query-monitor').length ) {
72
+ $('#wp-admin-bar-query-monitor')
73
+ .addClass('qm-error')
74
+ .find('a').eq(0)
75
+ .text(qm_l10n.fatal_error);
76
+
77
+ var fatal_container = document.createDocumentFragment();
78
+
79
+ var fatal_message_menu = $('#wp-admin-bar-query-monitor-placeholder')
80
+ .clone()
81
+ .attr('id','wp-admin-bar-qm-fatal-message');
82
+
83
+ fatal_message_menu
84
+ .find('a').eq(0)
85
+ .text($('#qm-fatal').attr('data-qm-message'))
86
+ .attr('href','#qm-fatal');
87
+
88
+ fatal_container.appendChild( fatal_message_menu.get(0) );
89
+
90
+ var fatal_file_menu = $('#wp-admin-bar-query-monitor-placeholder')
91
+ .clone()
92
+ .attr('id','wp-admin-bar-qm-fatal-file');
93
+
94
+ fatal_file_menu
95
+ .find('a').eq(0)
96
+ .text($('#qm-fatal').attr('data-qm-file') + ':' + $('#qm-fatal').attr('data-qm-line'))
97
+ .attr('href','#qm-fatal');
98
+
99
+ fatal_container.appendChild( fatal_file_menu.get(0) );
100
+
101
+ $('#wp-admin-bar-query-monitor ul').append(fatal_container);
102
+ }
103
+ }
104
+
105
  var link_click = function(e){
106
  var href = $( this ).attr('href') || $( this ).data('qm-href');
107
+
108
+ if ( '#qm-fatal' === href ) {
109
+ return;
110
+ }
111
+
112
  show_panel( href );
113
  $(href).focus();
114
  $('#wp-admin-bar-query-monitor').removeClass('hover');
363
  error = $.parseJSON( response.getResponseHeader( 'X-QM-php_errors-error-' + key ) );
364
 
365
  if ( window.console ) {
366
+ switch ( error.type ) {
367
+ case 'warning':
368
+ console.error( error );
369
+ break;
370
+ default:
371
+ console.warn( error );
372
+ break;
373
+ }
374
+ }
375
+
376
+ if ( $('#qm-php_errors').find('[data-qm-key="' + error.key + '"]').length ) {
377
+ continue;
378
  }
379
 
380
  if ( $('#wp-admin-bar-query-monitor').length ) {
classes/Activation.php CHANGED
@@ -32,7 +32,7 @@ class QM_Activation extends QM_Plugin {
32
  $db = WP_CONTENT_DIR . '/db.php';
33
 
34
  if ( ! file_exists( $db ) && function_exists( 'symlink' ) ) {
35
- @symlink( plugin_dir_path( $this->file ) . 'wp-content/db.php', $db ); // @codingStandardsIgnoreLine
36
  }
37
 
38
  if ( $sitewide ) {
32
  $db = WP_CONTENT_DIR . '/db.php';
33
 
34
  if ( ! file_exists( $db ) && function_exists( 'symlink' ) ) {
35
+ @symlink( $this->plugin_path( 'wp-content/db.php' ), $db ); // @codingStandardsIgnoreLine
36
  }
37
 
38
  if ( $sitewide ) {
classes/CLI.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin CLI command.
4
+ *
5
+ * @package query-monitor
6
+ */
7
+
8
+ class QM_CLI extends QM_Plugin {
9
+
10
+ protected function __construct( $file ) {
11
+
12
+ # Register command
13
+ WP_CLI::add_command( 'qm enable', array( $this, 'enable' ) );
14
+
15
+ # Parent setup:
16
+ parent::__construct( $file );
17
+
18
+ }
19
+
20
+ /**
21
+ * Enable QM by creating the symlink for db.php
22
+ */
23
+ public function enable() {
24
+ $drop_in = WP_CONTENT_DIR . '/db.php';
25
+
26
+ if ( file_exists( $drop_in ) ) {
27
+ if ( false !== strpos( file_get_contents( $drop_in ), 'class QM_DB' ) ) {
28
+ WP_CLI::success( "Query Monitor's wp-content/db.php is already in place" );
29
+ exit( 0 );
30
+ } else {
31
+ WP_CLI::error( 'Unknown wp-content/db.php already is already in place' );
32
+ }
33
+ }
34
+
35
+ if ( ! function_exists( 'symlink' ) ) {
36
+ WP_CLI::error( 'The symlink function is not available' );
37
+ }
38
+
39
+ if ( symlink( $this->plugin_path( 'wp-content/db.php' ), $drop_in ) ) {
40
+ WP_CLI::success( 'wp-content/db.php symlink created' );
41
+ exit( 0 );
42
+ } else {
43
+ WP_CLI::error( 'Failed to create wp-content/db.php symlink' );
44
+ }
45
+ }
46
+
47
+ public static function init( $file = null ) {
48
+
49
+ static $instance = null;
50
+
51
+ if ( ! $instance ) {
52
+ $instance = new QM_CLI( $file );
53
+ }
54
+
55
+ return $instance;
56
+
57
+ }
58
+
59
+ }
classes/Collector.php CHANGED
@@ -222,7 +222,7 @@ abstract class QM_Collector {
222
 
223
  public static function hide_qm() {
224
  if ( null === self::$hide_qm ) {
225
- self::$hide_qm = ( defined( 'QM_HIDE_SELF' ) && QM_HIDE_SELF );
226
  }
227
 
228
  return self::$hide_qm;
222
 
223
  public static function hide_qm() {
224
  if ( null === self::$hide_qm ) {
225
+ self::$hide_qm = QM_HIDE_SELF;
226
  }
227
 
228
  return self::$hide_qm;
classes/Dispatcher.php CHANGED
@@ -90,7 +90,7 @@ abstract class QM_Dispatcher {
90
  }
91
 
92
  public function init() {
93
- if ( ! $this->user_can_view() ) {
94
  return;
95
  }
96
 
@@ -109,7 +109,7 @@ abstract class QM_Dispatcher {
109
  // nothing
110
  }
111
 
112
- public function user_can_view() {
113
 
114
  if ( ! did_action( 'plugins_loaded' ) ) {
115
  return false;
@@ -131,7 +131,7 @@ abstract class QM_Dispatcher {
131
  }
132
 
133
  public static function editor_cookie() {
134
- if ( isset( $_COOKIE[QM_EDITOR_COOKIE] ) ) { // @codingStandardsIgnoreLine
135
  return $_COOKIE[QM_EDITOR_COOKIE]; // @codingStandardsIgnoreLine
136
  }
137
  return '';
90
  }
91
 
92
  public function init() {
93
+ if ( ! self::user_can_view() ) {
94
  return;
95
  }
96
 
109
  // nothing
110
  }
111
 
112
+ public static function user_can_view() {
113
 
114
  if ( ! did_action( 'plugins_loaded' ) ) {
115
  return false;
131
  }
132
 
133
  public static function editor_cookie() {
134
+ if ( defined( 'QM_EDITOR_COOKIE' ) && isset( $_COOKIE[QM_EDITOR_COOKIE] ) ) { // @codingStandardsIgnoreLine
135
  return $_COOKIE[QM_EDITOR_COOKIE]; // @codingStandardsIgnoreLine
136
  }
137
  return '';
classes/Plugin.php CHANGED
@@ -21,7 +21,7 @@ abstract class QM_Plugin {
21
  /**
22
  * Returns the URL for for a file/dir within this plugin.
23
  *
24
- * @param $file string The path within this plugin, e.g. '/js/clever-fx.js'
25
  * @return string URL
26
  */
27
  final public function plugin_url( $file = '' ) {
@@ -31,7 +31,7 @@ abstract class QM_Plugin {
31
  /**
32
  * Returns the filesystem path for a file/dir within this plugin.
33
  *
34
- * @param $file string The path within this plugin, e.g. '/js/clever-fx.js'
35
  * @return string Filesystem path
36
  */
37
  final public function plugin_path( $file = '' ) {
@@ -41,7 +41,7 @@ abstract class QM_Plugin {
41
  /**
42
  * Returns a version number for the given plugin file.
43
  *
44
- * @param $file string The path within this plugin, e.g. '/js/clever-fx.js'
45
  * @return string Version
46
  */
47
  final public function plugin_ver( $file ) {
21
  /**
22
  * Returns the URL for for a file/dir within this plugin.
23
  *
24
+ * @param string $file The path within this plugin, e.g. '/js/clever-fx.js'
25
  * @return string URL
26
  */
27
  final public function plugin_url( $file = '' ) {
31
  /**
32
  * Returns the filesystem path for a file/dir within this plugin.
33
  *
34
+ * @param string $file The path within this plugin, e.g. '/js/clever-fx.js'
35
  * @return string Filesystem path
36
  */
37
  final public function plugin_path( $file = '' ) {
41
  /**
42
  * Returns a version number for the given plugin file.
43
  *
44
+ * @param string $file The path within this plugin, e.g. '/js/clever-fx.js'
45
  * @return string Version
46
  */
47
  final public function plugin_ver( $file ) {
classes/QueryMonitor.php CHANGED
@@ -90,6 +90,10 @@ class QueryMonitor extends QM_Plugin {
90
  }
91
 
92
  public function action_plugins_loaded() {
 
 
 
 
93
 
94
  /**
95
  * Filters the collectors that are being added.
@@ -97,7 +101,7 @@ class QueryMonitor extends QM_Plugin {
97
  * @since 2.11.2
98
  *
99
  * @param QM_Collector[] $collectors Array of collector instances.
100
- * @param QueryMonitor $this QueryMonitor instance.
101
  */
102
  foreach ( apply_filters( 'qm/collectors', array(), $this ) as $collector ) {
103
  QM_Collectors::add( $collector );
@@ -114,7 +118,7 @@ class QueryMonitor extends QM_Plugin {
114
  * @since 2.11.2
115
  *
116
  * @param QM_Dispatcher[] $dispatchers Array of dispatcher instances.
117
- * @param QueryMonitor $this QueryMonitor instance.
118
  */
119
  foreach ( apply_filters( 'qm/dispatchers', array(), $this ) as $dispatcher ) {
120
  QM_Dispatchers::add( $dispatcher );
90
  }
91
 
92
  public function action_plugins_loaded() {
93
+ // Hide QM itself from output by default:
94
+ if ( ! defined( 'QM_HIDE_SELF' ) ) {
95
+ define( 'QM_HIDE_SELF', true );
96
+ }
97
 
98
  /**
99
  * Filters the collectors that are being added.
101
  * @since 2.11.2
102
  *
103
  * @param QM_Collector[] $collectors Array of collector instances.
104
+ * @param QueryMonitor $instance QueryMonitor instance.
105
  */
106
  foreach ( apply_filters( 'qm/collectors', array(), $this ) as $collector ) {
107
  QM_Collectors::add( $collector );
118
  * @since 2.11.2
119
  *
120
  * @param QM_Dispatcher[] $dispatchers Array of dispatcher instances.
121
+ * @param QueryMonitor $instance QueryMonitor instance.
122
  */
123
  foreach ( apply_filters( 'qm/dispatchers', array(), $this ) as $dispatcher ) {
124
  QM_Dispatchers::add( $dispatcher );
classes/Util.php CHANGED
@@ -69,23 +69,43 @@ class QM_Util {
69
 
70
  public static function get_file_dirs() {
71
  if ( empty( self::$file_dirs ) ) {
72
- self::$file_dirs['plugin'] = self::standard_dir( WP_PLUGIN_DIR );
73
- self::$file_dirs['mu-vendor'] = self::standard_dir( WPMU_PLUGIN_DIR . '/vendor' );
74
- self::$file_dirs['go-plugin'] = self::standard_dir( WPMU_PLUGIN_DIR . '/shared-plugins' );
75
- self::$file_dirs['mu-plugin'] = self::standard_dir( WPMU_PLUGIN_DIR );
76
- self::$file_dirs['vip-plugin'] = self::standard_dir( get_theme_root() . '/vip/plugins' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
 
78
  if ( defined( 'WPCOM_VIP_CLIENT_MU_PLUGIN_DIR' ) ) {
79
- self::$file_dirs['vip-client-mu-plugin'] = self::standard_dir( WPCOM_VIP_CLIENT_MU_PLUGIN_DIR );
80
  }
81
 
82
  self::$file_dirs['theme'] = null;
83
- self::$file_dirs['stylesheet'] = self::standard_dir( get_stylesheet_directory() );
84
- self::$file_dirs['template'] = self::standard_dir( get_template_directory() );
85
- self::$file_dirs['other'] = self::standard_dir( WP_CONTENT_DIR );
86
- self::$file_dirs['core'] = self::standard_dir( ABSPATH );
87
  self::$file_dirs['unknown'] = null;
 
 
 
 
88
  }
 
89
  return self::$file_dirs;
90
  }
91
 
@@ -176,6 +196,20 @@ class QM_Util {
176
  case 'unknown':
177
  default:
178
  $name = __( 'Unknown', 'query-monitor' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  break;
180
  }
181
 
@@ -190,6 +224,13 @@ class QM_Util {
190
  $callback['function'] = explode( '::', $callback['function'] );
191
  }
192
 
 
 
 
 
 
 
 
193
  try {
194
 
195
  if ( is_array( $callback['function'] ) ) {
@@ -324,16 +365,16 @@ class QM_Util {
324
  }
325
 
326
  public static function get_query_type( $sql ) {
327
- $sql = trim( $sql );
328
- $type = $sql;
329
 
330
  if ( 0 === strpos( $sql, '/*' ) ) {
331
  // Strip out leading comments such as `/*NO_SELECT_FOUND_ROWS*/` before calculating the query type
332
- $type = preg_replace( '|^/\*[^\*/]+\*/|', '', $sql );
333
  }
334
 
335
- $type = preg_split( '/\b/', trim( $type ), 2, PREG_SPLIT_NO_EMPTY );
336
- $type = strtoupper( $type[0] );
337
 
338
  return $type;
339
  }
69
 
70
  public static function get_file_dirs() {
71
  if ( empty( self::$file_dirs ) ) {
72
+
73
+ /**
74
+ * Filters the absolute directory paths that correlate to components.
75
+ *
76
+ * Note that this filter is applied before QM adds its built-in list of components. This is
77
+ * so custom registered components take precedence during component detection.
78
+ *
79
+ * See the corresponding `qm/component_name/{$type}` filter for specifying the component name.
80
+ *
81
+ * @since 3.6.0
82
+ *
83
+ * @param string[] $dirs Array of absolute directory paths keyed by component identifier.
84
+ */
85
+ self::$file_dirs = apply_filters( 'qm/component_dirs', self::$file_dirs );
86
+
87
+ self::$file_dirs['plugin'] = WP_PLUGIN_DIR;
88
+ self::$file_dirs['mu-vendor'] = WPMU_PLUGIN_DIR . '/vendor';
89
+ self::$file_dirs['go-plugin'] = WPMU_PLUGIN_DIR . '/shared-plugins';
90
+ self::$file_dirs['mu-plugin'] = WPMU_PLUGIN_DIR;
91
+ self::$file_dirs['vip-plugin'] = get_theme_root() . '/vip/plugins';
92
 
93
  if ( defined( 'WPCOM_VIP_CLIENT_MU_PLUGIN_DIR' ) ) {
94
+ self::$file_dirs['vip-client-mu-plugin'] = WPCOM_VIP_CLIENT_MU_PLUGIN_DIR;
95
  }
96
 
97
  self::$file_dirs['theme'] = null;
98
+ self::$file_dirs['stylesheet'] = get_stylesheet_directory();
99
+ self::$file_dirs['template'] = get_template_directory();
100
+ self::$file_dirs['other'] = WP_CONTENT_DIR;
101
+ self::$file_dirs['core'] = ABSPATH;
102
  self::$file_dirs['unknown'] = null;
103
+
104
+ foreach ( self::$file_dirs as $type => $dir ) {
105
+ self::$file_dirs[ $type ] = self::standard_dir( $dir );
106
+ }
107
  }
108
+
109
  return self::$file_dirs;
110
  }
111
 
196
  case 'unknown':
197
  default:
198
  $name = __( 'Unknown', 'query-monitor' );
199
+
200
+ /**
201
+ * Filters the name of a custom or unknown component.
202
+ *
203
+ * The dynamic portion of the hook name, `$type`, refers to the component identifier.
204
+ *
205
+ * See the corresponding `qm/component_dirs` filter for specifying the component directories.
206
+ *
207
+ * @since 3.6.0
208
+ *
209
+ * @param string $name The component name.
210
+ * @param string $file The full file path for the file within the component.
211
+ */
212
+ $name = apply_filters( "qm/component_name/{$type}", $name, $file );
213
  break;
214
  }
215
 
224
  $callback['function'] = explode( '::', $callback['function'] );
225
  }
226
 
227
+ if ( isset( $callback['class'] ) ) {
228
+ $callback['function'] = array(
229
+ $callback['class'],
230
+ $callback['function'],
231
+ );
232
+ }
233
+
234
  try {
235
 
236
  if ( is_array( $callback['function'] ) ) {
365
  }
366
 
367
  public static function get_query_type( $sql ) {
368
+ // Trim leading whitespace and brackets
369
+ $sql = ltrim( $sql, ' \t\n\r\0\x0B(' );
370
 
371
  if ( 0 === strpos( $sql, '/*' ) ) {
372
  // Strip out leading comments such as `/*NO_SELECT_FOUND_ROWS*/` before calculating the query type
373
+ $sql = preg_replace( '|^/\*[^\*/]+\*/|', '', $sql );
374
  }
375
 
376
+ $words = preg_split( '/\b/', trim( $sql ), 2, PREG_SPLIT_NO_EMPTY );
377
+ $type = strtoupper( $words[0] );
378
 
379
  return $type;
380
  }
classes/debug_bar.php CHANGED
@@ -47,7 +47,9 @@ class Debug_Bar {
47
  }
48
 
49
  public function ensure_ajaxurl() {
50
- if ( $this->panels && QM_Dispatchers::get( 'html' )->user_can_view() ) {
 
 
51
  ?>
52
  <script type="text/javascript">
53
  var ajaxurl = '<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>';
47
  }
48
 
49
  public function ensure_ajaxurl() {
50
+ $dispatcher = QM_Dispatchers::get( 'html' );
51
+
52
+ if ( $this->panels && $dispatcher::user_can_view() ) {
53
  ?>
54
  <script type="text/javascript">
55
  var ajaxurl = '<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>';
collectors/caps.php CHANGED
@@ -64,8 +64,8 @@ class QM_Collector_Caps extends QM_Collector {
64
  *
65
  * This does not get called for Super Admins. See filter_map_meta_cap() below.
66
  *
67
- * @param bool[] $user_caps Concerned user's capabilities.
68
- * @param string[] $required_caps Required primitive capabilities for the requested capability.
69
  * @param array $args {
70
  * Arguments that accompany the requested capability check.
71
  *
64
  *
65
  * This does not get called for Super Admins. See filter_map_meta_cap() below.
66
  *
67
+ * @param bool[] $user_caps Concerned user's capabilities.
68
+ * @param string[] $caps Required primitive capabilities for the requested capability.
69
  * @param array $args {
70
  * Arguments that accompany the requested capability check.
71
  *
collectors/conditionals.php CHANGED
@@ -31,6 +31,7 @@ class QM_Collector_Conditionals extends QM_Collector {
31
  'is_date',
32
  'is_day',
33
  'is_embed',
 
34
  'is_feed',
35
  'is_front_page',
36
  'is_home',
31
  'is_date',
32
  'is_day',
33
  'is_embed',
34
+ 'is_favicon',
35
  'is_feed',
36
  'is_front_page',
37
  'is_home',
collectors/environment.php CHANGED
@@ -158,7 +158,7 @@ class QM_Collector_Environment extends QM_Collector {
158
  $this->data['php']['version'] = phpversion();
159
  $this->data['php']['sapi'] = php_sapi_name();
160
  $this->data['php']['user'] = self::get_current_user();
161
- $this->data['php']['old'] = version_compare( $this->data['php']['version'], 7.1, '<' );
162
 
163
  foreach ( $this->php_vars as $setting ) {
164
  $this->data['php']['variables'][ $setting ]['after'] = ini_get( $setting );
158
  $this->data['php']['version'] = phpversion();
159
  $this->data['php']['sapi'] = php_sapi_name();
160
  $this->data['php']['user'] = self::get_current_user();
161
+ $this->data['php']['old'] = version_compare( $this->data['php']['version'], 7.2, '<' );
162
 
163
  foreach ( $this->php_vars as $setting ) {
164
  $this->data['php']['variables'][ $setting ]['after'] = ini_get( $setting );
collectors/logger.php CHANGED
@@ -28,35 +28,35 @@ class QM_Collector_Logger extends QM_Collector {
28
  }
29
 
30
  public function emergency( $message, array $context = array() ) {
31
- $this->store( 'emergency', $message, $context );
32
  }
33
 
34
  public function alert( $message, array $context = array() ) {
35
- $this->store( 'alert', $message, $context );
36
  }
37
 
38
  public function critical( $message, array $context = array() ) {
39
- $this->store( 'critical', $message, $context );
40
  }
41
 
42
  public function error( $message, array $context = array() ) {
43
- $this->store( 'error', $message, $context );
44
  }
45
 
46
  public function warning( $message, array $context = array() ) {
47
- $this->store( 'warning', $message, $context );
48
  }
49
 
50
  public function notice( $message, array $context = array() ) {
51
- $this->store( 'notice', $message, $context );
52
  }
53
 
54
  public function info( $message, array $context = array() ) {
55
- $this->store( 'info', $message, $context );
56
  }
57
 
58
  public function debug( $message, array $context = array() ) {
59
- $this->store( 'debug', $message, $context );
60
  }
61
 
62
  public function log( $level, $message, array $context = array() ) {
@@ -68,11 +68,13 @@ class QM_Collector_Logger extends QM_Collector {
68
  }
69
 
70
  protected function store( $level, $message, array $context = array() ) {
 
71
  $trace = new QM_Backtrace( array(
72
  'ignore_frames' => 2,
73
  ) );
74
 
75
  if ( is_wp_error( $message ) ) {
 
76
  $message = sprintf(
77
  'WP_Error: %s (%s)',
78
  $message->get_error_message(),
@@ -80,12 +82,14 @@ class QM_Collector_Logger extends QM_Collector {
80
  );
81
  }
82
 
83
- if ( $message instanceof Exception ) {
 
84
  $message = get_class( $message ) . ': ' . $message->getMessage();
85
  }
86
 
87
  if ( ! QM_Util::is_stringy( $message ) ) {
88
- $message = QM_Util::json_format( $message );
 
89
  }
90
 
91
  $this->data['logs'][] = array(
@@ -93,6 +97,7 @@ class QM_Collector_Logger extends QM_Collector {
93
  'context' => $context,
94
  'trace' => $trace,
95
  'level' => $level,
 
96
  );
97
  }
98
 
28
  }
29
 
30
  public function emergency( $message, array $context = array() ) {
31
+ $this->store( self::EMERGENCY, $message, $context );
32
  }
33
 
34
  public function alert( $message, array $context = array() ) {
35
+ $this->store( self::ALERT, $message, $context );
36
  }
37
 
38
  public function critical( $message, array $context = array() ) {
39
+ $this->store( self::CRITICAL, $message, $context );
40
  }
41
 
42
  public function error( $message, array $context = array() ) {
43
+ $this->store( self::ERROR, $message, $context );
44
  }
45
 
46
  public function warning( $message, array $context = array() ) {
47
+ $this->store( self::WARNING, $message, $context );
48
  }
49
 
50
  public function notice( $message, array $context = array() ) {
51
+ $this->store( self::NOTICE, $message, $context );
52
  }
53
 
54
  public function info( $message, array $context = array() ) {
55
+ $this->store( self::INFO, $message, $context );
56
  }
57
 
58
  public function debug( $message, array $context = array() ) {
59
+ $this->store( self::DEBUG, $message, $context );
60
  }
61
 
62
  public function log( $level, $message, array $context = array() ) {
68
  }
69
 
70
  protected function store( $level, $message, array $context = array() ) {
71
+ $type = 'string';
72
  $trace = new QM_Backtrace( array(
73
  'ignore_frames' => 2,
74
  ) );
75
 
76
  if ( is_wp_error( $message ) ) {
77
+ $type = 'wp_error';
78
  $message = sprintf(
79
  'WP_Error: %s (%s)',
80
  $message->get_error_message(),
82
  );
83
  }
84
 
85
+ if ( ( $message instanceof Exception ) || ( $message instanceof Throwable ) ) {
86
+ $type = 'throwable';
87
  $message = get_class( $message ) . ': ' . $message->getMessage();
88
  }
89
 
90
  if ( ! QM_Util::is_stringy( $message ) ) {
91
+ $type = 'dump';
92
+ $message = print_r( $message, true );
93
  }
94
 
95
  $this->data['logs'][] = array(
97
  'context' => $context,
98
  'trace' => $trace,
99
  'level' => $level,
100
+ 'type' => $type,
101
  );
102
  }
103
 
collectors/php_errors.php CHANGED
@@ -22,18 +22,21 @@ class QM_Collector_PHP_Errors extends QM_Collector {
22
  }
23
 
24
  parent::__construct();
 
 
25
  set_error_handler( array( $this, 'error_handler' ), ( E_ALL ^ QM_ERROR_FATALS ) );
26
 
27
  if ( ! interface_exists( 'Throwable' ) ) {
28
- // PHP < 7 fatal error handler.
29
  register_shutdown_function( array( $this, 'shutdown_handler' ) );
30
  }
31
 
 
 
 
32
  $this->error_reporting = error_reporting();
33
  $this->display_errors = ini_get( 'display_errors' );
34
  ini_set( 'display_errors', 0 );
35
-
36
- $this->exception_handler = set_exception_handler( array( $this, 'exception_handler' ) );
37
  }
38
 
39
  /**
@@ -45,41 +48,29 @@ class QM_Collector_PHP_Errors extends QM_Collector {
45
  * @param Throwable|Exception $e The error or exception.
46
  */
47
  public function exception_handler( $e ) {
48
- require_once __DIR__ . '/../output/Html.php';
49
-
50
  if ( is_a( $e, 'Exception' ) ) {
51
  $error = 'Uncaught Exception';
52
  } else {
53
  $error = 'Uncaught Error';
54
  }
55
 
56
- // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
57
- printf(
58
- '<br><b>%1$s</b>: %2$s in <b>%3$s</b> on line <b>%4$d</b><br>',
59
- htmlentities( $error, ENT_COMPAT, 'UTF-8' ),
60
- nl2br( htmlentities( $e->getMessage(), ENT_COMPAT, 'UTF-8' ), false ),
61
- htmlentities( $e->getFile(), ENT_COMPAT, 'UTF-8' ),
62
- intval( $e->getLine() )
63
- );
64
- // phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped
65
-
66
- echo '<ul>';
67
- foreach ( $e->getTrace() as $frame ) {
68
- $callback = QM_Util::populate_callback( $frame );
69
-
70
- printf(
71
- '<li>%s</li>',
72
- QM_Output_Html::output_filename( $callback['name'], $frame['file'], $frame['line'], true )
73
- ); // WPCS: XSS ok.
74
- }
75
- echo '</ul>';
76
 
77
  // The exception must be re-thrown or passed to the previously registered exception handler so that the error
78
  // is logged appropriately instead of discarded silently.
79
  if ( $this->exception_handler ) {
80
  call_user_func( $this->exception_handler, $e );
81
  } else {
82
- throw new Exception( $e->getMessage(), $e->getCode(), $e );
83
  }
84
 
85
  exit( 1 );
@@ -196,10 +187,6 @@ class QM_Collector_PHP_Errors extends QM_Collector {
196
 
197
  $e = error_get_last();
198
 
199
- if ( empty( $this->display_errors ) ) {
200
- return;
201
- }
202
-
203
  if ( empty( $e ) || ! ( $e['type'] & QM_ERROR_FATALS ) ) {
204
  return;
205
  }
@@ -210,15 +197,84 @@ class QM_Collector_PHP_Errors extends QM_Collector {
210
  $error = 'Fatal error';
211
  }
212
 
213
- // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
214
  printf(
215
- '<br><b>%1$s</b>: %2$s in <b>%3$s</b> on line <b>%4$d</b><br>',
216
- htmlentities( $error, ENT_COMPAT, 'UTF-8' ),
217
- nl2br( htmlentities( $e['message'], ENT_COMPAT, 'UTF-8' ), false ),
218
- htmlentities( $e['file'], ENT_COMPAT, 'UTF-8' ),
219
- intval( $e['line'] )
 
 
 
220
  );
221
- // phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222
  }
223
 
224
  public function post_process() {
22
  }
23
 
24
  parent::__construct();
25
+
26
+ // Non-fatal error handler for all PHP versions:
27
  set_error_handler( array( $this, 'error_handler' ), ( E_ALL ^ QM_ERROR_FATALS ) );
28
 
29
  if ( ! interface_exists( 'Throwable' ) ) {
30
+ // Fatal error handler for PHP < 7:
31
  register_shutdown_function( array( $this, 'shutdown_handler' ) );
32
  }
33
 
34
+ // Fatal error handler for PHP >= 7, and uncaught exception handler for all PHP versions:
35
+ $this->exception_handler = set_exception_handler( array( $this, 'exception_handler' ) );
36
+
37
  $this->error_reporting = error_reporting();
38
  $this->display_errors = ini_get( 'display_errors' );
39
  ini_set( 'display_errors', 0 );
 
 
40
  }
41
 
42
  /**
48
  * @param Throwable|Exception $e The error or exception.
49
  */
50
  public function exception_handler( $e ) {
 
 
51
  if ( is_a( $e, 'Exception' ) ) {
52
  $error = 'Uncaught Exception';
53
  } else {
54
  $error = 'Uncaught Error';
55
  }
56
 
57
+ $this->output_fatal( 'Fatal error', array(
58
+ 'message' => sprintf(
59
+ '%s: %s',
60
+ $error,
61
+ $e->getMessage()
62
+ ),
63
+ 'file' => $e->getFile(),
64
+ 'line' => $e->getLine(),
65
+ 'trace' => $e->getTrace(),
66
+ ) );
 
 
 
 
 
 
 
 
 
 
67
 
68
  // The exception must be re-thrown or passed to the previously registered exception handler so that the error
69
  // is logged appropriately instead of discarded silently.
70
  if ( $this->exception_handler ) {
71
  call_user_func( $this->exception_handler, $e );
72
  } else {
73
+ throw $e;
74
  }
75
 
76
  exit( 1 );
187
 
188
  $e = error_get_last();
189
 
 
 
 
 
190
  if ( empty( $e ) || ! ( $e['type'] & QM_ERROR_FATALS ) ) {
191
  return;
192
  }
197
  $error = 'Fatal error';
198
  }
199
 
200
+ $this->output_fatal( $error, $e );
201
+ }
202
+
203
+ protected function output_fatal( $error, array $e ) {
204
+ $dispatcher = QM_Dispatchers::get( 'html' );
205
+
206
+ if ( empty( $this->display_errors ) && ! $dispatcher::user_can_view() ) {
207
+ return;
208
+ }
209
+
210
+ if ( ! function_exists( '__' ) ) {
211
+ wp_load_translations_early();
212
+ }
213
+
214
+ require_once dirname( __DIR__ ) . '/output/Html.php';
215
+
216
+ // This hides the subsequent message from the fatal error handler in core. It cannot be
217
+ // disabled by a plugin so we'll just hide its output.
218
+ echo '<style type="text/css"> .wp-die-message { display: none; } </style>';
219
+
220
  printf(
221
+ // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedStylesheet
222
+ '<link rel="stylesheet" href="%s" media="all" />',
223
+ esc_url( includes_url( 'css/dashicons.css' ) )
224
+ );
225
+ printf(
226
+ // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedStylesheet
227
+ '<link rel="stylesheet" href="%s" media="all" />',
228
+ esc_url( QueryMonitor::init()->plugin_url( 'assets/query-monitor.css' ) )
229
  );
230
+
231
+ // This unused wrapper with ann attribute serves to help the #qm-fatal div break out of an
232
+ // attribute if a fatal has occured within one.
233
+ echo '<div data-qm="qm">';
234
+
235
+ printf(
236
+ '<div id="qm-fatal" data-qm-message="%1$s" data-qm-file="%2$s" data-qm-line="%3$d">',
237
+ esc_attr( $e['message'] ),
238
+ esc_attr( QM_Util::standard_dir( $e['file'], '' ) ),
239
+ esc_attr( $e['line'] )
240
+ );
241
+
242
+ echo '<div class="qm-fatal-wrap">';
243
+
244
+ if ( QM_Output_Html::has_clickable_links() ) {
245
+ $file = QM_Output_Html::output_filename( $e['file'], $e['file'], $e['line'], true );
246
+ } else {
247
+ $file = esc_html( $e['file'] );
248
+ }
249
+
250
+ printf(
251
+ '<p><span class="dashicons dashicons-warning" aria-hidden="true"></span> <b>%1$s</b>: %2$s<br>in <b>%3$s</b> on line <b>%4$d</b></p>',
252
+ esc_html( $error ),
253
+ nl2br( esc_html( $e['message'] ), false ),
254
+ $file,
255
+ intval( $e['line'] )
256
+ ); // WPCS: XSS ok.
257
+
258
+ if ( ! empty( $e['trace'] ) ) {
259
+ echo '<p>' . esc_html__( 'Call stack:', 'query-monitor' ) . '</p>';
260
+ echo '<ol>';
261
+ foreach ( $e['trace'] as $frame ) {
262
+ $callback = QM_Util::populate_callback( $frame );
263
+
264
+ printf(
265
+ '<li>%s</li>',
266
+ QM_Output_Html::output_filename( $callback['name'], $frame['file'], $frame['line'] )
267
+ ); // WPCS: XSS ok.
268
+ }
269
+ echo '</ol>';
270
+ }
271
+
272
+ echo '</div>';
273
+
274
+ echo '<h2>' . esc_html__( 'Query Monitor', 'query-monitor' ) . '</h2>';
275
+
276
+ echo '</div>';
277
+ echo '</div>';
278
  }
279
 
280
  public function post_process() {
composer.json DELETED
@@ -1,58 +0,0 @@
1
- {
2
- "name": "johnbillion/query-monitor",
3
- "description": "The Developer Tools panel for WordPress.",
4
- "homepage": "https://github.com/johnbillion/query-monitor/",
5
- "type": "wordpress-plugin",
6
- "license": "GPL-2.0-or-later",
7
- "authors": [
8
- {
9
- "name": "John Blackbourn",
10
- "homepage": "https://johnblackbourn.com/"
11
- }
12
- ],
13
- "support": {
14
- "issues": "https://github.com/johnbillion/query-monitor/issues",
15
- "forum": "https://wordpress.org/support/plugin/query-monitor",
16
- "source": "https://github.com/johnbillion/query-monitor"
17
- },
18
- "config": {
19
- "sort-packages": true,
20
- "preferred-install": "dist"
21
- },
22
- "extra": {
23
- "wordpress-install-dir": "tests/wordpress"
24
- },
25
- "require": {
26
- "php": ">=5.3.6",
27
- "composer/installers": "~1.0"
28
- },
29
- "require-dev": {
30
- "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
31
- "johnbillion/falsey-assertequals-detector": "^1 || ^3",
32
- "phpcompatibility/phpcompatibility-wp": "^2.0",
33
- "phpunit/phpunit": "^5 || ^7",
34
- "roots/wordpress": "*",
35
- "squizlabs/php_codesniffer": "^3.2",
36
- "vlucas/phpdotenv": "^3",
37
- "wp-cli/wp-cli-bundle": "^2.1",
38
- "wp-coding-standards/wpcs": "~2.0.0",
39
- "wp-phpunit/wp-phpunit": "*"
40
- },
41
- "scripts": {
42
- "post-update-cmd": [
43
- "@php -r \"! file_exists( 'tests/.env' ) && copy( 'tests/.env.dist', 'tests/.env' );\""
44
- ],
45
- "test:cs": [
46
- "vendor/bin/phpcs -nps --colors --report-code --report-summary --report-width=80 --cache=tests/cache/phpcs ."
47
- ],
48
- "test:ut": [
49
- "vendor/bin/wp db reset --yes --path=$(npm run --silent jq '.extra .\"wordpress-install-dir\"' composer.json -- -r) #",
50
- "export WP_MULTISITE=0 && vendor/bin/phpunit --verbose --colors=always --exclude-group=ms-required",
51
- "export WP_MULTISITE=1 && vendor/bin/phpunit --verbose --colors=always --exclude-group=ms-excluded"
52
- ],
53
- "test": [
54
- "@test:cs",
55
- "@test:ut"
56
- ]
57
- }
58
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dispatchers/AJAX.php CHANGED
@@ -18,7 +18,7 @@ class QM_Dispatcher_AJAX extends QM_Dispatcher {
18
 
19
  public function init() {
20
 
21
- if ( ! $this->user_can_view() ) {
22
  return;
23
  }
24
 
@@ -69,7 +69,7 @@ class QM_Dispatcher_AJAX extends QM_Dispatcher {
69
  return false;
70
  }
71
 
72
- if ( ! $this->user_can_view() ) {
73
  return false;
74
  }
75
 
18
 
19
  public function init() {
20
 
21
+ if ( ! self::user_can_view() ) {
22
  return;
23
  }
24
 
69
  return false;
70
  }
71
 
72
+ if ( ! self::user_can_view() ) {
73
  return false;
74
  }
75
 
dispatchers/Html.php CHANGED
@@ -10,7 +10,7 @@ class QM_Dispatcher_Html extends QM_Dispatcher {
10
  /**
11
  * Outputter instances.
12
  *
13
- * @var QM_Output_html[] Array of outputters.
14
  */
15
  protected $outputters = array();
16
 
@@ -101,7 +101,7 @@ class QM_Dispatcher_Html extends QM_Dispatcher {
101
 
102
  public function action_admin_bar_menu( WP_Admin_Bar $wp_admin_bar ) {
103
 
104
- if ( ! $this->user_can_view() ) {
105
  return;
106
  }
107
 
@@ -124,10 +124,14 @@ class QM_Dispatcher_Html extends QM_Dispatcher {
124
 
125
  public function init() {
126
 
127
- if ( ! $this->user_can_view() ) {
128
  return;
129
  }
130
 
 
 
 
 
131
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_assets' ), -9999 );
132
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ), -9999 );
133
  add_action( 'login_enqueue_scripts', array( $this, 'enqueue_assets' ), -9999 );
@@ -147,6 +151,21 @@ class QM_Dispatcher_Html extends QM_Dispatcher {
147
  ) );
148
  }
149
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  public function enqueue_assets() {
151
  global $wp_locale, $wp_version;
152
 
@@ -197,8 +216,18 @@ class QM_Dispatcher_Html extends QM_Dispatcher {
197
  'off' => wp_create_nonce( 'qm-auth-off' ),
198
  'editor-set' => wp_create_nonce( 'qm-editor-set' ),
199
  ),
 
200
  )
201
  );
 
 
 
 
 
 
 
 
 
202
  }
203
 
204
  public function dispatch() {
@@ -465,8 +494,8 @@ class QM_Dispatcher_Html extends QM_Dispatcher {
465
  'default' => false,
466
  ),
467
  'QM_HIDE_SELF' => array(
468
- 'label' => __( 'Hide Query Monitor itself from various panels.', 'query-monitor' ),
469
- 'default' => false,
470
  ),
471
  'QM_NO_JQUERY' => array(
472
  'label' => __( 'Don\'t specify jQuery as a dependency of Query Monitor. If jQuery isn\'t enqueued then Query Monitor will still operate, but with some reduced functionality.', 'query-monitor' ),
@@ -648,7 +677,7 @@ class QM_Dispatcher_Html extends QM_Dispatcher {
648
 
649
  public function is_active() {
650
 
651
- if ( ! $this->user_can_view() ) {
652
  return false;
653
  }
654
 
@@ -656,12 +685,12 @@ class QM_Dispatcher_Html extends QM_Dispatcher {
656
  return false;
657
  }
658
 
659
- // If this is an async request and not a customizer preview:
660
  if ( QM_Util::is_async() && ( ! function_exists( 'is_customize_preview' ) || ! is_customize_preview() ) ) {
661
  return false;
662
  }
663
 
664
- # Don't process if the minimum required actions haven't fired:
665
  if ( is_admin() ) {
666
  if ( ! did_action( 'admin_init' ) ) {
667
  return false;
@@ -672,6 +701,11 @@ class QM_Dispatcher_Html extends QM_Dispatcher {
672
  }
673
  }
674
 
 
 
 
 
 
675
  /** Back-compat filter. Please use `qm/dispatch/html` instead */
676
  if ( ! apply_filters( 'qm/process', true, is_admin_bar_showing() ) ) {
677
  return false;
10
  /**
11
  * Outputter instances.
12
  *
13
+ * @var QM_Output_Html[] Array of outputters.
14
  */
15
  protected $outputters = array();
16
 
101
 
102
  public function action_admin_bar_menu( WP_Admin_Bar $wp_admin_bar ) {
103
 
104
+ if ( ! self::user_can_view() ) {
105
  return;
106
  }
107
 
124
 
125
  public function init() {
126
 
127
+ if ( ! self::user_can_view() ) {
128
  return;
129
  }
130
 
131
+ if ( ! file_exists( $this->qm->plugin_path( 'assets/query-monitor.css' ) ) ) {
132
+ add_action( 'admin_notices', array( $this, 'build_warning' ) );
133
+ }
134
+
135
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_assets' ), -9999 );
136
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ), -9999 );
137
  add_action( 'login_enqueue_scripts', array( $this, 'enqueue_assets' ), -9999 );
151
  ) );
152
  }
153
 
154
+ public function build_warning() {
155
+ printf(
156
+ '<div id="qm-built-nope" class="notice notice-error"><p>%s</p></div>',
157
+ sprintf(
158
+ /* translators: 1: CLI command to run, 2: plugin directory name */
159
+ esc_html__( 'Asset files for Query Monitor need to be built. Run %1$s from the %2$s directory.', 'query-monitor' ),
160
+ '<code>npm i && npm run build</code>',
161
+ sprintf(
162
+ '<code>%s</code>',
163
+ esc_html( QM_Util::standard_dir( untrailingslashit( $this->qm->plugin_path() ), '' ) )
164
+ )
165
+ )
166
+ );
167
+ }
168
+
169
  public function enqueue_assets() {
170
  global $wp_locale, $wp_version;
171
 
216
  'off' => wp_create_nonce( 'qm-auth-off' ),
217
  'editor-set' => wp_create_nonce( 'qm-editor-set' ),
218
  ),
219
+ 'fatal_error' => __( 'PHP Fatal Error', 'query-monitor' ),
220
  )
221
  );
222
+
223
+ /**
224
+ * Fires when assets for QM's HTML have been enqueued.
225
+ *
226
+ * @since 3.6.0
227
+ *
228
+ * @param \QM_Dispatcher_Html $this The HTML dispatcher.
229
+ */
230
+ do_action( 'qm/output/enqueued-assets', $this );
231
  }
232
 
233
  public function dispatch() {
494
  'default' => false,
495
  ),
496
  'QM_HIDE_SELF' => array(
497
+ 'label' => __( 'Hide Query Monitor itself from various panels. Set to false if you want to see how Query Monitor hooks into WordPress.', 'query-monitor' ),
498
+ 'default' => true,
499
  ),
500
  'QM_NO_JQUERY' => array(
501
  'label' => __( 'Don\'t specify jQuery as a dependency of Query Monitor. If jQuery isn\'t enqueued then Query Monitor will still operate, but with some reduced functionality.', 'query-monitor' ),
677
 
678
  public function is_active() {
679
 
680
+ if ( ! self::user_can_view() ) {
681
  return false;
682
  }
683
 
685
  return false;
686
  }
687
 
688
+ // Don't dispatch if this is an async request and not a customizer preview:
689
  if ( QM_Util::is_async() && ( ! function_exists( 'is_customize_preview' ) || ! is_customize_preview() ) ) {
690
  return false;
691
  }
692
 
693
+ // Don't dispatch if the minimum required actions haven't fired:
694
  if ( is_admin() ) {
695
  if ( ! did_action( 'admin_init' ) ) {
696
  return false;
701
  }
702
  }
703
 
704
+ // Don't dispatch during an iframed request, eg the plugin info modal or an upgrader action:
705
+ if ( defined( 'IFRAME_REQUEST' ) && IFRAME_REQUEST ) {
706
+ return false;
707
+ }
708
+
709
  /** Back-compat filter. Please use `qm/dispatch/html` instead */
710
  if ( ! apply_filters( 'qm/process', true, is_admin_bar_showing() ) ) {
711
  return false;
dispatchers/REST.php CHANGED
@@ -63,7 +63,7 @@ class QM_Dispatcher_REST extends QM_Dispatcher {
63
  return false;
64
  }
65
 
66
- if ( ! $this->user_can_view() ) {
67
  return false;
68
  }
69
 
63
  return false;
64
  }
65
 
66
+ if ( ! self::user_can_view() ) {
67
  return false;
68
  }
69
 
dispatchers/Redirect.php CHANGED
@@ -52,7 +52,7 @@ class QM_Dispatcher_Redirect extends QM_Dispatcher {
52
 
53
  public function is_active() {
54
 
55
- if ( ! $this->user_can_view() ) {
56
  return false;
57
  }
58
 
52
 
53
  public function is_active() {
54
 
55
+ if ( ! self::user_can_view() ) {
56
  return false;
57
  }
58
 
dispatchers/WP_Die.php CHANGED
@@ -54,14 +54,22 @@ class QM_Dispatcher_WP_Die extends QM_Dispatcher {
54
 
55
  $component = QM_Backtrace::get_frame_component( $culprit );
56
 
 
 
 
 
 
 
57
  ?>
58
  <style>
59
  #query-monitor {
60
  position: absolute;
61
- margin: 4em 0 1em;
62
- border: 1px solid #aaa;
63
  background: #fff;
64
- width: 700px;
 
 
65
  }
66
 
67
  #query-monitor h2 {
@@ -70,14 +78,14 @@ class QM_Dispatcher_WP_Die extends QM_Dispatcher {
70
  padding: 5px;
71
  background: #f3f3f3;
72
  margin: 0;
73
- border-bottom: 1px solid #aaa;
74
  }
75
 
76
  #query-monitor ol,
77
  #query-monitor p {
78
  font-size: 12px;
79
  padding: 0;
80
- margin: 1em;
81
  }
82
 
83
  #query-monitor ol {
@@ -85,36 +93,46 @@ class QM_Dispatcher_WP_Die extends QM_Dispatcher {
85
  }
86
 
87
  #query-monitor li {
88
- margin: 0 0 0.5em;
89
  list-style: none;
90
  }
91
 
92
  #query-monitor .qm-info {
93
- color: #777;
 
 
 
 
 
 
94
  }
 
95
  </style>
96
  <?php
97
 
98
  echo '<div id="query-monitor">';
99
 
100
- echo '<h2>' . esc_html__( 'Query Monitor', 'query-monitor' ) . '</h2>';
 
101
 
102
  if ( $component ) {
103
- echo '<p>';
104
  $name = ( 'plugin' === $component->type ) ? $component->context : $component->name;
105
  printf(
106
  /* translators: %s: Plugin or theme name */
107
- esc_html__( 'The message above was triggered by %s.', 'query-monitor' ),
108
  '<b>' . esc_html( $name ) . '</b>'
109
  );
110
- echo '</p>';
111
  }
112
 
 
 
113
  echo '<p>' . esc_html__( 'Call stack:', 'query-monitor' ) . '</p>';
114
  echo '<ol>';
115
  echo '<li>' . implode( '</li><li>', $stack ) . '</li>'; // WPCS: XSS ok.
116
  echo '</ol>';
117
 
 
 
118
  echo '</div>';
119
 
120
  if ( $switched_locale ) {
@@ -127,7 +145,7 @@ class QM_Dispatcher_WP_Die extends QM_Dispatcher {
127
  return false;
128
  }
129
 
130
- if ( ! $this->user_can_view() ) {
131
  return false;
132
  }
133
 
54
 
55
  $component = QM_Backtrace::get_frame_component( $culprit );
56
 
57
+ printf(
58
+ // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedStylesheet
59
+ '<link rel="stylesheet" href="%s" media="all" />',
60
+ esc_url( includes_url( 'css/dashicons.css' ) )
61
+ );
62
+
63
  ?>
64
  <style>
65
  #query-monitor {
66
  position: absolute;
67
+ margin: 0.9em 0 1em;
68
+ box-shadow: 0 1px 3px rgba( 0, 0, 0, 0.13 );
69
  background: #fff;
70
+ padding-top: 1em;
71
+ max-width: 700px;
72
+ z-index: -1;
73
  }
74
 
75
  #query-monitor h2 {
78
  padding: 5px;
79
  background: #f3f3f3;
80
  margin: 0;
81
+ border-top: 1px solid #ddd;
82
  }
83
 
84
  #query-monitor ol,
85
  #query-monitor p {
86
  font-size: 12px;
87
  padding: 0;
88
+ margin: 1em 2em;
89
  }
90
 
91
  #query-monitor ol {
93
  }
94
 
95
  #query-monitor li {
96
+ margin: 0 0 0.7em;
97
  list-style: none;
98
  }
99
 
100
  #query-monitor .qm-info {
101
+ color: #666;
102
+ }
103
+
104
+ #query-monitor .dashicons-info {
105
+ color: #0071a1;
106
+ vertical-align: bottom;
107
+ margin-right: 5px;
108
  }
109
+
110
  </style>
111
  <?php
112
 
113
  echo '<div id="query-monitor">';
114
 
115
+ echo '<p>';
116
+ echo '<span class="dashicons dashicons-info" aria-hidden="true"></span>';
117
 
118
  if ( $component ) {
 
119
  $name = ( 'plugin' === $component->type ) ? $component->context : $component->name;
120
  printf(
121
  /* translators: %s: Plugin or theme name */
122
+ esc_html__( 'This message was triggered by %s.', 'query-monitor' ),
123
  '<b>' . esc_html( $name ) . '</b>'
124
  );
 
125
  }
126
 
127
+ echo '</p>';
128
+
129
  echo '<p>' . esc_html__( 'Call stack:', 'query-monitor' ) . '</p>';
130
  echo '<ol>';
131
  echo '<li>' . implode( '</li><li>', $stack ) . '</li>'; // WPCS: XSS ok.
132
  echo '</ol>';
133
 
134
+ echo '<h2>' . esc_html__( 'Query Monitor', 'query-monitor' ) . '</h2>';
135
+
136
  echo '</div>';
137
 
138
  if ( $switched_locale ) {
145
  return false;
146
  }
147
 
148
+ if ( ! self::user_can_view() ) {
149
  return false;
150
  }
151
 
output/Html.php CHANGED
@@ -470,7 +470,7 @@ abstract class QM_Output_Html extends QM_Output {
470
  if ( ! isset( self::$file_link_format ) ) {
471
  $format = ini_get( 'xdebug.file_link_format' );
472
 
473
- if ( isset( $_COOKIE[ QM_EDITOR_COOKIE ] ) ) {
474
  $format = self::get_editor_file_link_format(
475
  $_COOKIE[ QM_EDITOR_COOKIE ],
476
  $format
470
  if ( ! isset( self::$file_link_format ) ) {
471
  $format = ini_get( 'xdebug.file_link_format' );
472
 
473
+ if ( defined( 'QM_EDITOR_COOKIE' ) && isset( $_COOKIE[ QM_EDITOR_COOKIE ] ) ) {
474
  $format = self::get_editor_file_link_format(
475
  $_COOKIE[ QM_EDITOR_COOKIE ],
476
  $format
output/headers/php_errors.php CHANGED
@@ -26,7 +26,7 @@ class QM_Output_Headers_PHP_Errors extends QM_Output_Headers {
26
 
27
  foreach ( $data['errors'] as $type => $errors ) {
28
 
29
- foreach ( $errors as $key => $error ) {
30
 
31
  $count++;
32
 
@@ -34,6 +34,7 @@ class QM_Output_Headers_PHP_Errors extends QM_Output_Headers {
34
  # separately in each output.
35
  $component = $error['trace']->get_component();
36
  $output_error = array(
 
37
  'type' => $error['type'],
38
  'message' => $error['message'],
39
  'file' => QM_Util::standard_dir( $error['file'], '' ),
26
 
27
  foreach ( $data['errors'] as $type => $errors ) {
28
 
29
+ foreach ( $errors as $error_key => $error ) {
30
 
31
  $count++;
32
 
34
  # separately in each output.
35
  $component = $error['trace']->get_component();
36
  $output_error = array(
37
+ 'key' => $error_key,
38
  'type' => $error['type'],
39
  'message' => $error['message'],
40
  'file' => QM_Util::standard_dir( $error['file'], '' ),
output/html/hooks.php CHANGED
@@ -113,7 +113,7 @@ class QM_Output_Html_Hooks extends QM_Output_Html {
113
  esc_html__( 'Warning: The %s action is extremely resource intensive. Try to avoid using it.', 'query-monitor' ),
114
  '<code>all</code>'
115
  );
116
- echo '<span>';
117
  }
118
  echo '</span></th>';
119
 
113
  esc_html__( 'Warning: The %s action is extremely resource intensive. Try to avoid using it.', 'query-monitor' ),
114
  '<code>all</code>'
115
  );
116
+ echo '</span>';
117
  }
118
  echo '</span></th>';
119
 
output/html/logger.php CHANGED
@@ -85,10 +85,17 @@ class QM_Output_Html_Logger extends QM_Output_Html {
85
  echo esc_html( ucfirst( $row['level'] ) );
86
  echo '</td>';
87
 
88
- printf(
89
- '<td>%s</td>',
90
- esc_html( $row['message'] )
91
- );
 
 
 
 
 
 
 
92
 
93
  $stack = array();
94
  $filtered_trace = $row['trace']->get_display_trace();
85
  echo esc_html( ucfirst( $row['level'] ) );
86
  echo '</td>';
87
 
88
+ if ( 'dump' === $row['type'] ) {
89
+ printf(
90
+ '<td><pre>%s</pre></td>',
91
+ esc_html( $row['message'] )
92
+ );
93
+ } else {
94
+ printf(
95
+ '<td>%s</td>',
96
+ esc_html( $row['message'] )
97
+ );
98
+ }
99
 
100
  $stack = array();
101
  $filtered_trace = $row['trace']->get_display_trace();
output/html/php_errors.php CHANGED
@@ -68,12 +68,13 @@ class QM_Output_Html_PHP_Errors extends QM_Output_Html {
68
  continue;
69
  }
70
 
71
- foreach ( $data[ $error_group ][ $type ] as $error ) {
72
 
73
  $component = $error['trace']->get_component();
74
  $row_attr = array();
75
  $row_attr['data-qm-component'] = $component->name;
76
  $row_attr['data-qm-type'] = ucfirst( $type );
 
77
 
78
  if ( 'core' !== $component->context ) {
79
  $row_attr['data-qm-component'] .= ' non-core';
68
  continue;
69
  }
70
 
71
+ foreach ( $data[ $error_group ][ $type ] as $error_key => $error ) {
72
 
73
  $component = $error['trace']->get_component();
74
  $row_attr = array();
75
  $row_attr['data-qm-component'] = $component->name;
76
  $row_attr['data-qm-type'] = ucfirst( $type );
77
+ $row_attr['data-qm-key'] = $error_key;
78
 
79
  if ( 'core' !== $component->context ) {
80
  $row_attr['data-qm-component'] .= ' non-core';
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.5.2
14
  * Plugin URI: https://querymonitor.com/
15
  * Author: John Blackbourn
16
  * Author URI: https://querymonitor.com/
@@ -47,6 +47,11 @@ foreach ( array( 'Activation', 'Util', 'QM' ) as $qm_class ) {
47
 
48
  QM_Activation::init( __FILE__ );
49
 
 
 
 
 
 
50
  if ( defined( 'QM_DISABLED' ) && QM_DISABLED ) {
51
  return;
52
  }
10
  *
11
  * Plugin Name: Query Monitor
12
  * Description: The Developer Tools Panel for WordPress.
13
+ * Version: 3.6.0
14
  * Plugin URI: https://querymonitor.com/
15
  * Author: John Blackbourn
16
  * Author URI: https://querymonitor.com/
47
 
48
  QM_Activation::init( __FILE__ );
49
 
50
+ if ( defined( 'WP_CLI' ) && WP_CLI ) {
51
+ require_once "{$qm_dir}/classes/CLI.php";
52
+ QM_CLI::init( __FILE__ );
53
+ }
54
+
55
  if ( defined( 'QM_DISABLED' ) && QM_DISABLED ) {
56
  return;
57
  }
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.4
6
- Stable tag: 3.5.2
7
  License: GPLv2 or later
8
  Requires PHP: 5.3
9
 
@@ -66,7 +66,7 @@ Query Monitor is private by default and always will be. It does not persistently
66
 
67
  By default, Query Monitor's output is only shown to Administrators on single-site installations, and Super Admins on Multisite installations.
68
 
69
- In addition to this, you can set an authentication cookie which allows you to view Query Monitor output when you're not logged in (or if you're logged in as a non-Administrator). See the Settings panel for details.
70
 
71
  = Does Query Monitor itself impact the page generation time or memory usage? =
72
 
@@ -88,7 +88,7 @@ Please use [the issue tracker on Query Monitor's GitHub repo](https://github.com
88
 
89
  = Is Query Monitor available on WordPress.com VIP Go? =
90
 
91
- Yep! However, a user needs to be granted the `view_query_monitor` capability to see Query Monitor even if they're an administrator.
92
 
93
  = I'm using multiple instances of `wpdb`. How do I get my additional instances to show up in Query Monitor? =
94
 
@@ -105,12 +105,368 @@ Your `wpdb` instance will then show up as a separate panel, and the query time a
105
 
106
  = Can I click on stack traces to open the file in my editor? =
107
 
108
- Yes! You can enable this on the Settings panel.
109
 
110
  = Do you accept donations? =
111
 
112
  No, I do not accept donations. If you like the plugin, I'd love for you to [leave a review](https://wordpress.org/support/view/plugin-reviews/query-monitor). Tell all your friends about the plugin too!
113
 
114
- == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
 
116
- For Query Monitor's changelog, please see [the Releases page on GitHub](https://github.com/johnbillion/query-monitor/releases).
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.4
6
+ Stable tag: 3.6.0
7
  License: GPLv2 or later
8
  Requires PHP: 5.3
9
 
66
 
67
  By default, Query Monitor's output is only shown to Administrators on single-site installations, and Super Admins on Multisite installations.
68
 
69
+ In addition to this, you can set an authentication cookie which allows you to view Query Monitor output when you're not logged in, or when you're logged in as a user who cannot usually see Query Monitor's output. See the Settings panel for details.
70
 
71
  = Does Query Monitor itself impact the page generation time or memory usage? =
72
 
88
 
89
  = Is Query Monitor available on WordPress.com VIP Go? =
90
 
91
+ 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.
92
 
93
  = I'm using multiple instances of `wpdb`. How do I get my additional instances to show up in Query Monitor? =
94
 
105
 
106
  = Can I click on stack traces to open the file in my editor? =
107
 
108
+ Yes. You can enable this on the Settings panel.
109
 
110
  = Do you accept donations? =
111
 
112
  No, I do not accept donations. If you like the plugin, I'd love for you to [leave a review](https://wordpress.org/support/view/plugin-reviews/query-monitor). Tell all your friends about the plugin too!
113
 
114
+ ## Changelog ##
115
+
116
+ ### 3.6.0 ###
117
+
118
+ * Improvements to the UI when a fatal error occurs, including an admin toolbar warning.
119
+ * Improvements to the UI when QM is running in "broken" mode due to missing jQuery or an unrecoverable JavaScript error.
120
+ * Don't display fatal errors if error display is off and the user cannot view QM.
121
+ * Improvements to the visual appearance of the `wp_die()` output.
122
+ * Simplify re-throwing a caught exception so QM doesn't get the blame for fatal errors, eg. in the WordPress core fatal error handler.
123
+ * Add support for logging a variable of any type in the logger, as a replacement for var dumping.
124
+ * Don't show a message for errors in Ajax calls that have already occurred on the main page load.
125
+ * Don't dispatch QM during an iframed request, eg the plugin info modal or an upgrader action.
126
+ * Hide QM itself from various panels by default to remove noise. Can be controlled via the existing `QM_HIDE_SELF` configuration constant.
127
+ * Support for the new `is_favicon()` conditional added in WP 5.4.
128
+ * Fix the side panel resizing functionality.
129
+ * Add a WP-CLI command for creating the symlink to the db file.
130
+ * Add filters to `QM_Util::get_file_dirs()` and `get_file_component()` to allow support for non-standard plugin and theme locations.
131
+ * Add an action that fires when QM enqueues its assets, so add-on plugins can enqueue theirs only when necessary.
132
+
133
+
134
+ ### 3.5.2 ###
135
+
136
+ * 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.
137
+
138
+ ### 3.5.1 ###
139
+
140
+ * Defer population of the `found_formatted` property because this can fire before WPML has initialised its locale proxy. Fixes #485.
141
+ * Ensure all error types are accounted for when populating the panel menu error count. Fixes #486.
142
+
143
+
144
+ ### 3.5.0 ###
145
+
146
+ * Add an editor selection UI on the Settings panel.
147
+ * Improve the output of missing asset dependencies.
148
+ * Improve the output of unsuccessful template parts.
149
+ * Handle non-boolean constants such as `WP_DEBUG_LOG`, which now accepts a path too.
150
+ * Add support for touch devices when resizing the panel. (Works alright-ish, probably needs some animation frame work.)
151
+ * Apply the same styles to notices, deprecated, and strict errors.
152
+ * Some more style resets for compatibility with popular themes.
153
+ * Style changes to bring QM inline with WP 5.3's improved button and focus styles.
154
+ * More colour contrast and dark mode tweaks.
155
+ * Add permalink-related filters to the concerned filters for the Request panel.
156
+ * Fix and improve the admin toolbar menu hover colours.
157
+ * Add the error count to the panel menu.
158
+ * Remove unnecessary use of plural forms added in 3.4.0.
159
+ * More CSS resets to avoid overly tall filters in Firefox.
160
+ * Improved styling for warning rows.
161
+ * Display the log count in the menu item.
162
+
163
+
164
+ ### 3.4.0 ###
165
+
166
+ * Introduce an exception handler so a stack trace can be shown for fatal errors in PHP >= 7.
167
+ * Add separate persistence of QM window for front-end and admin area.
168
+ * Add the request and response HTTP headers to the Request panel.
169
+ * Introduce Started and Stopped columns in the Timings panel.
170
+ * By popular demand, revert back to closest first ordering of stack traces so they're inline with most other dev tools out there.
171
+ * Show the script handle in addition to the text domain in the Languages panel.
172
+ * Improve the panel menu highlighting colours.
173
+ * Better presentation of the default and current values for the settings constants.
174
+ * Truncate long host names in the Scripts and Styles panels.
175
+ * Add some more of the admin screen globals to the admin collector.
176
+ * Switch back to using a monospace font in numeric data cells.
177
+ * Allow dark mode to be enabled with `QM_DARK_MODE`.
178
+ * Display the total query count even when `SAVEQUERIES` is defined as false.
179
+ * Allow proper plural forms to be used wherever a phrase includes a numeric value.
180
+ * More style resetting for compatibility with Twenty Twenty.
181
+ * Avoid a division by zero when cache hits is 0.
182
+ * Switch to (mostly) CSS for the child menu item marker.
183
+
184
+
185
+ ### 3.3.7 ###
186
+
187
+ * Expose instances where a requested template part was not loaded.
188
+ * Update the docs for multiple `wpdb` instances.
189
+ * Various accessibility improvements.
190
+ * Remove the RDBMS info as it's not at all reliable.
191
+
192
+
193
+ ### 3.3.6 ###
194
+
195
+ * Fix a compatibility issue where QM and the fatal error protection in WordPress 5.2+ were handling syntax errors differently.
196
+ * Fix some bugs with the icons for the panel controls.
197
+
198
+ ### 3.3.5 ###
199
+
200
+ * Add support for the new `get_template_part` action in WP 5.2.
201
+ * Add a friendly error message when the PHP version requirement isn't met.
202
+ * Add support for the new privacy policy conditional in WP 5.2.
203
+ * Add support for the new privacy policy template in WP 5.2.
204
+
205
+ ### 3.3.4 ###
206
+
207
+ * Updated CSS to avoid conflicts with themes using `ul`, `nav`, and `li` styling.
208
+ * Don't define `ajaxurl` if there are no Debug Bar panels to show.
209
+ * New icon for QM! By [Tubagus Didin Asrori](https://www.instagram.com/asrorigus/).
210
+ * Push the close button a bit further away from the edge of the screen to avoid scrollbar interference on macOS.
211
+ * Fix clash with object cache plugins that keep their hit and miss stats private.
212
+ * Add missing asset position counters.
213
+
214
+ ### 3.3.3 ###
215
+
216
+ * Add scripts and styles counts to admin menu items.
217
+ * Group the cache logic together to avoid calling cache related functionality when it's not available. Fixes #418.
218
+ * Switch to installing the test suite as Composer dependencies.
219
+
220
+ ### 3.3.2 ###
221
+
222
+ * Improve the accuracy of the `ver` parameter for enqueued scripts and styles.
223
+ * Separate and simplify the output for the object cache and opcode cache statuses. Fixes #413.
224
+ * Better formatting when no object cache stats are available.
225
+
226
+
227
+ ### 3.3.1 ###
228
+
229
+ * 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.
230
+ * Increase the sidebar layout to 100% height when there's no admin toolbar.
231
+ * Update the QM element ID in the "worst case scenario" JS. Fixes #398.
232
+ * Improve the layout of the Settings panel.
233
+ * Force the `Core` and `Non-Core` filter items to the bottom of the list, so plugins and themes takes precedence.
234
+ * Add an entry for the Settings screen to the narrow view nav menu.
235
+ * Add the admin notice hooks to the list of concerned actions for the Admin Screen panel.
236
+
237
+ ### 3.3.0 ###
238
+
239
+ New features! Read about them here: https://querymonitor.com/blog/2019/02/new-features-in-query-monitor-3-3/
240
+
241
+ * Introduce sub-menus for displaying Hooks in Use for each panel.
242
+ * Output the call stack and responsible component when `wp_die()` is called.
243
+ * Support for JavaScript (Jed) translations in WordPress 5.0+.
244
+ * Add render timing for blocks using the new hooks introduced in WordPress 5.1.
245
+ * Introduce a toggle to display QM on the side of the window.
246
+ * Allow non-string values to be used in the logger message. They'll be presented as JSON formatted strings.
247
+ * Allow boolean values to be used in log message contexts.
248
+ * Add some margin to the Close button so it doesn't get covered up so much by scroll bars.
249
+ * Prefix QM's cookie name with `wp-` to ensure interoperability with caches and proxies.
250
+ * Separate the Scripts and Styles collector and outputter so they're actually two separate panels.
251
+ * Add support for opcode cache detection separate from the object cache detection.
252
+ * Rename the main QM container to get around the fact that its name clashes with the plugin rows in older versions of WordPress.
253
+ * Avoid using `wp_parse_url()` as it was only introduced in WP 4.4.
254
+
255
+
256
+ ### 3.2.2 ###
257
+
258
+ * Support for nested content blocks (eg. in columns).
259
+ * Hide long innerHTML content of blocks behind a toggle.
260
+ * Add validation of the referenced media file in media blocks.
261
+ * Ensure asset URLs include the `ver` query arg.
262
+ * Tweak the warning colours.
263
+ * Coding standards.
264
+ * Layout tweaks.
265
+
266
+
267
+ ### 3.2.1 ###
268
+
269
+ * Fix a fatal error for < 5.0 sites that are not running the Gutenberg plugin.
270
+
271
+ ### 3.2.0 ###
272
+
273
+ * Add a new `Blocks` panel for debugging blocks in post content. Supports WordPress 5.0 and the Gutenberg plugin.
274
+ * Display the number of times that each template part was included.
275
+ * Allow the scripts and styles output to be filtered based on Dependencies and Dependents.
276
+ * Remove the `Pin` button in favour of always pinning QM when it's open.
277
+ * Add a "Settings" link to the Plugins screen that opens the settings panel.
278
+ * Add a link to the Add-ons page on the wiki.
279
+ * Add some more verbose and visible error notices for suboptimal PHP configuration directives.
280
+ * Add support for identifying any RDBMS, not just MySQL and MariaDB.
281
+ * Perform the PHP version check earlier on so that fewer parts of QM need to be compatible with PHP 5.2.
282
+ * Highlight plain `http` requests to the HTTP API as insecure.
283
+ * Ensure the `Template` admin menu is always shown, even if the template file name isn't known.
284
+ * Adjust the JS and CSS asset source to not include the host.
285
+ * Add a warning for insecure JS and CSS assets.
286
+ * Remove before and after pseudo-elements in the style reset.
287
+ * Show as much theme and template information as possible, even if QM doesn't know the template name.
288
+ * Highlight non-core rows when filtering the Hooks & Actions panel by Non-Core.
289
+ * Add a filter for environment constants.
290
+ * Min width CSS for buttons.
291
+ * First pass at documenting filters and hooks.
292
+ * More coding standards updates.
293
+
294
+ ### 3.1.1 ###
295
+
296
+ * Add a dark mode for the UI which is used via the Dark Mode plugin.
297
+ * Display Query Monitor's output in the user's selected language, instead of the site language.
298
+ * Add extended support for the Members and User Role Editor plugins.
299
+ * Fix link hover and focus styles.
300
+ * Reset some more CSS styles.
301
+
302
+ ### 3.1.0 ###
303
+
304
+ **Main changes:**
305
+
306
+ * Lots of accessibility improvements.
307
+ * Switch to system default fonts to match the WordPress admin area fonts.
308
+ * [Implement a PSR-3 compatible logger](https://querymonitor.com/blog/2018/07/profiling-and-logging/).
309
+ * UI improvements for mobile/touch/narrow devices.
310
+ * Various improvements to the layout of the Scripts and Styles panels.
311
+ * Prevent the "overscroll" behaviour that causes the main page to scroll when scrolling to the end of a panel.
312
+ * Remove the second table footer when filtering tables.
313
+ * Add a settings panel with information about all of the available configuration constants.
314
+
315
+ **All other changes:**
316
+
317
+ * Show a warning message in the Overview panel when a PHP error is trigger during an Ajax request.
318
+ * Display a warning when time or memory usage is above 75% of the respective limit.
319
+ * Template Part file string normalization so template parts are correctly shown on Windows systems.
320
+ * Don't output toggle links or a blank HTTP API transport if not necessary.
321
+ * Add a human readable representation of transient timeouts, and prevent some wrapping.
322
+ * Add a tear down for the capability checks collector so that cap checks performed between QM's processing and output don't break things.
323
+ * Remove the ability to sort the HTTP API Calls table. This removes a column, increasing the available horizontal space.
324
+ * Handle a bunch more known object types when displaying parameter values.
325
+ * Allow PHP errors to be filtered by level.
326
+ * Shorten the displayed names of long namespaced symbols by initialising the inner portions of the name.
327
+ * Combine the Location and Caller columns for PHP Errors to save some horizontal space.
328
+ * Don't wrap text in the PHP error type column.
329
+ * Improve the authentication cookie toggle so it dynamically reflects the current state.
330
+ * For now, force QM to use ltr text direction.
331
+ * Clarify terminology around the number of enqueued assets.
332
+ * Add fallback support for `wp_cache_get_stats()` to fetch cache stats.
333
+ * Improve the message shown when no queries are performed.
334
+ * Pluck stats from cache controllers that implement a `getStats()` method and return a nested array of stats for each server.
335
+ * Rename the `QM_HIDE_CORE_HOOKS` configuration constant to `QM_HIDE_CORE_ACTIONS`.
336
+ * Better handling of environments with unlimited execution time or memory limit. Adds a warning for both.
337
+ * When an external cache isn't in use, provide some helpful info if an appropriate extension is installed.
338
+
339
+
340
+ ### 3.0.1 ###
341
+
342
+ * Add even more hardening to the JS handling to prevent problems when jQuery is broken.
343
+ * Remove the old `no-js` styles which don't work well with the new UI.
344
+ * Correct the logic for showing the `Non-Core` component filter option.
345
+ * Add another VIP function to the list of functions that call the HTTP API.
346
+ * Add an inline warning highlight to capability checks that are empty or of a non-string type.
347
+ * Add support for WordPress.com VIP Client MU plugins.
348
+ * Add support for displaying laps as part of the timing information.
349
+ * Add full support for namespaced Debug Bar add-on panels.
350
+ * Switch back to depending on `jquery` instead of `jquery-core`.
351
+ * Don't assume `php_uname()` is always callable. Add info about the host OS too.
352
+ * Reset inline height attribute when the panel is closed.
353
+
354
+ ### 3.0.0 ###
355
+
356
+ * Brand new UI that resembles familiar web developer tools. Lots of related improvements and fixes.
357
+ * Introduce some basic timing functionality in a Timings panel. See #282 for usage.
358
+ * Introduce a `QM_NO_JQUERY` constant for running QM without jQuery as a dependency.
359
+ * Greater resilience to JavaScript errors.
360
+ * Allow the Scripts and Styles panel to be filtered by host name.
361
+ * Expose information about redirects that occurred in HTTP API requests.
362
+ * Expose more debugging information for HTTP API requests.
363
+ * Don't enable the Capability Checks panel by default as it's very memory intensive.
364
+ * Allow PHP errors to be silenced according to their component. See `qm/collect/php_error_levels` and `qm/collect/hide_silenced_php_errors` filters.
365
+ * Hide all file paths and stack traces behind toggles by default.
366
+ * Remove support for the AMP for WordPress plugin.
367
+ * Add associative keys to the array passed to the `qm/built-in-collectors` filter.
368
+ * Drop support for PHP 5.2.
369
+ * Generally improve performance and reduce memory usage.
370
+
371
+ ### 2.17.0 ###
372
+
373
+ * Add the current user object to the Request panel.
374
+ * A few improvements to the appearance of the overall layout.
375
+ * Use relative positioning in place of the nasty absolute position hack needed for some themes.
376
+ * Ensure the `get_*_template()` function exists before calling it.
377
+ * Add a `QM_DISABLE_ERROR_HANDLER` constant to disable QM's error handling.
378
+ * Switch to runtime filtering of user capabilities instead of granting the `view_query_monitor` cap upon activation.
379
+ * Correct a bunch of inline docs and code standards.
380
+
381
+
382
+ ### 2.16.2 ###
383
+
384
+ * Correctly handle re-selection of filters with a saved value that contains special characters.
385
+ * Show the correct caller for Super Admin capability checks.
386
+
387
+
388
+ ### 2.16.1 ###
389
+
390
+ * Update the plugin version number (no functional changes from 2.16.0).
391
+
392
+ ### 2.16.0 ###
393
+
394
+ * Introduce a new panel for displaying user capability checks that have been performed during the page load.
395
+ * Remember the picked value in all the filters. Uses localStorage in the browser.
396
+ * Add a "Non-Core" filter to the Component filter control in all panels.
397
+ * Add a "Non-SELECT" filter to the query type filter control in the Queries panel.
398
+ * Display collapsed stack traces by default in all panels.
399
+ * Add the error code to the Database Errors output.
400
+ * Improve the visual appearance of the column sorting controls.
401
+ * Improved display for parameter values in call stacks.
402
+ * Any files within `wp-content` which don't have a component are now grouped by the root directory or file name.
403
+
404
+
405
+ ### 2.15.0 ###
406
+
407
+ * Reverse the order of stack traces so they're in natural order, and improve styling.
408
+ * Enable query types to be clicked in the Overview.
409
+ * Add a highlight to the currently applied table filter.
410
+ * Improve table row highlighting when the row header spans multiple rows.
411
+ * Expose a link to the main query from the Request panel.
412
+ * Better stack traces for transient sets and HTTP API requests.
413
+ * Group and sort the Languages output by textdomain.
414
+ * Log and expose PHP extensions, and improve styling for error reporting level.
415
+ * Better highlighting of PHP warnings and QM errors.
416
+ * Add support for a `vendor` directory in the root of the `mu-plugins` directory when detecting components.
417
+ * Log the size of the value of updated transients.
418
+ * Add a help link when query components aren't available.
419
+ * Make the Hooks table output reusable by other components.
420
+ * Add a bit of vertical breathing room.
421
+ * Various improvements to terminology.
422
+ * Coding standards.
423
+
424
+ ### 2.14.0 ###
425
+
426
+ * Some more inline documentation about clickable stack traces.
427
+ * Output a more complete list of error levels and their status.
428
+ * Internationalisation fixes.
429
+ * Add some wrapping to the Request and Theme output so posts with long unbroken slugs don't break the layout.
430
+ * PHP error handler: Add new hook `qm/collect/new_php_error`
431
+ * Built-in collectors: Add new `qm/built-in-collectors` filter on files before including them
432
+ * More defensive CSS.
433
+ * Fix the size of the expand/contract buttons.
434
+ * Avoid showing two unnecessary functions in the call stack for textdomain loading.
435
+
436
+ ### 2.13.4 ###
437
+
438
+ * Highlight the main query to make it easier to find.
439
+ * Allow filtering the db queries list to see just the main query.
440
+ * Visual fixes for buttons, toggles, and filters.
441
+ * Add some missing i18n.
442
+ * Add some missing table row text.
443
+ * Correct the Drop-in Plugins URL for network admin
444
+
445
+ ### 2.13.3 ###
446
+
447
+ - Several RTL and i18n fixes
448
+ - More compatibility with funky object cache controllers
449
+ - Link to the Dropins screen when an object cache is in use
450
+ - Always display the cache information in the overview
451
+ - Correct filename output for Timber templates
452
+ - Use latest HHVM on Trusty during Travis testing
453
+
454
+
455
+ ### 2.13.2 ###
456
+
457
+ - Fix the layout of QM when the Twenty Seventeen theme is in use.
458
+ - Display QM at the bottom of GlotPress' output.
459
+ - Add support for logging queries made through HyperDB.
460
+ - Display a more appropriate message when a conflicting db.php file is present.
461
+ - `paged.php` is no longer part of the template hierarchy.
462
+ - Some more CSS fixes to prevent themes having an effect.
463
+ - Increase some contrast.
464
+ - Correct the template hierarchy for templates that have a `theme-compat` version in core. Currently only affects `embed.php`.
465
+ - Include a back-compat version of `wp_normalize_path()` for WordPress < 3.9.
466
+ - Ensure the use of newer conditional functions such as `is_embed()` don't cause PHP warnings on older versions of WordPress.
467
+
468
+
469
+ ### 2.13.1 ###
470
+
471
+ - Correct the filter names used for the template hierarchy collection. This corrects the hierarchy when `is_front_page()` is true.
472