protected function _initModules() { //$front = null; //$default = 'core'; //if( isset($this->getContainer()->frontcontroller) ) { $front = $this->getContainer()->frontcontroller; $default = $front->getDefaultModule(); //} $bootstraps = new ArrayObject(); // Prepare data $enabledModuleNames = Khcn_Api::_()->getDbtable('modules', 'default')->getEnabledModuleNames(); $baseDir = WEB_ROOT; //$baseUrl = preg_replace('/[\/]*index\.php[\/]*/', '/', $front->getBaseUrl()); foreach ($enabledModuleNames as $module) { $moduleInflected = Khcn_Api::inflect($module); $moduleDir = $baseDir . DIRECTORY_SEPARATOR . 'application' . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $moduleInflected; // Default module is already bootstrapped, but bootstrap others if (strtolower($module) === strtolower($default)) { continue; } $bootstrapClass = $moduleInflected . '_Bootstrap'; if (!class_exists($bootstrapClass, false)) { $bootstrapPath = $moduleDir . '/Bootstrap.php'; if (file_exists($bootstrapPath)) { include_once $bootstrapPath; if (!class_exists($bootstrapClass, false)) { throw new Zend_Application_Resource_Exception('Bootstrap file found for module "' . $module . '" but bootstrap class "' . $bootstrapClass . '" not found'); } } else { continue; } } $moduleBootstrap = new $bootstrapClass($this); $moduleBootstrap->bootstrap(); $bootstraps[$module] = $moduleBootstrap; } return $bootstraps; }