comparison Language.inc @ 66:74f7b64bdb78

Lots of documentation fixes, and removal of unused function getXmlContent
author Tom Fredrik Blenning Klaussen <bfg@blenning.no>
date Thu, 11 Oct 2012 22:11:33 +0200
parents 0f1e08cdfff2
children
comparison
equal deleted inserted replaced
65:7b87ec8b0842 66:74f7b64bdb78
1 <?php 1 <?php
2 /** 2 /**
3 * @file
4 * Functionality for determining language use 3 * Functionality for determining language use
5 */ 4 */
6 class Language { 5 class Language {
7 /** 6 /**
8 * Extracts the accepted languages from the GET query, sorted by 7 * Extracts the accepted languages from the GET query, sorted by
9 * preference(q-value). 8 * preference(q-value).
10 * 9 *
11 * @return associative array of language codes with q value 10 * @return associative array of language codes with q value
12 */ 11 */
13 function accepted() { 12 static function accepted() {
14 $langs = array(); 13 $langs = array();
15 14
16 if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { 15 if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
17 // break up string into pieces (languages and q factors) 16 // break up string into pieces (languages and q factors)
18 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); 17 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);