Use wfMsg()'s parameters
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 15 Nov 2003 14:21:29 +0000 (14:21 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 15 Nov 2003 14:21:29 +0000 (14:21 +0000)
includes/DifferenceEngine.php
includes/EditPage.php

index 26c09ca..712690c 100644 (file)
@@ -18,7 +18,7 @@ class DifferenceEngine {
 
                $t = $wgTitle->getPrefixedText() . " (Diff: {$this->mOldid}, " .
                  "{$this->mNewid})";
-               $mtext = str_replace( "$1", $t, wfMsg( "missingarticle" ) );
+               $mtext = wfMsg( "missingarticle", $t );
 
                $wgOut->setArticleFlag( false );
                if ( ! $this->loadText() ) {
@@ -91,8 +91,7 @@ cellpadding=0 cellspacing='4px'><tr>
                        $this->mNewtext = $s->old_text;
 
                        $t = $wgLang->timeanddate( $s->old_timestamp, true );
-                       $this->mNewtitle = str_replace( "$1", "{$t}",
-                         wfMsg( "revisionasof" ) );
+                       $this->mNewtitle = wfMsg( "revisionasof", $t );
                }
                if ( 0 == $this->mOldid ) {
                        $sql = "SELECT old_timestamp,old_text FROM old USE INDEX (name_title_timestamp) WHERE " .
@@ -111,8 +110,7 @@ cellpadding=0 cellspacing='4px'><tr>
                $this->mOldtext = $s->old_text;
 
                $t = $wgLang->timeanddate( $s->old_timestamp, true );
-               $this->mOldtitle = str_replace( "$1", "{$t}",
-                 wfMsg( "revisionasof" ) );
+               $this->mOldtitle = wfMsg( "revisionasof", $t );
 
                return true;
        }
@@ -1059,8 +1057,8 @@ class TableDiffFormatter extends DiffFormatter
        }
     
        function _block_header( $xbeg, $xlen, $ybeg, $ylen ) {
-               $l1 = str_replace( "$1", $xbeg, wfMsg( "lineno" ) );
-               $l2 = str_replace( "$1", $ybeg, wfMsg( "lineno" ) );
+               $l1 = wfMsg( "lineno", $xbeg );
+               $l2 = wfMsg( "lineno", $ybeg );
 
                $r = "<tr><td colspan=2 align=left><strong>{$l1}</strong></td>\n" .
                  "<td colspan=2 align=left><strong>{$l2}</strong></td></tr>\n";
index f85a424..43aafdf 100644 (file)
@@ -171,8 +171,7 @@ class EditPage {
                $wgOut->setArticleFlag( false );
 
                if ( $isConflict ) {
-                       $s = str_replace( "$1", $this->mTitle->getPrefixedText(),
-                         wfMsg( "editconflict" ) );
+                       $s = wfMsg( "editconflict", $this->mTitle->getPrefixedText() );
                        $wgOut->setPageTitle( $s );
                        $wgOut->addHTML( wfMsg( "explainconflict" ) );
 
@@ -180,8 +179,7 @@ class EditPage {
                        $wpTextbox1 = $this->mArticle->getContent(true);
                        $wpEdittime = $this->mArticle->getTimestamp();
                } else {
-                       $s = str_replace( "$1", $this->mTitle->getPrefixedText(),
-                         wfMsg( "editing" ) );
+                       $s = wfMsg( "editing", $this->mTitle->getPrefixedText() );
 
                        if($section!="") { 
                                if($section=="new") {
@@ -210,7 +208,7 @@ class EditPage {
                $kblength = (int)(strlen( $wpTextbox1 ) / 1024);
                if( $kblength > 29 ) {
                        $wgOut->addHTML( "<strong>" . 
-                               str_replace( '$1', $kblength , wfMsg( "longpagewarning" ) )
+                               wfMsg( "longpagewarning", $kblength )
                                . "</strong>" );
                }
                
@@ -236,8 +234,8 @@ class EditPage {
                  wfMsg( "cancel" ) );
                $edithelp = $sk->makeKnownLink( wfMsg( "edithelppage" ),
                  wfMsg( "edithelp" ) );
-               $copywarn = str_replace( "$1", $sk->makeKnownLink(
-                 wfMsg( "copyrightpage" ) ), wfMsg( "copyrightwarning" ) );
+               $copywarn = wfMsg( "copyrightwarning", $sk->makeKnownLink(
+                 wfMsg( "copyrightpage" ) ) );
 
                $wpTextbox1 = wfEscapeHTML( $wpTextbox1 );
                $wpTextbox2 = wfEscapeHTML( $wpTextbox2 );
@@ -343,9 +341,7 @@ $wgLang->recodeForEdit( $wpTextbox1 ) .
                $link = "[[" . $wgLang->getNsText( Namespace::getUser() ) .
                  ":{$name}|{$name}]]";
 
-               $text = str_replace( "$1", $link, wfMsg( "blockedtext" ) );
-               $text = str_replace( "$2", $reason, $text );
-               $wgOut->addWikiText( $text );
+               $wgOut->addWikiText( wfMsg( "blockedtext", $link, $reason ) );
                $wgOut->returnToMain( false );
        }