Changeset 188343
- Timestamp:
- 12/31/2009 01:40:05 AM (16 years ago)
- File:
-
- 1 edited
-
wp-pear-debug/trunk/wp-pear-debug.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-pear-debug/trunk/wp-pear-debug.php
r150292 r188343 143 143 if($sDebug) 144 144 { 145 //Instruct wordpress to save queries 146 //Please do this in wp-config.php instead 147 define('SAVEQUERIES',true); 145 148 //register javascript 146 149 wp_register_script(self::WPD_JS, "".self::url()."/js/html_div.js"); … … 182 185 public static function show() 183 186 { 184 //Get current instance of debug class 185 $oDebug = self::get(); 186 //Display debug information 187 $oDebug->display(); 188 } 189 187 //Add query info before render 188 //This new method should gather most if not all the query info 189 self::_processQueries(); 190 //Render debug information 191 self::get()->display(); 192 193 } 194 195 //No longer used internally to add query information 196 //Still available as utility 190 197 //add database query to debug 191 198 public static function query($query) 192 199 { 193 //Get current instance of debug class 194 $oDebug = self::get(); 195 //Add sql query to debug output 196 $oDebug->query($query); 197 //Pass back out from wordpress filter 200 //Record query string 201 self::get()->query($query); 198 202 return $query; 203 } 204 205 //add all available query data to debug 206 private static function _processQueries() 207 { 208 foreach(self::getDB()->queries as $query) 209 { 210 self::get()->query('[ function: '.self::queryCaller($query[2]).' ] '.' [ '.self::toSeconds($query[1]).' secs ] '.$query[0]); 211 } 212 } 213 214 //May have to test for array result but doubtful 215 public static function queryCaller($callers) 216 { 217 $aCallers = explode(',',$callers); 218 return $aCallers[count($aCallers)-1]; 219 } 220 221 //Database data in millionseconds. Change to seconds before output to user. 222 public static function toSeconds($milli) 223 { 224 return $milli * 1000; 225 } 226 227 //don't ask...umm cause its pretty? 228 //This call provides a standard access method for the database 229 //May be a long way away but we might see the end of global wpdb 230 public static function getDB() 231 { 232 global $wpdb; 233 return $wpdb; 199 234 } 200 235 … … 247 282 public static function add($sVar) 248 283 { 249 $oDebug = self::get(); 250 $oDebug->add($sVar); 251 284 self::get()->add($sVar); 252 285 } 253 286 public static function dump($obj, $varName = '') 254 287 { 255 $oDebug = self::get(); 256 $oDebug->dump($obj, $varName); 257 288 self::get()->dump($obj, $varName); 258 289 } 259 290 public static function queryRel($sInfo) 260 291 { 261 $oDebug = self::get(); 262 $oDebug->queryRel($sInfo); 263 292 self::get()->queryRel($sInfo); 264 293 } 265 294 public static function error($sInfo) 266 { 267 $oDebug = self::get(); 268 $oDebug->error($sInfo); 269 295 { 296 self::get()->error($sInfo); 270 297 } 271 298 //shortcode entry point to debug … … 287 314 288 315 //Add in admin options with link under settings "Debugger" 316 //Indent this big mess? Thank wordpress for that...This should all be javascript 289 317 public static function admin() 290 318 {
Note: See TracChangeset
for help on using the changeset viewer.