import v2.0.0.0_RC3 | 2012-07-01
https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
This commit is contained in:
@ -16,7 +16,7 @@
|
||||
* @package Zend_Loader
|
||||
* @subpackage Autoloader
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @version $Id: Autoloader.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Autoloader.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
@ -25,7 +25,7 @@ require_once 'Zend/Loader.php';
|
||||
|
||||
/**
|
||||
* Autoloader stack and namespace autoloader
|
||||
*
|
||||
*
|
||||
* @uses Zend_Loader_Autoloader
|
||||
* @package Zend_Loader
|
||||
* @subpackage Autoloader
|
||||
@ -77,9 +77,14 @@ class Zend_Loader_Autoloader
|
||||
*/
|
||||
protected $_suppressNotFoundWarnings = false;
|
||||
|
||||
/**
|
||||
* @var null|string
|
||||
*/
|
||||
protected $_zfPath;
|
||||
|
||||
/**
|
||||
* Retrieve singleton instance
|
||||
*
|
||||
*
|
||||
* @return Zend_Loader_Autoloader
|
||||
*/
|
||||
public static function getInstance()
|
||||
@ -92,7 +97,7 @@ class Zend_Loader_Autoloader
|
||||
|
||||
/**
|
||||
* Reset the singleton instance
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function resetInstance()
|
||||
@ -102,8 +107,8 @@ class Zend_Loader_Autoloader
|
||||
|
||||
/**
|
||||
* Autoload a class
|
||||
*
|
||||
* @param string $class
|
||||
*
|
||||
* @param string $class
|
||||
* @return bool
|
||||
*/
|
||||
public static function autoload($class)
|
||||
@ -133,7 +138,7 @@ class Zend_Loader_Autoloader
|
||||
|
||||
/**
|
||||
* Set the default autoloader implementation
|
||||
*
|
||||
*
|
||||
* @param string|array $callback PHP callback
|
||||
* @return void
|
||||
*/
|
||||
@ -149,7 +154,7 @@ class Zend_Loader_Autoloader
|
||||
|
||||
/**
|
||||
* Retrieve the default autoloader callback
|
||||
*
|
||||
*
|
||||
* @return string|array PHP Callback
|
||||
*/
|
||||
public function getDefaultAutoloader()
|
||||
@ -159,7 +164,7 @@ class Zend_Loader_Autoloader
|
||||
|
||||
/**
|
||||
* Set several autoloader callbacks at once
|
||||
*
|
||||
*
|
||||
* @param array $autoloaders Array of PHP callbacks (or Zend_Loader_Autoloader_Interface implementations) to act as autoloaders
|
||||
* @return Zend_Loader_Autoloader
|
||||
*/
|
||||
@ -171,7 +176,7 @@ class Zend_Loader_Autoloader
|
||||
|
||||
/**
|
||||
* Get attached autoloader implementations
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAutoloaders()
|
||||
@ -181,7 +186,7 @@ class Zend_Loader_Autoloader
|
||||
|
||||
/**
|
||||
* Return all autoloaders for a given namespace
|
||||
*
|
||||
*
|
||||
* @param string $namespace
|
||||
* @return array
|
||||
*/
|
||||
@ -196,8 +201,8 @@ class Zend_Loader_Autoloader
|
||||
|
||||
/**
|
||||
* Register a namespace to autoload
|
||||
*
|
||||
* @param string|array $namespace
|
||||
*
|
||||
* @param string|array $namespace
|
||||
* @return Zend_Loader_Autoloader
|
||||
*/
|
||||
public function registerNamespace($namespace)
|
||||
@ -218,8 +223,8 @@ class Zend_Loader_Autoloader
|
||||
|
||||
/**
|
||||
* Unload a registered autoload namespace
|
||||
*
|
||||
* @param string|array $namespace
|
||||
*
|
||||
* @param string|array $namespace
|
||||
* @return Zend_Loader_Autoloader
|
||||
*/
|
||||
public function unregisterNamespace($namespace)
|
||||
@ -240,7 +245,7 @@ class Zend_Loader_Autoloader
|
||||
|
||||
/**
|
||||
* Get a list of registered autoload namespaces
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getRegisteredNamespaces()
|
||||
@ -248,10 +253,36 @@ class Zend_Loader_Autoloader
|
||||
return array_keys($this->_namespaces);
|
||||
}
|
||||
|
||||
public function setZfPath($spec, $version = 'latest')
|
||||
{
|
||||
$path = $spec;
|
||||
if (is_array($spec)) {
|
||||
if (!isset($spec['path'])) {
|
||||
throw new Zend_Loader_Exception('No path specified for ZF');
|
||||
}
|
||||
$path = $spec['path'];
|
||||
if (isset($spec['version'])) {
|
||||
$version = $spec['version'];
|
||||
}
|
||||
}
|
||||
|
||||
$this->_zfPath = $this->_getVersionPath($path, $version);
|
||||
set_include_path(implode(PATH_SEPARATOR, array(
|
||||
$this->_zfPath,
|
||||
get_include_path(),
|
||||
)));
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getZfPath()
|
||||
{
|
||||
return $this->_zfPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get or set the value of the "suppress not found warnings" flag
|
||||
*
|
||||
* @param null|bool $flag
|
||||
*
|
||||
* @param null|bool $flag
|
||||
* @return bool|Zend_Loader_Autoloader Returns boolean if no argument is passed, object instance otherwise
|
||||
*/
|
||||
public function suppressNotFoundWarnings($flag = null)
|
||||
@ -265,8 +296,8 @@ class Zend_Loader_Autoloader
|
||||
|
||||
/**
|
||||
* Indicate whether or not this autoloader should be a fallback autoloader
|
||||
*
|
||||
* @param bool $flag
|
||||
*
|
||||
* @param bool $flag
|
||||
* @return Zend_Loader_Autoloader
|
||||
*/
|
||||
public function setFallbackAutoloader($flag)
|
||||
@ -277,7 +308,7 @@ class Zend_Loader_Autoloader
|
||||
|
||||
/**
|
||||
* Is this instance acting as a fallback autoloader?
|
||||
*
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isFallbackAutoloader()
|
||||
@ -288,11 +319,11 @@ class Zend_Loader_Autoloader
|
||||
/**
|
||||
* Get autoloaders to use when matching class
|
||||
*
|
||||
* Determines if the class matches a registered namespace, and, if so,
|
||||
* returns only the autoloaders for that namespace. Otherwise, it returns
|
||||
* Determines if the class matches a registered namespace, and, if so,
|
||||
* returns only the autoloaders for that namespace. Otherwise, it returns
|
||||
* all non-namespaced autoloaders.
|
||||
*
|
||||
* @param string $class
|
||||
* @param string $class
|
||||
* @return array Array of autoloaders to use
|
||||
*/
|
||||
public function getClassAutoloaders($class)
|
||||
@ -334,7 +365,7 @@ class Zend_Loader_Autoloader
|
||||
|
||||
/**
|
||||
* Add an autoloader to the beginning of the stack
|
||||
*
|
||||
*
|
||||
* @param object|array|string $callback PHP callback or Zend_Loader_Autoloader_Interface implementation
|
||||
* @param string|array $namespace Specific namespace(s) under which to register callback
|
||||
* @return Zend_Loader_Autoloader
|
||||
@ -357,7 +388,7 @@ class Zend_Loader_Autoloader
|
||||
|
||||
/**
|
||||
* Append an autoloader to the autoloader stack
|
||||
*
|
||||
*
|
||||
* @param object|array|string $callback PHP callback or Zend_Loader_Autoloader_Interface implementation
|
||||
* @param string|array $namespace Specific namespace(s) under which to register callback
|
||||
* @return Zend_Loader_Autoloader
|
||||
@ -380,7 +411,7 @@ class Zend_Loader_Autoloader
|
||||
|
||||
/**
|
||||
* Remove an autoloader from the autoloader stack
|
||||
*
|
||||
*
|
||||
* @param object|array|string $callback PHP callback or Zend_Loader_Autoloader_Interface implementation
|
||||
* @param null|string|array $namespace Specific namespace(s) from which to remove autoloader
|
||||
* @return Zend_Loader_Autoloader
|
||||
@ -418,7 +449,7 @@ class Zend_Loader_Autoloader
|
||||
* Constructor
|
||||
*
|
||||
* Registers instance with spl_autoload stack
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function __construct()
|
||||
@ -429,8 +460,8 @@ class Zend_Loader_Autoloader
|
||||
|
||||
/**
|
||||
* Internal autoloader implementation
|
||||
*
|
||||
* @param string $class
|
||||
*
|
||||
* @param string $class
|
||||
* @return bool
|
||||
*/
|
||||
protected function _autoload($class)
|
||||
@ -450,9 +481,9 @@ class Zend_Loader_Autoloader
|
||||
|
||||
/**
|
||||
* Set autoloaders for a specific namespace
|
||||
*
|
||||
* @param array $autoloaders
|
||||
* @param string $namespace
|
||||
*
|
||||
* @param array $autoloaders
|
||||
* @param string $namespace
|
||||
* @return Zend_Loader_Autoloader
|
||||
*/
|
||||
protected function _setNamespaceAutoloaders(array $autoloaders, $namespace = '')
|
||||
@ -461,4 +492,93 @@ class Zend_Loader_Autoloader
|
||||
$this->_namespaceAutoloaders[$namespace] = $autoloaders;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the filesystem path for the requested ZF version
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $version
|
||||
* @return void
|
||||
*/
|
||||
protected function _getVersionPath($path, $version)
|
||||
{
|
||||
$type = $this->_getVersionType($version);
|
||||
|
||||
if ($type == 'latest') {
|
||||
$version = 'latest';
|
||||
}
|
||||
|
||||
$availableVersions = $this->_getAvailableVersions($path, $version);
|
||||
if (empty($availableVersions)) {
|
||||
throw new Zend_Loader_Exception('No valid ZF installations discovered');
|
||||
}
|
||||
|
||||
$matchedVersion = array_pop($availableVersions);
|
||||
return $matchedVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the ZF version type
|
||||
*
|
||||
* @param string $version
|
||||
* @return string "latest", "major", "minor", or "specific"
|
||||
* @throws Zend_Loader_Exception if version string contains too many dots
|
||||
*/
|
||||
protected function _getVersionType($version)
|
||||
{
|
||||
if (strtolower($version) == 'latest') {
|
||||
return 'latest';
|
||||
}
|
||||
|
||||
$parts = explode('.', $version);
|
||||
$count = count($parts);
|
||||
if (1 == $count) {
|
||||
return 'major';
|
||||
}
|
||||
if (2 == $count) {
|
||||
return 'minor';
|
||||
}
|
||||
if (3 < $count) {
|
||||
throw new Zend_Loader_Exception('Invalid version string provided');
|
||||
}
|
||||
return 'specific';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get available versions for the version type requested
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $version
|
||||
* @return array
|
||||
*/
|
||||
protected function _getAvailableVersions($path, $version)
|
||||
{
|
||||
if (!is_dir($path)) {
|
||||
throw new Zend_Loader_Exception('Invalid ZF path provided');
|
||||
}
|
||||
|
||||
$path = rtrim($path, '/');
|
||||
$path = rtrim($path, '\\');
|
||||
$versionLen = strlen($version);
|
||||
$versions = array();
|
||||
$dirs = glob("$path/*", GLOB_ONLYDIR);
|
||||
foreach ($dirs as $dir) {
|
||||
$dirName = substr($dir, strlen($path) + 1);
|
||||
if (!preg_match('/^(?:ZendFramework-)?(\d+\.\d+\.\d+((a|b|pl|pr|p|rc)\d+)?)(?:-minimal)?$/i', $dirName, $matches)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$matchedVersion = $matches[1];
|
||||
|
||||
if (('latest' == $version)
|
||||
|| ((strlen($matchedVersion) >= $versionLen)
|
||||
&& (0 === strpos($matchedVersion, $version)))
|
||||
) {
|
||||
$versions[$matchedVersion] = $dir . '/library';
|
||||
}
|
||||
}
|
||||
|
||||
uksort($versions, 'version_compare');
|
||||
return $versions;
|
||||
}
|
||||
}
|
||||
|
@ -16,13 +16,13 @@
|
||||
* @package Zend_Loader
|
||||
* @subpackage Autoloader
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @version $Id: Interface.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Interface.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Autoloader interface
|
||||
*
|
||||
*
|
||||
* @package Zend_Loader
|
||||
* @subpackage Autoloader
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @package Zend_Loader
|
||||
* @subpackage Autoloader
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @version $Id: Resource.php 17417 2009-08-06 18:06:04Z matthew $
|
||||
* @version $Id: Resource.php 19190 2009-11-23 12:43:42Z bate $
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
@ -25,7 +25,7 @@ require_once 'Zend/Loader/Autoloader/Interface.php';
|
||||
|
||||
/**
|
||||
* Resource loader
|
||||
*
|
||||
*
|
||||
* @uses Zend_Loader_Autoloader_Interface
|
||||
* @package Zend_Loader
|
||||
* @subpackage Autoloader
|
||||
@ -61,7 +61,7 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
*
|
||||
* @param array|Zend_Config $options Configuration options for resource autoloader
|
||||
* @return void
|
||||
*/
|
||||
@ -94,7 +94,7 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
|
||||
/**
|
||||
* Overloading: methods
|
||||
*
|
||||
* Allow retrieving concrete resource object instances using 'get<Resourcename>()'
|
||||
* Allow retrieving concrete resource object instances using 'get<Resourcename>()'
|
||||
* syntax. Example:
|
||||
* <code>
|
||||
* $loader = new Zend_Loader_Autoloader_Resource(array(
|
||||
@ -105,9 +105,9 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
|
||||
*
|
||||
* $foo = $loader->getModel('Foo'); // get instance of Stuff_Model_Foo class
|
||||
* </code>
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $args
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $args
|
||||
* @return mixed
|
||||
* @throws Zend_Loader_Exception if method not beginning with 'get' or not matching a valid resource type is called
|
||||
*/
|
||||
@ -132,12 +132,12 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to autoload a class
|
||||
*
|
||||
* @param string $class
|
||||
* @return mixed False if not matched, otherwise result if include operation
|
||||
* Helper method to calculate the correct class path
|
||||
*
|
||||
* @param string $class
|
||||
* @return False if not matched other wise the correct path
|
||||
*/
|
||||
public function autoload($class)
|
||||
public function getClassPath($class)
|
||||
{
|
||||
$segments = explode('_', $class);
|
||||
$namespaceTopLevel = $this->getNamespace();
|
||||
@ -171,15 +171,36 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
|
||||
return false;
|
||||
}
|
||||
|
||||
$final = substr($class, strlen($lastMatch));
|
||||
$final = substr($class, strlen($lastMatch) + 1);
|
||||
$path = $this->_components[$lastMatch];
|
||||
return include $path . '/' . str_replace('_', '/', $final) . '.php';
|
||||
$classPath = $path . '/' . str_replace('_', '/', $final) . '.php';
|
||||
|
||||
if (Zend_Loader::isReadable($classPath)) {
|
||||
return $classPath;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to autoload a class
|
||||
*
|
||||
* @param string $class
|
||||
* @return mixed False if not matched, otherwise result if include operation
|
||||
*/
|
||||
public function autoload($class)
|
||||
{
|
||||
$classPath = $this->getClassPath($class);
|
||||
if (false !== $classPath) {
|
||||
return include $classPath;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set class state from options
|
||||
*
|
||||
* @param array $options
|
||||
*
|
||||
* @param array $options
|
||||
* @return Zend_Loader_Autoloader_Resource
|
||||
*/
|
||||
public function setOptions(array $options)
|
||||
@ -196,8 +217,8 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
|
||||
|
||||
/**
|
||||
* Set namespace that this autoloader handles
|
||||
*
|
||||
* @param string $namespace
|
||||
*
|
||||
* @param string $namespace
|
||||
* @return Zend_Loader_Autoloader_Resource
|
||||
*/
|
||||
public function setNamespace($namespace)
|
||||
@ -208,7 +229,7 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
|
||||
|
||||
/**
|
||||
* Get namespace this autoloader handles
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNamespace()
|
||||
@ -218,8 +239,8 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
|
||||
|
||||
/**
|
||||
* Set base path for this set of resources
|
||||
*
|
||||
* @param string $path
|
||||
*
|
||||
* @param string $path
|
||||
* @return Zend_Loader_Autoloader_Resource
|
||||
*/
|
||||
public function setBasePath($path)
|
||||
@ -227,10 +248,10 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
|
||||
$this->_basePath = (string) $path;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get base path to this set of resources
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBasePath()
|
||||
@ -240,7 +261,7 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
|
||||
|
||||
/**
|
||||
* Add resource type
|
||||
*
|
||||
*
|
||||
* @param string $type identifier for the resource type being loaded
|
||||
* @param string $path path relative to resource base path containing the resource types
|
||||
* @param null|string $namespace sub-component namespace to append to base namespace that qualifies this resource type
|
||||
@ -264,7 +285,7 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
|
||||
require_once 'Zend/Loader/Exception.php';
|
||||
throw new Zend_Loader_Exception('Invalid path specification provided; must be string');
|
||||
}
|
||||
$this->_resourceTypes[$type]['path'] = $this->getBasePath() . '/' . $path;
|
||||
$this->_resourceTypes[$type]['path'] = $this->getBasePath() . '/' . rtrim($path, '\/');
|
||||
|
||||
$component = $this->_resourceTypes[$type]['namespace'];
|
||||
$this->_components[$component] = $this->_resourceTypes[$type]['path'];
|
||||
@ -274,10 +295,10 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
|
||||
/**
|
||||
* Add multiple resources at once
|
||||
*
|
||||
* $types should be an associative array of resource type => specification
|
||||
* pairs. Each specification should be an associative array containing
|
||||
* minimally the 'path' key (specifying the path relative to the resource
|
||||
* base path) and optionally the 'namespace' key (indicating the subcomponent
|
||||
* $types should be an associative array of resource type => specification
|
||||
* pairs. Each specification should be an associative array containing
|
||||
* minimally the 'path' key (specifying the path relative to the resource
|
||||
* base path) and optionally the 'namespace' key (indicating the subcomponent
|
||||
* namespace to append to the resource namespace).
|
||||
*
|
||||
* As an example:
|
||||
@ -293,8 +314,8 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
|
||||
* ),
|
||||
* ));
|
||||
* </code>
|
||||
*
|
||||
* @param array $types
|
||||
*
|
||||
* @param array $types
|
||||
* @return Zend_Loader_Autoloader_Resource
|
||||
*/
|
||||
public function addResourceTypes(array $types)
|
||||
@ -320,9 +341,9 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
|
||||
|
||||
/**
|
||||
* Overwrite existing and set multiple resource types at once
|
||||
*
|
||||
*
|
||||
* @see Zend_Loader_Autoloader_Resource::addResourceTypes()
|
||||
* @param array $types
|
||||
* @param array $types
|
||||
* @return Zend_Loader_Autoloader_Resource
|
||||
*/
|
||||
public function setResourceTypes(array $types)
|
||||
@ -333,7 +354,7 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
|
||||
|
||||
/**
|
||||
* Retrieve resource type mappings
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getResourceTypes()
|
||||
@ -343,8 +364,8 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
|
||||
|
||||
/**
|
||||
* Is the requested resource type defined?
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @param string $type
|
||||
* @return bool
|
||||
*/
|
||||
public function hasResourceType($type)
|
||||
@ -354,8 +375,8 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
|
||||
|
||||
/**
|
||||
* Remove the requested resource type
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @param string $type
|
||||
* @return Zend_Loader_Autoloader_Resource
|
||||
*/
|
||||
public function removeResourceType($type)
|
||||
@ -370,7 +391,7 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
|
||||
|
||||
/**
|
||||
* Clear all resource types
|
||||
*
|
||||
*
|
||||
* @return Zend_Loader_Autoloader_Resource
|
||||
*/
|
||||
public function clearResourceTypes()
|
||||
@ -382,8 +403,8 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
|
||||
|
||||
/**
|
||||
* Set default resource type to use when calling load()
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @param string $type
|
||||
* @return Zend_Loader_Autoloader_Resource
|
||||
*/
|
||||
public function setDefaultResourceType($type)
|
||||
@ -396,7 +417,7 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
|
||||
|
||||
/**
|
||||
* Get default resource type to use when calling load()
|
||||
*
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getDefaultResourceType()
|
||||
@ -407,12 +428,12 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac
|
||||
/**
|
||||
* Object registry and factory
|
||||
*
|
||||
* Loads the requested resource of type $type (or uses the default resource
|
||||
* type if none provided). If the resource has been loaded previously,
|
||||
* Loads the requested resource of type $type (or uses the default resource
|
||||
* type if none provided). If the resource has been loaded previously,
|
||||
* returns the previous instance; otherwise, instantiates it.
|
||||
*
|
||||
* @param string $resource
|
||||
* @param string $type
|
||||
*
|
||||
* @param string $resource
|
||||
* @param string $type
|
||||
* @return object
|
||||
* @throws Zend_Loader_Exception if resource type not specified or invalid
|
||||
*/
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @package Zend_Loader
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Exception.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Exception.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -31,5 +31,5 @@ require_once 'Zend/Exception.php';
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Loader_Exception extends Zend_Exception
|
||||
class Zend_Loader_Exception extends Zend_Exception
|
||||
{}
|
@ -17,7 +17,7 @@
|
||||
* @subpackage PluginLoader
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: PluginLoader.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: PluginLoader.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Loader_PluginLoader_Interface */
|
||||
@ -123,9 +123,9 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
|
||||
*/
|
||||
protected function _formatPrefix($prefix)
|
||||
{
|
||||
if($prefix == "") {
|
||||
return $prefix;
|
||||
}
|
||||
if($prefix == "") {
|
||||
return $prefix;
|
||||
}
|
||||
return rtrim($prefix, '_') . '_';
|
||||
}
|
||||
|
||||
@ -149,7 +149,12 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
|
||||
if ($this->_useStaticRegistry) {
|
||||
self::$_staticPrefixToPaths[$this->_useStaticRegistry][$prefix][] = $path;
|
||||
} else {
|
||||
$this->_prefixToPaths[$prefix][] = $path;
|
||||
if (!isset($this->_prefixToPaths[$prefix])) {
|
||||
$this->_prefixToPaths[$prefix] = array();
|
||||
}
|
||||
if (!in_array($path, $this->_prefixToPaths[$prefix])) {
|
||||
$this->_prefixToPaths[$prefix][] = $path;
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
@ -293,7 +298,7 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
|
||||
public function getClassName($name)
|
||||
{
|
||||
$name = $this->_formatName($name);
|
||||
if ($this->_useStaticRegistry
|
||||
if ($this->_useStaticRegistry
|
||||
&& isset(self::$_staticLoadedPlugins[$this->_useStaticRegistry][$name])
|
||||
) {
|
||||
return self::$_staticLoadedPlugins[$this->_useStaticRegistry][$name];
|
||||
@ -306,14 +311,14 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
|
||||
|
||||
/**
|
||||
* Get path to plugin class
|
||||
*
|
||||
* @param mixed $name
|
||||
*
|
||||
* @param mixed $name
|
||||
* @return string|false False if not found
|
||||
*/
|
||||
public function getClassPath($name)
|
||||
{
|
||||
$name = $this->_formatName($name);
|
||||
if ($this->_useStaticRegistry
|
||||
if ($this->_useStaticRegistry
|
||||
&& !empty(self::$_staticLoadedPluginPaths[$this->_useStaticRegistry][$name])
|
||||
) {
|
||||
return self::$_staticLoadedPluginPaths[$this->_useStaticRegistry][$name];
|
||||
@ -340,9 +345,9 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
|
||||
* Load a plugin via the name provided
|
||||
*
|
||||
* @param string $name
|
||||
* @param bool $throwExceptions Whether or not to throw exceptions if the
|
||||
* @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
|
||||
* @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
|
||||
*/
|
||||
@ -414,10 +419,10 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
|
||||
/**
|
||||
* Set path to class file cache
|
||||
*
|
||||
* Specify a path to a file that will add include_once statements for each
|
||||
* Specify a path to a file that will add include_once statements for each
|
||||
* plugin class loaded. This is an opt-in feature for performance purposes.
|
||||
*
|
||||
* @param string $file
|
||||
*
|
||||
* @param string $file
|
||||
* @return void
|
||||
* @throws Zend_Loader_PluginLoader_Exception if file is not writeable or path does not exist
|
||||
*/
|
||||
@ -446,7 +451,7 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
|
||||
|
||||
/**
|
||||
* Retrieve class file cache path
|
||||
*
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public static function getIncludeFileCache()
|
||||
@ -456,8 +461,8 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
|
||||
|
||||
/**
|
||||
* Append an include_once statement to the class file cache
|
||||
*
|
||||
* @param string $incFile
|
||||
*
|
||||
* @param string $incFile
|
||||
* @return void
|
||||
*/
|
||||
protected static function _appendIncFile($incFile)
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage PluginLoader
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Interface.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Interface.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -39,7 +39,7 @@ interface Zend_Loader_PluginLoader_Interface
|
||||
* @return Zend_Loader_PluginLoader
|
||||
*/
|
||||
public function addPrefixPath($prefix, $path);
|
||||
|
||||
|
||||
/**
|
||||
* Remove a prefix (or prefixed-path) from the registry
|
||||
*
|
||||
@ -48,7 +48,7 @@ interface Zend_Loader_PluginLoader_Interface
|
||||
* @return Zend_Loader_PluginLoader
|
||||
*/
|
||||
public function removePrefixPath($prefix, $path = null);
|
||||
|
||||
|
||||
/**
|
||||
* Whether or not a Helper by a specific name
|
||||
*
|
||||
@ -64,7 +64,7 @@ interface Zend_Loader_PluginLoader_Interface
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName($name);
|
||||
|
||||
|
||||
/**
|
||||
* Load a helper via the name provided
|
||||
*
|
||||
|
Reference in New Issue
Block a user