From a4039c6a3bd77d7aabd69e7b26bdc325a2559e66 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Thu, 5 Apr 2012 21:39:22 +0200 Subject: [PATCH] Use local context to get messages Change-Id: I73e0d08f684c67ec5257953eadfda3acdfa4e71f --- includes/specials/SpecialMovepage.php | 48 ++++++++++++--------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/includes/specials/SpecialMovepage.php b/includes/specials/SpecialMovepage.php index 393cf7ef0d..6b817d2804 100644 --- a/includes/specials/SpecialMovepage.php +++ b/includes/specials/SpecialMovepage.php @@ -141,13 +141,13 @@ class MovePageForm extends UnlistedSpecialPage { && $newTitle->quickUserCan( 'delete', $user ) ) { $out->addWikiMsg( 'delete_and_move_text', $newTitle->getPrefixedText() ); - $movepagebtn = wfMsg( 'delete_and_move' ); + $movepagebtn = $this->msg( 'delete_and_move' )->text(); $submitVar = 'wpDeleteAndMove'; $confirm = " " . - Xml::checkLabel( wfMsg( 'delete_and_move_confirm' ), 'wpConfirm', 'wpConfirm' ) . + Xml::checkLabel( $this->msg( 'delete_and_move_confirm' )->text(), 'wpConfirm', 'wpConfirm' ) . " "; $err = array(); @@ -157,7 +157,7 @@ class MovePageForm extends UnlistedSpecialPage { } $out->addWikiMsg( $wgFixDoubleRedirects ? 'movepagetext' : 'movepagetext-noredirectfixer' ); - $movepagebtn = wfMsg( 'movepagebtn' ); + $movepagebtn = $this->msg( 'movepagebtn' )->text(); $submitVar = 'wpMove'; $confirm = false; } @@ -249,11 +249,11 @@ class MovePageForm extends UnlistedSpecialPage { $out->addHTML( Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getTitle()->getLocalURL( 'action=submit' ), 'id' => 'movepage' ) ) . Xml::openElement( 'fieldset' ) . - Xml::element( 'legend', null, wfMsg( 'move-page-legend' ) ) . + Xml::element( 'legend', null, $this->msg( 'move-page-legend' )->text() ) . Xml::openElement( 'table', array( 'border' => '0', 'id' => 'mw-movepage-table' ) ) . " " . - wfMsgHtml( 'movearticle' ) . + $this->msg( 'movearticle' )->escaped() . " {$oldTitleLink} @@ -261,7 +261,7 @@ class MovePageForm extends UnlistedSpecialPage { " . - Xml::label( wfMsg( 'newtitle' ), 'wpNewTitleMain' ) . + Xml::label( $this->msg( 'newtitle' )->text(), 'wpNewTitleMain' ) . " " . Html::namespaceSelector( @@ -278,7 +278,7 @@ class MovePageForm extends UnlistedSpecialPage { " . - Xml::label( wfMsg( 'movereason' ), 'wpReason' ) . + Xml::label( $this->msg( 'movereason' )->text(), 'wpReason' ) . " " . Html::element( 'textarea', array( 'name' => 'wpReason', 'id' => 'wpReason', 'cols' => 60, 'rows' => 2, @@ -292,7 +292,7 @@ class MovePageForm extends UnlistedSpecialPage { " . - Xml::checkLabel( wfMsg( 'movetalk' ), 'wpMovetalk', 'wpMovetalk', $this->moveTalk ) . + Xml::checkLabel( $this->msg( 'movetalk' )->text(), 'wpMovetalk', 'wpMovetalk', $this->moveTalk ) . " " ); @@ -303,7 +303,7 @@ class MovePageForm extends UnlistedSpecialPage { " . - Xml::checkLabel( wfMsg( 'move-leave-redirect' ), 'wpLeaveRedirect', + Xml::checkLabel( $this->msg( 'move-leave-redirect' )->text(), 'wpLeaveRedirect', 'wpLeaveRedirect', $this->leaveRedirect ) . " " @@ -315,7 +315,7 @@ class MovePageForm extends UnlistedSpecialPage { " . - Xml::checkLabel( wfMsg( 'fix-double-redirects' ), 'wpFixRedirects', + Xml::checkLabel( $this->msg( 'fix-double-redirects' )->text(), 'wpFixRedirects', 'wpFixRedirects', $this->fixRedirects ) . " " @@ -335,15 +335,11 @@ class MovePageForm extends UnlistedSpecialPage { array( 'id' => 'wpMovesubpages' ) ) . ' ' . Xml::tags( 'label', array( 'for' => 'wpMovesubpages' ), - wfMsgExt( + $this->msg( ( $this->oldTitle->hasSubpages() ? 'move-subpages' - : 'move-talk-subpages' ), - array( 'parseinline' ), - $this->getLanguage()->formatNum( $wgMaximumMovedPages ), - # $2 to allow use of PLURAL in message. - $wgMaximumMovedPages - ) + : 'move-talk-subpages' ) + )->numParams( $wgMaximumMovedPages )->params( $wgMaximumMovedPages )->parse() ) . " " @@ -358,7 +354,7 @@ class MovePageForm extends UnlistedSpecialPage { " . - Xml::checkLabel( wfMsg( 'move-watch' ), 'wpWatch', 'watch', $watchChecked ) . + Xml::checkLabel( $this->msg( 'move-watch' )->text(), 'wpWatch', 'watch', $watchChecked ) . " "); } @@ -421,7 +417,7 @@ class MovePageForm extends UnlistedSpecialPage { return; } - $reason = wfMessage( 'delete_and_move_reason', $ot )->inContentLanguage()->text(); + $reason = $this->msg( 'delete_and_move_reason', $ot )->inContentLanguage()->text(); // Delete an associated image if there is if ( $nt->getNamespace() == NS_FILE ) { @@ -472,7 +468,7 @@ class MovePageForm extends UnlistedSpecialPage { $newText = $nt->getPrefixedText(); $msgName = $createRedirect ? 'movepage-moved-redirect' : 'movepage-moved-noredirect'; - $out->addHTML( wfMessage( 'movepage-moved' )->rawParams( $oldLink, + $out->addHTML( $this->msg( 'movepage-moved' )->rawParams( $oldLink, $newLink )->params( $oldText, $newText )->parseAsBlock() ); $out->addWikiMsg( $msgName ); @@ -562,15 +558,15 @@ class MovePageForm extends UnlistedSpecialPage { $newSubpage = Title::makeTitleSafe( $newNs, $newPageName ); if( !$newSubpage ) { $oldLink = Linker::linkKnown( $oldSubpage ); - $extraOutput []= wfMsgHtml( 'movepage-page-unmoved', $oldLink, - htmlspecialchars(Title::makeName( $newNs, $newPageName ))); + $extraOutput []= $this->msg( 'movepage-page-unmoved' )->rawParams( $oldLink + )->params( Title::makeName( $newNs, $newPageName ) )->escaped(); continue; } # This was copy-pasted from Renameuser, bleh. if ( $newSubpage->exists() && !$oldSubpage->isValidMoveTarget( $newSubpage ) ) { $link = Linker::linkKnown( $newSubpage ); - $extraOutput []= wfMsgHtml( 'movepage-page-exists', $link ); + $extraOutput []= $this->msg( 'movepage-page-exists' )->rawParams( $link )->escaped(); } else { $success = $oldSubpage->moveTo( $newSubpage, true, $this->reason, $createRedirect ); if( $success === true ) { @@ -584,16 +580,16 @@ class MovePageForm extends UnlistedSpecialPage { array( 'redirect' => 'no' ) ); $newLink = Linker::linkKnown( $newSubpage ); - $extraOutput []= wfMsgHtml( 'movepage-page-moved', $oldLink, $newLink ); + $extraOutput []= $this->msg( 'movepage-page-moved' )->rawParams( $oldLink, $newLink )->escaped(); ++$count; if( $count >= $wgMaximumMovedPages ) { - $extraOutput []= wfMsgExt( 'movepage-max-pages', array( 'parsemag', 'escape' ), $this->getLanguage()->formatNum( $wgMaximumMovedPages ) ); + $extraOutput []= $this->msg( 'movepage-max-pages' )->numParams( $wgMaximumMovedPages )->escaped(); break; } } else { $oldLink = Linker::linkKnown( $oldSubpage ); $newLink = Linker::link( $newSubpage ); - $extraOutput []= wfMsgHtml( 'movepage-page-unmoved', $oldLink, $newLink ); + $extraOutput []= $this->msg( 'movepage-page-unmoved' )->rawParams( $oldLink, $newLink )->escaped(); } } -- 2.20.1