diff --git a/Rails/Application/Base.php b/Rails/Application/Base.php index bde8ab9..b714c48 100755 --- a/Rails/Application/Base.php +++ b/Rails/Application/Base.php @@ -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(); diff --git a/Rails/Rails.php b/Rails/Rails.php index 11ed839..250ae11 100755 --- a/Rails/Rails.php +++ b/Rails/Rails.php @@ -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');