/** * Parse the footer into the template */ public function parse() { // get footer links $footerLinks = (array) FrontendNavigation::getFooterLinks(); // assign footer links $this->tpl->assign('footerLinks', $footerLinks); // initial value for footer HTML $siteHTMLFooter = (string) FrontendModel::getModuleSetting('core', 'site_html_footer', null); // facebook admins given? if (FrontendModel::getModuleSetting('core', 'facebook_admin_ids', null) !== null || FrontendModel::getModuleSetting('core', 'facebook_app_id', null) !== null) { // build correct locale switch (FRONTEND_LANGUAGE) { case 'en': $locale = 'en_US'; break; case 'zh': $locale = 'zh_CN'; break; case 'cs': $locale = 'cs_CZ'; break; case 'el': $locale = 'el_GR'; break; case 'ja': $locale = 'ja_JP'; break; case 'sv': $locale = 'sv_SE'; break; case 'uk': $locale = 'uk_UA'; break; default: $locale = strtolower(FRONTEND_LANGUAGE) . '_' . strtoupper(FRONTEND_LANGUAGE); } // add Facebook container $siteHTMLFooter .= "\n" . '<div id="fb-root"></div>' . "\n"; // add facebook JS $siteHTMLFooter .= '<script>' . "\n"; if (FrontendModel::getModuleSetting('core', 'facebook_app_id', null) !== null) { $siteHTMLFooter .= ' window.fbAsyncInit = function() {' . "\n"; $siteHTMLFooter .= ' FB.init({ appId: \'' . FrontendModel::getModuleSetting('core', 'facebook_app_id', null) . '\', status: true, cookie: true, xfbml: true, oauth: true });' . "\n"; $siteHTMLFooter .= ' jsFrontend.facebook.afterInit();' . "\n"; $siteHTMLFooter .= ' };' . "\n"; } $siteHTMLFooter .= ' (function() {' . "\n"; $siteHTMLFooter .= ' var e = document.createElement(\'script\'); e.async = true; e.src = document.location.protocol + "//connect.facebook.net/' . $locale . '/all.js#xfbml=1";' . "\n"; $siteHTMLFooter .= ' document.getElementById(\'fb-root\').appendChild(e);' . "\n"; $siteHTMLFooter .= ' }());' . "\n"; $siteHTMLFooter .= '</script>'; } // assign site wide html $this->tpl->assign('siteHTMLFooter', $siteHTMLFooter); }