示例#1
0
 /**
  * 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 IfwPsn_Vendor_Zend_Form_Element
  * @see IfwPsn_Vendor_Zend_Form_Element::addPrefixPath
  */
 public function addPrefixPath($prefix, $path, $type = null)
 {
     $type = strtoupper($type);
     switch ($type) {
         case null:
             $loader = $this->getPluginLoader(self::CAPTCHA);
             $nsSeparator = false !== strpos($prefix, '\\') ? '\\' : '_';
             $cPrefix = rtrim($prefix, $nsSeparator) . $nsSeparator . '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
文件: File.php 项目: jasmun/Noco100
 /**
  * Add prefix path for plugin loader
  *
  * @param  string $prefix
  * @param  string $path
  * @param  string $type
  * @return IfwPsn_Vendor_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)) {
         $nsSeparator = false !== strpos($prefix, '\\') ? '\\' : '_';
         $pluginPrefix = rtrim($prefix, $nsSeparator) . $nsSeparator . 'Transfer' . $nsSeparator . '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;
 }