Use wfMsg()'s parameters
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 15 Nov 2003 13:41:26 +0000 (13:41 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 15 Nov 2003 13:41:26 +0000 (13:41 +0000)
includes/SpecialMovepage.php
includes/SpecialRecentchangeslinked.php
includes/SpecialShortpages.php
includes/SpecialStatistics.php
includes/SpecialUndelete.php
includes/SpecialUnlockdb.php
includes/SpecialUpload.php

index 58471f8..3eec064 100644 (file)
@@ -219,8 +219,7 @@ class MovePageForm {
                $fields = array( "oldtitle", "newtitle" );
                wfCleanFormFields( $fields );
 
-               $text = str_replace( "$1", $oldtitle, wfMsg( "pagemovedtext" ) );
-               $text = str_replace( "$2", $newtitle, $text );
+               $text = wfMsg( "pagemovedtext", $oldtitle, $newtitle );
                $wgOut->addWikiText( $text );
 
                if ( 1 == $talkmoved ) {
index 6dd6952..e2b1d3a 100644 (file)
@@ -19,8 +19,7 @@ function wfSpecialRecentchangeslinked( $par = NULL )
                return;
        }
        $nt = Title::newFromURL( $target );
-       $sub = str_replace( "$1", $nt->getPrefixedText(), wfMsg( "rclsub" ) );
-       $wgOut->setSubtitle( $sub );
+       $wgOut->setSubtitle( wfMsg( "rclsub", $nt->getPrefixedText() ) );
 
        if ( ! $days ) {
                $days = $wgUser->getOption( "rcdays" );
index deb3824..bca5e8e 100644 (file)
@@ -33,7 +33,7 @@ function wfSpecialShortpages()
        $sk = $wgUser->getSkin();
        $s = "<ol start=" . ( $offset + 1 ) . ">";
        while ( $obj = wfFetchObject( $res ) ) {
-               $nb = str_replace( "$1", $obj->len, wfMsg( "nbytes" ) );
+               $nb = wfMsg( "nbytes", $obj->len );
                $link = $sk->makeKnownLink( $obj->cur_title, "" );
                $s .= "<li>{$link} ({$nb})</li>\n";
        }
index b353ecf..5b7f56c 100644 (file)
@@ -20,12 +20,10 @@ function wfSpecialStatistics()
        $edits = $row->ss_total_edits;
        $good = $row->ss_good_articles;
 
-       $text = str_replace( "$1", $total, wfMsg( "sitestatstext" ) );
-       $text = str_replace( "$2", $good, $text );
-       $text = str_replace( "$3", $views, $text );
-       $text = str_replace( "$4", $edits, $text );
-       $text = str_replace( "$5", sprintf( "%.2f", $total ? $edits / $total : 0 ), $text );
-       $text = str_replace( "$6", sprintf( "%.2f", $edits ? $views / $edits : 0 ), $text );
+       $text = wfMsg( "sitestatstext",
+               $total, $good, $views, $edits,
+               sprintf( "%.2f", $total ? $edits / $total : 0 ),
+               sprintf( "%.2f", $edits ? $views / $edits : 0 ) );
 
        $wgOut->addHTML( $text );
        $wgOut->addHTML( "<h2>" . wfMsg( "userstats" ) . "</h2>\n" );
@@ -44,9 +42,7 @@ function wfSpecialStatistics()
        $sk = $wgUser->getSkin();
        $ap = $sk->makeKnownLink( wfMsg( "administrators" ), "" );
 
-       $text = str_replace( "$1", $total, wfMsg( "userstatstext" ) );
-       $text = str_replace( "$2", $admins, $text );
-       $text = str_replace( "$3", $ap, $text );
+       $text = wfMsg( "userstatstext", $total, $admins, $ap );
        $wgOut->addHTML( $text );
 }
 
index 0a339a8..d58c97e 100644 (file)
@@ -36,7 +36,7 @@ function wfSpecialUndelete( $par )
        $wgOut->addHTML( "<li>" .
          $sk->makeKnownLink( $wgLang->specialPage( "Undelete" ),
           $n, "target=" . urlencode($n) ) . " " .
-         str_replace( '$1', $row->count, wfMsg( "undeleterevisions" )) );
+                 wfMsg( "undeleterevisions", $row->count ) );
     }
     $wgOut->addHTML( "</ul>\n" );
     
@@ -53,8 +53,7 @@ function wfSpecialUndelete( $par )
     $row = wfFetchObject( $ret );
     
     $wgOut->setPagetitle( wfMsg( "undeletepage" ) );
-    $wgOut->addWikiText( "(" . str_replace("$1",
-      $wgLang->date($timestamp, true), wfMsg( "undeleterevision" ))
+    $wgOut->addWikiText( "(" . wfMsg( "undeleterevision", $wgLang->date($timestamp, true) )
       . ")\n<hr>\n" . $row->ar_text );
     
        return 0;
@@ -173,7 +172,7 @@ function wfSpecialUndelete( $par )
                $log = new LogPage( wfMsg( "dellogpage" ), wfMsg( "dellogpagetext" ) );
                $log->addEntry( wfMsg( "undeletedarticle", $target ), "" );
 
-               $wgOut->addwikitext(str_replace("$1", $target, wfmsg("undeletedtext")));
+               $wgOut->addWikiText( wfMsg( "undeletedtext", $target ) );
                return 0;
        }
 ?>
index 7baee94..e8d26e5 100644 (file)
@@ -74,8 +74,7 @@ class DBUnlockForm {
 
                $wgOut->setPagetitle( wfMsg( "unlockdb" ) );
                $wgOut->setSubtitle( wfMsg( "unlockdbsuccesssub" ) );
-               $text = str_replace( "$1", $ip, wfMsg( "unlockdbsuccesstext" ) );
-               $wgOut->addWikiText( $text );
+               $wgOut->addWikiText( wfMsg( "unlockdbsuccesstext", $ip ) );
        }
 }
 
index d2b0dbf..16ab982 100644 (file)
@@ -84,15 +84,12 @@ function processUpload()
                saveUploadedFile();
                if ( ( ! $wpIgnoreWarning ) &&
                  ( 0 != strcmp( ucfirst( $basename ), $wpUploadSaveName ) ) ) {
-                       $warn = str_replace( "$1", $wpUploadSaveName,
-                         wfMsg( "badfilename" ) );
-                       return uploadWarning( $warn );
+                       return uploadWarning( wfMsg( "badfilename", $wpUploadSaveName ) );
                }
                $extensions = array( "png", "jpg", "jpeg", "ogg" ); 
                if ( ( ! $wpIgnoreWarning ) &&
                  ( ! in_array( strtolower( $ext ), $extensions ) ) ) {
-                       $warn = str_replace( "$1", $ext, wfMsg( "badfiletype" ) );
-                       return uploadWarning( $warn );
+                       return uploadWarning( wfMsg( "badfiletype", $ext ) );
                }
                if ( ( ! $wpIgnoreWarning ) && ( $wpUploadSize > 150000 ) ) {
                        return uploadWarning( WfMsg( "largefile" ) );
@@ -111,8 +108,7 @@ function processUpload()
        $dlink = $sk->makeKnownLink( $dname, $dname );
 
        $wgOut->addHTML( "<h2>" . wfMsg( "successfulupload" ) . "</h2>\n" );
-       $text = str_replace( "$1", $ilink, wfMsg( "fileuploaded" ) );
-       $text = str_replace( "$2", $dlink, $text );
+       $text = wfMsg( "fileuploaded", $ilink, $dlink );
        $wgOut->addHTML( "<p>{$text}\n" );
        $wgOut->returnToMain( false );
 }
@@ -246,7 +242,7 @@ function mainUploadForm( $msg )
 
        $clink = $sk->makeKnownLink( wfMsg( "copyrightpage" ),
          wfMsg( "copyrightpagename" ) );
-       $ca = str_replace( "$1", $clink, wfMsg( "affirmation" ) );
+       $ca = wfMsg( "affirmation", $clink );
        $iw = wfMsg( "ignorewarning" );
 
        $action = wfLocalUrl( $wgLang->specialPage( "Upload" ) );