r102406 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102405‎ | r102406 | r102407 >
Date:16:04, 8 November 2011
Author:ialex
Status:ok (Comments)
Tags:
Comment:
* Use local context to get messages
* Changed three isset() to [!=]== null
Modified paths:
  • /trunk/phase3/includes/specials/SpecialAllpages.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialAllpages.php
@@ -80,9 +80,9 @@
8181 );
8282 $out->addModuleStyles( 'mediawiki.special' );
8383
84 - if( isset($par) ) {
 84+ if( $par !== null ) {
8585 $this->showChunk( $namespace, $par, $to );
86 - } elseif( isset($from) && !isset($to) ) {
 86+ } elseif( $from !== null && $to == null ) {
8787 $this->showChunk( $namespace, $from, $to );
8888 } else {
8989 $this->showToplevel( $namespace, $from, $to );
@@ -104,11 +104,11 @@
105105 $out .= Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) );
106106 $out .= Html::hidden( 'title', $t->getPrefixedText() );
107107 $out .= Xml::openElement( 'fieldset' );
108 - $out .= Xml::element( 'legend', null, wfMsg( 'allpages' ) );
 108+ $out .= Xml::element( 'legend', null, $this->msg( 'allpages' )->text() );
109109 $out .= Xml::openElement( 'table', array( 'id' => 'nsselect', 'class' => 'allpages' ) );
110110 $out .= "<tr>
111111 <td class='mw-label'>" .
112 - Xml::label( wfMsg( 'allpagesfrom' ), 'nsfrom' ) .
 112+ Xml::label( $this->msg( 'allpagesfrom' )->text(), 'nsfrom' ) .
113113 " </td>
114114 <td class='mw-input'>" .
115115 Xml::input( 'from', 30, str_replace('_',' ',$from), array( 'id' => 'nsfrom' ) ) .
@@ -116,7 +116,7 @@
117117 </tr>
118118 <tr>
119119 <td class='mw-label'>" .
120 - Xml::label( wfMsg( 'allpagesto' ), 'nsto' ) .
 120+ Xml::label( $this->msg( 'allpagesto' )->text(), 'nsto' ) .
121121 " </td>
122122 <td class='mw-input'>" .
123123 Xml::input( 'to', 30, str_replace('_',' ',$to), array( 'id' => 'nsto' ) ) .
@@ -124,11 +124,11 @@
125125 </tr>
126126 <tr>
127127 <td class='mw-label'>" .
128 - Xml::label( wfMsg( 'namespace' ), 'namespace' ) .
 128+ Xml::label( $this->msg( 'namespace' )->text(), 'namespace' ) .
129129 " </td>
130130 <td class='mw-input'>" .
131131 Xml::namespaceSelector( $namespace, null ) . ' ' .
132 - Xml::submitButton( wfMsg( 'allpagessubmit' ) ) .
 132+ Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ) .
133133 " </td>
134134 </tr>";
135135 $out .= Xml::closeElement( 'table' );
@@ -249,7 +249,7 @@
250250 $nsForm .
251251 '</td>
252252 <td class="mw-allpages-nav">' .
253 - Linker::link( $this->getTitle(), wfMsgHtml ( 'allpages' ),
 253+ Linker::link( $this->getTitle(), $this->msg( 'allpages' )->escaped(),
254254 array(), array(), 'known' ) .
255255 "</td>
256256 </tr>" .
@@ -280,10 +280,10 @@
281281 $special = $this->getTitle();
282282 $link = $special->escapeLocalUrl( $queryparams . 'from=' . urlencode($inpoint) . '&to=' . urlencode($outpoint) );
283283
284 - $out = wfMsgHtml( 'alphaindexline',
 284+ $out = $this->msg( 'alphaindexline' )->rawParams(
285285 "<a href=\"$link\">$inpointf</a></td><td>",
286286 "</td><td><a href=\"$link\">$outpointf</a>"
287 - );
 287+ )->escaped();
288288 return '<tr><td class="mw-allpages-alphaindexline">' . $out . '</td></tr>';
289289 }
290290
@@ -302,10 +302,10 @@
303303 $n = 0;
304304
305305 if ( !$fromList || !$toList ) {
306 - $out = wfMsgExt( 'allpagesbadtitle', 'parse' );
 306+ $out = $this->msg( 'allpagesbadtitle' )->parseAsBlock();
307307 } elseif ( !in_array( $namespace, array_keys( $namespaces ) ) ) {
308308 // Show errormessage and reset to NS_MAIN
309 - $out = wfMsgExt( 'allpages-bad-ns', array( 'parseinline' ), $namespace );
 309+ $out = $this->msg( 'allpages-bad-ns', $namespace )->parse();
310310 $namespace = NS_MAIN;
311311 } else {
312312 list( $namespace, $fromKey, $from ) = $fromList;
@@ -410,7 +410,7 @@
411411 $nsForm .
412412 '</td>
413413 <td class="mw-allpages-nav">' .
414 - Linker::link( $self, wfMsgHtml ( 'allpages' ) );
 414+ Linker::link( $self, $this->msg( 'allpages' )->escaped() );
415415
416416 # Do we put a previous link ?
417417 if( isset( $prevTitle ) && $pt = $prevTitle->getText() ) {
@@ -421,7 +421,7 @@
422422
423423 $prevLink = Linker::linkKnown(
424424 $self,
425 - wfMessage( 'prevpage', $pt )->escaped(),
 425+ $this->msg( 'prevpage', $pt )->escaped(),
426426 array(),
427427 $query
428428 );
@@ -438,7 +438,7 @@
439439
440440 $nextLink = Linker::linkKnown(
441441 $self,
442 - wfMessage( 'nextpage', $t->getText() )->escaped(),
 442+ $this->msg( 'nextpage', $t->getText() )->escaped(),
443443 array(),
444444 $query
445445 );

Follow-up revisions

RevisionCommit summaryAuthorDate
r107631Per Krinkle, fix for r102406: use strict comparisonialex11:37, 30 December 2011

Comments

#Comment by Krinkle (talk | contribs)   11:20, 30 December 2011
+		} elseif( $from !== null && $to == null ) {

Was it intentional that one is strict and not the other ?

#Comment by IAlex (talk | contribs)   11:38, 30 December 2011

Thanks! Fixed in r107631.

Status & tagging log