示例#1
0
文件: Captcha.php 项目: rexmac/zf2
 /**
  * Add prefix path for plugin loader for captcha adapters
  *
  * This method handles the captcha type, the rest is handled by
  * the parent
  * @param  string $prefix
  * @param  string $path
  * @param  string $type
  * @return \Zend\Form\Element
  * @see Zend_Form_Element::addPrefixPath
  */
 public function addPrefixPath($prefix, $path, $type = null)
 {
     $type = strtoupper($type);
     switch ($type) {
         case null:
             $loader = $this->getPluginLoader(self::CAPTCHA);
             $cPrefix = rtrim($prefix, '\\') . '\\Captcha';
             $cPath = rtrim($path, '/\\') . '/Captcha';
             $loader->addPrefixPath($cPrefix, $cPath);
             return parent::addPrefixPath($prefix, $path);
         case self::CAPTCHA:
             $loader = $this->getPluginLoader($type);
             $loader->addPrefixPath($prefix, $path);
             return $this;
         default:
             return parent::addPrefixPath($prefix, $path, $type);
     }
 }
示例#2
0
 /**
  * Add prefix path for plugin loader
  *
  * @param  string $prefix:
  * @param  string $path
  * @param  string $type
  * @return \Zend\Form\Element\File
  */
 public function addPrefixPath($prefix, $path, $type = null)
 {
     $type = strtoupper($type);
     if (!empty($type) && $type != self::TRANSFER_ADAPTER) {
         return parent::addPrefixPath($prefix, $path, $type);
     }
     if (empty($type)) {
         $pluginPrefix = rtrim($prefix, '\\') . '\\Transfer\\Adapter';
         $pluginPath = rtrim($path, DIRECTORY_SEPARATOR) . '/Transfer/Adapter/';
         $loader = $this->getPluginLoader(self::TRANSFER_ADAPTER);
         $loader->addPrefixPath($pluginPrefix, $pluginPath);
         return parent::addPrefixPath($prefix, $path, null);
     }
     $loader = $this->getPluginLoader($type);
     $loader->addPrefixPath($prefix, $path);
     return $this;
 }