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:
2019-07-17 22:31:04 +02:00
parent 38c146901c
commit 2f397f01f7
2677 changed files with 296182 additions and 45159 deletions

View File

@ -17,7 +17,7 @@
* @subpackage Framework
* @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: Abstract.php 16971 2009-07-22 18:05:45Z mikaelkael $
* @version $Id: Abstract.php 19145 2009-11-20 22:08:36Z beberlei $
*/
/**
@ -37,17 +37,17 @@ abstract class Zend_Tool_Framework_Loader_Abstract implements Zend_Tool_Framewor
* @var Zend_Tool_Framework_Repository_Interface
*/
protected $_registry = null;
/**
* @var array
*/
private $_retrievedFiles = array();
/**
* @var array
*/
private $_loadedClasses = array();
/**
* _getFiles
*
@ -67,7 +67,7 @@ abstract class Zend_Tool_Framework_Loader_Abstract implements Zend_Tool_Framewor
$this->_registry = $registry;
return $this;
}
/**
* load() - called by the client initialize routine to load files
*
@ -76,14 +76,18 @@ abstract class Zend_Tool_Framework_Loader_Abstract implements Zend_Tool_Framewor
{
$this->_retrievedFiles = $this->getRetrievedFiles();
$this->_loadedClasses = array();
$manifestRegistry = $this->_registry->getManifestRepository();
$providerRegistry = $this->_registry->getProviderRepository();
$loadedClasses = array();
// loop through files and find the classes declared by loading the file
foreach ($this->_retrievedFiles as $file) {
if(is_dir($file)) {
continue;
}
$classesLoadedBefore = get_declared_classes();
$oldLevel = error_reporting(E_ALL | ~E_STRICT); // remove strict so that other packages wont throw warnings
// should we lint the files here? i think so
@ -92,32 +96,32 @@ abstract class Zend_Tool_Framework_Loader_Abstract implements Zend_Tool_Framewor
$classesLoadedAfter = get_declared_classes();
$loadedClasses = array_merge($loadedClasses, array_diff($classesLoadedAfter, $classesLoadedBefore));
}
// loop through the loaded classes and ensure that
// loop through the loaded classes and ensure that
foreach ($loadedClasses as $loadedClass) {
// reflect class to see if its something we want to load
$reflectionClass = new ReflectionClass($loadedClass);
if ($reflectionClass->implementsInterface('Zend_Tool_Framework_Manifest_Interface')
&& !$reflectionClass->isAbstract())
if ($reflectionClass->implementsInterface('Zend_Tool_Framework_Manifest_Interface')
&& !$reflectionClass->isAbstract())
{
$manifestRegistry->addManifest($reflectionClass->newInstance());
$this->_loadedClasses[] = $loadedClass;
}
if ($reflectionClass->implementsInterface('Zend_Tool_Framework_Provider_Interface')
if ($reflectionClass->implementsInterface('Zend_Tool_Framework_Provider_Interface')
&& !$reflectionClass->isAbstract()
&& !$providerRegistry->hasProvider($reflectionClass->getName(), false))
&& !$providerRegistry->hasProvider($reflectionClass->getName(), false))
{
$providerRegistry->addProvider($reflectionClass->newInstance());
$this->_loadedClasses[] = $loadedClass;
}
}
return $this->_loadedClasses;
}
/**
* getRetrievedFiles()
*
@ -128,10 +132,10 @@ abstract class Zend_Tool_Framework_Loader_Abstract implements Zend_Tool_Framewor
if ($this->_retrievedFiles == null) {
$this->_retrievedFiles = $this->_getFiles();
}
return $this->_retrievedFiles;
}
/**
* getLoadedClasses()
*
@ -142,5 +146,5 @@ abstract class Zend_Tool_Framework_Loader_Abstract implements Zend_Tool_Framewor
return $this->_loadedClasses;
}
}

View File

@ -17,7 +17,7 @@
* @subpackage Framework
* @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: IncludePathLoader.php 16971 2009-07-22 18:05:45Z mikaelkael $
* @version $Id: IncludePathLoader.php 19145 2009-11-20 22:08:36Z beberlei $
*/
/**
@ -36,9 +36,9 @@ require_once 'Zend/Tool/Framework/Loader/IncludePathLoader/RecursiveFilterIterat
* @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_Tool_Framework_Loader_IncludePathLoader extends Zend_Tool_Framework_Loader_Abstract
class Zend_Tool_Framework_Loader_IncludePathLoader extends Zend_Tool_Framework_Loader_Abstract
{
/**
* _getFiles()
*
@ -52,19 +52,19 @@ class Zend_Tool_Framework_Loader_IncludePathLoader extends Zend_Tool_Framework_L
$relativeItems = array();
$files = array();
$isZendTraversed = false;
foreach ($paths as $path) {
// default patterns to use
$filterDenyDirectoryPattern = '.*(/|\\\\).svn';
$filterAcceptFilePattern = '.*(?:Manifest|Provider)\.php$';
if (!file_exists($path) || $path[0] == '.') {
continue;
}
$realIncludePath = realpath($path);
// ensure that we only traverse a single version of Zend Framework on all include paths
if (file_exists($realIncludePath . '/Zend/Tool/Framework/Loader/IncludePathLoader.php')) {
if ($isZendTraversed === false) {
@ -74,10 +74,10 @@ class Zend_Tool_Framework_Loader_IncludePathLoader extends Zend_Tool_Framework_L
$filterDenyDirectoryPattern = '.*((/|\\\\).svn|' . preg_quote($realIncludePath . DIRECTORY_SEPARATOR) . 'Zend)';
}
}
// create recursive directory iterator
$rdi = new RecursiveDirectoryIterator($path);
// pass in the RecursiveDirectoryIterator & the patterns
$filter = new Zend_Tool_Framework_Loader_IncludePathLoader_RecursiveFilterIterator(
$rdi,
@ -87,18 +87,22 @@ class Zend_Tool_Framework_Loader_IncludePathLoader extends Zend_Tool_Framework_L
// build the rii with the filter
$iterator = new RecursiveIteratorIterator($filter);
// iterate over the accepted items
foreach ($iterator as $item) {
$file = (string)$item;
if($this->_fileIsBlacklisted($file)) {
continue;
}
// ensure that the same named file from separate include_paths is not loaded
$relativeItem = preg_replace('#^' . preg_quote($realIncludePath . DIRECTORY_SEPARATOR, '#') . '#', '', $item->getRealPath());
// no links allowed here for now
if ($item->isLink()) {
continue;
}
// no items that are relavitely the same are allowed
if (in_array($relativeItem, $relativeItems)) {
continue;
@ -111,5 +115,24 @@ class Zend_Tool_Framework_Loader_IncludePathLoader extends Zend_Tool_Framework_L
return $files;
}
/**
*
* @param string $file
* @return bool
*/
protected function _fileIsBlacklisted($file)
{
$blacklist = array(
"PHPUnit".DIRECTORY_SEPARATOR."Framework",
"Zend".DIRECTORY_SEPARATOR."OpenId".DIRECTORY_SEPARATOR."Provider"
);
foreach($blacklist AS $blacklitedPattern) {
if(strpos($file, $blacklitedPattern) !== false) {
return true;
}
}
return false;
}
}

View File

@ -17,7 +17,7 @@
* @subpackage Framework
* @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: RecursiveFilterIterator.php 16971 2009-07-22 18:05:45Z mikaelkael $
* @version $Id: RecursiveFilterIterator.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -31,7 +31,7 @@ class Zend_Tool_Framework_Loader_IncludePathLoader_RecursiveFilterIterator exten
protected $_denyDirectoryPattern = null;
protected $_acceptFilePattern = null;
/**
* constructor
*
@ -45,7 +45,7 @@ class Zend_Tool_Framework_Loader_IncludePathLoader_RecursiveFilterIterator exten
$this->_acceptFilePattern = $acceptFilePattern;
parent::__construct($iterator);
}
/**
* accept() - Which iterable items to accept or deny, required by FilterInterface
*
@ -57,11 +57,11 @@ class Zend_Tool_Framework_Loader_IncludePathLoader_RecursiveFilterIterator exten
$currentNodeRealPath = $currentNode->getRealPath();
// if the current node is a directory AND doesn't match the denyDirectory pattern, accept
if ($currentNode->isDir()
if ($currentNode->isDir()
&& !preg_match('#' . $this->_denyDirectoryPattern . '#', $currentNodeRealPath)) {
return true;
}
// if the file matches the accept file pattern, accept
$acceptable = (preg_match('#' . $this->_acceptFilePattern . '#', $currentNodeRealPath)) ? true : false;
return $acceptable;
@ -79,13 +79,13 @@ class Zend_Tool_Framework_Loader_IncludePathLoader_RecursiveFilterIterator exten
if (empty($this->ref)) {
$this->ref = new ReflectionClass($this);
}
return $this->ref->newInstance(
$this->getInnerIterator()->getChildren(),
$this->_denyDirectoryPattern,
$this->_acceptFilePattern
);
}
}