From 077ccb298c8b49f55bdbea2f7ed754b3b852f8a5 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 15 Nov 2003 13:41:26 +0000 Subject: [PATCH] Use wfMsg()'s parameters --- includes/SpecialMovepage.php | 3 +-- includes/SpecialRecentchangeslinked.php | 3 +-- includes/SpecialShortpages.php | 2 +- includes/SpecialStatistics.php | 14 +++++--------- includes/SpecialUndelete.php | 7 +++---- includes/SpecialUnlockdb.php | 3 +-- includes/SpecialUpload.php | 12 ++++-------- 7 files changed, 16 insertions(+), 28 deletions(-) diff --git a/includes/SpecialMovepage.php b/includes/SpecialMovepage.php index 58471f8219..3eec064339 100644 --- a/includes/SpecialMovepage.php +++ b/includes/SpecialMovepage.php @@ -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 ) { diff --git a/includes/SpecialRecentchangeslinked.php b/includes/SpecialRecentchangeslinked.php index 6dd6952784..e2b1d3aafb 100644 --- a/includes/SpecialRecentchangeslinked.php +++ b/includes/SpecialRecentchangeslinked.php @@ -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" ); diff --git a/includes/SpecialShortpages.php b/includes/SpecialShortpages.php index deb3824515..bca5e8edc3 100644 --- a/includes/SpecialShortpages.php +++ b/includes/SpecialShortpages.php @@ -33,7 +33,7 @@ function wfSpecialShortpages() $sk = $wgUser->getSkin(); $s = "
    "; while ( $obj = wfFetchObject( $res ) ) { - $nb = str_replace( "$1", $obj->len, wfMsg( "nbytes" ) ); + $nb = wfMsg( "nbytes", $obj->len ); $link = $sk->makeKnownLink( $obj->cur_title, "" ); $s .= "
  1. {$link} ({$nb})
  2. \n"; } diff --git a/includes/SpecialStatistics.php b/includes/SpecialStatistics.php index b353ecf666..5b7f56c7be 100644 --- a/includes/SpecialStatistics.php +++ b/includes/SpecialStatistics.php @@ -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( "

    " . wfMsg( "userstats" ) . "

    \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 ); } diff --git a/includes/SpecialUndelete.php b/includes/SpecialUndelete.php index 0a339a887d..d58c97ee90 100644 --- a/includes/SpecialUndelete.php +++ b/includes/SpecialUndelete.php @@ -36,7 +36,7 @@ function wfSpecialUndelete( $par ) $wgOut->addHTML( "
  3. " . $sk->makeKnownLink( $wgLang->specialPage( "Undelete" ), $n, "target=" . urlencode($n) ) . " " . - str_replace( '$1', $row->count, wfMsg( "undeleterevisions" )) ); + wfMsg( "undeleterevisions", $row->count ) ); } $wgOut->addHTML( "\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
    \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; } ?> diff --git a/includes/SpecialUnlockdb.php b/includes/SpecialUnlockdb.php index 7baee945f3..e8d26e50c7 100644 --- a/includes/SpecialUnlockdb.php +++ b/includes/SpecialUnlockdb.php @@ -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 ) ); } } diff --git a/includes/SpecialUpload.php b/includes/SpecialUpload.php index d2b0dbf848..16ab982063 100644 --- a/includes/SpecialUpload.php +++ b/includes/SpecialUpload.php @@ -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( "

    " . wfMsg( "successfulupload" ) . "

    \n" ); - $text = str_replace( "$1", $ilink, wfMsg( "fileuploaded" ) ); - $text = str_replace( "$2", $dlink, $text ); + $text = wfMsg( "fileuploaded", $ilink, $dlink ); $wgOut->addHTML( "

    {$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" ) ); -- 2.20.1