From bca7dc68e9f73e863e3a65173a8883c99dc09e3a Mon Sep 17 00:00:00 2001 From: Thomas Bruederli <bruederli@kolabsys.com> Date: Mon, 29 Dec 2014 07:40:26 -0500 Subject: [PATCH] Fix syntax error and codestyle from recent PR merge --- program/lib/Roundcube/rcube_config.php | 40 ++++++++++++++++++++++------------------ 1 files changed, 22 insertions(+), 18 deletions(-) diff --git a/program/lib/Roundcube/rcube_config.php b/program/lib/Roundcube/rcube_config.php index e9a16c0..9de192d 100644 --- a/program/lib/Roundcube/rcube_config.php +++ b/program/lib/Roundcube/rcube_config.php @@ -102,22 +102,25 @@ * * @return The guess at the type. */ - private function guess_type($value) { + private function guess_type($value) + { $_ = 'string'; - + // array requires hint to be passed. - - if (preg_match('/^[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?$/', $value) !== False) { + + if (preg_match('/^[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?$/', $value) !== false) { $_ = 'double'; - } else if (preg_match('/^\d+$/', $value) !== False) { + } + else if (preg_match('/^\d+$/', $value) !== false) { $_ = 'integer'; - } else if (preg_match('/(t(rue)?)|(f(alse)?)/i', $value) !== False) { + } + else if (preg_match('/(t(rue)?)|(f(alse)?)/i', $value) !== false) { $_ = 'boolean'; } - + return $_; } - + /** * @brief Parse environment variable into PHP type. @@ -129,11 +132,10 @@ * * @return Appropriately typed interpretation of $string. */ - private function parse_env($string, $type) { - console("parse $string into $type"); - + private function parse_env($string, $type) + { $_ = $string; - + switch ($type) { case 'boolean': $_ = (boolean) $_; @@ -160,7 +162,7 @@ return $_; } - + /** * @brief Get environment variable value. @@ -174,12 +176,14 @@ * * @return Value of the environment variable or default if not found. */ - private function getenv_default($varname, $default_value, $type = null) { + private function getenv_default($varname, $default_value, $type = null) + { $_ = getenv($varname); - if ($_ === False) { + if ($_ === false) { $_ = $default_value; - } else { + } + else { if (is_null($type)) { $type = gettype($default_value); } @@ -377,6 +381,8 @@ $result = $def; } + $result = $this->getenv_default('ROUNDCUBE_' . strtoupper($name), $result); + $rcube = rcube::get_instance(); if ($name == 'timezone') { @@ -390,8 +396,6 @@ if ($result && is_string($result)) $result = explode(',', $result); } - - $result = $this->getenv_default('ROUNDCUBE_' . strtoupper($name), $result) $plugin = $rcube->plugins->exec_hook('config_get', array( 'name' => $name, 'default' => $def, 'result' => $result)); -- Gitblit v1.9.1