r81591 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81590‎ | r81591 | r81592 >
Date:12:38, 6 February 2011
Author:ialex
Status:ok
Tags:
Comment:
* 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
Modified paths:
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialAllpages.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialConfirmemail.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialPrefixindex.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUndelete.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUpload.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUserlogin.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialWatchlist.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/EditPage.php
@@ -2049,7 +2049,7 @@
20502050 $wgOut->setRobotPolicy( 'noindex,nofollow' );
20512051 $wgOut->setArticleRelated( false );
20522052
2053 - $wgOut->addHTML( wfMsgWikiHtml( 'whitelistedittext', $loginLink ) );
 2053+ $wgOut->addWikiMsgArray( 'whitelistedittext', array( $loginLink ), array( 'replaceafter' ) );
20542054 $wgOut->returnToMain( false, $wgTitle );
20552055 }
20562056
Index: trunk/phase3/includes/OutputPage.php
@@ -2063,7 +2063,7 @@
20642064 array( 'returnto' => $this->getTitle()->getPrefixedText() ),
20652065 array( 'known', 'noclasses' )
20662066 );
2067 - $this->addHTML( wfMsgWikiHtml( 'loginreqpagetext', $loginLink ) );
 2067+ $this->addWikiMsgArray( 'loginreqpagetext', array( $loginLink ), array( 'replaceafter' ) );
20682068 $this->addHTML( "\n<!--" . $this->getTitle()->getPrefixedUrl() . '-->' );
20692069
20702070 # Don't return to the main page if the user can't read it
Index: trunk/phase3/includes/specials/SpecialAllpages.php
@@ -301,7 +301,7 @@
302302 $n = 0;
303303
304304 if ( !$fromList || !$toList ) {
305 - $out = wfMsgWikiHtml( 'allpagesbadtitle' );
 305+ $out = wfMsgExt( 'allpagesbadtitle', 'parse' );
306306 } elseif ( !in_array( $namespace, array_keys( $namespaces ) ) ) {
307307 // Show errormessage and reset to NS_MAIN
308308 $out = wfMsgExt( 'allpages-bad-ns', array( 'parseinline' ), $namespace );
Index: trunk/phase3/includes/specials/SpecialUndelete.php
@@ -821,28 +821,26 @@
822822 } else {
823823 $openDiv = '<div id="mw-undelete-revision">';
824824 }
 825+ $wgOut->addHTML( $openDiv );
825826
826827 // Revision delete links
827828 $canHide = $wgUser->isAllowed( 'deleterevision' );
828 - if( $this->mDiff ) {
829 - $revdlink = ''; // diffs already have revision delete links
830 - } else if( $canHide || ($rev->getVisibility() && $wgUser->isAllowed('deletedhistory')) ) {
 829+ if ( !$this->mDiff && ( $canHide || ( $rev->getVisibility() && $wgUser->isAllowed( 'deletedhistory' ) ) ) ) {
831830 if( !$rev->userCan(Revision::DELETED_RESTRICTED ) ) {
832 - $revdlink = $skin->revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops
 831+ $wgOut->addHTML( $skin->revDeleteLinkDisabled( $canHide ) ); // revision was hidden from sysops
833832 } else {
834833 $query = array(
835834 'type' => 'archive',
836835 'target' => $this->mTargetObj->getPrefixedDBkey(),
837836 'ids' => $rev->getTimestamp()
838837 );
839 - $revdlink = $skin->revDeleteLink( $query,
840 - $rev->isDeleted( File::DELETED_RESTRICTED ), $canHide );
 838+ $wgOut->addHTML( $skin->revDeleteLink( $query,
 839+ $rev->isDeleted( File::DELETED_RESTRICTED ), $canHide ) );
841840 }
842 - } else {
843 - $revdlink = '';
844841 }
845842
846 - $wgOut->addHTML( $openDiv . $revdlink . wfMsgWikiHtml( 'undelete-revision', $link, $time, $user, $d, $t ) . '</div>' );
 843+ $wgOut->addWikiMsgArray( 'undelete-revision', array( $link, $time, $user, $d, $t ), array( 'replaceafter' ) );
 844+ $wgOut->addHTML( '</div>' );
847845 wfRunHooks( 'UndeleteShowRevision', array( $this->mTargetObj, $rev ) );
848846
849847 if( $this->mPreview ) {
@@ -1116,7 +1114,7 @@
11171115 Xml::openElement( 'table', array( 'id' => 'mw-undelete-table' ) ) .
11181116 "<tr>
11191117 <td colspan='2' class='mw-undelete-extrahelp'>" .
1120 - wfMsgWikiHtml( 'undeleteextrahelp' ) .
 1118+ wfMsgExt( 'undeleteextrahelp', 'parse' ) .
11211119 "</td>
11221120 </tr>
11231121 <tr>
@@ -1410,7 +1408,7 @@
14111409
14121410 $skin = $wgUser->getSkin();
14131411 $link = $skin->linkKnown( $this->mTargetObj );
1414 - $wgOut->addHTML( wfMsgWikiHtml( 'undeletedpage', $link ) );
 1412+ $wgOut->addWikiMsgArray( 'undeletedpage', array( $link ), array( 'replaceafter' ) );
14151413 } else {
14161414 $wgOut->showFatalError( wfMsg( "cannotundelete" ) );
14171415 $wgOut->addHTML( '<p>' . wfMsgHtml( "undeleterevdel" ) . '</p>' );
Index: trunk/phase3/includes/specials/SpecialUserlogin.php
@@ -231,7 +231,7 @@
232232 # Confirm that the account was created
233233 $self = SpecialPage::getTitleFor( 'Userlogin' );
234234 $wgOut->setPageTitle( wfMsgHtml( 'accountcreated' ) );
235 - $wgOut->addHTML( wfMsgWikiHtml( 'accountcreatedtext', $u->getName() ) );
 235+ $wgOut->addWikiMsg( 'accountcreatedtext', $u->getName() );
236236 $wgOut->returnToMain( false, $self );
237237 wfRunHooks( 'AddNewAccount', array( $u, false ) );
238238 $u->addNewUserLogEntry( false, $this->mReason );
@@ -680,7 +680,7 @@
681681 break;
682682 case self::NOT_EXISTS:
683683 if( $wgUser->isAllowed( 'createaccount' ) ) {
684 - $this->mainLoginForm( wfMsgWikiHtml( 'nosuchuser', htmlspecialchars( $this->mUsername ) ) );
 684+ $this->mainLoginForm( wfMsgExt( 'nosuchuser', 'parseinline', $this->mUsername ) );
685685 } else {
686686 $this->mainLoginForm( wfMsg( 'nosuchusershort', htmlspecialchars( $this->mUsername ) ) );
687687 }
@@ -775,7 +775,7 @@
776776 return;
777777 }
778778 if ( 0 == $u->getID() ) {
779 - $this->mainLoginForm( wfMsgWikiHtml( 'nosuchuser', htmlspecialchars( $u->getName() ) ) );
 779+ $this->mainLoginForm( wfMsgExt( 'nosuchuser', 'parseinline', $u->getName() ) );
780780 return;
781781 }
782782
Index: trunk/phase3/includes/specials/SpecialPrefixindex.php
@@ -126,7 +126,7 @@
127127 $namespaces = $wgContLang->getNamespaces();
128128
129129 if ( !$prefixList || !$fromList ) {
130 - $out = wfMsgWikiHtml( 'allpagesbadtitle' );
 130+ $out = wfMsgExt( 'allpagesbadtitle', 'parse' );
131131 } elseif ( !in_array( $namespace, array_keys( $namespaces ) ) ) {
132132 // Show errormessage and reset to NS_MAIN
133133 $out = wfMsgExt( 'allpages-bad-ns', array( 'parseinline' ), $namespace );
Index: trunk/phase3/includes/specials/SpecialUpload.php
@@ -698,7 +698,7 @@
699699 'page' => $filename
700700 )
701701 );
702 - $warning = wfMsgWikiHtml( 'filewasdeleted', $llink );
 702+ $warning = wfMsgExt( 'filewasdeleted', array( 'parse', 'replaceafter' ), $llink );
703703 }
704704
705705 return $warning;
@@ -910,16 +910,16 @@
911911 # Everything not permitted is banned
912912 $extensionsList =
913913 '<div id="mw-upload-permitted">' .
914 - wfMsgWikiHtml( 'upload-permitted', $wgLang->commaList( $wgFileExtensions ) ) .
 914+ wfMsgExt( 'upload-permitted', 'parse', $wgLang->commaList( $wgFileExtensions ) ) .
915915 "</div>\n";
916916 } else {
917917 # We have to list both preferred and prohibited
918918 $extensionsList =
919919 '<div id="mw-upload-preferred">' .
920 - wfMsgWikiHtml( 'upload-preferred', $wgLang->commaList( $wgFileExtensions ) ) .
 920+ wfMsgExt( 'upload-preferred', 'parse', $wgLang->commaList( $wgFileExtensions ) ) .
921921 "</div>\n" .
922922 '<div id="mw-upload-prohibited">' .
923 - wfMsgWikiHtml( 'upload-prohibited', $wgLang->commaList( $wgFileBlacklist ) ) .
 923+ wfMsgExt( 'upload-prohibited', 'parse', $wgLang->commaList( $wgFileBlacklist ) ) .
924924 "</div>\n";
925925 }
926926 } else {
Index: trunk/phase3/includes/specials/SpecialWatchlist.php
@@ -57,12 +57,12 @@
5858 if( $wgUser->isAnon() ) {
5959 $wgOut->setPageTitle( wfMsg( 'watchnologin' ) );
6060 $llink = $skin->linkKnown(
61 - SpecialPage::getTitleFor( 'Userlogin' ),
 61+ SpecialPage::getTitleFor( 'Userlogin' ),
6262 wfMsgHtml( 'loginreqlink' ),
6363 array(),
6464 array( 'returnto' => $specialTitle->getPrefixedText() )
6565 );
66 - $wgOut->addHTML( wfMsgWikiHtml( 'watchlistanontext', $llink ) );
 66+ $wgOut->addWikiMsgArray( 'watchlistanontext', array( $llink ), array( 'replaceafter' ) );
6767 return;
6868 }
6969
Index: trunk/phase3/includes/specials/SpecialConfirmemail.php
@@ -68,7 +68,7 @@
6969 array(),
7070 array( 'returnto' => $this->getTitle()->getPrefixedText() )
7171 );
72 - $wgOut->addHTML( wfMsgWikiHtml( 'confirmemail_needlogin', $llink ) );
 72+ $wgOut->addWikiMsgArray( 'confirmemail_needlogin', array( $llink ), array( 'replaceafter' ) );
7373 }
7474 } else {
7575 $this->attemptConfirm( $code );

Status & tagging log