Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'libs/Zend/Config/Ini.php')
-rw-r--r--libs/Zend/Config/Ini.php71
1 files changed, 43 insertions, 28 deletions
diff --git a/libs/Zend/Config/Ini.php b/libs/Zend/Config/Ini.php
index efb6862713..63cab0f9a4 100644
--- a/libs/Zend/Config/Ini.php
+++ b/libs/Zend/Config/Ini.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: Ini.php 16201 2009-06-21 18:51:15Z thomas $
+ * @version $Id: Ini.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Config
*/
-require_once 'Zend/Config.php';
+// require_once 'Zend/Config.php';
/**
* @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_Ini extends Zend_Config
@@ -49,12 +49,12 @@ class Zend_Config_Ini extends Zend_Config
protected $_sectionSeparator = ':';
/**
- * Wether to skip extends or not
+ * Whether to skip extends or not
*
* @var boolean
*/
protected $_skipExtends = false;
-
+
/**
* Loads the section $section from the config file $filename for
* access facilitated by nested object properties.
@@ -103,7 +103,7 @@ class Zend_Config_Ini extends Zend_Config
/**
* @see Zend_Config_Exception
*/
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception('Filename is not set');
}
@@ -129,7 +129,7 @@ class Zend_Config_Ini extends Zend_Config
$dataArray = array();
foreach ($iniArray as $sectionName => $sectionData) {
if(!is_array($sectionData)) {
- $dataArray = array_merge_recursive($dataArray, $this->_processKey(array(), $sectionName, $sectionData));
+ $dataArray = $this->_arrayMergeRecursive($dataArray, $this->_processKey(array(), $sectionName, $sectionData));
} else {
$dataArray[$sectionName] = $this->_processSection($iniArray, $sectionName);
}
@@ -146,44 +146,59 @@ class Zend_Config_Ini extends Zend_Config
/**
* @see Zend_Config_Exception
*/
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception("Section '$sectionName' cannot be found in $filename");
}
- $dataArray = array_merge($this->_processSection($iniArray, $sectionName), $dataArray);
+ $dataArray = $this->_arrayMergeRecursive($this->_processSection($iniArray, $sectionName), $dataArray);
}
parent::__construct($dataArray, $allowModifications);
- }
+ }
$this->_loadedSection = $section;
}
-
+
/**
- * Load the ini file and preprocess the section separator (':' in the
- * section name (that is used for section extension) so that the resultant
- * array has the correct section names and the extension information is
- * stored in a sub-key called ';extends'. We use ';extends' as this can
- * never be a valid key name in an INI file that has been loaded using
- * parse_ini_file().
- *
+ * Load the INI file from disk using parse_ini_file(). Use a private error
+ * handler to convert any loading errors into a Zend_Config_Exception
+ *
* @param string $filename
* @throws Zend_Config_Exception
* @return array
*/
- protected function _loadIniFile($filename)
+ protected function _parseIniFile($filename)
{
set_error_handler(array($this, '_loadFileErrorHandler'));
- $loaded = parse_ini_file($filename, true); // Warnings and errors are suppressed
+ $iniArray = parse_ini_file($filename, true); // Warnings and errors are suppressed
restore_error_handler();
+
// Check if there was a error while loading file
if ($this->_loadFileErrorStr !== null) {
/**
* @see Zend_Config_Exception
*/
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception($this->_loadFileErrorStr);
}
+
+ return $iniArray;
+ }
+ /**
+ * Load the ini file and preprocess the section separator (':' in the
+ * section name (that is used for section extension) so that the resultant
+ * array has the correct section names and the extension information is
+ * stored in a sub-key called ';extends'. We use ';extends' as this can
+ * never be a valid key name in an INI file that has been loaded using
+ * parse_ini_file().
+ *
+ * @param string $filename
+ * @throws Zend_Config_Exception
+ * @return array
+ */
+ protected function _loadIniFile($filename)
+ {
+ $loaded = $this->_parseIniFile($filename);
$iniArray = array();
foreach ($loaded as $key => $data)
{
@@ -203,14 +218,14 @@ class Zend_Config_Ini extends Zend_Config
/**
* @see Zend_Config_Exception
*/
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception("Section '$thisSection' may not extend multiple sections in $filename");
}
}
return $iniArray;
}
-
+
/**
* Process each element in the section and handle the ";extends" inheritance
* key. Passes control to _processKey() to handle the nest separator
@@ -230,7 +245,7 @@ class Zend_Config_Ini extends Zend_Config
if (strtolower($key) == ';extends') {
if (isset($iniArray[$value])) {
$this->_assertValidExtend($section, $value);
-
+
if (!$this->_skipExtends) {
$config = $this->_processSection($iniArray, $value, $config);
}
@@ -238,7 +253,7 @@ class Zend_Config_Ini extends Zend_Config
/**
* @see Zend_Config_Exception
*/
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception("Parent section '$section' cannot be found");
}
} else {
@@ -274,7 +289,7 @@ class Zend_Config_Ini extends Zend_Config
/**
* @see Zend_Config_Exception
*/
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception("Cannot create sub-key for '{$pieces[0]}' as key already exists");
}
$config[$pieces[0]] = $this->_processKey($config[$pieces[0]], $pieces[1], $value);
@@ -282,7 +297,7 @@ class Zend_Config_Ini extends Zend_Config
/**
* @see Zend_Config_Exception
*/
- require_once 'Zend/Config/Exception.php';
+ // require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception("Invalid key '$key'");
}
} else {