r62307 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62306‎ | r62307 | r62308 >
Date:14:57, 11 February 2010
Author:ialex
Status:ok (Comments)
Tags:
Comment:
Whitespaces fixes
Modified paths:
  • /trunk/phase3/includes/parser/CoreParserFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/CoreParserFunctions.php
@@ -70,7 +70,7 @@
7171 $parser->setFunctionHook( 'pipetrick', array( __CLASS__, 'pipetrick' ), SFH_NO_HASH );
7272 $parser->setFunctionHook( 'pipetricke', array( __CLASS__, 'pipetricke' ), SFH_NO_HASH );
7373 $parser->setFunctionHook( 'tag', array( __CLASS__, 'tagObj' ), SFH_OBJECT_ARGS );
74 - $parser->setFunctionHook( 'formatdate', array( __CLASS__, 'formatDate' ) );
 74+ $parser->setFunctionHook( 'formatdate', array( __CLASS__, 'formatDate' ) );
7575
7676 if ( $wgAllowDisplayTitle ) {
7777 $parser->setFunctionHook( 'displaytitle', array( __CLASS__, 'displaytitle' ), SFH_NO_HASH );
@@ -95,16 +95,16 @@
9696 static function formatDate( $parser, $date, $defaultPref = null ) {
9797 $df = DateFormatter::getInstance();
9898
99 - $date = trim($date);
 99+ $date = trim( $date );
100100
101101 $pref = $parser->mOptions->getDateFormat();
102102
103103 // Specify a different default date format other than the the normal default
104104 // iff the user has 'default' for their setting
105 - if ($pref == 'default' && $defaultPref)
 105+ if ( $pref == 'default' && $defaultPref )
106106 $pref = $defaultPref;
107107
108 - $date = $df->reformat( $pref, $date, array('match-whole') );
 108+ $date = $df->reformat( $pref, $date, array( 'match-whole' ) );
109109 return $date;
110110 }
111111
@@ -121,7 +121,7 @@
122122 return array( 'found' => false );
123123 }
124124 }
125 -
 125+
126126 static function nse( $parser, $part1 = '' ) {
127127 return wfUrlencode( str_replace( ' ', '_', self::ns( $parser, $part1 ) ) );
128128 }
@@ -209,7 +209,7 @@
210210 // allow prefix.
211211 $title = Title::newFromText( $user );
212212
213 - if (is_object( $title ) && $title->getNamespace() == NS_USER)
 213+ if ( is_object( $title ) && $title->getNamespace() == NS_USER )
214214 $user = $title->getText();
215215
216216 // check parameter, or use $wgUser if in interface message
@@ -224,8 +224,8 @@
225225 wfProfileOut( __METHOD__ );
226226 return $ret;
227227 }
228 - static function plural( $parser, $text = '') {
229 - $forms = array_slice( func_get_args(), 2);
 228+ static function plural( $parser, $text = '' ) {
 229+ $forms = array_slice( func_get_args(), 2 );
230230 $text = $parser->getFunctionLang()->parseFormattedNumber( $text );
231231 return $parser->getFunctionLang()->convertPlural( $text, $forms );
232232 }
@@ -330,37 +330,37 @@
331331 */
332332 static function mwnamespace( $parser, $title = null ) {
333333 $t = Title::newFromText( $title );
334 - if ( is_null($t) )
 334+ if ( is_null( $t ) )
335335 return '';
336336 return str_replace( '_', ' ', $t->getNsText() );
337337 }
338338 static function namespacee( $parser, $title = null ) {
339339 $t = Title::newFromText( $title );
340 - if ( is_null($t) )
 340+ if ( is_null( $t ) )
341341 return '';
342342 return wfUrlencode( $t->getNsText() );
343343 }
344344 static function talkspace( $parser, $title = null ) {
345345 $t = Title::newFromText( $title );
346 - if ( is_null($t) || !$t->canTalk() )
 346+ if ( is_null( $t ) || !$t->canTalk() )
347347 return '';
348348 return str_replace( '_', ' ', $t->getTalkNsText() );
349349 }
350350 static function talkspacee( $parser, $title = null ) {
351351 $t = Title::newFromText( $title );
352 - if ( is_null($t) || !$t->canTalk() )
 352+ if ( is_null( $t ) || !$t->canTalk() )
353353 return '';
354354 return wfUrlencode( $t->getTalkNsText() );
355355 }
356356 static function subjectspace( $parser, $title = null ) {
357357 $t = Title::newFromText( $title );
358 - if ( is_null($t) )
 358+ if ( is_null( $t ) )
359359 return '';
360360 return str_replace( '_', ' ', $t->getSubjectNsText() );
361361 }
362362 static function subjectspacee( $parser, $title = null ) {
363363 $t = Title::newFromText( $title );
364 - if ( is_null($t) )
 364+ if ( is_null( $t ) )
365365 return '';
366366 return wfUrlencode( $t->getSubjectNsText() );
367367 }
@@ -370,73 +370,73 @@
371371 */
372372 static function pagename( $parser, $title = null ) {
373373 $t = Title::newFromText( $title );
374 - if ( is_null($t) )
 374+ if ( is_null( $t ) )
375375 return '';
376376 return wfEscapeWikiText( $t->getText() );
377377 }
378378 static function pagenamee( $parser, $title = null ) {
379379 $t = Title::newFromText( $title );
380 - if ( is_null($t) )
 380+ if ( is_null( $t ) )
381381 return '';
382382 return $t->getPartialURL();
383383 }
384384 static function fullpagename( $parser, $title = null ) {
385385 $t = Title::newFromText( $title );
386 - if ( is_null($t) || !$t->canTalk() )
 386+ if ( is_null( $t ) || !$t->canTalk() )
387387 return '';
388388 return wfEscapeWikiText( $t->getPrefixedText() );
389389 }
390390 static function fullpagenamee( $parser, $title = null ) {
391391 $t = Title::newFromText( $title );
392 - if ( is_null($t) || !$t->canTalk() )
 392+ if ( is_null( $t ) || !$t->canTalk() )
393393 return '';
394394 return $t->getPrefixedURL();
395395 }
396396 static function subpagename( $parser, $title = null ) {
397397 $t = Title::newFromText( $title );
398 - if ( is_null($t) )
 398+ if ( is_null( $t ) )
399399 return '';
400400 return $t->getSubpageText();
401401 }
402402 static function subpagenamee( $parser, $title = null ) {
403403 $t = Title::newFromText( $title );
404 - if ( is_null($t) )
 404+ if ( is_null( $t ) )
405405 return '';
406406 return $t->getSubpageUrlForm();
407407 }
408408 static function basepagename( $parser, $title = null ) {
409409 $t = Title::newFromText( $title );
410 - if ( is_null($t) )
 410+ if ( is_null( $t ) )
411411 return '';
412412 return $t->getBaseText();
413413 }
414414 static function basepagenamee( $parser, $title = null ) {
415415 $t = Title::newFromText( $title );
416 - if ( is_null($t) )
 416+ if ( is_null( $t ) )
417417 return '';
418418 return wfUrlEncode( str_replace( ' ', '_', $t->getBaseText() ) );
419419 }
420420 static function talkpagename( $parser, $title = null ) {
421421 $t = Title::newFromText( $title );
422 - if ( is_null($t) || !$t->canTalk() )
 422+ if ( is_null( $t ) || !$t->canTalk() )
423423 return '';
424424 return wfEscapeWikiText( $t->getTalkPage()->getPrefixedText() );
425425 }
426426 static function talkpagenamee( $parser, $title = null ) {
427427 $t = Title::newFromText( $title );
428 - if ( is_null($t) || !$t->canTalk() )
 428+ if ( is_null( $t ) || !$t->canTalk() )
429429 return '';
430430 return $t->getTalkPage()->getPrefixedUrl();
431431 }
432432 static function subjectpagename( $parser, $title = null ) {
433433 $t = Title::newFromText( $title );
434 - if ( is_null($t) )
 434+ if ( is_null( $t ) )
435435 return '';
436436 return wfEscapeWikiText( $t->getSubjectPage()->getPrefixedText() );
437437 }
438438 static function subjectpagenamee( $parser, $title = null ) {
439439 $t = Title::newFromText( $title );
440 - if ( is_null($t) )
 440+ if ( is_null( $t ) )
441441 return '';
442442 return $t->getSubjectPage()->getPrefixedUrl();
443443 }
@@ -449,7 +449,7 @@
450450 * for more information.
451451 */
452452 static function pipetrick( $parser, $link = '', $text = '' ) {
453 - if ($link)
 453+ if ( $link )
454454 return $parser->getPipeTrickText( $link );
455455 else
456456 return $parser->getPipeTrickLink( $text );
@@ -501,7 +501,7 @@
502502 */
503503 static function pagesize( $parser, $page = '', $raw = null ) {
504504 static $cache = array();
505 - $title = Title::newFromText($page);
 505+ $title = Title::newFromText( $page );
506506
507507 if( !is_object( $title ) ) {
508508 $cache[$page] = 0;
@@ -515,7 +515,7 @@
516516 if( isset( $cache[$page] ) ) {
517517 $length = $cache[$page];
518518 } elseif( $parser->incrementExpensiveFunctionCount() ) {
519 - $rev = Revision::newFromTitle($title);
 519+ $rev = Revision::newFromTitle( $title );
520520 $id = $rev ? $rev->getPage() : 0;
521521 $length = $cache[$page] = $rev ? $rev->getSize() : 0;
522522

Comments

#Comment by He7d3r (talk | contribs)   17:51, 22 January 2011

Per Manual:Coding_conventions#Braceless_control_structures, shouldn't we also add the brackets { ... } ?

E.g.:

		if ( is_null( $t ) ) {
			return '';
		}

Status & tagging log