示例#1
0
 /**
  * Register autoloader.
  * @return void
  */
 public function register()
 {
     $cache = $this->getCache();
     $key = $this->getKey();
     if (isset($cache[$key])) {
         $this->list = $cache[$key];
     } else {
         $this->rebuild();
     }
     if (isset($this->list[strtolower(__CLASS__)]) && class_exists('Nette\\Loaders\\NetteLoader', FALSE)) {
         NetteLoader::getInstance()->unregister();
     }
     parent::register();
 }
 * Copyright (c) 2008 Filip Procházka (filip@prochazka.su)
 *
 * For the full copyright and license information, please view the file license.txt that was distributed with this source code.
 */
namespace Kdyby\Replicator\DI;

use Kdyby;
use Nette;
use Nette\PhpGenerator as Code;
if (!class_exists('Nette\\DI\\CompilerExtension')) {
    class_alias('Nette\\Config\\CompilerExtension', 'Nette\\DI\\CompilerExtension');
    class_alias('Nette\\Config\\Compiler', 'Nette\\DI\\Compiler');
    class_alias('Nette\\Config\\Helpers', 'Nette\\DI\\Config\\Helpers');
}
if (isset(Nette\Loaders\NetteLoader::getInstance()->renamed['Nette\\Configurator']) || !class_exists('Nette\\Configurator')) {
    unset(Nette\Loaders\NetteLoader::getInstance()->renamed['Nette\\Configurator']);
    // f**k you
    class_alias('Nette\\Config\\Configurator', 'Nette\\Configurator');
}
/**
 * @author Filip Procházka <*****@*****.**>
 */
class ReplicatorExtension extends Nette\DI\CompilerExtension
{
    public function afterCompile(Code\ClassType $class)
    {
        parent::afterCompile($class);
        $init = $class->methods['initialize'];
        $init->addBody('Kdyby\\Replicator\\Container::register();');
    }
    /**
示例#3
0
<?php

/**
 * This file is part of the Kdyby (http://www.kdyby.org)
 *
 * Copyright (c) 2008 Filip Procházka (filip@prochazka.su)
 *
 * For the full copyright and license information, please view the file license.txt that was distributed with this source code.
 */
namespace App;

use Nette;
use WebLoader;
if (isset(Nette\Loaders\NetteLoader::getInstance()->renamed['Nette\\Config\\CompilerExtension']) || !class_exists('Nette\\DI\\CompilerExtension')) {
    unset(Nette\Loaders\NetteLoader::getInstance()->renamed['Nette\\Config\\CompilerExtension']);
    class_alias('Nette\\DI\\CompilerExtension', 'Nette\\Config\\CompilerExtension');
}
class WebloaderExtension extends WebLoader\Nette\Extension
{
}