diff --git a/library/Zend/Form.php b/library/Zend/Form.php index 5e6544f..b7aa18a 100644 --- a/library/Zend/Form.php +++ b/library/Zend/Form.php @@ -495,12 +495,13 @@ class Zend_Form implements Iterator, Countable, Zend_Validate_Interface $loader->addPrefixPath($prefix, $path); return $this; case null: - $prefix = rtrim($prefix, '_'); + $nsSeparator = (false !== strpos($prefix, '\\'))?'\\':'_'; + $prefix = rtrim($prefix, $nsSeparator); $path = rtrim($path, DIRECTORY_SEPARATOR); foreach (array(self::DECORATOR, self::ELEMENT) as $type) { $cType = ucfirst(strtolower($type)); $pluginPath = $path . DIRECTORY_SEPARATOR . $cType . DIRECTORY_SEPARATOR; - $pluginPrefix = $prefix . '_' . $cType; + $pluginPrefix = $prefix . $nsSeparator . $cType; $loader = $this->getPluginLoader($type); $loader->addPrefixPath($pluginPrefix, $pluginPath); } diff --git a/library/Zend/Form/Element.php b/library/Zend/Form/Element.php index 42cf95b..4213d8a 100644 --- a/library/Zend/Form/Element.php +++ b/library/Zend/Form/Element.php @@ -1070,12 +1070,13 @@ class Zend_Form_Element implements Zend_Validate_Interface $loader->addPrefixPath($prefix, $path); return $this; case null: - $prefix = rtrim($prefix, '_'); + $nsSeparator = (false !== strpos($prefix, '\\'))?'\\':'_'; + $prefix = rtrim($prefix, $nsSeparator); $path = rtrim($path, DIRECTORY_SEPARATOR); foreach (array(self::DECORATOR, self::FILTER, self::VALIDATE) as $type) { $cType = ucfirst(strtolower($type)); $pluginPath = $path . DIRECTORY_SEPARATOR . $cType . DIRECTORY_SEPARATOR; - $pluginPrefix = $prefix . '_' . $cType; + $pluginPrefix = $prefix . $nsSeparator . $cType; $loader = $this->getPluginLoader($type); $loader->addPrefixPath($pluginPrefix, $pluginPath); } diff --git a/library/Zend/Form/Element/Captcha.php b/library/Zend/Form/Element/Captcha.php index 25ad94b..ecdb710 100644 --- a/library/Zend/Form/Element/Captcha.php +++ b/library/Zend/Form/Element/Captcha.php @@ -244,7 +244,8 @@ class Zend_Form_Element_Captcha extends Zend_Form_Element_Xhtml switch ($type) { case null: $loader = $this->getPluginLoader(self::CAPTCHA); - $cPrefix = rtrim($prefix, '_') . '_Captcha'; + $nsSeparator = (false !== strpos($prefix, '\\'))?'\\':'_'; + $cPrefix = rtrim($prefix, $nsSeparator) . $nsSeparator . 'Captcha'; $cPath = rtrim($path, '/\\') . '/Captcha'; $loader->addPrefixPath($cPrefix, $cPath); return parent::addPrefixPath($prefix, $path); diff --git a/library/Zend/Form/Element/File.php b/library/Zend/Form/Element/File.php index 7ef9421..3d0be60 100644 --- a/library/Zend/Form/Element/File.php +++ b/library/Zend/Form/Element/File.php @@ -150,7 +150,8 @@ class Zend_Form_Element_File extends Zend_Form_Element_Xhtml } if (empty($type)) { - $pluginPrefix = rtrim($prefix, '_') . '_Transfer_Adapter'; + $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); diff --git a/library/Zend/Loader/PluginLoader.php b/library/Zend/Loader/PluginLoader.php index f74ad9e..fceb838 100644 --- a/library/Zend/Loader/PluginLoader.php +++ b/library/Zend/Loader/PluginLoader.php @@ -127,12 +127,8 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface return $prefix; } - $last = strlen($prefix) - 1; - if ($prefix{$last} == '\\') { - return $prefix; - } - - return rtrim($prefix, '_') . '_'; + $nsSeparator = (false !== strpos($prefix, '\\'))?'\\':'_'; + return rtrim($prefix, $nsSeparator) . $nsSeparator; } /**