Пример #1
0
<?php

DebugBarAutoload::init();
class DebugBarAutoload
{
    protected static $classes = array();
    public static function addClass($class, $path)
    {
        static::$classes[$class] = $path;
    }
    public static function init()
    {
        static::$classes = array('DebugBar' => DEBUGBAR_PATH . 'lib' . DIRECTORY_SEPARATOR . 'DebugBar.php', 'DebugPanel' => DEBUGBAR_PATH . 'lib' . DIRECTORY_SEPARATOR . 'DebugPanel.php', 'ApcPanel' => DEBUGBAR_PATH . 'lib' . DIRECTORY_SEPARATOR . 'panels' . DIRECTORY_SEPARATOR . 'ApcPanel.php', 'HttpRequestPanel' => DEBUGBAR_PATH . 'lib' . DIRECTORY_SEPARATOR . 'panels' . DIRECTORY_SEPARATOR . 'HttpRequestPanel.php', 'MemcachedPanel' => DEBUGBAR_PATH . 'lib' . DIRECTORY_SEPARATOR . 'panels' . DIRECTORY_SEPARATOR . 'MemcachedPanel.php', 'PhpInfoPanel' => DEBUGBAR_PATH . 'lib' . DIRECTORY_SEPARATOR . 'panels' . DIRECTORY_SEPARATOR . 'PhpInfoPanel.php', 'ResourcesPanel' => DEBUGBAR_PATH . 'lib' . DIRECTORY_SEPARATOR . 'panels' . DIRECTORY_SEPARATOR . 'ResourcesPanel.php', 'SqlPanel' => DEBUGBAR_PATH . 'lib' . DIRECTORY_SEPARATOR . 'panels' . DIRECTORY_SEPARATOR . 'SqlPanel.php');
    }
    public static function load($class)
    {
        if (isset(static::$classes[$class])) {
            require static::$classes[$class];
            return true;
        }
        return false;
    }
}
Пример #2
0
<?php

define('DEBUGBAR_PATH', __DIR__ . DIRECTORY_SEPARATOR);
require_once DEBUGBAR_PATH . 'lib' . DIRECTORY_SEPARATOR . 'DebugBarAutoload.php';
spl_autoload_register('DebugBarAutoload::load', true, true);
DebugBarAutoload::load('DebugBar');