From 83b43d49ce0f9b019776dbbc03230bf3c283fdfc Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 15 Nov 2003 14:32:58 +0000 Subject: [PATCH] Use wfMsg()'s parameters --- includes/GlobalFunctions.php | 25 ++++++++----------------- includes/OutputPage.php | 30 ++++++++++-------------------- 2 files changed, 18 insertions(+), 37 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 0de9ac302c..9efda15070 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -540,10 +540,9 @@ function wfRecordUpload( $name, $oldver, $size, $desc ) } $log = new LogPage( wfMsg( "uploadlogpage" ), wfMsg( "uploadlogpagetext" ) ); - $da = str_replace( "$1", "[[:" . $wgLang->getNsText( - Namespace::getImage() ) . ":{$name}|{$name}]]", - wfMsg( "uploadedimage" ) ); - $ta = str_replace( "$1", $name, wfMsg( "uploadedimage" ) ); + $da = wfMsg( "uploadedimage", "[[:" . $wgLang->getNsText( + Namespace::getImage() ) . ":{$name}|{$name}]]" ); + $ta = wfMsg( "uploadedimage", $name ); $log->addEntry( $da, $desc, $ta ); } @@ -552,24 +551,19 @@ function wfRecordUpload( $name, $oldver, $size, $desc ) function wfShowingResults( $offset, $limit ) { - $top = str_replace( "$1", $limit, wfMsg( "showingresults" ) ); - $top = str_replace( "$2", $offset+1, $top ); - return $top; + return wfMsg( "showingresults", $limit, $offset+1 ); } function wfShowingResultsNum( $offset, $limit, $num ) { - $top = str_replace( "$1", $limit, wfMsg( "showingresultsnum" ) ); - $top = str_replace( "$2", $offset+1, $top ); - $top = str_replace( "$3", $num, $top ); - return $top; + return wfMsg( "showingresultsnum", $limit, $offset+1, $num ); } function wfViewPrevNext( $offset, $limit, $link, $query = "" ) { global $wgUser; - $prev = str_replace( "$1", $limit, wfMsg( "prevn" ) ); - $next = str_replace( "$1", $limit, wfMsg( "nextn" ) ); + $prev = wfMsg( "prevn", $limit ); + $next = wfMsg( "nextn", $limit ); $sk = $wgUser->getSkin(); if ( 0 != $offset ) { @@ -591,10 +585,7 @@ function wfViewPrevNext( $offset, $limit, $link, $query = "" ) wfNumLink( $offset, 250, $link, $query ) . " | " . wfNumLink( $offset, 500, $link, $query ); - $sl = str_replace( "$1", $plink, wfMsg( "viewprevnext" ) ); - $sl = str_replace( "$2", $nlink, $sl ); - $sl = str_replace( "$3", $nums, $sl ); - return $sl; + return wfMsg( "viewprevnext", $plink, $nlink, $nums ); } function wfNumLink( $offset, $limit, $link, $query = "" ) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index c20c1d71e8..1bf0923483 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -368,8 +368,7 @@ class OutputPage { $sk = $wgUser->getSkin(); $ap = $sk->makeKnownLink( wfMsg( "administrators" ), "" ); - $text = str_replace( "$1", $ap, wfMsg( "sysoptext" ) ); - $this->addHTML( $text ); + $this->addHTML( wfMsg( "sysoptext", $ap ) ); $this->returnToMain(); } @@ -385,8 +384,7 @@ class OutputPage { $sk = $wgUser->getSkin(); $ap = $sk->makeKnownLink( wfMsg( "administrators" ), "" ); - $text = str_replace( "$1", $ap, wfMsg( "developertext" ) ); - $this->addHTML( $text ); + $this->addHTML( wfMsg( "developertext", $ap ) ); $this->returnToMain(); } @@ -401,7 +399,7 @@ class OutputPage { if ( $wgCommandLineMode ) { $msg = wfMsgNoDB( "dberrortextcl" ); } else { - $msg = wfMsgNoDB( "dberrortextcl" ); + $msg = wfMsgNoDB( "dberrortext" ); } $msg = str_replace( "$1", htmlspecialchars( wfLastDBquery() ), $msg ); @@ -463,35 +461,27 @@ class OutputPage { function unexpectedValueError( $name, $val ) { - $msg = str_replace( "$1", $name, wfMsg( "unexpected" ) ); - $msg = str_replace( "$2", $val, $msg ); - $this->fatalError( $msg ); + $this->fatalError( wfMsg( "unexpected", $name, $val ) ); } function fileCopyError( $old, $new ) { - $msg = str_replace( "$1", $old, wfMsg( "filecopyerror" ) ); - $msg = str_replace( "$2", $new, $msg ); - $this->fatalError( $msg ); + $this->fatalError( wfMsg( "filecopyerror", $old, $new ) ); } function fileRenameError( $old, $new ) { - $msg = str_replace( "$1", $old, wfMsg( "filerenameerror" ) ); - $msg = str_replace( "$2", $new, $msg ); - $this->fatalError( $msg ); + $this->fatalError( wfMsg( "filerenameerror", $old, $new ) ); } function fileDeleteError( $name ) { - $msg = str_replace( "$1", $name, wfMsg( "filedeleteerror" ) ); - $this->fatalError( $msg ); + $this->fatalError( wfMsg( "filedeleteerror", $name ) ); } function fileNotFoundError( $name ) { - $msg = str_replace( "$1", $name, wfMsg( "filenotfound" ) ); - $this->fatalError( $msg ); + $this->fatalError( wfMsg( "filenotfound", $name ) ); } function returnToMain( $auto = true ) @@ -504,7 +494,7 @@ class OutputPage { } $link = $sk->makeKnownLink( $returnto, "" ); - $r = str_replace( "$1", $link, wfMsg( "returnto" ) ); + $r = wfMsg( "returnto", $link ); if ( $auto ) { $wgOut->addMeta( "http:Refresh", "10;url=" . wfLocalUrlE( wfUrlencode( $returnto ) ) ); @@ -560,7 +550,7 @@ class OutputPage { if ( count ( $articles ) > 0 ) { asort ( $articles ) ; - $h = str_replace ( "$1" , $ti[1] , wfMsg("category_header") ) ; + $h = wfMsg( "category_header", $ti[1] ); $r .= "

{$h}

\n" ; $r .= implode ( ", " , $articles ) ; } -- 2.20.1