cvs: phpweb /include langchooser.inc

From: Date: Sat, 17 May 2003 09:14:42 +0000
Subject: cvs: phpweb /include langchooser.inc
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-17756@lists.php.net to get a copy of this message
goba Sat May 17 05:14:42 2003 EDT Modified files: /phpweb/include langchooser.inc Log: Use spaces not tabs Index: phpweb/include/langchooser.inc diff -u phpweb/include/langchooser.inc:1.23 phpweb/include/langchooser.inc:1.24 --- phpweb/include/langchooser.inc:1.23 Sat May 17 05:13:03 2003 +++ phpweb/include/langchooser.inc Sat May 17 05:14:42 2003 @@ -1,6 +1,6 @@ <?php // -*- C++ -*- -// $Id: langchooser.inc,v 1.23 2003/05/17 09:13:03 goba Exp $ +// $Id: langchooser.inc,v 1.24 2003/05/17 09:14:42 goba Exp $ /* @@ -103,21 +103,21 @@ // Check if we have $_SERVER['HTTP_ACCEPT_LANGUAGE'] set and // it no longer breaks if you only have one language set :) - if (isset ($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { - $browser_accept = explode(",", $_SERVER['HTTP_ACCEPT_LANGUAGE']); + if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { + $browser_accept = explode(",", $_SERVER['HTTP_ACCEPT_LANGUAGE']); - // Go through all language preference specs - for ($i = 0; $i < count($browser_accept); $i++) { - // The language part is either a code or a code with a quality - // We cannot do anything with a * code, so it is skipped - // If the quality is missing, it is assumed to be 1 according to the RFC - if (preg_match("!([a-z-]+)(;q=([0-9\\.]+))?!", trim($browser_accept[$i]), $found)) { - $quality = (isset($found[3]) ? (float) $found[3] : 1.0); - $browser_langs[] = array($found[1], $quality); - } - unset($found); - } - } + // Go through all language preference specs + for ($i = 0; $i < count($browser_accept); $i++) { + // The language part is either a code or a code with a quality + // We cannot do anything with a * code, so it is skipped + // If the quality is missing, it is assumed to be 1 according to the RFC + if (preg_match("!([a-z-]+)(;q=([0-9\\.]+))?!", trim($browser_accept[$i]), $found)) { + $quality = (isset($found[3]) ? (float) $found[3] : 1.0); + $browser_langs[] = array($found[1], $quality); + } + unset($found); + } + } // Order the codes by quality usort($browser_langs, "language_accept_order");

« previous php.mirrors (#17756) next »