Commit | Line | Data |
---|---|---|
c495c100 P |
1 | <?php |
2 | ||
3 | /***************************************************************************\ | |
4 | * SPIP, Systeme de publication pour l'internet * | |
5 | * * | |
6 | * Copyright (c) 2001-2007 * | |
7 | * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * | |
8 | * * | |
9 | * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * | |
10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * | |
11 | \***************************************************************************/ | |
12 | ||
13 | if (!defined("_ECRIRE_INC_VERSION")) return; #securite | |
14 | ||
15 | // #MENU_LANG_ECRIRE affiche le menu des langues de l'espace privé | |
16 | // et preselectionne celle la globale $lang | |
17 | // ou de l'arguemnt fourni: #MENU_LANG_ECRIRE{#ENV{malangue}} | |
18 | ||
19 | // http://doc.spip.org/@balise_MENU_LANG_ECRIRE | |
20 | function balise_MENU_LANG_ECRIRE ($p) { | |
21 | ||
22 | return calculer_balise_dynamique($p,'MENU_LANG_ECRIRE', array('lang')); | |
23 | } | |
24 | ||
25 | // s'il n'y a qu'une langue proposee eviter definitivement la balise ?php | |
26 | // http://doc.spip.org/@balise_MENU_LANG_ECRIRE_stat | |
27 | function balise_MENU_LANG_ECRIRE_stat ($args, $filtres) { | |
28 | global $all_langs; | |
29 | include_spip('inc/lang'); | |
30 | if (strpos($all_langs,',') === false) return ''; | |
31 | return $filtres ? $filtres : $args; | |
32 | } | |
33 | ||
34 | // normalement $opt sera toujours non vide suite au test ci-dessus | |
35 | // http://doc.spip.org/@balise_MENU_LANG_ECRIRE_dyn | |
36 | function balise_MENU_LANG_ECRIRE_dyn($opt) { | |
37 | return menu_lang_pour_tous('var_lang_ecrire', $opt); | |
38 | } | |
39 | ||
40 | // http://doc.spip.org/@menu_lang_pour_tous | |
41 | function menu_lang_pour_tous($nom, $default) { | |
42 | include_spip('inc/lang'); | |
43 | ||
44 | if ($GLOBALS['spip_lang'] <> $default) { | |
45 | lang_select($default); # et remplace | |
46 | if ($GLOBALS['spip_lang'] <> $default) { | |
47 | $default = ''; # annule tout choix par defaut | |
48 | lang_dselect(); #annule la selection | |
49 | } | |
50 | } | |
51 | ||
52 | $opt = liste_options_langues($nom, $default); | |
53 | if (!$opt) | |
54 | return ''; | |
55 | ||
56 | $cible = str_replace('&', '&', parametre_url(self( /* racine */ true), 'lang' , '')); # lien a partir de / | |
57 | $post = parametre_url(generer_url_action('cookie'), 'url', $cible, '&'); | |
58 | ||
59 | return array('formulaires/menu_lang', | |
60 | 3600, | |
61 | array('nom' => $nom, | |
62 | 'url' => $post, | |
63 | 'langues' => $opt | |
64 | ) | |
65 | ); | |
66 | } | |
67 | ||
68 | ?> |