Example #1
0
 /**
  * Sets a new adapter
  *
  * @param  string  $adapter   Adapter to use
  * @param  boolean $direction OPTIONAL False means Download, true means upload
  * @param  array   $options   OPTIONAL Options to set for this adapter
  * @throws \Zend\File\Transfer\Exception
  */
 public function setAdapter($adapter, $direction = false, $options = array())
 {
     if (end\Loader::isReadable('Zend/File/Transfer/Adapter/' . ucfirst($adapter) . '.php')) {
         $adapter = 'Zend_File_Transfer_Adapter_' . ucfirst($adapter);
     }
     if (!class_exists($adapter)) {
         end\Loader::loadClass($adapter);
     }
     $direction = (int) $direction;
     $this->_adapter[$direction] = new $adapter($options);
     if (!$this->_adapter[$direction] instanceof Adapter\AbstractAdapter) {
         throw new Exception("Adapter " . $adapter . " does not extend Zend_File_Transfer_Adapter_Abstract");
     }
     return $this;
 }
Example #2
0
 /**
  * @param string $className
  */
 public function enableManifest($className)
 {
     end\Loader::loadClass($className);
     $reflClass = new \ReflectionClass($className);
     if (!in_array("Zend_Tool_Framework_Manifest_Interface", $reflClass->getInterfaceNames())) {
         throw new Framework\Exception("Given class is not a manifest.");
     }
     $this->_doEnable($className);
 }
Example #3
0
 /**
  * Retrieve default controller class
  *
  * Determines whether the default controller to use lies within the
  * requested module, or if the global default should be used.
  *
  * By default, will only use the module default unless that controller does
  * not exist; if this is the case, it falls back to the default controller
  * in the default module.
  *
  * @param \Zend\Controller\Request\AbstractRequest $request
  * @return string
  */
 public function getDefaultControllerClass(Request\AbstractRequest $request)
 {
     $controller = $this->getDefaultControllerName();
     $default = $this->formatControllerName($controller);
     $request->setControllerName($controller)->setActionName(null);
     $module = $request->getModuleName();
     $controllerDirs = $this->getControllerDirectory();
     $this->_curModule = $this->_defaultModule;
     $this->_curDirectory = $controllerDirs[$this->_defaultModule];
     if ($this->isValidModule($module)) {
         $found = false;
         if (class_exists($default, false)) {
             $found = true;
         } else {
             $moduleDir = $controllerDirs[$module];
             $fileSpec = $moduleDir . DIRECTORY_SEPARATOR . $this->classToFilename($default);
             if (end\Loader::isReadable($fileSpec)) {
                 $found = true;
                 $this->_curDirectory = $moduleDir;
             }
         }
         if ($found) {
             $request->setModuleName($module);
             $this->_curModule = $this->formatModuleName($module);
         }
     } else {
         $request->setModuleName($this->_defaultModule);
     }
     return $default;
 }