summaryrefslogtreecommitdiff
path: root/includes/SpecialAllmessages.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2008-03-21 11:49:34 +0100
committerPierre Schmitz <pierre@archlinux.de>2008-03-21 11:49:34 +0100
commit086ae52d12011746a75f5588e877347bc0457352 (patch)
treee73263c7a29d0f94fafb874562610e16eb292ba8 /includes/SpecialAllmessages.php
parent749e7fb2bae7bbda855de3c9e319435b9f698ff7 (diff)
Update auf MediaWiki 1.12.0
Diffstat (limited to 'includes/SpecialAllmessages.php')
-rw-r--r--includes/SpecialAllmessages.php33
1 files changed, 26 insertions, 7 deletions
diff --git a/includes/SpecialAllmessages.php b/includes/SpecialAllmessages.php
index 4ba01e29..ee97b48e 100644
--- a/includes/SpecialAllmessages.php
+++ b/includes/SpecialAllmessages.php
@@ -13,7 +13,7 @@ function wfSpecialAllmessages() {
# The page isn't much use if the MediaWiki namespace is not being used
if( !$wgUseDatabaseMessages ) {
- $wgOut->addWikiText( wfMsg( 'allmessagesnotsupportedDB' ) );
+ $wgOut->addWikiMsg( 'allmessagesnotsupportedDB' );
return;
}
@@ -44,25 +44,44 @@ function wfSpecialAllmessages() {
wfProfileIn( __METHOD__ . '-output' );
if ( $ot == 'php' ) {
- $navText .= makePhp( $messages );
- $wgOut->addHTML( 'PHP | <a href="' . $wgTitle->escapeLocalUrl( 'ot=html' ) . '">HTML</a><pre>' . htmlspecialchars( $navText ) . '</pre>' );
+ $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' );
+ $wgOut->addHTML( '<a href="' . $wgTitle->escapeLocalUrl( 'ot=php' ) . '">PHP</a> | ' .
+ 'HTML | <a href="' . $wgTitle->escapeLocalUrl( 'ot=xml' ) . '">XML</a>' );
$wgOut->addWikiText( $navText );
- $wgOut->addHTML( makeHTMLText( $messages ) );
+ $wgOut->addHTML( wfAllMessagesMakeHTMLText( $messages ) );
}
wfProfileOut( __METHOD__ . '-output' );
wfProfileOut( __METHOD__ );
}
+function wfAllMessagesMakeXml( $messages ) {
+ global $wgLang;
+ $lang = $wgLang->getCode();
+ $txt = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
+ $txt .= "<messages lang=\"$lang\">\n";
+ foreach( $messages as $key => $m ) {
+ $txt .= "\t" . Xml::element( 'message', array( 'name' => $key ), $m['msg'] ) . "\n";
+ }
+ $txt .= "</messages>";
+ return $txt;
+}
+
/**
* Create the messages array, formatted in PHP to copy to language files.
* @param $messages Messages array.
* @return The PHP messages array.
* @todo Make suitable for language files.
*/
-function makePhp( $messages ) {
+function wfAllMessagesMakePhp( $messages ) {
global $wgLang;
$txt = "\n\n\$messages = array(\n";
foreach( $messages as $key => $m ) {
@@ -85,7 +104,7 @@ function makePhp( $messages ) {
* @param $messages Messages array.
* @return The HTML list of messages.
*/
-function makeHTMLText( $messages ) {
+function wfAllMessagesMakeHTMLText( $messages ) {
global $wgLang, $wgContLang, $wgUser;
wfProfileIn( __METHOD__ );