added plugins support

This commit is contained in:
Parziphal 2013-10-02 01:42:08 -05:00
parent e0f47af18b
commit daec4cdf66
2 changed files with 15 additions and 3 deletions

View File

@ -99,6 +99,7 @@ class Base
$this->setPhpConfig();
$this->_load_files();
$this->_load_active_record();
$this->initPlugins();
$this->setDispatcher();
$this->init();
$this->runInitializers();
@ -199,6 +200,17 @@ class Base
{
}
private function initPlugins()
{
if ($this->config()->plugins) {
foreach ($this->config()->plugins->toArray() as $pluginName) {
$initClassName = $pluginName . '\Initializer';
$initializer = new $initClassName();
$initializer->initialize();
}
}
}
private function _load_controller()
{
$route = $this->dispatcher()->router()->route();

View File

@ -434,9 +434,9 @@ final class Rails
$autoloadFile = defined("COMPOSER_AUTOLOAD_FILE") ?
COMPOSER_AUTOLOAD_FILE :
Rails::path() . '/../../../autoload.php';
// self::$loader->setComposerAutoload(require $autoloadFile);
$loader = require $autoloadFile;
vpe($loader->getPrefixes());
self::$loader->setComposerAutoload(require $autoloadFile);
// $loader = require $autoloadFile;
// vpe($loader->getPrefixes());
spl_autoload_register([Rails::loader(), 'loadClass']);
set_exception_handler('Rails::exceptionHandler');