diff options
author | diosmosis <benaka@piwik.pro> | 2015-04-14 01:07:06 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-04-14 01:07:06 +0300 |
commit | ab95aee4bd36eb7a41e9bcde7f96f4544d64a256 (patch) | |
tree | d4f7be5b80da1e33a5018acf78fe699b0e99626a /core/Config.php | |
parent | ff8a24c8f7dea77845a5cb38dae7023663719690 (diff) |
Encode/decode INI properties in IniFileChain since the encoding/decoding is used to avoid issues w/ parse_ini_file() use.
Diffstat (limited to 'core/Config.php')
-rw-r--r-- | core/Config.php | 61 |
1 files changed, 3 insertions, 58 deletions
diff --git a/core/Config.php b/core/Config.php index 91853de733..0b5170de60 100644 --- a/core/Config.php +++ b/core/Config.php @@ -334,9 +334,6 @@ class Config extends Singleton } } - // decode section datas - $this->decodeValues($this->settings->getAll()); - // Check config.ini.php last if (!$inTrackerRequest) { $this->checkLocalConfigFound(); @@ -362,46 +359,6 @@ class Config extends Singleton } /** - * Decode HTML entities - * - * @param mixed $values - * @return mixed - */ - protected function decodeValues(&$values) - { - if (is_array($values)) { - foreach ($values as &$value) { - $value = $this->decodeValues($value); - } - return $values; - } elseif (is_string($values)) { - return html_entity_decode($values, ENT_COMPAT, 'UTF-8'); - } - return $values; - } - - /** - * Encode HTML entities - * - * @param mixed $values - * @return mixed - */ - protected function encodeValues(&$values) - { - if (is_array($values)) { - foreach ($values as &$value) { - $value = $this->encodeValues($value); - } - } elseif (is_float($values)) { - $values = Common::forceDotAsSeparatorForDecimalPoint($values); - } elseif (is_string($values)) { - $values = htmlentities($values, ENT_COMPAT, 'UTF-8'); - $values = str_replace('$', '$', $values); - } - return $values; - } - - /** * Returns a configuration value or section by name. * * @param string $name The value or section name. @@ -455,21 +412,9 @@ class Config extends Singleton */ public function dumpConfig() { - $this->encodeValues($this->settings->getAll()); - - try { - $header = "; <?php exit; ?> DO NOT REMOVE THIS LINE\n"; - $header .= "; file automatically generated or modified by Piwik; you can manually override the default values in global.ini.php by redefining them in this file.\n"; - $dumpedString = $this->settings->dumpChanges($header); - - $this->decodeValues($this->settings->getAll()); - } catch (Exception $ex) { - $this->decodeValues($this->settings->getAll()); - - throw $ex; - } - - return $dumpedString; + $header = "; <?php exit; ?> DO NOT REMOVE THIS LINE\n"; + $header .= "; file automatically generated or modified by Piwik; you can manually override the default values in global.ini.php by redefining them in this file.\n"; + return $this->settings->dumpChanges($header); } /** |