Debug Bar - Version 0.7

Version Description

Made compatible with PHP < 5.2.0 CSS Tweaks Load JavaScript in Footer Fixed display issues for WP_Query debug on CPT archives pages

Download this release

Release Info

Developer westi
Plugin Icon 128x128 Debug Bar
Version 0.7
Comparing to
See all releases

Code changes from version 0.6 to 0.7

css/debug-bar.css CHANGED
@@ -1 +1 @@
1
- #wpadminbar #wp-admin-bar-debug-bar{float:right;}#wpadminbar #wp-admin-bar-debug-bar.active{background:#555;background:-moz-linear-gradient(bottom,#555,#3e3e3e);background:-webkit-gradient(linear,left bottom,left top,from(#555),to(#3e3e3e));}#wpadminbar #wp-admin-bar-debug-bar.warning{background-color:#f44;background-image:-moz-linear-gradient(bottom,#d00,#f44);background-image:-webkit-gradient(linear,left bottom,left top,from(#d00),to(#f44));}#wpadminbar #wp-admin-bar-debug-bar.warning:hover,#wpadminbar #wp-admin-bar-debug-bar.warning.active{background-color:#d00;background-image:-moz-linear-gradient(bottom,#f44,#d00);background-image:-webkit-gradient(linear,left bottom,left top,from(#f44),to(#d00));}#wpadminbar #wp-admin-bar-debug-bar.warning a{color:#fff;text-shadow:0 -1px 0 #700;}#wpadminbar #wp-admin-bar-debug-bar.notice{background-color:#ff8922;background-image:-moz-linear-gradient(bottom,#ee6f00,#ff8922);background-image:-webkit-gradient(linear,left bottom,left top,from(#ee6f00),to(#ff8922));}#wpadminbar #wp-admin-bar-debug-bar.notice:hover,#wpadminbar #wp-admin-bar-debug-bar.notice.active{background-color:#ee6f00;background-image:-moz-linear-gradient(bottom,#ff8922,#ee6f00);background-image:-webkit-gradient(linear,left bottom,left top,from(#ff8922),to(#ee6f00));}#wpadminbar #wp-admin-bar-debug-bar.notice a{color:#fff;text-shadow:0 -1px 0 #884000;}#querylist{font-family:Arial,Tahoma,sans-serif;display:none;position:fixed;height:250px;left:0;right:0;bottom:0;background:#fff;z-index:99999;color:#000;line-height:150%!important;text-align:left;}#debug-bar-handle{border-color:#c6c6c6;border-style:solid;border-width:1px 0;height:2px;background:#fff;cursor:n-resize;}#debug-bar-menu{background:#d9d9d9;background:-moz-linear-gradient(bottom,#d7d7d7,#e4e4e4);background:-webkit-gradient(linear,left bottom,left top,from(#d7d7d7),to(#e4e4e4));overflow:hidden;height:24px;text-shadow:0 1px 0 #f4f4f4;}#debug-bar-menu-right{float:right;}#debug-status{float:left;text-align:right;padding-top:4px;padding-right:15px;color:#bbb;}#debug-status .debug-status-title{color:#999;}#debug-status .debug-status-data{color:#999;font-weight:bold;}#debug-status #debug-status-warning{font-weight:bold;color:red;}#debug-status #debug-status-site{font-weight:bold;}#querylist pre{font-size:12px;padding:10px;}#querylist .left{float:left;}#querylist .right{float:right;}#querylist h1,#querylist h2,#querylist h3{font-weight:normal;}#debug-menu-links{clear:left;padding:3px 15px 0;overflow:hidden;list-style:none;margin:0;}#debug-menu-links li{float:left;margin-right:10px;margin-bottom:0!important;}#debug-menu-links li a{outline:none;display:block;line-height:16px;padding:2px 9px 3px;margin-right:0;color:#777!important;text-decoration:none!important;font-weight:bold!important;font-size:12px;-webkit-border-top-right-radius:4px;-webkit-border-top-left-radius:4px;-moz-border-radius-topright:4px;-moz-border-radius-topleft:4px;}#debug-menu-links li a:hover{color:#555!important;background-color:#eee;background-image:-moz-linear-gradient(bottom,#ddd,#eee);background-image:-webkit-gradient(linear,left bottom,left top,from(#ddd),to(#eee));}#debug-menu-links li a.current{background:#fff;color:#222!important;}#querylist h2{float:left;min-width:150px;border:1px solid #eee;padding:5px 10px 15px;clear:none;text-align:center;font-family:georgia,times,serif;font-size:28px;margin:15px 10px 15px 0!important;}#querylist h2 span{font-size:12px;color:#888;text-transform:uppercase;white-space:nowrap;display:block;margin-bottom:5px;}#object-cache-stats h2{border:none;float:none;text-align:left;font-size:22px;margin-bottom:0;}#querylist h3{margin-bottom:15px;}#querylist ol.wpd-queries{padding:0!important;margin:0!important;list-style:none;clear:left;}#querylist ol.wpd-queries li{padding:10px;background:#f0f0f0;margin:0 0 10px 0;}#querylist ol.wpd-queries li div.qdebug{background:#e8e8e8;margin:10px -10px -10px -10px;padding:5px 150px 5px 5px;font-size:11px;position:relative;min-height:20px;}#querylist ol.wpd-queries li div.qdebug span{position:absolute;right:10px;top:5px;white-space:nowrap;}#querylist a{text-decoration:underline!important;color:blue!important;}#querylist a:hover{text-decoration:none!important;}#debug-menu-targets{overflow:auto;position:absolute;top:28px;left:0;right:0;bottom:0;}#querylist .debug-menu-target{margin:10px;display:none;}#querylist ol{font:12px Monaco,"Courier New",Courier,Fixed!important;line-height:180%!important;}#debug-bar-php ol.debug-bar-php-list{padding:0!important;margin:0!important;list-style:none;clear:left;}#debug-bar-php ol.debug-bar-php-list li{padding:10px;margin:0 0 10px 0;}#debug-bar-php .debug-bar-php-warning{background-color:#ffebe8;border:1px solid #c00;}#debug-bar-php .debug-bar-php-notice{background-color:#ffffe0;border:1px solid #e6db55;}#debug-bar-deprecated ol.debug-bar-deprecated-list{padding:0!important;margin:0!important;list-style:none;clear:left;}#debug-bar-deprecated ol.debug-bar-deprecated-list li{padding:10px;margin:0 0 10px 0;background:#f0f0f0;}#debug-bar-wp-query ol.debug-bar-wp-query-list{padding:0!important;margin:0!important;list-style:none;clear:left;}#debug-bar-wp-query ol.debug-bar-wp-query-list li,#debug-bar-wp-query p,#debug-bar-request p{padding:10px;margin:0 0 10px 0;background:#f0f0f0;}#debug-bar-wp-query h3,#debug-bar-request h3{float:none;clear:both;font-family:georgia,times,serif;font-size:22px;margin:15px 10px 15px 0!important;}#debug-bar-actions{float:left;margin-top:5px;margin-right:5px;}#debug-bar-actions span{-moz-border-radius:20px;-webkit-border-radius:20px;border-radius:20px;display:block;float:left;font-size:16px;height:12px;line-height:13px;width:12px;color:#eee;background:#aaa;background:-moz-linear-gradient(bottom,#999,#bbb);background:-webkit-gradient(linear,left bottom,left top,from(#999),to(#bbb));text-shadow:0 1px 0 #999;border:1px solid #999;text-align:center;cursor:pointer;}#debug-bar-actions span.minus{line-height:10px;font-size:14px;}#debug-bar-actions span:hover{background:#888;background:-moz-linear-gradient(bottom,#999,#777);background:-webkit-gradient(linear,left bottom,left top,from(#999),to(#777));border:1px solid #777;text-shadow:0 1px 0 #777;}
1
+ #wpadminbar #wp-admin-bar-debug-bar{float:right;}#wpadminbar #wp-admin-bar-debug-bar.active{background:#555;background:-moz-linear-gradient(bottom,#555,#3e3e3e);background:-webkit-gradient(linear,left bottom,left top,from(#555),to(#3e3e3e));}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary{background-color:#f44;background-image:-moz-linear-gradient(bottom,#d00,#f44);background-image:-webkit-gradient(linear,left bottom,left top,from(#d00),to(#f44));}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary:hover,#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary.active{background-color:#d00;background-image:-moz-linear-gradient(bottom,#f44,#d00);background-image:-webkit-gradient(linear,left bottom,left top,from(#f44),to(#d00));}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary a{color:#fff;text-shadow:0 -1px 0 #700;}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary{background-color:#ff8922;background-image:-moz-linear-gradient(bottom,#ee6f00,#ff8922);background-image:-webkit-gradient(linear,left bottom,left top,from(#ee6f00),to(#ff8922));}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary:hover,#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary.active{background-color:#ee6f00;background-image:-moz-linear-gradient(bottom,#ff8922,#ee6f00);background-image:-webkit-gradient(linear,left bottom,left top,from(#ff8922),to(#ee6f00));}#wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary a{color:#fff;text-shadow:0 -1px 0 #884000;}#querylist{font-family:Arial,Tahoma,sans-serif;display:none;position:fixed;height:250px;left:0;right:0;bottom:0;background:#fff;z-index:99999;color:#000;line-height:150%!important;text-align:left;}#querylist.db-dockable-disabled{height:auto;top:28px;}#debug-bar-handle{border-color:#c6c6c6;border-style:solid;border-width:1px 0;height:2px;background:#fff;cursor:n-resize;}.db-dockable-disabled #debug-bar-handle{cursor:inherit;height:1px;border-top:0;}#debug-bar-menu{background:#d9d9d9;background:-moz-linear-gradient(bottom,#d7d7d7,#e4e4e4);background:-webkit-gradient(linear,left bottom,left top,from(#d7d7d7),to(#e4e4e4));overflow:hidden;height:24px;text-shadow:0 1px 0 #f4f4f4;}#debug-bar-menu-right{float:right;}#debug-status{float:left;text-align:right;padding-top:4px;padding-right:15px;color:#bbb;}#debug-status .debug-status-title{color:#999;}#debug-status .debug-status-data{color:#999;font-weight:bold;}#debug-status #debug-status-warning{font-weight:bold;color:red;}#debug-status #debug-status-site{font-weight:bold;}#querylist pre{font-size:12px;padding:10px;}#querylist .left{float:left;}#querylist .right{float:right;}#querylist h1,#querylist h2,#querylist h3{font-weight:normal;}#debug-menu-links{clear:left;padding:3px 15px 0;overflow:hidden;list-style:none;margin:0;}#debug-menu-links li{float:left;margin-right:10px;margin-bottom:0!important;}#debug-menu-links li a{outline:none;display:block;line-height:16px;padding:2px 9px 3px;margin-right:0;color:#777!important;text-decoration:none!important;font-weight:bold!important;font-size:12px;-webkit-border-top-right-radius:4px;-webkit-border-top-left-radius:4px;-moz-border-radius-topright:4px;-moz-border-radius-topleft:4px;}#debug-menu-links li a:hover{color:#555!important;background-color:#eee;background-image:-moz-linear-gradient(bottom,#ddd,#eee);background-image:-webkit-gradient(linear,left bottom,left top,from(#ddd),to(#eee));}#debug-menu-links li a.current{background:#fff;color:#222!important;}#querylist h2{float:left;min-width:150px;border:1px solid #eee;padding:5px 10px 15px;clear:none;text-align:center;font-family:georgia,times,serif;font-size:28px;margin:15px 10px 15px 0!important;}#querylist h2 span{font-size:12px;color:#888;text-transform:uppercase;white-space:nowrap;display:block;margin-bottom:5px;}#object-cache-stats h2{border:none;float:none;text-align:left;font-size:22px;margin-bottom:0;}#querylist h3{margin-bottom:15px;}#querylist ol.wpd-queries{padding:0!important;margin:0!important;list-style:none;clear:left;}#querylist ol.wpd-queries li{padding:10px;background:#f0f0f0;margin:0 0 10px 0;}#querylist ol.wpd-queries li div.qdebug{background:#e8e8e8;margin:10px -10px -10px -10px;padding:5px 150px 5px 5px;font-size:11px;position:relative;min-height:20px;}#querylist ol.wpd-queries li div.qdebug span{position:absolute;right:10px;top:5px;white-space:nowrap;}#querylist a{text-decoration:underline!important;color:blue!important;}#querylist a:hover{text-decoration:none!important;}#debug-menu-targets{overflow:auto;position:absolute;top:28px;left:0;right:0;bottom:0;}#querylist .debug-menu-target{margin:10px;display:none;}#querylist ol{font:12px Monaco,"Courier New",Courier,Fixed!important;line-height:180%!important;}#debug-bar-php ol.debug-bar-php-list{padding:0!important;margin:0!important;list-style:none;clear:left;}#debug-bar-php ol.debug-bar-php-list li{padding:10px;margin:0 0 10px 0;}#debug-bar-php .debug-bar-php-warning{background-color:#ffebe8;border:1px solid #c00;}#debug-bar-php .debug-bar-php-notice{background-color:#ffffe0;border:1px solid #e6db55;}#debug-bar-deprecated ol.debug-bar-deprecated-list{padding:0!important;margin:0!important;list-style:none;clear:left;}#debug-bar-deprecated ol.debug-bar-deprecated-list li{padding:10px;margin:0 0 10px 0;background:#f0f0f0;}#debug-bar-wp-query ol.debug-bar-wp-query-list{padding:0!important;margin:0!important;list-style:none;clear:left;}#debug-bar-wp-query ol.debug-bar-wp-query-list li,#debug-bar-wp-query p,#debug-bar-request p{padding:10px;margin:0 0 10px 0;background:#f0f0f0;}#debug-bar-wp-query ol.debug-bar-wp-query-list li ol{padding:0!important;margin:0!important;list-style:none;clear:left;}#debug-bar-wp-query h3,#debug-bar-request h3{float:none;clear:both;font-family:georgia,times,serif;font-size:22px;margin:15px 10px 15px 0!important;}#debug-bar-actions{float:left;margin-top:5px;margin-right:5px;}#debug-bar-actions span{-moz-border-radius:20px;-webkit-border-radius:20px;border-radius:20px;display:block;float:left;font-size:18px;height:12px;line-height:10px;width:12px;color:#eee;background:#aaa;background:-moz-linear-gradient(bottom,#999,#bbb);background:-webkit-gradient(linear,left bottom,left top,from(#999),to(#bbb));text-shadow:0 1px 0 #999;border:1px solid #999;text-align:center;cursor:pointer;}#debug-bar-actions span.minus{line-height:10px;font-size:14px;}#debug-bar-actions span:hover{background:#888;background:-moz-linear-gradient(bottom,#999,#777);background:-webkit-gradient(linear,left bottom,left top,from(#999),to(#777));border:1px solid #777;text-shadow:0 1px 0 #777;}
css/debug-bar.dev.css CHANGED
@@ -12,34 +12,34 @@
12
  background: -webkit-gradient(linear, left bottom, left top, from(#555), to(#3e3e3e));
13
  }
14
 
15
- #wpadminbar #wp-admin-bar-debug-bar.warning {
16
  background-color: #f44;
17
  background-image: -moz-linear-gradient(bottom, #d00, #f44);
18
  background-image: -webkit-gradient(linear, left bottom, left top, from(#d00), to(#f44));
19
  }
20
- #wpadminbar #wp-admin-bar-debug-bar.warning:hover,
21
- #wpadminbar #wp-admin-bar-debug-bar.warning.active {
22
  background-color: #d00;
23
  background-image: -moz-linear-gradient(bottom, #f44, #d00 );
24
  background-image: -webkit-gradient(linear, left bottom, left top, from(#f44), to(#d00));
25
  }
26
- #wpadminbar #wp-admin-bar-debug-bar.warning a {
27
  color: #fff;
28
  text-shadow: 0 -1px 0 #700;
29
  }
30
 
31
- #wpadminbar #wp-admin-bar-debug-bar.notice {
32
  background-color: #ff8922;
33
  background-image: -moz-linear-gradient(bottom, #ee6f00, #ff8922);
34
  background-image: -webkit-gradient(linear, left bottom, left top, from(#ee6f00), to(#ff8922));
35
  }
36
- #wpadminbar #wp-admin-bar-debug-bar.notice:hover,
37
- #wpadminbar #wp-admin-bar-debug-bar.notice.active {
38
  background-color: #ee6f00;
39
  background-image: -moz-linear-gradient(bottom, #ff8922, #ee6f00 );
40
  background-image: -webkit-gradient(linear, left bottom, left top, from(#ff8922), to(#ee6f00));
41
  }
42
- #wpadminbar #wp-admin-bar-debug-bar.notice a {
43
  color: #fff;
44
  text-shadow: 0 -1px 0 #884000;
45
  }
@@ -312,6 +312,13 @@
312
  background: #f0f0f0;
313
  }
314
 
 
 
 
 
 
 
 
315
  #debug-bar-wp-query h3, #debug-bar-request h3 {
316
  float: none;
317
  clear: both;
@@ -331,9 +338,9 @@
331
  border-radius: 20px;
332
  display: block;
333
  float: left;
334
- font-size: 16px;
335
  height: 12px;
336
- line-height: 13px;
337
  width: 12px;
338
  color: #eee;
339
  background: #aaa;
12
  background: -webkit-gradient(linear, left bottom, left top, from(#555), to(#3e3e3e));
13
  }
14
 
15
+ #wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary {
16
  background-color: #f44;
17
  background-image: -moz-linear-gradient(bottom, #d00, #f44);
18
  background-image: -webkit-gradient(linear, left bottom, left top, from(#d00), to(#f44));
19
  }
20
+ #wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary:hover,
21
+ #wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary.active {
22
  background-color: #d00;
23
  background-image: -moz-linear-gradient(bottom, #f44, #d00 );
24
  background-image: -webkit-gradient(linear, left bottom, left top, from(#f44), to(#d00));
25
  }
26
+ #wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-warning-summary a {
27
  color: #fff;
28
  text-shadow: 0 -1px 0 #700;
29
  }
30
 
31
+ #wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary {
32
  background-color: #ff8922;
33
  background-image: -moz-linear-gradient(bottom, #ee6f00, #ff8922);
34
  background-image: -webkit-gradient(linear, left bottom, left top, from(#ee6f00), to(#ff8922));
35
  }
36
+ #wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary:hover,
37
+ #wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary.active {
38
  background-color: #ee6f00;
39
  background-image: -moz-linear-gradient(bottom, #ff8922, #ee6f00 );
40
  background-image: -webkit-gradient(linear, left bottom, left top, from(#ff8922), to(#ee6f00));
41
  }
42
+ #wpadminbar #wp-admin-bar-debug-bar.debug-bar-php-notice-summary a {
43
  color: #fff;
44
  text-shadow: 0 -1px 0 #884000;
45
  }
312
  background: #f0f0f0;
313
  }
314
 
315
+ #debug-bar-wp-query ol.debug-bar-wp-query-list li ol {
316
+ padding: 0 !important;
317
+ margin: 0 !important;
318
+ list-style: none;
319
+ clear: left;
320
+ }
321
+
322
  #debug-bar-wp-query h3, #debug-bar-request h3 {
323
  float: none;
324
  clear: both;
338
  border-radius: 20px;
339
  display: block;
340
  float: left;
341
+ font-size: 18px;
342
  height: 12px;
343
+ line-height: 10px;
344
  width: 12px;
345
  color: #eee;
346
  background: #aaa;
debug-bar.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin URI: http://wordpress.org/extend/plugins/debug-bar/
5
  Description: Adds a debug menu to the admin bar that shows query, cache, and other helpful debugging information.
6
  Author: wordpressdotorg
7
- Version: 0.6
8
  Author URI: http://wordpress.org/
9
  */
10
 
@@ -27,7 +27,7 @@ class Debug_Bar {
27
  }
28
 
29
  function init() {
30
- if ( ! is_super_admin() || ! is_admin_bar_showing() )
31
  return;
32
 
33
  add_action( 'admin_bar_menu', array( &$this, 'admin_bar_menu' ), 1000 );
@@ -38,6 +38,13 @@ class Debug_Bar {
38
  $this->enqueue();
39
  $this->init_panels();
40
  }
 
 
 
 
 
 
 
41
 
42
  function init_ajax() {
43
  if ( ! is_super_admin() )
@@ -56,9 +63,9 @@ class Debug_Bar {
56
  function enqueue() {
57
  $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
58
 
59
- wp_enqueue_style( 'debug-bar', plugins_url( "css/debug-bar$suffix.css", __FILE__ ), array(), '20110114' );
60
- wp_enqueue_script( 'debug-bar-ui-dockable', plugins_url( "js/ui-dockable$suffix.js", __FILE__ ), array('jquery-ui-mouse'), '20110113' );
61
- wp_enqueue_script( 'debug-bar', plugins_url( "js/debug-bar$suffix.js", __FILE__ ), array('jquery', 'debug-bar-ui-dockable', 'utils'), '20110114' );
62
 
63
  do_action('debug_bar_enqueue_scripts');
64
  }
@@ -103,6 +110,16 @@ class Debug_Bar {
103
  <?php
104
  }
105
 
 
 
 
 
 
 
 
 
 
 
106
  function admin_bar_menu() {
107
  global $wp_admin_bar;
108
 
@@ -143,7 +160,7 @@ class Debug_Bar {
143
  $statuses[] = array( 'site', sprintf( __('Site #%d on %s', 'debug-bar'), $GLOBALS['blog_id'], php_uname( 'n' ) ), '' );
144
  $statuses[] = array( 'php', __('PHP', 'debug-bar'), phpversion() );
145
  $statuses[] = array( 'db', __('DB', 'debug-bar'), $wpdb->db_version() );
146
- $statuses[] = array( 'memory', __('Mem.', 'debug-bar'), sprintf( __('%s bytes', 'debug-bar'), number_format( memory_get_peak_usage() ) ) );
147
 
148
  $statuses = apply_filters( 'debug_bar_statuses', $statuses );
149
 
@@ -213,4 +230,4 @@ class Debug_Bar {
213
 
214
  $GLOBALS['debug_bar'] = new Debug_Bar();
215
 
216
- ?>
4
  Plugin URI: http://wordpress.org/extend/plugins/debug-bar/
5
  Description: Adds a debug menu to the admin bar that shows query, cache, and other helpful debugging information.
6
  Author: wordpressdotorg
7
+ Version: 0.7
8
  Author URI: http://wordpress.org/
9
  */
10
 
27
  }
28
 
29
  function init() {
30
+ if ( ! is_super_admin() || ! is_admin_bar_showing() || $this->is_wp_login() )
31
  return;
32
 
33
  add_action( 'admin_bar_menu', array( &$this, 'admin_bar_menu' ), 1000 );
38
  $this->enqueue();
39
  $this->init_panels();
40
  }
41
+
42
+ /* Are we on the wp-login.php page?
43
+ * We can get here while logged in and break the page as the admin bar isn't shown and otherthings the js relies on aren't available.
44
+ */
45
+ function is_wp_login() {
46
+ return 'wp-login.php' == basename( $_SERVER['SCRIPT_NAME']);
47
+ }
48
 
49
  function init_ajax() {
50
  if ( ! is_super_admin() )
63
  function enqueue() {
64
  $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
65
 
66
+ wp_enqueue_style( 'debug-bar', plugins_url( "css/debug-bar$suffix.css", __FILE__ ), array(), '20110316a' );
67
+ wp_enqueue_script( 'debug-bar-ui-dockable', plugins_url( "js/ui-dockable$suffix.js", __FILE__ ), array('jquery-ui-mouse'), '20110113', true );
68
+ wp_enqueue_script( 'debug-bar', plugins_url( "js/debug-bar$suffix.js", __FILE__ ), array('jquery', 'debug-bar-ui-dockable', 'utils'), '20110114', true );
69
 
70
  do_action('debug_bar_enqueue_scripts');
71
  }
110
  <?php
111
  }
112
 
113
+ // memory_get_peak_usage is PHP >= 5.2.0 only
114
+ function safe_memory_get_peak_usage() {
115
+ if ( function_exists( 'memory_get_peak_usage' ) ) {
116
+ $usage = memory_get_peak_usage();
117
+ } else {
118
+ $usage = memory_get_usage();
119
+ }
120
+ return $usage;
121
+ }
122
+
123
  function admin_bar_menu() {
124
  global $wp_admin_bar;
125
 
160
  $statuses[] = array( 'site', sprintf( __('Site #%d on %s', 'debug-bar'), $GLOBALS['blog_id'], php_uname( 'n' ) ), '' );
161
  $statuses[] = array( 'php', __('PHP', 'debug-bar'), phpversion() );
162
  $statuses[] = array( 'db', __('DB', 'debug-bar'), $wpdb->db_version() );
163
+ $statuses[] = array( 'memory', __('Mem.', 'debug-bar'), sprintf( __('%s bytes', 'debug-bar'), number_format( $this->safe_memory_get_peak_usage() ) ) );
164
 
165
  $statuses = apply_filters( 'debug_bar_statuses', $statuses );
166
 
230
 
231
  $GLOBALS['debug_bar'] = new Debug_Bar();
232
 
233
+ ?>
panels/class-debug-bar-php.php CHANGED
@@ -20,9 +20,9 @@ class Debug_Bar_PHP extends Debug_Bar_Panel {
20
 
21
  function debug_bar_classes( $classes ) {
22
  if ( count( $this->warnings ) )
23
- $classes[] = 'warning';
24
  elseif ( count( $this->notices ) )
25
- $classes[] = 'notice';
26
  return $classes;
27
  }
28
 
20
 
21
  function debug_bar_classes( $classes ) {
22
  if ( count( $this->warnings ) )
23
+ $classes[] = 'debug-bar-php-warning-summary';
24
  elseif ( count( $this->notices ) )
25
+ $classes[] = 'debug-bar-php-notice-summary';
26
  return $classes;
27
  }
28
 
panels/class-debug-bar-queries.php CHANGED
@@ -6,13 +6,18 @@ class Debug_Bar_Queries extends Debug_Bar_Panel {
6
  }
7
 
8
  function prerender() {
9
- $this->set_visible( defined('SAVEQUERIES') && SAVEQUERIES );
 
 
 
 
 
 
10
  }
11
 
12
  function render() {
13
- global $wpdb;
14
 
15
- $queries = array();
16
  $out = '';
17
  $total_time = 0;
18
 
@@ -20,10 +25,9 @@ class Debug_Bar_Queries extends Debug_Bar_Panel {
20
  $show_many = isset($_GET['debug_queries']);
21
 
22
  if ( $wpdb->num_queries > 500 && !$show_many )
23
- $out .= "<p>" . sprintf( __('There are too many queries to show easily! <a href="%s">Show them anyway</a>', 'debug-bar'), add_query_arg( 'debug_queries', 'true' ) ) . "</p>";
24
 
25
  $out .= '<ol class="wpd-queries">';
26
- $first_query = 0;
27
  $counter = 0;
28
 
29
  foreach ( $wpdb->queries as $q ) {
@@ -31,8 +35,8 @@ class Debug_Bar_Queries extends Debug_Bar_Panel {
31
 
32
  $total_time += $elapsed;
33
 
34
- if ( !$show_many && ++$counter > 500 )
35
- continue;
36
 
37
  $debug = explode( ', ', $debug );
38
  $debug = array_diff( $debug, array( 'require_once', 'require', 'include_once', 'include' ) );
@@ -44,16 +48,35 @@ class Debug_Bar_Queries extends Debug_Bar_Panel {
44
  }
45
  $out .= '</ol>';
46
  } else {
47
- $out .= "<p><strong>" . __('There are no queries on this page.', 'debug-bar') . "</strong></p>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  }
49
 
50
- $query_count = '<h2><span>Total Queries:</span>' . number_format( $wpdb->num_queries ) . "</h2>\n";
51
- $query_time = '<h2><span>Total query time:</span>' . number_format(sprintf('%0.1f', $total_time * 1000), 1) . " ms</h2>\n";
 
 
 
 
 
52
 
53
- $out = $query_count . $query_time . $out;
54
 
55
  echo $out;
56
  }
57
  }
58
 
59
- ?>
6
  }
7
 
8
  function prerender() {
9
+ $this->set_visible( defined('SAVEQUERIES') && SAVEQUERIES || ! empty($GLOBALS['EZSQL_ERROR']) );
10
+ }
11
+
12
+ function debug_bar_classes( $classes ) {
13
+ if ( ! empty($GLOBALS['EZSQL_ERROR']) )
14
+ $classes[] = 'warning';
15
+ return $classes;
16
  }
17
 
18
  function render() {
19
+ global $wpdb, $EZSQL_ERROR;
20
 
 
21
  $out = '';
22
  $total_time = 0;
23
 
25
  $show_many = isset($_GET['debug_queries']);
26
 
27
  if ( $wpdb->num_queries > 500 && !$show_many )
28
+ $out .= "<p>" . sprintf( __('There are too many queries to show easily! <a href="%s">Show them anyway</a>', 'debug-bar'), add_query_arg( 'debug_queries', 'true' ) ) . "</p>";
29
 
30
  $out .= '<ol class="wpd-queries">';
 
31
  $counter = 0;
32
 
33
  foreach ( $wpdb->queries as $q ) {
35
 
36
  $total_time += $elapsed;
37
 
38
+ if ( ++$counter > 500 && ! $show_many )
39
+ continue;
40
 
41
  $debug = explode( ', ', $debug );
42
  $debug = array_diff( $debug, array( 'require_once', 'require', 'include_once', 'include' ) );
48
  }
49
  $out .= '</ol>';
50
  } else {
51
+ if ( $wpdb->num_queries == 0 )
52
+ $out .= "<p><strong>" . __('There are no queries on this page.', 'debug-bar') . "</strong></p>";
53
+ else
54
+ $out .= "<p><strong>" . __('SAVEQUERIES must be defined to show the query log.', 'debug-bar') . "</strong></p>";
55
+ }
56
+
57
+ if ( ! empty($EZSQL_ERROR) ) {
58
+ $out .= '<h3>' . __( 'Database Errors', 'debug-bar' ) . '</h3>';
59
+ $out .= '<ol class="wpd-queries">';
60
+
61
+ foreach ( $EZSQL_ERROR as $e ) {
62
+ $query = nl2br(esc_html($e['query']));
63
+ $out .= "<li>$query<br/><div class='qdebug'>{$e['error_str']}</div></li>\n";
64
+ }
65
+ $out .= '</ol>';
66
  }
67
 
68
+ $heading = '';
69
+ if ( $wpdb->num_queries )
70
+ $heading .= '<h2><span>Total Queries:</span>' . number_format( $wpdb->num_queries ) . "</h2>\n";
71
+ if ( $total_time )
72
+ $heading .= '<h2><span>Total query time:</span>' . number_format(sprintf('%0.1f', $total_time * 1000), 1) . " ms</h2>\n";
73
+ if ( ! empty($EZSQL_ERROR) )
74
+ $heading .= '<h2><span>Total DB Errors:</span>' . number_format( count($EZSQL_ERROR) ) . "</h2>\n";
75
 
76
+ $out = $heading . $out;
77
 
78
  echo $out;
79
  }
80
  }
81
 
82
+ ?>
panels/class-debug-bar-wp-query.php CHANGED
@@ -87,7 +87,16 @@ class Debug_Bar_WP_Query extends Debug_Bar_Panel {
87
  echo '<h3>Queried Object:</h3>';
88
  echo '<ol class="debug-bar-wp-query-list">';
89
  foreach ($queried_object as $key => $value) {
90
- echo '<li>' . $key . ' => ' . $value . '</li>';
 
 
 
 
 
 
 
 
 
91
  }
92
  echo '</ol>';
93
  }
87
  echo '<h3>Queried Object:</h3>';
88
  echo '<ol class="debug-bar-wp-query-list">';
89
  foreach ($queried_object as $key => $value) {
90
+ // See: http://wordpress.org/support/topic/plugin-debug-bar-custom-post-type-archive-catchable-fatal-error
91
+ // TODO: Fix better
92
+ if ( is_object( $value ) ) {
93
+ echo '<li>' . $key . ' => <ol>';
94
+ foreach ( $value as $_key => $_value )
95
+ echo '<li>' . $_key . ' => ' . $_value . '</li>';
96
+ echo '</ol></li>';
97
+ } else {
98
+ echo '<li>' . $key . ' => ' . $value . '</li>';
99
+ }
100
  }
101
  echo '</ol>';
102
  }
readme.txt CHANGED
@@ -1,5 +1,5 @@
1
  === Debug Bar ===
2
- Contributors: wordpressdotorg, ryan, westi, koopersmith
3
  Tags: debug
4
  Tested up to: 3.1
5
  Stable tag: 0.6
@@ -21,6 +21,12 @@ Add a PHP/MySQL console with the [Debug Bar Console plugin](http://wordpress.org
21
 
22
  == Upgrade Notice ==
23
 
 
 
 
 
 
 
24
  = 0.6 =
25
  Added maximize/restore button
26
  Added cookie to keep track of debug bar state
@@ -53,6 +59,12 @@ Initial Release
53
 
54
  == Changelog ==
55
 
 
 
 
 
 
 
56
  = 0.6 =
57
  Added maximize/restore button
58
  Added cookie to keep track of debug bar state
1
  === Debug Bar ===
2
+ Contributors: wordpressdotorg, ryan, westi, koopersmith, duck_
3
  Tags: debug
4
  Tested up to: 3.1
5
  Stable tag: 0.6
21
 
22
  == Upgrade Notice ==
23
 
24
+ = 0.7 =
25
+ Made compatible with PHP < 5.2.0
26
+ CSS Tweaks
27
+ Load JavaScript in Footer
28
+ Fixed display issues for WP_Query debug on CPT archives pages
29
+
30
  = 0.6 =
31
  Added maximize/restore button
32
  Added cookie to keep track of debug bar state
59
 
60
  == Changelog ==
61
 
62
+ = 0.7 =
63
+ Made compatible with PHP < 5.2.0
64
+ CSS Tweaks
65
+ Load JavaScript in Footer
66
+ Fixed display issues for WP_Query debug on CPT archives pages
67
+
68
  = 0.6 =
69
  Added maximize/restore button
70
  Added cookie to keep track of debug bar state