GlisWeb framework
_localization.tools.php
Vai alla documentazione di questo file.
1 <?php
2 
20 
21 $langs = array();
22 
23 if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
24  // break up string into pieces (languages and q factors)
25  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);
26 
27  if (count($lang_parse[1])) {
28  // create a list like "en" => 0.8
29  $langs = array_combine($lang_parse[1], $lang_parse[4]);
30 
31  // set default to 1 for any without q factor
32  foreach ($langs as $lang => $val) {
33  if ($val === '') $langs[$lang] = 1;
34  }
35 
36  // sort list based on value
37  arsort($langs, SORT_NUMERIC);
38  }
39 }
40 
41 return $langs;
42 
43  }
44 
45 
46 
47 
54 /* SDF funzione per ricodificare in UTF-8 (utile anche per contenuto da codificare in Json */
55 function string2utf8( $mixed ) {
56  if (is_array($mixed)) {
57  foreach ($mixed as $key => $value) {
58  $mixed[$key] = string2utf8($value);
59  }
60  } elseif (is_string($mixed)) {
61  return mb_convert_encoding($mixed, "UTF-8", "UTF-8");
62  }
63  return $mixed;
64 }
65 
66 
67 
68 
69 
70 
71 ?>
string2utf8( $mixed)
parseHttpRequestedLanguage()
if(! isset( $_REQUEST['__view__'][ $ct['view']['id']]['__extra__']['assegnato'])|| $_REQUEST['__view__'][ $ct['view']['id']]['__extra__']['assegnato']=='__me__') elseif($_REQUEST[ '__view__'][$ct[ 'view'][ 'id']][ '__extra__'][ 'assegnato']=='__nessuno__')