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->setPhpConfig();
$this->_load_files(); $this->_load_files();
$this->_load_active_record(); $this->_load_active_record();
$this->initPlugins();
$this->setDispatcher(); $this->setDispatcher();
$this->init(); $this->init();
$this->runInitializers(); $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() private function _load_controller()
{ {
$route = $this->dispatcher()->router()->route(); $route = $this->dispatcher()->router()->route();

View File

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