diff options
-rw-r--r-- | lib.php | 30 |
1 files changed, 20 insertions, 10 deletions
@@ -189,24 +189,31 @@ P; * @param boolean $wrap = false should it be wrapped in a <header id="nav" /> element? * @param string $lang = 'en' * @param string $inject = null - * @param string $vhost = '//www.mageia.org' + * @param string $vhost = 'www.mageia.org' + * @param object $cache * * @return string HTML code */ -function _mgnav_html($wrap = false, $lang = 'en', $inject = null, $vhost = '//www.mageia.org') +function _mgnav_html($wrap = false, $lang = 'en', $inject = null, $vhost = 'www.mageia.org', $cache = null) { + $key = array($wrap, $lang, $inject, $vhost); + + if (!is_null($cache) && ($h = $cache->get($key))) { + return $h; + } + $lang = _lang_check($lang); - l10n::load($lang); + l10n::load($lang, $cache); $tn = array( - array('mageia', '$S/$L/map/', 'Mageia', l10n::_t('Go to mageia.org site map.')), - array('about', '$S/$L/about/', l10n::_t('About us', $_t), l10n::_t('Learn more about Mageia.')), - array('downloads', '$S/$L/downloads/', l10n::_t('Downloads', $_t), l10n::_t('Download Mageia ISO and updates.')), - array('support', '$S/$L/support/', l10n::_t('Support', $_t), l10n::_t('Get support from Mageia community.')), - array('community', '$S/$L/community/', l10n::_t('Community', $_t), l10n::_t('')), - array('contribute', '$S/$L/contribute/', l10n::_t('Contribute', $_t), l10n::_t('You too can build Mageia with us!')), - array('you', '//identity.mageia.org/', l10n::_t('You', $_t), l10n::_t('Your Mageia online account.')) + array('mageia', '//$S/$L/map/', 'Mageia', l10n::_t('Go to mageia.org site map.')), + array('about', '//$S/$L/about/', l10n::_t('About us'), l10n::_t('Learn more about Mageia.')), + array('downloads', '//$S/$L/downloads/', l10n::_t('Downloads'), l10n::_t('Download Mageia ISO and updates.')), + array('support', '//$S/$L/support/', l10n::_t('Support'), l10n::_t('Get support from Mageia community.')), + array('community', '//$S/$L/community/', l10n::_t('Community'), l10n::_t('')), + array('contribute', '//$S/$L/contribute/', l10n::_t('Contribute'), l10n::_t('You too can build Mageia with us!')), + array('you', '//identity.mageia.org/', l10n::_t('You'), l10n::_t('Your Mageia online account.')) // <search> ); @@ -233,6 +240,9 @@ function _mgnav_html($wrap = false, $lang = 'en', $inject = null, $vhost = '//ww if ($wrap) $h = sprintf('<header id="hmgn">%s</header>', $h); + if (!is_null($cache)) + $cache->set($key, $h); + return $h; } |