public function getMsg() { global $wgUser, $wgContLang, $wgRequest, $wgServer, $wgMobileRedirectFormAction, $wgMobileDomain, $wgOut, $wgLanguageCode; wfProfileIn(__METHOD__); self::$disableImagesURL = $wgRequest->escapeAppendQuery('disableImages=1'); self::$enableImagesURL = $wgRequest->escapeAppendQuery('enableImages=1'); self::$disableMobileSiteURL = $wgRequest->escapeAppendQuery('mobileaction=disable_mobile_site'); self::$viewNormalSiteURL = $wgRequest->escapeAppendQuery('mobileaction=view_normal_site'); self::$currentURL = $wgRequest->getFullRequestURL(); self::$leaveFeedbackURL = $wgRequest->escapeAppendQuery('mobileaction=leave_feedback'); $skin = $wgUser->getSkin(); $copyright = $skin->getCopyright(); if (stristr($copyright, '<li class="noprint">') !== false) { $copyright = '<ul id="footer-info"><li>' . $copyright . '</li></ul>'; } // Need to stash the results of the "wfMsg" call before the Output Buffering handler // because at this point the database connection is shut down, etc. self::$messages['mobile-frontend-copyright'] = $copyright; foreach (self::$messageKeys as $messageKey) { if ($messageKey == 'mobile-frontend-leave-feedback-notice') { $linkText = wfMsg('mobile-frontend-leave-feedback-link-text'); $linkTarget = wfMsgNoTrans('mobile-frontend-feedback-page'); self::$messages[$messageKey] = wfMsgExt($messageKey, array('replaceafter'), Html::element('a', array('href' => Title::newFromText($linkTarget)->getFullURL(), 'target' => '_blank'), $linkText)); } elseif ($messageKey == 'mobile-frontend-feedback-page') { self::$messages[$messageKey] = wfMsgNoTrans($messageKey); } else { self::$messages[$messageKey] = wfMsg($messageKey); } } self::$dir = $wgContLang->getDir(); self::$code = $wgContLang->getCode(); $languageUrls = array(); $languageUrls[] = array('href' => self::$currentURL, 'text' => self::$htmlTitle, 'language' => $wgContLang->getLanguageName($wgLanguageCode), 'class' => 'interwiki-' . $wgLanguageCode, 'lang' => $wgLanguageCode); foreach ($wgOut->getLanguageLinks() as $l) { $tmp = explode(':', $l, 2); $class = 'interwiki-' . $tmp[0]; $lang = $tmp[0]; unset($tmp); $nt = Title::newFromText($l); if ($nt) { $parsedUrl = wfParseUrl($nt->getFullURL()); if (stristr($parsedUrl['host'], $wgMobileDomain) === false) { $hostParts = explode('.', $parsedUrl['host']); $parsedUrl['host'] = $hostParts[0] . $wgMobileDomain . $hostParts[1] . '.' . $hostParts[2]; } $fragmentDelimiter = isset($parsedUrl['fragment']) && $parsedUrl['fragment'] !== null ? '#' : ''; $queryDelimiter = isset($parsedUrl['query']) && $parsedUrl['query'] !== null ? '?' : ''; $languageUrl = $parsedUrl['scheme'] . $parsedUrl['delimiter'] . $parsedUrl['host'] . $parsedUrl['path']; if (isset($parsedUrl['query'])) { $languageUrl .= $queryDelimiter . $parsedUrl['query']; } if (isset($parsedUrl['fragment'])) { $languageUrl .= $fragmentDelimiter . $parsedUrl['fragment']; } $languageUrls[] = array('href' => $languageUrl, 'text' => $wgContLang->getLanguageName($nt->getInterwiki()) != '' ? $wgContLang->getLanguageName($nt->getInterwiki()) : $l, 'language' => $wgContLang->getLanguageName($lang), 'class' => $class, 'lang' => $lang); } } self::$languageUrls = $languageUrls; $nonMobileServerBaseURL = str_replace($wgMobileDomain, '.', $wgServer); self::$mobileRedirectFormAction = $wgMobileRedirectFormAction !== false ? $wgMobileRedirectFormAction : "{$nonMobileServerBaseURL}/w/mobileRedirect.php"; self::$mainPageUrl = Title::newMainPage()->getLocalUrl(); self::$randomPageUrl = $this->getRelativeURL(SpecialPage::getTitleFor('Randompage')->getLocalUrl()); wfProfileOut(__METHOD__); return true; }