import v1.1.0_beta1 | 2009-08-21

This commit is contained in:
2019-07-17 22:16:19 +02:00
parent 2c1152f0d3
commit 8dee6b1a10
2306 changed files with 251360 additions and 23428 deletions

View File

@ -101,8 +101,12 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
{
if (is_string($staticRegistryName) && !empty($staticRegistryName)) {
$this->_useStaticRegistry = $staticRegistryName;
self::$_staticPrefixToPaths[$staticRegistryName] = array();
self::$_staticLoadedPlugins[$staticRegistryName] = array();
if(!isset(self::$_staticPrefixToPaths[$staticRegistryName])) {
self::$_staticPrefixToPaths[$staticRegistryName] = array();
}
if(!isset(self::$_staticLoadedPlugins[$staticRegistryName])) {
self::$_staticLoadedPlugins[$staticRegistryName] = array();
}
}
foreach ($prefixToPaths as $prefix => $path) {
@ -118,6 +122,9 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
*/
protected function _formatPrefix($prefix)
{
if($prefix == "") {
return $prefix;
}
return rtrim($prefix, '_') . '_';
}
@ -332,10 +339,13 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
* Load a plugin via the name provided
*
* @param string $name
* @return string Class name of loaded class
* @param bool $throwExceptions Whether or not to throw exceptions if the
* class is not resolved
* @return string|false Class name of loaded class; false if $throwExceptions
* if false and no class found
* @throws Zend_Loader_Exception if class not found
*/
public function load($name)
public function load($name, $throwExceptions = true)
{
$name = $this->_formatName($name);
if ($this->isLoaded($name)) {
@ -378,6 +388,10 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
}
if (!$found) {
if (!$throwExceptions) {
return false;
}
$message = "Plugin by name '$name' was not found in the registry; used paths:";
foreach ($registry as $prefix => $paths) {
$message .= "\n$prefix: " . implode(PATH_SEPARATOR, $paths);