From 5ce1ed2b1b5328b7a50f140ea9c54aca505668cf Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sun, 6 Feb 2011 12:38:33 +0000 Subject: [PATCH] * Changed all calls to wfMsgWikiHtml() in core * Now replacing parameter before parsing where possible * Used 'parseinline' for 'nosuchuser' message in Special:Userlogin for consistency with other error messages --- includes/EditPage.php | 2 +- includes/OutputPage.php | 2 +- includes/specials/SpecialAllpages.php | 2 +- includes/specials/SpecialConfirmemail.php | 2 +- includes/specials/SpecialPrefixindex.php | 2 +- includes/specials/SpecialUndelete.php | 20 +++++++++----------- includes/specials/SpecialUpload.php | 8 ++++---- includes/specials/SpecialUserlogin.php | 6 +++--- includes/specials/SpecialWatchlist.php | 4 ++-- 9 files changed, 23 insertions(+), 25 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index 57d2590ce0..29690148d1 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -2049,7 +2049,7 @@ HTML $wgOut->setRobotPolicy( 'noindex,nofollow' ); $wgOut->setArticleRelated( false ); - $wgOut->addHTML( wfMsgWikiHtml( 'whitelistedittext', $loginLink ) ); + $wgOut->addWikiMsgArray( 'whitelistedittext', array( $loginLink ), array( 'replaceafter' ) ); $wgOut->returnToMain( false, $wgTitle ); } diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 946a41ab97..36b6124946 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -2063,7 +2063,7 @@ class OutputPage { array( 'returnto' => $this->getTitle()->getPrefixedText() ), array( 'known', 'noclasses' ) ); - $this->addHTML( wfMsgWikiHtml( 'loginreqpagetext', $loginLink ) ); + $this->addWikiMsgArray( 'loginreqpagetext', array( $loginLink ), array( 'replaceafter' ) ); $this->addHTML( "\n' ); # Don't return to the main page if the user can't read it diff --git a/includes/specials/SpecialAllpages.php b/includes/specials/SpecialAllpages.php index e8f60e4bad..04b8d202b2 100644 --- a/includes/specials/SpecialAllpages.php +++ b/includes/specials/SpecialAllpages.php @@ -301,7 +301,7 @@ class SpecialAllpages extends IncludableSpecialPage { $n = 0; if ( !$fromList || !$toList ) { - $out = wfMsgWikiHtml( 'allpagesbadtitle' ); + $out = wfMsgExt( 'allpagesbadtitle', 'parse' ); } elseif ( !in_array( $namespace, array_keys( $namespaces ) ) ) { // Show errormessage and reset to NS_MAIN $out = wfMsgExt( 'allpages-bad-ns', array( 'parseinline' ), $namespace ); diff --git a/includes/specials/SpecialConfirmemail.php b/includes/specials/SpecialConfirmemail.php index e556a60b5a..bc21d927de 100644 --- a/includes/specials/SpecialConfirmemail.php +++ b/includes/specials/SpecialConfirmemail.php @@ -68,7 +68,7 @@ class EmailConfirmation extends UnlistedSpecialPage { array(), array( 'returnto' => $this->getTitle()->getPrefixedText() ) ); - $wgOut->addHTML( wfMsgWikiHtml( 'confirmemail_needlogin', $llink ) ); + $wgOut->addWikiMsgArray( 'confirmemail_needlogin', array( $llink ), array( 'replaceafter' ) ); } } else { $this->attemptConfirm( $code ); diff --git a/includes/specials/SpecialPrefixindex.php b/includes/specials/SpecialPrefixindex.php index 09e7734c2e..55309f3f1c 100644 --- a/includes/specials/SpecialPrefixindex.php +++ b/includes/specials/SpecialPrefixindex.php @@ -126,7 +126,7 @@ class SpecialPrefixindex extends SpecialAllpages { $namespaces = $wgContLang->getNamespaces(); if ( !$prefixList || !$fromList ) { - $out = wfMsgWikiHtml( 'allpagesbadtitle' ); + $out = wfMsgExt( 'allpagesbadtitle', 'parse' ); } elseif ( !in_array( $namespace, array_keys( $namespaces ) ) ) { // Show errormessage and reset to NS_MAIN $out = wfMsgExt( 'allpages-bad-ns', array( 'parseinline' ), $namespace ); diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index 7c5849d94d..bb0325f734 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -821,28 +821,26 @@ class SpecialUndelete extends SpecialPage { } else { $openDiv = '
'; } + $wgOut->addHTML( $openDiv ); // Revision delete links $canHide = $wgUser->isAllowed( 'deleterevision' ); - if( $this->mDiff ) { - $revdlink = ''; // diffs already have revision delete links - } else if( $canHide || ($rev->getVisibility() && $wgUser->isAllowed('deletedhistory')) ) { + if ( !$this->mDiff && ( $canHide || ( $rev->getVisibility() && $wgUser->isAllowed( 'deletedhistory' ) ) ) ) { if( !$rev->userCan(Revision::DELETED_RESTRICTED ) ) { - $revdlink = $skin->revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops + $wgOut->addHTML( $skin->revDeleteLinkDisabled( $canHide ) ); // revision was hidden from sysops } else { $query = array( 'type' => 'archive', 'target' => $this->mTargetObj->getPrefixedDBkey(), 'ids' => $rev->getTimestamp() ); - $revdlink = $skin->revDeleteLink( $query, - $rev->isDeleted( File::DELETED_RESTRICTED ), $canHide ); + $wgOut->addHTML( $skin->revDeleteLink( $query, + $rev->isDeleted( File::DELETED_RESTRICTED ), $canHide ) ); } - } else { - $revdlink = ''; } - $wgOut->addHTML( $openDiv . $revdlink . wfMsgWikiHtml( 'undelete-revision', $link, $time, $user, $d, $t ) . '
' ); + $wgOut->addWikiMsgArray( 'undelete-revision', array( $link, $time, $user, $d, $t ), array( 'replaceafter' ) ); + $wgOut->addHTML( '' ); wfRunHooks( 'UndeleteShowRevision', array( $this->mTargetObj, $rev ) ); if( $this->mPreview ) { @@ -1116,7 +1114,7 @@ class SpecialUndelete extends SpecialPage { Xml::openElement( 'table', array( 'id' => 'mw-undelete-table' ) ) . " " . - wfMsgWikiHtml( 'undeleteextrahelp' ) . + wfMsgExt( 'undeleteextrahelp', 'parse' ) . " @@ -1410,7 +1408,7 @@ class SpecialUndelete extends SpecialPage { $skin = $wgUser->getSkin(); $link = $skin->linkKnown( $this->mTargetObj ); - $wgOut->addHTML( wfMsgWikiHtml( 'undeletedpage', $link ) ); + $wgOut->addWikiMsgArray( 'undeletedpage', array( $link ), array( 'replaceafter' ) ); } else { $wgOut->showFatalError( wfMsg( "cannotundelete" ) ); $wgOut->addHTML( '

' . wfMsgHtml( "undeleterevdel" ) . '

' ); diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index e14dd19da9..8fb0899892 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -698,7 +698,7 @@ class SpecialUpload extends SpecialPage { 'page' => $filename ) ); - $warning = wfMsgWikiHtml( 'filewasdeleted', $llink ); + $warning = wfMsgExt( 'filewasdeleted', array( 'parse', 'replaceafter' ), $llink ); } return $warning; @@ -910,16 +910,16 @@ class UploadForm extends HTMLForm { # Everything not permitted is banned $extensionsList = '
' . - wfMsgWikiHtml( 'upload-permitted', $wgLang->commaList( $wgFileExtensions ) ) . + wfMsgExt( 'upload-permitted', 'parse', $wgLang->commaList( $wgFileExtensions ) ) . "
\n"; } else { # We have to list both preferred and prohibited $extensionsList = '
' . - wfMsgWikiHtml( 'upload-preferred', $wgLang->commaList( $wgFileExtensions ) ) . + wfMsgExt( 'upload-preferred', 'parse', $wgLang->commaList( $wgFileExtensions ) ) . "
\n" . '
' . - wfMsgWikiHtml( 'upload-prohibited', $wgLang->commaList( $wgFileBlacklist ) ) . + wfMsgExt( 'upload-prohibited', 'parse', $wgLang->commaList( $wgFileBlacklist ) ) . "
\n"; } } else { diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index 63abc8f6ed..0812bf79fe 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -231,7 +231,7 @@ class LoginForm extends SpecialPage { # Confirm that the account was created $self = SpecialPage::getTitleFor( 'Userlogin' ); $wgOut->setPageTitle( wfMsgHtml( 'accountcreated' ) ); - $wgOut->addHTML( wfMsgWikiHtml( 'accountcreatedtext', $u->getName() ) ); + $wgOut->addWikiMsg( 'accountcreatedtext', $u->getName() ); $wgOut->returnToMain( false, $self ); wfRunHooks( 'AddNewAccount', array( $u, false ) ); $u->addNewUserLogEntry( false, $this->mReason ); @@ -680,7 +680,7 @@ class LoginForm extends SpecialPage { break; case self::NOT_EXISTS: if( $wgUser->isAllowed( 'createaccount' ) ) { - $this->mainLoginForm( wfMsgWikiHtml( 'nosuchuser', htmlspecialchars( $this->mUsername ) ) ); + $this->mainLoginForm( wfMsgExt( 'nosuchuser', 'parseinline', $this->mUsername ) ); } else { $this->mainLoginForm( wfMsg( 'nosuchusershort', htmlspecialchars( $this->mUsername ) ) ); } @@ -775,7 +775,7 @@ class LoginForm extends SpecialPage { return; } if ( 0 == $u->getID() ) { - $this->mainLoginForm( wfMsgWikiHtml( 'nosuchuser', htmlspecialchars( $u->getName() ) ) ); + $this->mainLoginForm( wfMsgExt( 'nosuchuser', 'parseinline', $u->getName() ) ); return; } diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index 3bd5d48ed9..626038b71f 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -57,12 +57,12 @@ function wfSpecialWatchlist( $par ) { if( $wgUser->isAnon() ) { $wgOut->setPageTitle( wfMsg( 'watchnologin' ) ); $llink = $skin->linkKnown( - SpecialPage::getTitleFor( 'Userlogin' ), + SpecialPage::getTitleFor( 'Userlogin' ), wfMsgHtml( 'loginreqlink' ), array(), array( 'returnto' => $specialTitle->getPrefixedText() ) ); - $wgOut->addHTML( wfMsgWikiHtml( 'watchlistanontext', $llink ) ); + $wgOut->addWikiMsgArray( 'watchlistanontext', array( $llink ), array( 'replaceafter' ) ); return; } -- 2.20.1