Version Description
Initial Release
=
Download this release
Release Info
Developer | ryan |
Plugin | Debug Bar |
Version | 0.1 |
Comparing to | |
See all releases |
Version 0.1
- debug-bar.css +1 -0
- debug-bar.dev.css +222 -0
- debug-bar.php +182 -0
- readme.txt +26 -0
debug-bar.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
#querylist{font-family:Arial,Tahoma,sans-serif;display:none;position:absolute;top:50px;left:50px;right:50px;background:#fff;padding:20px;-moz-box-shadow:0 0 15px #888;-webkit-box-shadow:0 0 15px #888;box-shadow:0 0 15px #888;z-index:99999;border:10px solid #f0f0f0;color:#000;line-height:150%!important;}#querylist pre{font-size:12px;padding:10px;}#querylist h1{font-family:georgia,times,serif;text-align:center;font-size:24px;padding:20px 5px;background:#eee;color:#555;margin:0;}#querylist div#debug-status{background:#ccc;color:#fff;overflow:hidden;height:21px;font-size:14px;font-family:georgia,times,serif;padding:7px 15px;}#querylist .left{float:left;}#querylist .right{float:right;}#querylist h1,#querylist h2,#querylist h3{font-weight:normal;}#querylist ul.debug-menu-links{clear:left;background:#ccc;padding:10px 15px 0;overflow:hidden;list-style:none;margin:0;padding:0 0 0 15px;}#querylist ul.debug-menu-links li{float:left;margin-right:10px;margin-bottom:0!important;}#querylist ul.debug-menu-links li a{outline:none;display:block;padding:5px 9px;margin-right:0;background:#bbb;color:#fff!important;text-decoration:none!important;font-weight:normal;font-size:12px;color:#555;-webkit-border-top-right-radius:4px;-webkit-border-top-left-radius:4px;-moz-border-radius-topright:4px;-moz-border-radius-topleft:4px;}#querylist ul.debug-menu-links li.current a{background:#fff;color:#555!important;}#querylist h2{float:left;min-width:150px;border:1px solid #eee;padding:5px 10px 15px;clear:none;important;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;}#object-cache-stats ul.debug-menu-links{padding:0;margin:0;background:none;}#object-cache-stats ul.debug-menu-links li{float:left;margin-bottom:10px!important;background:none!important;border:1px solid #eee!important;color:#555!important;}#object-cache-stats ul.debug-menu-links li.current a{background:#ccc!important;color:#fff!important;-webkit-border-top-right-radius:0;-webkit-border-top-left-radius:0;-moz-border-radius-topright:0;-moz-border-radius-topleft:0;}#object-cache-stats ul.debug-menu-links li a{background:none;color:#555!important;overflow:hidden;}#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;}#querylist .debug-menu-target{display:none;}#querylist ol{font:12px Monaco,"Courier New",Courier,Fixed!important;line-height:180%!important;}#wpadminbar #admin-bar-micro ul li{list-style-type:none;position:relative;margin:0;padding:0;}#wpadminbar #admin-bar-micro ul ul,#wpadminbar #admin-bar-micro #awaiting-mod,#wpadminbar .ab-sadmin .count-0{display:none!important;}#wpadminbar #admin-bar-micro ul li:hover>ul{display:block;position:absolute;top:-1px;left:100%;}#wpadminbar #admin-bar-micro li a{display:block;text-decoration:none;}#wpadminbar #admin-bar-micro li li a{background:#ddd;}#wpadminbar #admin-bar-micro li li li a{background:#fff;}
|
debug-bar.dev.css
ADDED
@@ -0,0 +1,222 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Super admin styling
|
3 |
+
*/
|
4 |
+
#querylist {
|
5 |
+
font-family: Arial, Tahoma, sans-serif;
|
6 |
+
display: none;
|
7 |
+
position: absolute;
|
8 |
+
top: 50px;
|
9 |
+
left: 50px;
|
10 |
+
right: 50px;
|
11 |
+
background: #fff;
|
12 |
+
padding: 20px;
|
13 |
+
-moz-box-shadow: 0 0 15px #888;
|
14 |
+
-webkit-box-shadow: 0 0 15px #888;
|
15 |
+
box-shadow: 0 0 15px #888;
|
16 |
+
z-index: 99999;
|
17 |
+
border: 10px solid #f0f0f0;
|
18 |
+
color: #000;
|
19 |
+
line-height: 150% !important;
|
20 |
+
}
|
21 |
+
#querylist pre {
|
22 |
+
font-size: 12px;
|
23 |
+
padding: 10px;
|
24 |
+
}
|
25 |
+
|
26 |
+
#querylist h1 {
|
27 |
+
font-family: georgia, times, serif;
|
28 |
+
text-align: center;
|
29 |
+
font-size: 24px;
|
30 |
+
padding: 20px 5px;
|
31 |
+
background: #eee;
|
32 |
+
color: #555;
|
33 |
+
margin: 0;
|
34 |
+
}
|
35 |
+
#querylist div#debug-status {
|
36 |
+
background: #ccc;
|
37 |
+
color: #fff;
|
38 |
+
overflow: hidden;
|
39 |
+
height: 21px;
|
40 |
+
font-size: 14px;
|
41 |
+
font-family: georgia, times, serif;
|
42 |
+
padding: 7px 15px;
|
43 |
+
}
|
44 |
+
#querylist .left {
|
45 |
+
float: left;
|
46 |
+
}
|
47 |
+
#querylist .right {
|
48 |
+
float: right;
|
49 |
+
}
|
50 |
+
|
51 |
+
#querylist h1, #querylist h2, #querylist h3 {
|
52 |
+
font-weight: normal;
|
53 |
+
}
|
54 |
+
|
55 |
+
#querylist ul.debug-menu-links {
|
56 |
+
clear: left;
|
57 |
+
background: #ccc;
|
58 |
+
padding: 10px 15px 0;
|
59 |
+
overflow: hidden;
|
60 |
+
list-style: none;
|
61 |
+
margin: 0;
|
62 |
+
padding: 0 0 0 15px;
|
63 |
+
}
|
64 |
+
#querylist ul.debug-menu-links li {
|
65 |
+
float: left;
|
66 |
+
margin-right: 10px;
|
67 |
+
margin-bottom: 0 !important;
|
68 |
+
}
|
69 |
+
|
70 |
+
#querylist ul.debug-menu-links li a {
|
71 |
+
outline: none;
|
72 |
+
display: block;
|
73 |
+
padding: 5px 9px;
|
74 |
+
margin-right: 0;
|
75 |
+
background: #bbb;
|
76 |
+
color: #fff !important;
|
77 |
+
text-decoration: none !important;
|
78 |
+
font-weight: normal;
|
79 |
+
font-size: 12px;
|
80 |
+
color: #555;
|
81 |
+
-webkit-border-top-right-radius: 4px;
|
82 |
+
-webkit-border-top-left-radius: 4px;
|
83 |
+
-moz-border-radius-topright: 4px;
|
84 |
+
-moz-border-radius-topleft: 4px;
|
85 |
+
}
|
86 |
+
#querylist ul.debug-menu-links li.current a {
|
87 |
+
background: #fff;
|
88 |
+
color: #555 !important;
|
89 |
+
}
|
90 |
+
|
91 |
+
#querylist h2 {
|
92 |
+
float: left;
|
93 |
+
min-width: 150px;
|
94 |
+
border: 1px solid #eee;
|
95 |
+
padding: 5px 10px 15px;
|
96 |
+
clear: none;
|
97 |
+
important;
|
98 |
+
text-align: center;
|
99 |
+
font-family: georgia, times, serif;
|
100 |
+
font-size: 28px;
|
101 |
+
margin: 15px 10px 15px 0 !important;
|
102 |
+
}
|
103 |
+
#querylist h2 span {
|
104 |
+
font-size: 12px;
|
105 |
+
color: #888;
|
106 |
+
text-transform: uppercase;
|
107 |
+
white-space: nowrap;
|
108 |
+
display: block;
|
109 |
+
margin-bottom: 5px;
|
110 |
+
}
|
111 |
+
|
112 |
+
#object-cache-stats h2 {
|
113 |
+
border: none;
|
114 |
+
float: none;
|
115 |
+
text-align: left;
|
116 |
+
font-size: 22px;
|
117 |
+
margin-bottom: 0;
|
118 |
+
}
|
119 |
+
|
120 |
+
#object-cache-stats ul.debug-menu-links {
|
121 |
+
padding: 0;
|
122 |
+
margin: 0;
|
123 |
+
background: none;
|
124 |
+
}
|
125 |
+
#object-cache-stats ul.debug-menu-links li {
|
126 |
+
float: left;
|
127 |
+
margin-bottom: 10px !important;
|
128 |
+
background: none !important;
|
129 |
+
border: 1px solid #eee !important;
|
130 |
+
color: #555 !important;
|
131 |
+
}
|
132 |
+
#object-cache-stats ul.debug-menu-links li.current a {
|
133 |
+
background: #ccc !important;
|
134 |
+
color: #fff !important;
|
135 |
+
-webkit-border-top-right-radius: 0;
|
136 |
+
-webkit-border-top-left-radius: 0;
|
137 |
+
-moz-border-radius-topright: 0;
|
138 |
+
-moz-border-radius-topleft: 0;
|
139 |
+
}
|
140 |
+
|
141 |
+
#object-cache-stats ul.debug-menu-links li a {
|
142 |
+
background: none;
|
143 |
+
color: #555 !important;
|
144 |
+
overflow: hidden;
|
145 |
+
}
|
146 |
+
|
147 |
+
#querylist h3 {
|
148 |
+
margin-bottom: 15px;
|
149 |
+
}
|
150 |
+
|
151 |
+
#querylist ol#wpd-queries {
|
152 |
+
padding: 0 !important;
|
153 |
+
margin: 0 !important;
|
154 |
+
list-style: none;
|
155 |
+
clear: left;
|
156 |
+
}
|
157 |
+
#querylist ol#wpd-queries li {
|
158 |
+
padding: 10px;
|
159 |
+
background: #f0f0f0;
|
160 |
+
margin: 0 0 10px 0;
|
161 |
+
}
|
162 |
+
#querylist ol#wpd-queries li div.qdebug {
|
163 |
+
background: #e8e8e8;
|
164 |
+
margin: 10px -10px -10px -10px;
|
165 |
+
padding: 5px 150px 5px 5px;
|
166 |
+
font-size: 11px;
|
167 |
+
position: relative;
|
168 |
+
min-height: 20px;
|
169 |
+
}
|
170 |
+
|
171 |
+
#querylist ol#wpd-queries li div.qdebug span {
|
172 |
+
position: absolute;
|
173 |
+
right: 10px;
|
174 |
+
top: 5px;
|
175 |
+
white-space: nowrap;
|
176 |
+
}
|
177 |
+
|
178 |
+
#querylist a {
|
179 |
+
text-decoration: underline !important;
|
180 |
+
color: blue !important;
|
181 |
+
}
|
182 |
+
#querylist a:hover {
|
183 |
+
text-decoration: none !important;
|
184 |
+
}
|
185 |
+
#querylist .debug-menu-target {
|
186 |
+
display: none;
|
187 |
+
}
|
188 |
+
|
189 |
+
#querylist ol {
|
190 |
+
font: 12px Monaco, "Courier New", Courier, Fixed !important;
|
191 |
+
line-height: 180% !important;
|
192 |
+
}
|
193 |
+
|
194 |
+
#wpadminbar #admin-bar-micro ul li {
|
195 |
+
list-style-type: none;
|
196 |
+
position: relative;
|
197 |
+
margin: 0;
|
198 |
+
padding: 0;
|
199 |
+
}
|
200 |
+
#wpadminbar #admin-bar-micro ul ul, #wpadminbar #admin-bar-micro #awaiting-mod, #wpadminbar .ab-sadmin .count-0 {
|
201 |
+
display: none !important;
|
202 |
+
}
|
203 |
+
#wpadminbar #admin-bar-micro ul li:hover > ul {
|
204 |
+
display: block;
|
205 |
+
position: absolute;
|
206 |
+
top: -1px;
|
207 |
+
left: 100%;
|
208 |
+
}
|
209 |
+
#wpadminbar #admin-bar-micro li a {
|
210 |
+
display: block;
|
211 |
+
text-decoration: none;
|
212 |
+
}
|
213 |
+
#wpadminbar #admin-bar-micro li li a {
|
214 |
+
background: #ddd;
|
215 |
+
}
|
216 |
+
#wpadminbar #admin-bar-micro li li li a {
|
217 |
+
background: #fff;
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* End super admin styling
|
222 |
+
*/
|
debug-bar.php
ADDED
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Debug Bar
|
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.1
|
8 |
+
Author URI: http://wordpress.org/
|
9 |
+
*/
|
10 |
+
|
11 |
+
/***
|
12 |
+
* Debug Functions
|
13 |
+
*
|
14 |
+
* When logged in as a super admin, these functions will run to provide
|
15 |
+
* debugging information when specific super admin menu items are selected.
|
16 |
+
*
|
17 |
+
* They are not used when a regular user is logged in.
|
18 |
+
*/
|
19 |
+
|
20 |
+
function debug_bar_menu() {
|
21 |
+
global $wp_admin_bar, $wpdb;
|
22 |
+
|
23 |
+
if ( ! is_super_admin() || ! is_admin_bar_showing() )
|
24 |
+
return;
|
25 |
+
|
26 |
+
$wp_admin_bar->add_menu( array( 'id' => 'queries', 'title' => __('Debug'), 'href' => 'javascript:toggle_query_list()', 'meta' => array( 'class' => 'ab-sadmin' ) ) );
|
27 |
+
}
|
28 |
+
add_action( 'wp_before_admin_bar_render', 'debug_bar_menu', 1000 );
|
29 |
+
|
30 |
+
function debug_bar_menu_init() {
|
31 |
+
if ( ! is_super_admin() || ! is_admin_bar_showing() )
|
32 |
+
return;
|
33 |
+
wp_enqueue_style( 'admin-bar-debug', WP_PLUGIN_URL . '/debug-bar/debug-bar.css', array(), '20101103' );
|
34 |
+
}
|
35 |
+
add_action('admin_bar_init', 'debug_bar_menu_init');
|
36 |
+
|
37 |
+
function debug_bar_list() {
|
38 |
+
global $wpdb, $wp_object_cache;
|
39 |
+
|
40 |
+
if ( ! is_super_admin() || ! is_admin_bar_showing() )
|
41 |
+
return;
|
42 |
+
|
43 |
+
$debugs = array();
|
44 |
+
|
45 |
+
if ( defined('SAVEQUERIES') && SAVEQUERIES )
|
46 |
+
$debugs['wpdb'] = array( __('Queries'), 'debug_bar_queries' );
|
47 |
+
|
48 |
+
if ( is_object($wp_object_cache) && method_exists($wp_object_cache, 'stats') )
|
49 |
+
$debugs['object-cache'] = array( __('Object Cache'), 'debug_bar_object_cache' );
|
50 |
+
|
51 |
+
$debugs = apply_filters( 'debug_bar_list', $debugs );
|
52 |
+
|
53 |
+
if ( empty($debugs) )
|
54 |
+
return;
|
55 |
+
|
56 |
+
?>
|
57 |
+
<script type="text/javascript">
|
58 |
+
/* <![CDATA[ */
|
59 |
+
var toggle_query_list = function() {
|
60 |
+
var querylist = document.getElementById( 'querylist' );
|
61 |
+
if( querylist && querylist.style.display == 'block' ) {
|
62 |
+
querylist.style.display='none';
|
63 |
+
} else {
|
64 |
+
querylist.style.display='block';
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
var clickDebugLink = function( targetsGroupId, obj) {
|
69 |
+
var sectionDivs = document.getElementById( targetsGroupId ).childNodes;
|
70 |
+
for ( var i = 0; i < sectionDivs.length; i++ ) {
|
71 |
+
if ( 1 != sectionDivs[i].nodeType ) {
|
72 |
+
continue;
|
73 |
+
}
|
74 |
+
sectionDivs[i].style.display = 'none';
|
75 |
+
}
|
76 |
+
document.getElementById( obj.href.substr( obj.href.indexOf( '#' ) + 1 ) ).style.display = 'block';
|
77 |
+
|
78 |
+
for ( var i = 0; i < obj.parentNode.parentNode.childNodes.length; i++ ) {
|
79 |
+
if ( 1 != obj.parentNode.parentNode.childNodes[i].nodeType ) {
|
80 |
+
continue;
|
81 |
+
}
|
82 |
+
obj.parentNode.parentNode.childNodes[i].removeAttribute( 'class' );
|
83 |
+
}
|
84 |
+
obj.parentNode.setAttribute( 'class', 'current' );
|
85 |
+
return false;
|
86 |
+
};
|
87 |
+
/* ]]> */
|
88 |
+
</script>
|
89 |
+
<div align='left' id='querylist'>
|
90 |
+
|
91 |
+
<h1>Debugging blog #<?php echo $GLOBALS['blog_id']; ?> on <?php echo php_uname( 'n' ); ?></h1>
|
92 |
+
<div id="debug-status">
|
93 |
+
<p class="left"></p>
|
94 |
+
<p class="right">PHP Version: <?php echo phpversion(); ?></p>
|
95 |
+
</div>
|
96 |
+
<ul class="debug-menu-links">
|
97 |
+
|
98 |
+
<?php $current = ' class="current"'; foreach ( $debugs as $debug => $debug_output ) : ?>
|
99 |
+
|
100 |
+
<li<?php echo $current; ?>><a id="debug-menu-link-<?php echo $debug; ?>" href="#debug-menu-target-<?php echo $debug; ?>" onclick="try { return clickDebugLink( 'debug-menu-targets', this ); } catch (e) { return true; }"><?php echo $debug_output[0] ?></a></li>
|
101 |
+
|
102 |
+
<?php $current = ''; endforeach; ?>
|
103 |
+
|
104 |
+
</ul>
|
105 |
+
|
106 |
+
<div id="debug-menu-targets">
|
107 |
+
|
108 |
+
<?php $current = ' style="display: block"'; foreach ( $debugs as $debug => $debug_output ) : ?>
|
109 |
+
|
110 |
+
<div id="debug-menu-target-<?php echo $debug; ?>" class="debug-menu-target"<?php echo $current; ?>>
|
111 |
+
<?php echo str_replace( ' ', '', call_user_func( $debug_output[1] ) ); ?>
|
112 |
+
</div>
|
113 |
+
|
114 |
+
<?php $current = ''; endforeach; ?>
|
115 |
+
|
116 |
+
</div>
|
117 |
+
|
118 |
+
<?php do_action( 'debug_bar' ); ?>
|
119 |
+
|
120 |
+
</div>
|
121 |
+
|
122 |
+
<?php
|
123 |
+
}
|
124 |
+
add_action( 'wp_after_admin_bar_render', 'debug_bar_list' );
|
125 |
+
|
126 |
+
function debug_bar_queries() {
|
127 |
+
global $wpdb;
|
128 |
+
|
129 |
+
$queries = array();
|
130 |
+
$out = '';
|
131 |
+
$total_time = 0;
|
132 |
+
|
133 |
+
if ( !empty($wpdb->queries) ) {
|
134 |
+
$show_many = isset($_GET['debug_queries']);
|
135 |
+
|
136 |
+
if ( $wpdb->num_queries > 500 && !$show_many )
|
137 |
+
$out .= "<p>There are too many queries to show easily! <a href='" . add_query_arg( 'debug_queries', 'true' ) . "'>Show them anyway</a>.</p>";
|
138 |
+
|
139 |
+
$out .= '<ol id="wpd-queries">';
|
140 |
+
$first_query = 0;
|
141 |
+
$counter = 0;
|
142 |
+
|
143 |
+
foreach ( $wpdb->queries as $q ) {
|
144 |
+
list($query, $elapsed, $debug) = $q;
|
145 |
+
|
146 |
+
$total_time += $elapsed;
|
147 |
+
|
148 |
+
if ( !$show_many && ++$counter > 500 )
|
149 |
+
continue;
|
150 |
+
|
151 |
+
$query = nl2br(esc_html($query));
|
152 |
+
|
153 |
+
// $dbhname, $host, $port, $name, $tcp, $elapsed
|
154 |
+
$out .= "<li>$query<br/><div class='qdebug'>$debug <span>#{$counter} (" . number_format(sprintf('%0.1f', $elapsed * 1000), 1, '.', ',') . "ms)</span></div></li>\n";
|
155 |
+
}
|
156 |
+
$out .= '</ol>';
|
157 |
+
} else {
|
158 |
+
$out .= "<p><strong>There are no queries on this page, you won the prize!!! :)</strong></p>";
|
159 |
+
}
|
160 |
+
|
161 |
+
$query_count = '<h2><span>Total Queries:</span>' . number_format( $wpdb->num_queries ) . "</h2>\n";
|
162 |
+
$query_time = '<h2><span>Total query time:</span>' . number_format(sprintf('%0.1f', $total_time * 1000), 1) . "ms</h2>\n";
|
163 |
+
$memory_usage = '<h2><span>Peak Memory Used:</span>' . number_format( memory_get_peak_usage( ) ) . " bytes</h2>\n";
|
164 |
+
|
165 |
+
$out = $query_count . $query_time . $memory_usage . $out;
|
166 |
+
|
167 |
+
return $out;
|
168 |
+
}
|
169 |
+
|
170 |
+
function debug_bar_object_cache() {
|
171 |
+
global $wp_object_cache;
|
172 |
+
ob_start();
|
173 |
+
echo "<div id='object-cache-stats'>";
|
174 |
+
$wp_object_cache->stats();
|
175 |
+
echo "</div>";
|
176 |
+
$out = ob_get_contents();
|
177 |
+
ob_end_clean();
|
178 |
+
|
179 |
+
return $out;
|
180 |
+
}
|
181 |
+
|
182 |
+
?>
|
readme.txt
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Debug Bar ===
|
2 |
+
Contributors: wordpressdotorg, ryan
|
3 |
+
Tags: debug
|
4 |
+
Tested up to: 3.1
|
5 |
+
Stable tag: 0.1
|
6 |
+
Requires at least: 3.1
|
7 |
+
|
8 |
+
Adds a debug menu to the admin bar that shows query, cache, and other helpful debugging information.
|
9 |
+
|
10 |
+
== Description ==
|
11 |
+
|
12 |
+
Adds a debug menu to the admin bar that shows query, cache, and other helpful debugging information.
|
13 |
+
|
14 |
+
== Upgrade Notice ==
|
15 |
+
|
16 |
+
= 0.1 =
|
17 |
+
Initial Release
|
18 |
+
|
19 |
+
== Changelog ==
|
20 |
+
|
21 |
+
= 0.1 =
|
22 |
+
Initial Release
|
23 |
+
|
24 |
+
== Installation ==
|
25 |
+
|
26 |
+
Use automatic installer.
|