comparison accept-language.inc @ 53:2e6ba7259281

Merge
author Tom Fredrik "BFG" Klaussen <bfg@blenning.no>
date Thu, 11 Oct 2012 00:54:54 +0200
parents 3898353ed1d8 2cfea6e84694
children f938b292f046
comparison
equal deleted inserted replaced
52:3898353ed1d8 53:2e6ba7259281
1 <?php 1 <?php
2 <<<<<<< local
2 class Language { 3 class Language {
3 function acceptedLanguages() { 4 function acceptedLanguages() {
4 $langs = array(); 5 $langs = array();
6 =======
7 /**
8 * @file
9 * Functionality for determining language use
10 */
11
12 /**
13 * Extracts the accepted languages from the GET query, sorted by
14 * preference(q-value).
15 *
16 * @return associative array of language codes with q value
17 */
18 function acceptedLanguages() {
19 $langs = array();
20 >>>>>>> other
5 21
6 if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { 22 if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
7 // break up string into pieces (languages and q factors) 23 // break up string into pieces (languages and q factors)
8 preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $lang_parse); 24 preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $lang_parse);
9 25