Author: chabotc
Date: Sat Jun 7 06:21:17 2008
New Revision: 664336
URL: http://svn.apache.org/viewvc?rev=664336&view=rev
Log:
Fixes SHINDIG-352, an old debugging artifact that should've been gone a long
time ago
Modified:
incubator/shindig/trunk/php/src/gadgets/GadgetContext.php
Modified: incubator/shindig/trunk/php/src/gadgets/GadgetContext.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/GadgetContext.php?rev=664336&r1=664335&r2=664336&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/GadgetContext.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/GadgetContext.php Sat Jun 7
06:21:17 2008
@@ -158,24 +158,9 @@
private function instanceLocale()
{
- $language = 'all';
- $country = 'all';
- if (! empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
- $acceptLanguage = explode(';',
$_SERVER['HTTP_ACCEPT_LANGUAGE']);
- $acceptLanguage = $acceptLanguage[0];
- if (strpos($acceptLanguage, '-') !== false) {
- $lang = explode('-', $acceptLanguage);
- $language = $lang[0];
- $country = $lang[1];
- if (strpos($country, ',') !== false) {
- $country = explode(',', $country);
- $country = $country[0];
- }
- } else {
- $language = $acceptLanguage;
- }
-
- }
+ // Get language and country params, try the GET params first,
if their not set try the POST, else use 'all' as default
+ $language = !empty($_GET['lang']) ? $_GET['lang'] :
(!empty($_POST['lang']) ? $_POST['lang'] : 'all');
+ $country = !empty($_GET['country']) ? $_GET['country'] :
(!empty($_POST['country']) ? $_POST['country'] : 'all');
return new Locale($language, $country);
}