r52019 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52018‎ | r52019 | r52020 >
Date:06:16, 17 June 2009
Author:nikerabbit
Status:ok
Tags:
Comment:
* use addWikiMsg or wrapWikiMsg instead off addWikiText
* post isntead of POST
* escape link text for link()
Modified paths:
  • /trunk/extensions/UsabilityInitiative/OptIn/SpecialOptIn.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/PrefStats/SpecialPrefStats.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/OptIn/SpecialOptIn.php
@@ -20,23 +20,21 @@
2121 if ( $wgUser->isAnon() ) {
2222 $url = SpecialPage::getTitleFor( 'Userlogin' )->getFullURL(
2323 array( 'returnto' => $this->getTitle()->getPrefixedUrl() ) );
24 - $wgOut->addHTML( Xml::openElement( 'div',
25 - array( 'class' => 'plainlinks' ) ) );
26 - $wgOut->addWikiText( wfMsg( 'optin-needlogin', $url ) );
27 - $wgOut->addHTML( Xml::closeElement( 'div' ) );
 24+ $wgOut->wrapWikiMsg( "<div class='plainlinks'>\n$1\n</div>", array( 'optin-needlogin', $url ) );
2825 return;
2926 }
3027
3128 if ( $wgRequest->wasPosted() ) {
 29+ // Is the weak comparison intentional?
3230 if ( $wgRequest->getVal( 'opt' ) == 'in' ) {
3331 $this->optIn( $wgUser );
34 - $wgOut->addWikiText( wfMsg( 'optin-success-in' ) );
 32+ $wgOut->addWikiMsg( 'optin-success-in' );
3533 } else {
3634 $this->optOut( $wgUser );
37 - $wgOut->addWikiText( wfMsg( 'optin-success-out' ) );
 35+ $wgOut->addWikfMsg( 'optin-success-out' );
3836 }
3937 } else {
40 - $wgOut->addWikiText( wfMsg( 'optin-intro' ) );
 38+ $wgOut->addWikiMsg( 'optin-intro' );
4139 }
4240 $this->showForm();
4341 }
@@ -44,7 +42,7 @@
4543 function showForm() {
4644 global $wgUser, $wgOut;
4745 $retval = Xml::openElement( 'form', array(
48 - 'method' => 'POST',
 46+ 'method' => 'post',
4947 'action' => $this->getTitle()->getLinkURL()
5048 ) );
5149 $opt = ( $this->isOptedIn( $wgUser ) ? 'out' : 'in' );
Index: trunk/extensions/UsabilityInitiative/PrefStats/SpecialPrefStats.php
@@ -34,14 +34,14 @@
3535
3636 function displayTrackedPrefs() {
3737 global $wgOut, $wgUser, $wgPrefStatsTrackPrefs;
38 - $wgOut->addWikitext( wfMsg( 'prefstats-list-intro' ) );
 38+ $wgOut->addWikiMsg( 'prefstats-list-intro' );
3939 $wgOut->addHTML( Xml::openElement( 'ul' ) );
4040 foreach ( $wgPrefStatsTrackPrefs as $pref => $value ) {
4141 $wgOut->addHTML( Xml::tags( 'li', array(),
4242 $wgUser->getSkin()->link(
4343 $this->getTitle( $pref ),
44 - wfMsg( 'prefstats-list-elem', $pref,
45 - $value ) ) ) );
 44+ htmlspecialchars( wfMsg( 'prefstats-list-elem', $pref,
 45+ $value ) ) ) ) );
4646 }
4747 $wgOut->addHTML( Xml::closeElement( 'ul' ) );
4848 }

Status & tagging log