Debug Bar - Version 0.4

Version Description

Added DB Version information Updated PHP Warning and Notice tracking so that multiple different errors on the same line are tracked Compatibility updates for trunk

Download this release

Release Info

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

Code changes from version 0.3 to 0.4

Files changed (5) hide show
  1. debug-bar.dev.css +2 -2
  2. debug-bar.dev.js +26 -4
  3. debug-bar.js +1 -1
  4. debug-bar.php +13 -7
  5. readme.txt +17 -1
debug-bar.dev.css CHANGED
@@ -1,9 +1,9 @@
1
  /**
2
- * Super admin styling
3
  */
4
 
5
  div#wpadminbar li.ab-debug-bar {
6
- float: right;
7
  }
8
 
9
  #querylist {
1
  /**
2
+ * Debug Bar styling
3
  */
4
 
5
  div#wpadminbar li.ab-debug-bar {
6
+ float: right;
7
  }
8
 
9
  #querylist {
debug-bar.dev.js CHANGED
@@ -1,13 +1,28 @@
1
- var toggle_query_list, clickDebugLink;
2
 
3
- toggle_query_list = function() {
 
 
 
 
 
 
 
 
 
4
  var querylist = document.getElementById( 'querylist' );
 
5
  if( querylist && querylist.style.display == 'block' ) {
6
  querylist.style.display='none';
7
  } else {
8
  querylist.style.display='block';
9
  }
10
- }
 
 
 
 
 
11
 
12
  clickDebugLink = function( targetsGroupId, obj) {
13
  var sectionDivs, i, j;
@@ -28,4 +43,11 @@ clickDebugLink = function( targetsGroupId, obj) {
28
  }
29
  obj.parentNode.setAttribute( 'class', 'current' );
30
  return false;
31
- };
 
 
 
 
 
 
 
1
+ (function(){
2
 
3
+ var addEvent, toggleQueryList, clickDebugLink;
4
+
5
+ addEvent = function( obj, type, fn ) {
6
+ if (obj.addEventListener)
7
+ obj.addEventListener(type, fn, false);
8
+ else if (obj.attachEvent)
9
+ obj.attachEvent('on' + type, function() { return fn.call(obj, window.event);});
10
+ };
11
+
12
+ toggleQueryList = function( e ) {
13
  var querylist = document.getElementById( 'querylist' );
14
+
15
  if( querylist && querylist.style.display == 'block' ) {
16
  querylist.style.display='none';
17
  } else {
18
  querylist.style.display='block';
19
  }
20
+
21
+ // IE doesn't support preventDefault, and does support returnValue
22
+ if ( e.preventDefault )
23
+ e.preventDefault();
24
+ e.returnValue = false;
25
+ };
26
 
27
  clickDebugLink = function( targetsGroupId, obj) {
28
  var sectionDivs, i, j;
43
  }
44
  obj.parentNode.setAttribute( 'class', 'current' );
45
  return false;
46
+ };
47
+
48
+ addEvent(window, 'load', function() {
49
+ var li = document.getElementById('wp-admin-bar-queries');
50
+ addEvent( li, 'click', toggleQueryList );
51
+ });
52
+
53
+ })();
debug-bar.js CHANGED
@@ -1 +1 @@
1
- var toggle_query_list,clickDebugLink;toggle_query_list=function(){var a=document.getElementById("querylist");if(a&&a.style.display=="block"){a.style.display="none"}else{a.style.display="block"}};clickDebugLink=function(d,e){var c,b,a;c=document.getElementById(d).childNodes;for(b=0;b<c.length;b++){if(1!=c[b].nodeType){continue}c[b].style.display="none"}document.getElementById(e.href.substr(e.href.indexOf("#")+1)).style.display="block";for(a=0;a<e.parentNode.parentNode.childNodes.length;a++){if(1!=e.parentNode.parentNode.childNodes[a].nodeType){continue}e.parentNode.parentNode.childNodes[a].removeAttribute("class")}e.parentNode.setAttribute("class","current");return false};
1
+ (function(){var c,a,b;c=function(f,e,d){if(f.addEventListener){f.addEventListener(e,d,false)}else{if(f.attachEvent){f.attachEvent("on"+e,function(){return d.call(f,window.event)})}}};a=function(f){var d=document.getElementById("querylist");if(d&&d.style.display=="block"){d.style.display="none"}else{d.style.display="block"}if(f.preventDefault){f.preventDefault()}f.returnValue=false};b=function(g,h){var f,e,d;f=document.getElementById(g).childNodes;for(e=0;e<f.length;e++){if(1!=f[e].nodeType){continue}f[e].style.display="none"}document.getElementById(h.href.substr(h.href.indexOf("#")+1)).style.display="block";for(d=0;d<h.parentNode.parentNode.childNodes.length;d++){if(1!=h.parentNode.parentNode.childNodes[d].nodeType){continue}h.parentNode.parentNode.childNodes[d].removeAttribute("class")}h.parentNode.setAttribute("class","current");return false};c(window,"load",function(){var d=document.getElementById("wp-admin-bar-queries");c(d,"click",a)})})();
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.3
8
  Author URI: http://wordpress.org/
9
  */
10
 
@@ -30,7 +30,7 @@ function debug_bar_menu() {
30
  $class .= ' ab-php-notice';
31
 
32
  /* Add the main siteadmin menu item */
33
- $wp_admin_bar->add_menu( array( 'id' => 'queries', 'title' => __('Debug'), 'href' => 'javascript:toggle_query_list()', 'meta' => array( 'class' => $class ) ) );
34
  }
35
  add_action( 'admin_bar_menu', 'debug_bar_menu', 1000 );
36
 
@@ -84,7 +84,7 @@ function debug_bar_list() {
84
  <h1><?php printf( __('Debugging blog #%d on %s'), $GLOBALS['blog_id'], php_uname( 'n' ) ); ?></h1>
85
  <div id="debug-status">
86
  <p class="left"></p>
87
- <p class="right"><?php printf( __('PHP Version: %s'), phpversion() ); ?></p>
88
  </div>
89
  <ul class="debug-menu-links">
90
 
@@ -176,14 +176,18 @@ function debug_bar_php() {
176
  echo '<h2><span>Total Notices:</span>' . number_format( count( $_debug_bar_notices ) ) . "</h2>\n";
177
  if ( count( $_debug_bar_warnings ) ) {
178
  echo '<ol class="debug-bar-php-list">';
179
- foreach ( $_debug_bar_warnings as $location => $message)
 
180
  echo "<li class='debug-bar-php-warning'>WARNING: ".str_replace(ABSPATH, '', $location) . ' - ' . strip_tags($message). "</li>";
 
181
  echo '</ol>';
182
  }
183
  if ( count( $_debug_bar_notices ) ) {
184
  echo '<ol class="debug-bar-php-list">';
185
- foreach ( $_debug_bar_notices as $location => $message)
 
186
  echo "<li class='debug-bar-php-notice'>NOTICE: ".str_replace(ABSPATH, '', $location) . ' - ' . strip_tags($message). "</li>";
 
187
  echo '</ol>';
188
  }
189
  echo "</div>";
@@ -339,14 +343,16 @@ function debug_bar_request() {
339
  function debug_bar_error_handler( $type, $message, $file, $line ) {
340
  global $_debug_bar_real_error_handler, $_debug_bar_notices, $_debug_bar_warnings;
341
 
 
 
342
  switch ( $type ) {
343
  case E_WARNING :
344
  case E_USER_WARNING :
345
- $_debug_bar_warnings[$file.':'.$line] = $message;
346
  break;
347
  case E_NOTICE :
348
  case E_USER_NOTICE :
349
- $_debug_bar_notices[$file.':'.$line] = $message;
350
  break;
351
  case E_STRICT :
352
  // TODO
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.4
8
  Author URI: http://wordpress.org/
9
  */
10
 
30
  $class .= ' ab-php-notice';
31
 
32
  /* Add the main siteadmin menu item */
33
+ $wp_admin_bar->add_menu( array( 'id' => 'queries', 'title' => __('Debug'), 'meta' => array( 'class' => $class ) ) );
34
  }
35
  add_action( 'admin_bar_menu', 'debug_bar_menu', 1000 );
36
 
84
  <h1><?php printf( __('Debugging blog #%d on %s'), $GLOBALS['blog_id'], php_uname( 'n' ) ); ?></h1>
85
  <div id="debug-status">
86
  <p class="left"></p>
87
+ <p class="right"><?php printf( __('PHP Version: %1$s, DB Version: %2$s'), phpversion(), $wpdb->db_version() ); ?></p>
88
  </div>
89
  <ul class="debug-menu-links">
90
 
176
  echo '<h2><span>Total Notices:</span>' . number_format( count( $_debug_bar_notices ) ) . "</h2>\n";
177
  if ( count( $_debug_bar_warnings ) ) {
178
  echo '<ol class="debug-bar-php-list">';
179
+ foreach ( $_debug_bar_warnings as $location_message) {
180
+ list( $location, $message) = $location_message;
181
  echo "<li class='debug-bar-php-warning'>WARNING: ".str_replace(ABSPATH, '', $location) . ' - ' . strip_tags($message). "</li>";
182
+ }
183
  echo '</ol>';
184
  }
185
  if ( count( $_debug_bar_notices ) ) {
186
  echo '<ol class="debug-bar-php-list">';
187
+ foreach ( $_debug_bar_notices as $location_message) {
188
+ list( $location, $message) = $location_message;
189
  echo "<li class='debug-bar-php-notice'>NOTICE: ".str_replace(ABSPATH, '', $location) . ' - ' . strip_tags($message). "</li>";
190
+ }
191
  echo '</ol>';
192
  }
193
  echo "</div>";
343
  function debug_bar_error_handler( $type, $message, $file, $line ) {
344
  global $_debug_bar_real_error_handler, $_debug_bar_notices, $_debug_bar_warnings;
345
 
346
+ $_key = md5( $file . ':' . $line . ':' . $message );
347
+
348
  switch ( $type ) {
349
  case E_WARNING :
350
  case E_USER_WARNING :
351
+ $_debug_bar_warnings[$_key] = array( $file.':'.$line, $message );
352
  break;
353
  case E_NOTICE :
354
  case E_USER_NOTICE :
355
+ $_debug_bar_notices[$_key] = array( $file.':'.$line, $message );
356
  break;
357
  case E_STRICT :
358
  // TODO
readme.txt CHANGED
@@ -1,5 +1,5 @@
1
  === Debug Bar ===
2
- Contributors: wordpressdotorg, ryan, westi
3
  Tags: debug
4
  Tested up to: 3.1
5
  Stable tag: 0.3
@@ -15,8 +15,15 @@ A must for developers!
15
 
16
  When WP_DEBUG is enabled it also tracks PHP Warnings and Notices to make them easier to find.
17
 
 
 
18
  == Upgrade Notice ==
19
 
 
 
 
 
 
20
  = 0.3 =
21
  Added WordPress Query infomation
22
  Added Request parsing information
@@ -30,6 +37,15 @@ Initial Release
30
 
31
  == Changelog ==
32
 
 
 
 
 
 
 
 
 
 
33
  = 0.2 =
34
  Added PHP Notice / Warning tracking when WP_DEBUG enabled
35
  Added deprecated function usage tracking
1
  === Debug Bar ===
2
+ Contributors: wordpressdotorg, ryan, westi, koopersmith
3
  Tags: debug
4
  Tested up to: 3.1
5
  Stable tag: 0.3
15
 
16
  When WP_DEBUG is enabled it also tracks PHP Warnings and Notices to make them easier to find.
17
 
18
+ When SAVEQUERIES is enabled the mysql queries are tracked and displayed.
19
+
20
  == Upgrade Notice ==
21
 
22
+ = 0.4 =
23
+ Added DB Version information
24
+ Updated PHP Warning and Notice tracking so that multiple different errors on the same line are tracked
25
+ Compatibility updates for trunk
26
+
27
  = 0.3 =
28
  Added WordPress Query infomation
29
  Added Request parsing information
37
 
38
  == Changelog ==
39
 
40
+ = 0.4 =
41
+ Added DB Version information
42
+ Updated PHP Warning and Notice tracking so that multiple different errors on the same line are tracked
43
+ Compatibility updates for trunk
44
+
45
+ = 0.3 =
46
+ Added WordPress Query infomation
47
+ Added Request parsing information
48
+
49
  = 0.2 =
50
  Added PHP Notice / Warning tracking when WP_DEBUG enabled
51
  Added deprecated function usage tracking