summaryrefslogtreecommitdiff
path: root/pear/HTTP.php
diff options
context:
space:
mode:
authorTomas V.V.Cox <cox@php.net>2002-01-07 00:11:11 +0000
committerTomas V.V.Cox <cox@php.net>2002-01-07 00:11:11 +0000
commited0106089786030c12187590628a867de181f237 (patch)
tree459491af79b744e07264bd1d70d9a942615c1314 /pear/HTTP.php
parent9a307e45504784826d2cd9f14a687eccdf51186f (diff)
downloadphp-git-ed0106089786030c12187590628a867de181f237.tar.gz
ws
Diffstat (limited to 'pear/HTTP.php')
-rw-r--r--pear/HTTP.php74
1 files changed, 37 insertions, 37 deletions
diff --git a/pear/HTTP.php b/pear/HTTP.php
index df5c38db36..ebb34688e2 100644
--- a/pear/HTTP.php
+++ b/pear/HTTP.php
@@ -77,44 +77,44 @@ class HTTP {
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 (isset($candidates)) {
- arsort($candidates);
- reset($candidates);
- return key($candidates);
- }
- }
+ * 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];
+ }
- /* 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;
- }
- }
+ 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);
+ }
+ }
+
+ /* 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;
}
}
-?>
+?> \ No newline at end of file