예제 #1
1
<?php

global $wpdb;
$bb = BlackBox::getInstance();
$time = number_format($bb->getProfiler()->totalTime() * 1000, 2);
$sqlC = count($wpdb->queries);
$sqlT = 0;
foreach ($wpdb->queries as $q) {
    $sqlT += $q[1];
}
$err = count($bb->getErrors());
$errI = 0;
foreach ($bb->getErrors() as $error) {
    if ($error['errno'] == E_WARNING) {
        $errI++;
    }
}
?>

<div id="blackbox-web-debug">
&nbsp;
<a href="javascript:WpDebugBar.switchPanel('globals')" class="globals">Globals</a>
<a href="javascript:WpDebugBar.switchPanel('profiler')" class="profiler">Profiler (<?php 
echo $time;
?>
 ms)</a>
<a href="javascript:WpDebugBar.switchPanel('database')" class="database">SQL (<span class="qnum"><?php 
echo $sqlC;
?>
</span> queries in <span class="qtime"><?php 
echo number_format($sqlT * 1000, 2);
예제 #2
0
파일: Hook.php 프로젝트: donwea/nhap.org
 public static function profiler()
 {
     if (func_get_arg(0) != BlackBox::DEBUG) {
         return;
     }
     BlackBox::getInstance()->getProfiler()->trace(func_get_arg(1));
 }
예제 #3
0
 /**
  * Retuns BlackBox instance.
  *
  * Note. There can be only one instance of BlackBox object.
  *
  * @return BlackBox
  */
 public static function getInstance()
 {
     if (self::$_instance === null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
예제 #4
0
파일: index.php 프로젝트: donwea/nhap.org
<?php

/*
Plugin Name: BlackBox
Plugin URI: http://ditio.net/
Description: BlackBox is designed for WordPress plugin and theme developers, it uses unobstrusive box that contatins useful informatiom (executed queries, global variables, notices, warnings and profiler). BlackBox should be used in development environment only
Author: Grzegorz Winiarski
Version: 0.1.3
Author URI: http://ditio.net/
*/
if (!defined("SAVEQUERIES")) {
    define("SAVEQUERIES", 1);
}
define("BLACKBOX_DIR", dirname(__FILE__));
require_once BLACKBOX_DIR . "/application/BlackBox.php";
require_once BLACKBOX_DIR . "/application/BlackBox/Profiler.php";
require_once BLACKBOX_DIR . "/application/BlackBox/Hook.php";
require_once BLACKBOX_DIR . "/application/BlackBox/Exception.php";
BlackBox::init();