r93292 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93291‎ | r93292 | r93293 >
Date:18:11, 27 July 2011
Author:ashley
Status:deferred
Tags:
Comment:
DPLforum: add some braces
Modified paths:
  • /trunk/extensions/DPLforum/DPLforum_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DPLforum/DPLforum_body.php
@@ -68,8 +68,9 @@
6969 if ( preg_match_all( "/^\s*$name\s*=\s*(.*)/mi", $this->sInput, $matches ) ) {
7070 foreach ( $matches[1] as $cat ) {
7171 $title = Title::newFromText( $parser->replaceVariables( trim( $cat ) ) );
72 - if ( !is_null( $title ) )
 72+ if ( !is_null( $title ) ) {
7373 $cats[] = $title;
 74+ }
7475 }
7576 }
7677 return $cats;
@@ -78,42 +79,48 @@
7980 function get( $name, $value = null, $parser = null ) {
8081 if ( preg_match( "/^\s*$name\s*=\s*(.*)/mi", $this->sInput, $matches ) ) {
8182 $arg = trim( $matches[1] );
82 - if ( is_int( $value ) )
 83+ if ( is_int( $value ) ) {
8384 return intval( $arg );
84 - elseif ( is_null( $parser ) )
 85+ } elseif ( is_null( $parser ) ) {
8586 return htmlspecialchars( $arg );
86 - else
 87+ } else {
8788 return $parser->replaceVariables( $arg );
 89+ }
8890 }
8991 return $value;
9092 }
9193
9294 function link( &$parser, $count, $page = '', $text = '' ) {
9395 $count = intval( $count );
94 - if ( $count < 1 )
 96+ if ( $count < 1 ) {
9597 return '';
 98+ }
9699
97 - if ( $this->requireCache )
 100+ if ( $this->requireCache ) {
98101 $offset = 0;
99 - else {
 102+ } else {
100103 global $wgRequest;
101104 $parser->disableCache();
102105 $offset = intval( $wgRequest->getVal( 'offset', '' ) );
103106 }
104107
105108 $i = intval( $page );
106 - if ( ( $i != 0 ) && ctype_digit( $page[0] ) )
 109+ if ( ( $i != 0 ) && ctype_digit( $page[0] ) ) {
107110 $i -= 1;
108 - else
 111+ } else {
109112 $i += intval( $offset / $count );
110 - if ( $this->link_test( $i, $page ) )
 113+ }
 114+ if ( $this->link_test( $i, $page ) ) {
111115 return '';
 116+ }
112117
113 - if ( $text === '' )
 118+ if ( $text === '' ) {
114119 $text = ( $i + 1 );
 120+ }
115121 $page = ( $count * $i );
116 - if ( $page == $offset )
 122+ if ( $page == $offset ) {
117123 return $text;
 124+ }
118125
119126 return '[' . $parser->replaceVariables( '{{fullurl:{{FULLPAGENAME}}|offset=' . $page . '}} ' ) . $text . ']';
120127 }
@@ -137,13 +144,14 @@
138145 }
139146
140147 function msg( $type, $error = null ) {
141 - if ( $error && ( $this->get( 'suppresserrors' ) == 'true' ) )
 148+ if ( $error && ( $this->get( 'suppresserrors' ) == 'true' ) ) {
142149 return '';
 150+ }
143151
144152 return htmlspecialchars( wfMsg( $type ) );
145153 }
146154
147 - function date( $ts, $type = 'date', $df = false ) { // based on Language::date()
 155+ function date( $ts, $type = 'date', $df = false ) { // based on Language::date()
148156 global $wgLang;
149157 $ts = wfTimestamp( TS_MW, $ts );
150158 $ts = $wgLang->userAdjust( $ts );
@@ -186,22 +194,25 @@
187195 }
188196
189197 $arg = $this->get( 'compact' );
190 - if ( $arg == 'all' || strpos( $arg, 'edit' ) === 0 )
191 - $this->bCompactEdit = $this->bAddLastEdit;
 198+ if ( $arg == 'all' || strpos( $arg, 'edit' ) === 0 ) {
 199+ $this->bCompactEdit = $this->bAddLastEdit;
 200+ }
192201 $this->bCompactAuthor = ( $arg == 'author' || $arg == 'all' );
193202
194203 $arg = $this->get( 'namespace', '', $parser );
195204 $iNamespace = $wgContLang->getNsIndex( $arg );
196205 if ( !$iNamespace ) {
197 - if ( ( $arg ) || ( $arg === '0' ) )
 206+ if ( ( $arg ) || ( $arg === '0' ) ) {
198207 $iNamespace = intval( $arg );
199 - else
200 - $iNamespace = - 1;
 208+ } else {
 209+ $iNamespace = -1;
 210+ }
201211 }
202 - if ( $iNamespace < 0 )
 212+ if ( $iNamespace < 0 ) {
203213 $this->bShowNamespace = ( $this->get( 'shownamespace' ) != 'false' );
204 - else
 214+ } else {
205215 $this->bShowNamespace = ( $this->get( 'shownamespace' ) == 'true' );
 216+ }
206217
207218 $this->bTableMode = false;
208219 $sStartItem = $sEndItem = '';
@@ -234,10 +245,12 @@
235246 $output = '';
236247
237248 if ( $sPrefix === '' && ( ( $cats < 1 && $iNamespace < 0 ) ||
238 - ( $total < $this->minCategories ) ) )
 249+ ( $total < $this->minCategories ) ) ) {
239250 return $this->msg( 'dplforum-toofew', 1 );
240 - if ( ( $total > $this->maxCategories ) && ( !$this->unlimitedCategories ) )
 251+ }
 252+ if ( ( $total > $this->maxCategories ) && ( !$this->unlimitedCategories ) ) {
241253 return $this->msg( 'dplforum-toomany', 1 );
 254+ }
242255
243256 $count = 1;
244257 $start = $this->get( 'start', 0 );
@@ -251,18 +264,21 @@
252265 $start += intval( $wgRequest->getVal( 'offset' ) );
253266 }
254267 }
255 - if ( $start < 0 )
 268+ if ( $start < 0 ) {
256269 $start = 0;
 270+ }
257271
258272 if ( is_null( $title ) ) {
259273 $count = $this->get( 'count', 0 );
260274 if ( $count > 0 ) {
261 - if ( $count > $this->maxResultCount )
 275+ if ( $count > $this->maxResultCount ) {
262276 $count = $this->maxResultCount;
263 - } elseif ( $this->unlimitedResults )
 277+ }
 278+ } elseif ( $this->unlimitedResults ) {
264279 $count = 0x7FFFFFFF; // maximum integer value
265 - else
 280+ } else {
266281 $count = $this->maxResultCount;
 282+ }
267283 }
268284
269285 // build the SQL query
@@ -416,7 +432,7 @@
417433 }
418434
419435 if ( $tm ) {
420 - $output .= "<td class='forum_title'>";
 436+ $output .= '<td class="forum_title">';
421437 }
422438
423439 $text = $query = $props = '';

Status & tagging log