diff options
Diffstat (limited to 'libs/Zend/Config/Xml.php')
-rw-r--r-- | libs/Zend/Config/Xml.php | 59 |
1 files changed, 15 insertions, 44 deletions
diff --git a/libs/Zend/Config/Xml.php b/libs/Zend/Config/Xml.php index e68bfd3b32..698247cec8 100644 --- a/libs/Zend/Config/Xml.php +++ b/libs/Zend/Config/Xml.php @@ -14,22 +14,22 @@ * * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Xml.php 17267 2009-07-29 02:13:18Z yoshida@zend.co.jp $ + * @version $Id: Xml.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** * @see Zend_Config */ -require_once 'Zend/Config.php'; +// require_once 'Zend/Config.php'; /** * XML Adapter for Zend_Config * * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Config_Xml extends Zend_Config @@ -40,7 +40,7 @@ class Zend_Config_Xml extends Zend_Config const XML_NAMESPACE = 'http://framework.zend.com/xml/zend-config-xml/1.0/'; /** - * Wether to skip extends or not + * Whether to skip extends or not * * @var boolean */ @@ -61,14 +61,14 @@ class Zend_Config_Xml extends Zend_Config * * @param string $xml XML file or string to process * @param mixed $section Section to process - * @param boolean $options Whether modifiacations are allowed at runtime + * @param boolean $options Whether modifications are allowed at runtime * @throws Zend_Config_Exception When xml is not set or cannot be loaded * @throws Zend_Config_Exception When section $sectionName cannot be found in $xml */ public function __construct($xml, $section = null, $options = false) { if (empty($xml)) { - require_once 'Zend/Config/Exception.php'; + // require_once 'Zend/Config/Exception.php'; throw new Zend_Config_Exception('Filename is not set'); } @@ -94,7 +94,7 @@ class Zend_Config_Xml extends Zend_Config restore_error_handler(); // Check if there was a error while loading file if ($this->_loadFileErrorStr !== null) { - require_once 'Zend/Config/Exception.php'; + // require_once 'Zend/Config/Exception.php'; throw new Zend_Config_Exception($this->_loadFileErrorStr); } @@ -109,7 +109,7 @@ class Zend_Config_Xml extends Zend_Config $dataArray = array(); foreach ($section as $sectionName) { if (!isset($config->$sectionName)) { - require_once 'Zend/Config/Exception.php'; + // require_once 'Zend/Config/Exception.php'; throw new Zend_Config_Exception("Section '$sectionName' cannot be found in $xml"); } @@ -119,7 +119,7 @@ class Zend_Config_Xml extends Zend_Config parent::__construct($dataArray, $allowModifications); } else { if (!isset($config->$section)) { - require_once 'Zend/Config/Exception.php'; + // require_once 'Zend/Config/Exception.php'; throw new Zend_Config_Exception("Section '$section' cannot be found in $xml"); } @@ -148,7 +148,7 @@ class Zend_Config_Xml extends Zend_Config protected function _processExtends(SimpleXMLElement $element, $section, array $config = array()) { if (!isset($element->$section)) { - require_once 'Zend/Config/Exception.php'; + // require_once 'Zend/Config/Exception.php'; throw new Zend_Config_Exception("Section '$section' cannot be found"); } @@ -205,7 +205,7 @@ class Zend_Config_Xml extends Zend_Config // Search for local 'const' nodes and replace them if (count($xmlObject->children(self::XML_NAMESPACE)) > 0) { if (count($xmlObject->children()) > 0) { - require_once 'Zend/Config/Exception.php'; + // require_once 'Zend/Config/Exception.php'; throw new Zend_Config_Exception("A node with a 'const' childnode may not have any other children"); } @@ -224,14 +224,14 @@ class Zend_Config_Xml extends Zend_Config switch ($node->localName) { case 'const': if (!$node->hasAttributeNS(self::XML_NAMESPACE, 'name')) { - require_once 'Zend/Config/Exception.php'; + // require_once 'Zend/Config/Exception.php'; throw new Zend_Config_Exception("Misssing 'name' attribute in 'const' node"); } $constantName = $node->getAttributeNS(self::XML_NAMESPACE, 'name'); if (!defined($constantName)) { - require_once 'Zend/Config/Exception.php'; + // require_once 'Zend/Config/Exception.php'; throw new Zend_Config_Exception("Constant with name '$constantName' was not defined"); } @@ -241,7 +241,7 @@ class Zend_Config_Xml extends Zend_Config break; default: - require_once 'Zend/Config/Exception.php'; + // require_once 'Zend/Config/Exception.php'; throw new Zend_Config_Exception("Unknown node with name '$node->localName' found"); } } @@ -283,33 +283,4 @@ class Zend_Config_Xml extends Zend_Config return $config; } - - /** - * Merge two arrays recursively, overwriting keys of the same name - * in $firstArray with the value in $secondArray. - * - * @param mixed $firstArray First array - * @param mixed $secondArray Second array to merge into first array - * @return array - */ - protected function _arrayMergeRecursive($firstArray, $secondArray) - { - if (is_array($firstArray) && is_array($secondArray)) { - foreach ($secondArray as $key => $value) { - if (isset($firstArray[$key])) { - $firstArray[$key] = $this->_arrayMergeRecursive($firstArray[$key], $value); - } else { - if($key === 0) { - $firstArray= array(0=>$this->_arrayMergeRecursive($firstArray, $value)); - } else { - $firstArray[$key] = $value; - } - } - } - } else { - $firstArray = $secondArray; - } - - return $firstArray; - } } |