コード例 #1
0
 /**
  * Load the extensions for the application
  *
  * WARNING: When using extensions, you MUST be careful not to name
  * one using the same name as one of the controllers. If you do, 
  * ZF will think you're trying to use modules... heh heh heh
  * 
  */
 protected function loadExtensions()
 {
     $this->extensions = array();
     $extDir = ifset($this->config, 'extensions_dir', APP_DIR . '/extensions');
     if (!is_dir($extDir)) {
         return;
     }
     $dir = new DirectoryIterator($extDir);
     foreach ($dir as $value) {
         $dirname = $value->__toString();
         if ($dirname == '.' || $dirname == '..') {
             continue;
         }
         if (!is_dir($extDir . DIRECTORY_SEPARATOR . $dirname)) {
             continue;
         }
         $base = $extDir . DIRECTORY_SEPARATOR . $dirname . DIRECTORY_SEPARATOR;
         if (is_dir($base . 'services')) {
             $this->injector->addServiceDirectory($base . 'services');
         }
         if (is_dir($base . 'controllers')) {
             // We add the 'ext' so that we don't clash with the module routing
             $this->frontController->addControllerDirectory($base . 'controllers', 'ext-' . $dirname);
         }
         if (is_dir($base . 'views')) {
             $view = Zend_Registry::get(self::$ZEND_VIEW);
             /* @var $view CompositeView */
             $view->addScriptPath($base . 'views');
         }
         // add the extension
         $this->extensions[$dirname] = rtrim($base, '/');
     }
 }
コード例 #2
0
ファイル: Bootstrapper.php プロジェクト: Cryde/sydney-core
 /**
  * Add modules
  */
 public function initCustomModules()
 {
     if (count($this->customModules) > 0) {
         $this->frontController->addModuleDirectory(Sydney_Tools_Paths::getCustomapPath() . '/modules');
         foreach ($this->customModules as $module => $role) {
             $this->frontController->addControllerDirectory(Sydney_Tools_Paths::getCustomapPath() . '/modules/' . $module . '/controllers', $module);
         }
     }
 }
コード例 #3
0
ファイル: Bootstrap.php プロジェクト: rocknoon/Stack
 protected function _initControllers()
 {
     $this->_front->addControllerDirectory(APPLICATION_PATH . '/admin/controllers', 'admin');
 }
コード例 #4
0
ファイル: Initializer.php プロジェクト: ajbrown/bitnotion
 /**
  * Initialize Controller paths
  *
  * @return void
  */
 public function initControllers()
 {
     $this->_front->addControllerDirectory($this->_root . '/application/default/controllers', 'default');
     $this->_front->addControllerDirectory($this->_root . '/application/dashboard/controllers', 'dashboard');
     $this->_front->addControllerDirectory($this->_root . '/application/data/controllers', 'data');
 }
コード例 #5
0
 /**
  * Loads and initializes zendfox module system
  *
  * @param Zend_Controller_Front $front
  * @return array 
  */
 private static function loadNamespacesAndModules(Zend_Controller_Front $front, $bootS)
 {
     if (null == self::$modules) {
         self::$modules = array();
         $loader = Zend_Loader_Autoloader::getInstance();
         if ((self::$modules = self::$cache->load('fox_modules')) === false) {
             $dbConf = $bootS->db->getConfig();
             if (self::$modeRun) {
                 $mData = self::$dbAdapter->fetchAll("SELECT * FROM {$dbConf['prefix']}core_module");
                 foreach ($mData as $mInfo) {
                     $name = trim($mInfo['name']);
                     $enabled = trim($mInfo['status']);
                     $package = trim($mInfo['package']);
                     $nameSpc = trim($mInfo['namespace']);
                     if ($name != '' && $enabled == 1 && $package != '' && $nameSpc != '') {
                         $moduleDir = APPLICATION_PATH . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR . $nameSpc . DIRECTORY_SEPARATOR . $name;
                         self::$modules[$name]['path'] = $moduleDir;
                         self::$modules[$name]['namespace'] = $nameSpc;
                     }
                 }
                 //Caching module info
                 self::$cache->save(self::$modules, 'fox_modules');
             } else {
                 //      ********Reading Module info from XML files**********************/
                 $doc = new DOMDocument();
                 if (is_dir(MODULE_CONFIG_DIR)) {
                     $dp = opendir(MODULE_CONFIG_DIR);
                     while ($file = readdir($dp)) {
                         if (!($file == '.' || $file == '..')) {
                             $fPath = MODULE_CONFIG_DIR . DIRECTORY_SEPARATOR . $file;
                             if (is_readable($fPath) && is_file($fPath)) {
                                 $doc->load($fPath);
                                 if ($doc->documentElement->childNodes) {
                                     $nList = $doc->documentElement->childNodes;
                                     foreach ($nList as $n) {
                                         if ($n->nodeName == 'module' && ($name = $n->getAttribute('name')) && ($enabled = $n->getAttribute('enabled') === 'true') && ($package = $n->getAttribute('package')) && ($nameSpc = $n->getAttribute('namespace'))) {
                                             if ($enabled) {
                                                 $moduleDir = APPLICATION_PATH . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR . $nameSpc . DIRECTORY_SEPARATOR . $name;
                                                 self::$modules[$name]['path'] = $moduleDir;
                                                 self::$modules[$name]['namespace'] = $nameSpc;
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
                 /*                     * ****End Reading module info from XML files************** */
             }
         }
         $ns = array();
         foreach (self::$modules as $name => $module) {
             $moduleDir = $module['path'];
             $nameSpc = $module['namespace'];
             if (!in_array($nameSpc, $ns)) {
                 $loader->registerNamespace($nameSpc . '_');
                 $ns[] = $nameSpc;
             }
             $front->addControllerDirectory($moduleDir . DIRECTORY_SEPARATOR . 'controllers', $name);
             //Translation loading
             if (NULL == self::$translator) {
                 self::$translator = new Zend_Translate(array('adapter' => 'csv', 'locale' => 'auto'));
                 Zend_Registry::set('translator', self::$translator);
                 //                                                self::$translator->setLocale(Zend_Registry::get('Zend_Locale'));
             }
             $langDir = $moduleDir . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR;
             if (file_exists($langDir)) {
                 self::$translator->addTranslation(array('content' => $langDir, 'scan' => Zend_Translate::LOCALE_FILENAME));
             }
         }
         unset($ns);
     }
 }
コード例 #6
0
ファイル: Pimcore.php プロジェクト: pdaniel-frk/pimcore
 /**
  * @static
  * @param \Zend_Controller_Front $front
  */
 public static function initControllerFront(\Zend_Controller_Front $front)
 {
     // disable build-in error handler
     $front->setParam('noErrorHandler', true);
     // for admin an other modules directly in the core
     $front->addModuleDirectory(PIMCORE_PATH . "/modules");
     // for plugins
     if (is_dir(PIMCORE_PLUGINS_PATH) && is_readable(PIMCORE_PLUGINS_PATH)) {
         $front->addModuleDirectory(PIMCORE_PLUGINS_PATH);
     }
     // for frontend (default: website)
     $front->addControllerDirectory(PIMCORE_WEBSITE_PATH . "/controllers", PIMCORE_FRONTEND_MODULE);
     $front->setDefaultModule(PIMCORE_FRONTEND_MODULE);
 }
コード例 #7
0
 /**
  * Initialize Controller paths 
  * 
  * @return void
  */
 public function initControllers()
 {
     $this->_front->addControllerDirectory($this->_root . '/application/default/controllers', 'default');
     $this->_front->addControllerDirectory($this->_root . '/application/user/controllers', 'user');
 }
コード例 #8
0
ファイル: Initializer.php プロジェクト: rdohms/ugDirectory
 /**
  * Initialize Controller paths
  *
  * @return void
  */
 public function initControllers()
 {
     $this->_front->addControllerDirectory($this->_root . '/application/default/controllers', 'default');
     $this->_front->addControllerDirectory($this->_root . '/application/admin/controllers', 'admin');
     $this->_front->addControllerDirectory($this->_root . '/application/cli/controllers', 'cli');
 }