From abc8436bfdc331609342105d8c56e8bd6468e693 Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Fri, 11 May 2012 12:08:06 +0000 Subject: new global nav bar service --- _nav/lib.php | 151 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 _nav/lib.php (limited to '_nav/lib.php') diff --git a/_nav/lib.php b/_nav/lib.php new file mode 100644 index 000000000..7b7240ed9 --- /dev/null +++ b/_nav/lib.php @@ -0,0 +1,151 @@ + element? + * @param string $lang = 'en' + * @param string $inject = null + * @param string $vhost = '//www.mageia.org' + * + * @return string HTML code +*/ +function _mgnav_html($wrap = false, $lang = 'en', $inject = null, $vhost = '//www.mageia.org') +{ + if (!function_exists('_t')) { + function _t($s = null, $opt = null) { + if (!is_null($opt)) + $_t = $opt; + else { + global $_t; + } + return ($s == '' ? '-EMPTY-STRING-' : (array_key_exists($s, $_t) ? $_t[$s] : $s)); + } + } + $_t = array( + 'en' => array(), + 'fr' => array( + 'About us' => 'À propos', + 'Downloads' => 'Téléchargements', + 'Support' => 'Aide', + 'Community' => 'Communauté', + 'Contribute' => 'Contribuer', + 'You' => 'Vous' + ), + 'de' => array( + 'About us' => 'Über', + 'Downloads' => 'Herunterladen', + 'Support' => 'Unterstützung', + 'Community' => 'Gemeinshaft', + 'Contribute' => 'Mitwirken', + 'You' => 'You' + ), + 'el' => array( + 'About us' => 'Σχετικά', + 'Downloads' => 'Λήψεις', + 'Support' => 'Υποστήριξη', + 'Community' => 'Communauté', + 'Contribute' => 'Συνεισφέρετε', + 'You' => 'You' + ), + 'es' => array( + 'About us' => 'Acerca de', + 'Downloads' => 'Descargas', + 'Support' => 'Soporte', + 'Community' => 'Comunidad', + 'Contribute' => 'Contribuir', + 'You' => 'Yo' + ), + 'et' => array( + 'About us' => 'About', + 'Downloads' => 'Allalaadimine', + 'Support' => 'Support', + 'Community' => 'Community', + 'Contribute' => 'Contribuer', + 'You' => 'You' + ), + 'it' => array( + 'About us' => 'A proposito di', + 'Downloads' => 'Scarica', + 'Support' => 'Supporto', + 'Community' => 'Comunità', + 'Contribute' => 'Contribuire', + 'You' => 'You' + ), + 'pt' => array( + 'About us' => 'Acerca', + 'Downloads' => 'Transferências', + 'Support' => 'Suporte', + 'Community' => 'Comunidade', + 'Contribute' => 'Contribuir', + 'You' => 'You' + ), + 'ro' => array( + 'About us' => 'Despre noi', + 'Downloads' => 'Descărcați', + 'Support' => 'Suport', + 'Community' => 'Community', + 'Contribute' => 'Contribuiți', + 'You' => 'You' + ), + 'tr' => array( + 'About us' => 'Hakkında', + 'Downloads' => 'İndirmeler', + 'Support' => 'Destek', + 'Community' => 'Community', + 'Contribute' => 'Katkıda Bulunun', + 'You' => 'You' + ), + 'ru' => array( + 'Downloads' => 'Загрузить' + ) + ); + + $lang = array_key_exists($lang, $_t) ? $lang : 'en'; + $_t = $_t[$lang]; + $tn = array( + array('mageia', '$S/$L/map/', 'Mageia'), + array('about', '$S/$L/about/', _t('About us', $_t)), + array('downloads', '$S/$L/downloads/', _t('Downloads', $_t)), + array('support', '$S/$L/support/', _t('Support', $_t)), + array('community', '$S/$L/community/', _t('Community', $_t)), + array('contribute', '$S/$L/contribute/', _t('Contribute', $_t)), + array('you', '//identity.mageia.org/', _t('You', $_t)) + // + ); + + $s = array(); + foreach ($tn as $i) { + $s[] = sprintf('
  • %s
  • ', + str_replace( + array('$L', '$S'), + array($lang, $vhost), + $i[1] + ), + $i[0], + $i[2] + ); + } + + if (!is_null($inject)) + $s[] = sprintf('
  • %s
  • ', $inject); + + $s = implode($s); + $h = sprintf('', $s); + + if ($wrap) + $h = sprintf('
    %s
    ', $h); + + return $h; +} + +/** + * Returns CSS definition ready to be inserted into a HTML document. + * + * @return string +*/ +function _mgnav_style() +{ + return ''; +} -- cgit v1.2.1