From: Martin Jansen Date: Tue, 18 Dec 2001 14:13:43 +0000 (+0000) Subject: * Convert tabs to spaces. X-Git-Tag: PRE_ISSET_PATCH~484 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4b389679c407d107846642192e2f7fb9098be6fb;p=php * Convert tabs to spaces. --- diff --git a/pear/HTTP.php b/pear/HTTP.php index 594642c8bb..df5c38db36 100644 --- a/pear/HTTP.php +++ b/pear/HTTP.php @@ -74,46 +74,47 @@ class HTTP { * @author Stig Bakken */ function negotiateLanguage(&$supported, $default = 'en_US') { - global $HTTP_SERVER_VARS; + global $HTTP_SERVER_VARS; - /* If the client has sent an Accept-Language: header, see if - * it contains a language we support. - */ - if (isset($HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE'])) { - $accepted = split(',[[:space:]]*', $HTTP_ACCEPT_LANGUAGE); - for ($i = 0; $i < count($accepted); $i++) { - if (eregi('^([a-z]+);[[:space:]]*q=([0-9\.]+)', $accepted[$i], &$arr)) { - $q = (double)$arr[2]; - $l = $arr[1]; - } else { - $q = 42; - $l = $accepted[$i]; - } - if (!empty($supported[$l]) && ($q > 0.0)) { - if ($q == 42) { - return $l; - } - $candidates[$l] = $q; - } + /* If the client has sent an Accept-Language: header, see if + * it contains a language we support. + */ + if (isset($HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE'])) { + $accepted = split(',[[:space:]]*', $HTTP_ACCEPT_LANGUAGE); + for ($i = 0; $i < count($accepted); $i++) { + if (eregi('^([a-z]+);[[:space:]]*q=([0-9\.]+)', $accepted[$i], &$arr)) { + $q = (double)$arr[2]; + $l = $arr[1]; + } else { + $q = 42; + $l = $accepted[$i]; + } + + if (!empty($supported[$l]) && ($q > 0.0)) { + if ($q == 42) { + return $l; + } + $candidates[$l] = $q; + } + } + if (isset($candidates)) { + arsort($candidates); + reset($candidates); + return key($candidates); + } } - if (isset($candidates)) { - arsort($candidates); - reset($candidates); - return key($candidates); - } - } - /* Check for a valid language code in the top-level domain of - * the client's host address. - */ - if (ereg("\.[^\.]+$", $HTTP_SERVER_VARS['REMOTE_HOST'], &$arr)) { - $lang = strtolower($arr[1]); - if (!empty($supported[$lang])) { - return $lang; + /* Check for a valid language code in the top-level domain of + * the client's host address. + */ + if (ereg("\.[^\.]+$", $HTTP_SERVER_VARS['REMOTE_HOST'], &$arr)) { + $lang = strtolower($arr[1]); + if (!empty($supported[$lang])) { + return $lang; + } } - } - return $default; + return $default; } } ?>