From 086ae52d12011746a75f5588e877347bc0457352 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 21 Mar 2008 11:49:34 +0100 Subject: Update auf MediaWiki 1.12.0 --- includes/SpecialAllmessages.php | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'includes/SpecialAllmessages.php') 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 | HTML
' . htmlspecialchars( $navText ) . '
' ); + $navText .= wfAllMessagesMakePhp( $messages ); + $wgOut->addHTML( 'PHP | HTML | ' . + 'XML' . + '
' . htmlspecialchars( $navText ) . '
' ); + } else if ( $ot == 'xml' ) { + $wgOut->disable(); + header( 'Content-type: text/xml' ); + echo wfAllMessagesMakeXml( $messages ); } else { - $wgOut->addHTML( 'PHP | HTML' ); + $wgOut->addHTML( 'PHP | ' . + 'HTML | XML' ); $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 = "\n"; + $txt .= "\n"; + foreach( $messages as $key => $m ) { + $txt .= "\t" . Xml::element( 'message', array( 'name' => $key ), $m['msg'] ) . "\n"; + } + $txt .= ""; + 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__ ); -- cgit v1.2.2