Esempio n. 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, '/');
     }
 }