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:
authorrobocoder <anthon.pang@gmail.com>2011-11-26 07:51:25 +0400
committerrobocoder <anthon.pang@gmail.com>2011-11-26 07:51:25 +0400
commitc3122f80624b84d603064fa22f9dcf81cd6039b2 (patch)
tree873df56283bb6b0f47fe7e4f7cf24c84f7bb0867 /core/Config
parent03f4ee0f1689c2980ffaa1f0353ad33023317740 (diff)
refs #1713
git-svn-id: http://dev.piwik.org/svn/trunk@5484 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'core/Config')
-rw-r--r--core/Config/Ini.php55
1 files changed, 55 insertions, 0 deletions
diff --git a/core/Config/Ini.php b/core/Config/Ini.php
new file mode 100644
index 0000000000..22b02560a7
--- /dev/null
+++ b/core/Config/Ini.php
@@ -0,0 +1,55 @@
+<?php
+/**
+ * Piwik - Open source web analytics
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ * @version $Id$
+ *
+ * @category Piwik
+ * @package Piwik
+ */
+
+/**
+ * Subclasses Zend_Config_Ini so we can use our own parse_ini_file() wrapper.
+ *
+ * @package Piwik
+ * @subpackage Piwik_Config
+ */
+class Piwik_Config_Ini extends Zend_Config_Ini
+{
+ /**
+ * Handle any errors from parse_ini_file
+ *
+ * @param integer $errno
+ * @param string $errstr
+ * @param string $errfile
+ * @param integer $errline
+ */
+ public function _parseFileErrorHandler($errno, $errstr, $errfile, $errline)
+ {
+ $this->_loadFileErrorHandler($errno, $errstr, $errfile, $errline);
+ }
+
+ /**
+ * Load ini file configuration
+ *
+ * Derived from Zend_Config_Ini->_loadIniFile() and Zend_Config_Ini->_parseIniFile()
+ * @license New BSD License
+ *
+ * @param string $filename
+ * @return array
+ */
+ protected function _loadIniFile($filename)
+ {
+ set_error_handler(array($this, '_parseFileErrorHandler'));
+ $iniArray = _parse_ini_file($filename, true);
+ restore_error_handler();
+ // Check if there was an error while loading the file
+ if ($this->_loadFileErrorStr !== null) {
+ throw new Zend_Config_Exception($this->_loadFileErrorStr);
+ }
+
+ return $iniArray;
+ }
+}