/** * Constructor. */ function wfSpecialAllmessages() { global $wgOut, $wgRequest, $wgMessageCache, $wgTitle; global $wgUseDatabaseMessages, $wgLang; # The page isn't much use if the MediaWiki namespace is not being used if (!$wgUseDatabaseMessages) { $wgOut->addWikiMsg('allmessagesnotsupportedDB'); return; } wfProfileIn(__METHOD__); wfProfileIn(__METHOD__ . '-setup'); $ot = $wgRequest->getText('ot'); $navText = wfMsg('allmessagestext'); # Make sure all extension messages are available $wgMessageCache->loadAllMessages(); $sortedArray = array_merge(Language::getMessagesFor('en'), $wgMessageCache->getExtensionMessagesFor('en')); ksort($sortedArray); $messages = array(); foreach ($sortedArray as $key => $value) { $messages[$key]['enmsg'] = $value; $messages[$key]['statmsg'] = wfMsgReal($key, array(), false, false, false); $messages[$key]['msg'] = wfMsgNoTrans($key); $sortedArray[$key] = NULL; // trade bytes from $sortedArray to this } unset($sortedArray); // trade bytes from $sortedArray to this wfProfileOut(__METHOD__ . '-setup'); wfProfileIn(__METHOD__ . '-output'); $wgOut->addScriptFile('allmessages.js'); if ($ot == 'php') { $navText .= wfAllMessagesMakePhp($messages); $wgOut->addHTML($wgLang->pipeList(array('PHP', '<a href="' . $wgTitle->escapeLocalUrl('ot=html') . '">HTML</a>', '<a href="' . $wgTitle->escapeLocalUrl('ot=xml') . '">XML</a>' . '<pre>' . htmlspecialchars($navText) . '</pre>'))); } else { if ($ot == 'xml') { $wgOut->disable(); header('Content-type: text/xml'); echo wfAllMessagesMakeXml($messages); } else { $wgOut->addHTML($wgLang->pipeList(array('<a href="' . $wgTitle->escapeLocalUrl('ot=php') . '">PHP</a>', 'HTML', '<a href="' . $wgTitle->escapeLocalUrl('ot=xml') . '">XML</a>'))); $wgOut->addWikiText($navText); $wgOut->addHTML(wfAllMessagesMakeHTMLText($messages)); } } wfProfileOut(__METHOD__ . '-output'); wfProfileOut(__METHOD__); }
/** * Constructor. */ function wfSpecialAllmessages() { global $wgOut, $wgRequest, $wgMessageCache, $wgTitle; global $wgUseDatabaseMessages; # The page isn't much use if the MediaWiki namespace is not being used if (!$wgUseDatabaseMessages) { $wgOut->addWikiMsg('allmessagesnotsupportedDB'); return; } wfProfileIn(__METHOD__); wfProfileIn(__METHOD__ . '-setup'); $ot = $wgRequest->getText('ot'); $navText = wfMsg('allmessagestext'); # Make sure all extension messages are available $wgMessageCache->loadAllMessages(); $wgOut->addScript("<script src='/skins/common/allmessages.js'></script>"); $sortedArray = array_merge(Language::getMessagesFor('en'), $wgMessageCache->getExtensionMessagesFor('en')); ksort($sortedArray); $messages = array(); $wgMessageCache->disableTransform(); foreach ($sortedArray as $key => $value) { $messages[$key]['enmsg'] = $value; $messages[$key]['statmsg'] = wfMsgNoDb($key); $messages[$key]['msg'] = wfMsg($key); } $wgMessageCache->enableTransform(); wfProfileOut(__METHOD__ . '-setup'); wfProfileIn(__METHOD__ . '-output'); if ($ot == 'php') { $navText .= wfAllMessagesMakePhp($messages); $wgOut->addHTML('PHP | <a href="' . $wgTitle->escapeLocalUrl('ot=html') . '">HTML</a> | ' . '<a href="' . $wgTitle->escapeLocalUrl('ot=xml') . '">XML</a>' . '<pre>' . htmlspecialchars($navText) . '</pre>'); } else { if ($ot == 'xml') { $wgOut->disable(); header('Content-type: text/xml'); echo wfAllMessagesMakeXml($messages); } else { $wgOut->addHTML('<a href="' . $wgTitle->escapeLocalUrl('ot=php') . '">PHP</a> | ' . 'HTML | <a href="' . $wgTitle->escapeLocalUrl('ot=xml') . '">XML</a>'); $wgOut->addWikiText($navText); $wgOut->addHTML(wfAllMessagesMakeHTMLText($messages)); } } wfProfileOut(__METHOD__ . '-output'); wfProfileOut(__METHOD__); }