Index: trunk/phase3/includes/parser/CoreParserFunctions.php |
— | — | @@ -70,7 +70,7 @@ |
71 | 71 | $parser->setFunctionHook( 'pipetrick', array( __CLASS__, 'pipetrick' ), SFH_NO_HASH ); |
72 | 72 | $parser->setFunctionHook( 'pipetricke', array( __CLASS__, 'pipetricke' ), SFH_NO_HASH ); |
73 | 73 | $parser->setFunctionHook( 'tag', array( __CLASS__, 'tagObj' ), SFH_OBJECT_ARGS ); |
74 | | - $parser->setFunctionHook( 'formatdate', array( __CLASS__, 'formatDate' ) ); |
| 74 | + $parser->setFunctionHook( 'formatdate', array( __CLASS__, 'formatDate' ) ); |
75 | 75 | |
76 | 76 | if ( $wgAllowDisplayTitle ) { |
77 | 77 | $parser->setFunctionHook( 'displaytitle', array( __CLASS__, 'displaytitle' ), SFH_NO_HASH ); |
— | — | @@ -95,16 +95,16 @@ |
96 | 96 | static function formatDate( $parser, $date, $defaultPref = null ) { |
97 | 97 | $df = DateFormatter::getInstance(); |
98 | 98 | |
99 | | - $date = trim($date); |
| 99 | + $date = trim( $date ); |
100 | 100 | |
101 | 101 | $pref = $parser->mOptions->getDateFormat(); |
102 | 102 | |
103 | 103 | // Specify a different default date format other than the the normal default |
104 | 104 | // iff the user has 'default' for their setting |
105 | | - if ($pref == 'default' && $defaultPref) |
| 105 | + if ( $pref == 'default' && $defaultPref ) |
106 | 106 | $pref = $defaultPref; |
107 | 107 | |
108 | | - $date = $df->reformat( $pref, $date, array('match-whole') ); |
| 108 | + $date = $df->reformat( $pref, $date, array( 'match-whole' ) ); |
109 | 109 | return $date; |
110 | 110 | } |
111 | 111 | |
— | — | @@ -121,7 +121,7 @@ |
122 | 122 | return array( 'found' => false ); |
123 | 123 | } |
124 | 124 | } |
125 | | - |
| 125 | + |
126 | 126 | static function nse( $parser, $part1 = '' ) { |
127 | 127 | return wfUrlencode( str_replace( ' ', '_', self::ns( $parser, $part1 ) ) ); |
128 | 128 | } |
— | — | @@ -209,7 +209,7 @@ |
210 | 210 | // allow prefix. |
211 | 211 | $title = Title::newFromText( $user ); |
212 | 212 | |
213 | | - if (is_object( $title ) && $title->getNamespace() == NS_USER) |
| 213 | + if ( is_object( $title ) && $title->getNamespace() == NS_USER ) |
214 | 214 | $user = $title->getText(); |
215 | 215 | |
216 | 216 | // check parameter, or use $wgUser if in interface message |
— | — | @@ -224,8 +224,8 @@ |
225 | 225 | wfProfileOut( __METHOD__ ); |
226 | 226 | return $ret; |
227 | 227 | } |
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 ); |
230 | 230 | $text = $parser->getFunctionLang()->parseFormattedNumber( $text ); |
231 | 231 | return $parser->getFunctionLang()->convertPlural( $text, $forms ); |
232 | 232 | } |
— | — | @@ -330,37 +330,37 @@ |
331 | 331 | */ |
332 | 332 | static function mwnamespace( $parser, $title = null ) { |
333 | 333 | $t = Title::newFromText( $title ); |
334 | | - if ( is_null($t) ) |
| 334 | + if ( is_null( $t ) ) |
335 | 335 | return ''; |
336 | 336 | return str_replace( '_', ' ', $t->getNsText() ); |
337 | 337 | } |
338 | 338 | static function namespacee( $parser, $title = null ) { |
339 | 339 | $t = Title::newFromText( $title ); |
340 | | - if ( is_null($t) ) |
| 340 | + if ( is_null( $t ) ) |
341 | 341 | return ''; |
342 | 342 | return wfUrlencode( $t->getNsText() ); |
343 | 343 | } |
344 | 344 | static function talkspace( $parser, $title = null ) { |
345 | 345 | $t = Title::newFromText( $title ); |
346 | | - if ( is_null($t) || !$t->canTalk() ) |
| 346 | + if ( is_null( $t ) || !$t->canTalk() ) |
347 | 347 | return ''; |
348 | 348 | return str_replace( '_', ' ', $t->getTalkNsText() ); |
349 | 349 | } |
350 | 350 | static function talkspacee( $parser, $title = null ) { |
351 | 351 | $t = Title::newFromText( $title ); |
352 | | - if ( is_null($t) || !$t->canTalk() ) |
| 352 | + if ( is_null( $t ) || !$t->canTalk() ) |
353 | 353 | return ''; |
354 | 354 | return wfUrlencode( $t->getTalkNsText() ); |
355 | 355 | } |
356 | 356 | static function subjectspace( $parser, $title = null ) { |
357 | 357 | $t = Title::newFromText( $title ); |
358 | | - if ( is_null($t) ) |
| 358 | + if ( is_null( $t ) ) |
359 | 359 | return ''; |
360 | 360 | return str_replace( '_', ' ', $t->getSubjectNsText() ); |
361 | 361 | } |
362 | 362 | static function subjectspacee( $parser, $title = null ) { |
363 | 363 | $t = Title::newFromText( $title ); |
364 | | - if ( is_null($t) ) |
| 364 | + if ( is_null( $t ) ) |
365 | 365 | return ''; |
366 | 366 | return wfUrlencode( $t->getSubjectNsText() ); |
367 | 367 | } |
— | — | @@ -370,73 +370,73 @@ |
371 | 371 | */ |
372 | 372 | static function pagename( $parser, $title = null ) { |
373 | 373 | $t = Title::newFromText( $title ); |
374 | | - if ( is_null($t) ) |
| 374 | + if ( is_null( $t ) ) |
375 | 375 | return ''; |
376 | 376 | return wfEscapeWikiText( $t->getText() ); |
377 | 377 | } |
378 | 378 | static function pagenamee( $parser, $title = null ) { |
379 | 379 | $t = Title::newFromText( $title ); |
380 | | - if ( is_null($t) ) |
| 380 | + if ( is_null( $t ) ) |
381 | 381 | return ''; |
382 | 382 | return $t->getPartialURL(); |
383 | 383 | } |
384 | 384 | static function fullpagename( $parser, $title = null ) { |
385 | 385 | $t = Title::newFromText( $title ); |
386 | | - if ( is_null($t) || !$t->canTalk() ) |
| 386 | + if ( is_null( $t ) || !$t->canTalk() ) |
387 | 387 | return ''; |
388 | 388 | return wfEscapeWikiText( $t->getPrefixedText() ); |
389 | 389 | } |
390 | 390 | static function fullpagenamee( $parser, $title = null ) { |
391 | 391 | $t = Title::newFromText( $title ); |
392 | | - if ( is_null($t) || !$t->canTalk() ) |
| 392 | + if ( is_null( $t ) || !$t->canTalk() ) |
393 | 393 | return ''; |
394 | 394 | return $t->getPrefixedURL(); |
395 | 395 | } |
396 | 396 | static function subpagename( $parser, $title = null ) { |
397 | 397 | $t = Title::newFromText( $title ); |
398 | | - if ( is_null($t) ) |
| 398 | + if ( is_null( $t ) ) |
399 | 399 | return ''; |
400 | 400 | return $t->getSubpageText(); |
401 | 401 | } |
402 | 402 | static function subpagenamee( $parser, $title = null ) { |
403 | 403 | $t = Title::newFromText( $title ); |
404 | | - if ( is_null($t) ) |
| 404 | + if ( is_null( $t ) ) |
405 | 405 | return ''; |
406 | 406 | return $t->getSubpageUrlForm(); |
407 | 407 | } |
408 | 408 | static function basepagename( $parser, $title = null ) { |
409 | 409 | $t = Title::newFromText( $title ); |
410 | | - if ( is_null($t) ) |
| 410 | + if ( is_null( $t ) ) |
411 | 411 | return ''; |
412 | 412 | return $t->getBaseText(); |
413 | 413 | } |
414 | 414 | static function basepagenamee( $parser, $title = null ) { |
415 | 415 | $t = Title::newFromText( $title ); |
416 | | - if ( is_null($t) ) |
| 416 | + if ( is_null( $t ) ) |
417 | 417 | return ''; |
418 | 418 | return wfUrlEncode( str_replace( ' ', '_', $t->getBaseText() ) ); |
419 | 419 | } |
420 | 420 | static function talkpagename( $parser, $title = null ) { |
421 | 421 | $t = Title::newFromText( $title ); |
422 | | - if ( is_null($t) || !$t->canTalk() ) |
| 422 | + if ( is_null( $t ) || !$t->canTalk() ) |
423 | 423 | return ''; |
424 | 424 | return wfEscapeWikiText( $t->getTalkPage()->getPrefixedText() ); |
425 | 425 | } |
426 | 426 | static function talkpagenamee( $parser, $title = null ) { |
427 | 427 | $t = Title::newFromText( $title ); |
428 | | - if ( is_null($t) || !$t->canTalk() ) |
| 428 | + if ( is_null( $t ) || !$t->canTalk() ) |
429 | 429 | return ''; |
430 | 430 | return $t->getTalkPage()->getPrefixedUrl(); |
431 | 431 | } |
432 | 432 | static function subjectpagename( $parser, $title = null ) { |
433 | 433 | $t = Title::newFromText( $title ); |
434 | | - if ( is_null($t) ) |
| 434 | + if ( is_null( $t ) ) |
435 | 435 | return ''; |
436 | 436 | return wfEscapeWikiText( $t->getSubjectPage()->getPrefixedText() ); |
437 | 437 | } |
438 | 438 | static function subjectpagenamee( $parser, $title = null ) { |
439 | 439 | $t = Title::newFromText( $title ); |
440 | | - if ( is_null($t) ) |
| 440 | + if ( is_null( $t ) ) |
441 | 441 | return ''; |
442 | 442 | return $t->getSubjectPage()->getPrefixedUrl(); |
443 | 443 | } |
— | — | @@ -449,7 +449,7 @@ |
450 | 450 | * for more information. |
451 | 451 | */ |
452 | 452 | static function pipetrick( $parser, $link = '', $text = '' ) { |
453 | | - if ($link) |
| 453 | + if ( $link ) |
454 | 454 | return $parser->getPipeTrickText( $link ); |
455 | 455 | else |
456 | 456 | return $parser->getPipeTrickLink( $text ); |
— | — | @@ -501,7 +501,7 @@ |
502 | 502 | */ |
503 | 503 | static function pagesize( $parser, $page = '', $raw = null ) { |
504 | 504 | static $cache = array(); |
505 | | - $title = Title::newFromText($page); |
| 505 | + $title = Title::newFromText( $page ); |
506 | 506 | |
507 | 507 | if( !is_object( $title ) ) { |
508 | 508 | $cache[$page] = 0; |
— | — | @@ -515,7 +515,7 @@ |
516 | 516 | if( isset( $cache[$page] ) ) { |
517 | 517 | $length = $cache[$page]; |
518 | 518 | } elseif( $parser->incrementExpensiveFunctionCount() ) { |
519 | | - $rev = Revision::newFromTitle($title); |
| 519 | + $rev = Revision::newFromTitle( $title ); |
520 | 520 | $id = $rev ? $rev->getPage() : 0; |
521 | 521 | $length = $cache[$page] = $rev ? $rev->getSize() : 0; |
522 | 522 | |