summaryrefslogtreecommitdiff
path: root/framework/I18N
diff options
context:
space:
mode:
authorxue <>2007-01-25 13:41:32 +0000
committerxue <>2007-01-25 13:41:32 +0000
commite30048fca6e6cb351f311b2dc039f31210db8eec (patch)
tree247dd1a7cebdfb9deb823735551292fa0f81177b /framework/I18N
parent643bf53bea5865f41ffc67ebd3e4fe7ddffeeb12 (diff)
merge from 3.0 branch till 1656.
Diffstat (limited to 'framework/I18N')
-rw-r--r--framework/I18N/core/HTTPNegotiator.php23
1 files changed, 11 insertions, 12 deletions
diff --git a/framework/I18N/core/HTTPNegotiator.php b/framework/I18N/core/HTTPNegotiator.php
index 31639a99..de5ff8e3 100644
--- a/framework/I18N/core/HTTPNegotiator.php
+++ b/framework/I18N/core/HTTPNegotiator.php
@@ -24,7 +24,7 @@ require_once(dirname(__FILE__).'/CultureInfo.php');
/**
* HTTPNegotiator class.
- *
+ *
* Get the language and charset information from the client browser.
*
* @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com>
@@ -35,19 +35,19 @@ class HTTPNegotiator
{
/**
* A list of languages accepted by the browser.
- * @var array
+ * @var array
*/
protected $languages;
/**
* A list of charsets accepted by the browser
- * @var array
+ * @var array
*/
protected $charsets;
/**
* Get a list of languages acceptable by the client browser
- * @return array languages ordered in the user browser preferences.
+ * @return array languages ordered in the user browser preferences.
*/
function getLanguages()
{
@@ -61,16 +61,15 @@ class HTTPNegotiator
//$basedir = CultureInfo::dataDir();
//$ext = CultureInfo::fileExt();
-
$info = new CultureInfo();
- foreach(explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $lang)
+ foreach(explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $lang)
{
// Cut off any q-value that might come after a semi-colon
if ($pos = strpos($lang, ';'))
$lang = trim(substr($lang, 0, $pos));
- if (strstr($lang, '-'))
+ if (strstr($lang, '-'))
{
$codes = explode('-',$lang);
if($codes[0] == 'i')
@@ -98,13 +97,13 @@ class HTTPNegotiator
if($info->validCulture($lang))
$this->languages[] = $lang;
}
-
+
return $this->languages;
}
/**
* Get a list of charsets acceptable by the client browser.
- * @return array list of charsets in preferable order.
+ * @return array list of charsets in preferable order.
*/
function getCharsets()
{
@@ -116,9 +115,9 @@ class HTTPNegotiator
if (!isset($_SERVER['HTTP_ACCEPT_CHARSET']))
return $this->charsets;
- foreach (explode(',', $_SERVER['HTTP_ACCEPT_CHARSET']) as $charset)
+ foreach (explode(',', $_SERVER['HTTP_ACCEPT_CHARSET']) as $charset)
{
- if (!empty($charset))
+ if (!empty($charset))
$this->charsets[] = preg_replace('/;.*/', '', $charset);
}
@@ -126,4 +125,4 @@ class HTTPNegotiator
}
}
-?> \ No newline at end of file
+?>