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

@ -16,7 +16,7 @@
* @package Zend_Application
* @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: Application.php 17802 2009-08-24 21:15:12Z matthew $
* @version $Id: Application.php 18951 2009-11-12 16:26:19Z alexander $
*/
/**
@ -29,35 +29,35 @@ class Zend_Application
{
/**
* Autoloader to use
*
*
* @var Zend_Loader_Autoloader
*/
protected $_autoloader;
/**
* Bootstrap
*
*
* @var Zend_Application_Bootstrap_BootstrapAbstract
*/
protected $_bootstrap;
/**
* Application environment
*
*
* @var string
*/
protected $_environment;
/**
* Flattened (lowercase) option keys
*
*
* @var array
*/
protected $_optionKeys = array();
/**
* Options for Zend_Application
*
*
* @var array
*/
protected $_options = array();
@ -65,10 +65,10 @@ class Zend_Application
/**
* Constructor
*
* Initialize application. Potentially initializes include_paths, PHP
* Initialize application. Potentially initializes include_paths, PHP
* settings, and bootstrap class.
*
* @param string $environment
*
* @param string $environment
* @param string|array|Zend_Config $options String path to configuration file, or array/Zend_Config of configuration options
* @throws Zend_Application_Exception When invalid options are provided
* @return void
@ -95,7 +95,7 @@ class Zend_Application
/**
* Retrieve current environment
*
*
* @return string
*/
public function getEnvironment()
@ -105,7 +105,7 @@ class Zend_Application
/**
* Retrieve autoloader instance
*
*
* @return Zend_Loader_Autoloader
*/
public function getAutoloader()
@ -115,8 +115,8 @@ class Zend_Application
/**
* Set application options
*
* @param array $options
*
* @param array $options
* @throws Zend_Application_Exception When no bootstrap path is provided
* @throws Zend_Application_Exception When invalid bootstrap information are provided
* @return Zend_Application
@ -126,7 +126,7 @@ class Zend_Application
if (!empty($options['config'])) {
$options = $this->mergeOptions($options, $this->_loadConfig($options['config']));
}
$this->_options = $options;
$options = array_change_key_case($options, CASE_LOWER);
@ -136,32 +136,43 @@ class Zend_Application
if (!empty($options['phpsettings'])) {
$this->setPhpSettings($options['phpsettings']);
}
if (!empty($options['includepaths'])) {
$this->setIncludePaths($options['includepaths']);
}
if (!empty($options['autoloadernamespaces'])) {
$this->setAutoloaderNamespaces($options['autoloadernamespaces']);
}
if (!empty($options['autoloaderzfpath'])) {
$autoloader = $this->getAutoloader();
if (method_exists($autoloader, 'setZfPath')) {
$zfPath = $options['autoloaderzfpath'];
$zfVersion = !empty($options['autoloaderzfversion'])
? $options['autoloaderzfversion']
: 'latest';
$autoloader->setZfPath($zfPath, $zfVersion);
}
}
if (!empty($options['bootstrap'])) {
$bootstrap = $options['bootstrap'];
if (is_string($bootstrap)) {
$this->setBootstrap($bootstrap);
} elseif (is_array($bootstrap)) {
if (empty($bootstrap['path'])) {
throw new Zend_Application_Exception('No bootstrap path provided');
}
$path = $bootstrap['path'];
$class = null;
if (!empty($bootstrap['class'])) {
$class = $bootstrap['class'];
}
$this->setBootstrap($path, $class);
} else {
throw new Zend_Application_Exception('Invalid bootstrap information provided');
@ -173,7 +184,7 @@ class Zend_Application
/**
* Retrieve application options (for caching)
*
*
* @return array
*/
public function getOptions()
@ -183,19 +194,19 @@ class Zend_Application
/**
* Is an option present?
*
* @param string $key
*
* @param string $key
* @return bool
*/
public function hasOption($key)
{
return in_array($key, $this->_optionKeys);
return in_array(strtolower($key), $this->_optionKeys);
}
/**
* Retrieve a single option
*
* @param string $key
*
* @param string $key
* @return mixed
*/
public function getOption($key)
@ -210,9 +221,9 @@ class Zend_Application
/**
* Merge options recursively
*
* @param array $array1
* @param mixed $array2
*
* @param array $array1
* @param mixed $array2
* @return array
*/
public function mergeOptions(array $array1, $array2 = null)
@ -221,7 +232,7 @@ class Zend_Application
foreach ($array2 as $key => $val) {
if (is_array($array2[$key])) {
$array1[$key] = (array_key_exists($key, $array1) && is_array($array1[$key]))
? $this->mergeOptions($array1[$key], $array2[$key])
? $this->mergeOptions($array1[$key], $array2[$key])
: $array2[$key];
} else {
$array1[$key] = $val;
@ -233,8 +244,8 @@ class Zend_Application
/**
* Set PHP configuration settings
*
* @param array $settings
*
* @param array $settings
* @param string $prefix Key prefix to prepend to array values (used to map . separated INI values)
* @return Zend_Application
*/
@ -248,14 +259,14 @@ class Zend_Application
$this->setPhpSettings($value, $key . '.');
}
}
return $this;
}
/**
* Set include path
*
* @param array $paths
*
* @param array $paths
* @return Zend_Application
*/
public function setIncludePaths(array $paths)
@ -267,31 +278,31 @@ class Zend_Application
/**
* Set autoloader namespaces
*
* @param array $namespaces
*
* @param array $namespaces
* @return Zend_Application
*/
public function setAutoloaderNamespaces(array $namespaces)
{
$autoloader = $this->getAutoloader();
foreach ($namespaces as $namespace) {
$autoloader->registerNamespace($namespace);
}
return $this;
}
/**
* Set bootstrap path/class
*
* @param string $path
* @param string $class
*
* @param string $path
* @param string $class
* @return Zend_Application
*/
public function setBootstrap($path, $class = null)
{
// setOptions() can potentially send a null value; specify default
// setOptions() can potentially send a null value; specify default
// here
if (null === $class) {
$class = 'Bootstrap';
@ -308,13 +319,13 @@ class Zend_Application
if (!$this->_bootstrap instanceof Zend_Application_Bootstrap_Bootstrapper) {
throw new Zend_Application_Exception('Bootstrap class does not implement Zend_Application_Bootstrap_Bootstrapper');
}
return $this;
}
/**
* Get bootstrap object
*
*
* @return Zend_Application_Bootstrap_BootstrapAbstract
*/
public function getBootstrap()
@ -327,18 +338,19 @@ class Zend_Application
/**
* Bootstrap application
*
*
* @param null|string|array $resource
* @return Zend_Application
*/
public function bootstrap()
public function bootstrap($resource = null)
{
$this->getBootstrap()->bootstrap();
$this->getBootstrap()->bootstrap($resource);
return $this;
}
/**
* Run the application
*
*
* @return void
*/
public function run()
@ -348,25 +360,25 @@ class Zend_Application
/**
* Load configuration file of options
*
*
* @param string $file
* @throws Zend_Application_Exception When invalid configuration file is provided
* @throws Zend_Application_Exception When invalid configuration file is provided
* @return array
*/
protected function _loadConfig($file)
{
$environment = $this->getEnvironment();
$suffix = strtolower(pathinfo($file, PATHINFO_EXTENSION));
switch ($suffix) {
case 'ini':
$config = new Zend_Config_Ini($file, $environment);
break;
case 'xml':
$config = new Zend_Config_Xml($file, $environment);
break;
case 'php':
case 'inc':
$config = include $file;
@ -375,11 +387,11 @@ class Zend_Application
}
return $config;
break;
default:
throw new Zend_Application_Exception('Invalid configuration file provided; unknown config type');
}
return $config->toArray();
}
}