r106421 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106420‎ | r106421 | r106422 >
Date:09:29, 16 December 2011
Author:nikerabbit
Status:ok
Tags:
Comment:
Stylize
Modified paths:
  • /trunk/phase3/includes/SpecialPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialPage.php
@@ -348,12 +348,12 @@
349349 $this->mListed = $listed;
350350 $this->mIncludable = $includable;
351351 if ( !$function ) {
352 - $this->mFunction = 'wfSpecial'.$name;
 352+ $this->mFunction = 'wfSpecial' . $name;
353353 } else {
354354 $this->mFunction = $function;
355355 }
356356 if ( $file === 'default' ) {
357 - $this->mFile = dirname(__FILE__) . "/specials/Special$name.php";
 357+ $this->mFile = dirname( __FILE__ ) . "/specials/Special$name.php";
358358 } else {
359359 $this->mFile = $file;
360360 }
@@ -370,9 +370,9 @@
371371 public function __call( $fName, $a ) {
372372 // Deprecated messages now, remove in 1.19 or 1.20?
373373 wfDeprecated( __METHOD__, '1.17' );
374 -
 374+
375375 // Sometimes $fName is SpecialPage, sometimes it's specialpage. <3 PHP
376 - if( strtolower( $fName ) == 'specialpage' ) {
 376+ if ( strtolower( $fName ) == 'specialpage' ) {
377377 $name = isset( $a[0] ) ? $a[0] : '';
378378 $restriction = isset( $a[1] ) ? $a[1] : '';
379379 $listed = isset( $a[2] ) ? $a[2] : true;
@@ -410,7 +410,7 @@
411411 * @deprecated since 1.18
412412 */
413413 function getFile() {
414 - wfDeprecated( __METHOD__, '1.18' );
 414+ wfDeprecated( __METHOD__, '1.18' );
415415 return $this->mFile;
416416 }
417417
@@ -438,7 +438,7 @@
439439 * @param $x Bool
440440 * @return Bool
441441 */
442 - function listed( $x = null) {
 442+ function listed( $x = null ) {
443443 return wfSetVar( $this->mListed, $x );
444444 }
445445
@@ -446,7 +446,7 @@
447447 * Whether it's allowed to transclude the special page via {{Special:Foo/params}}
448448 * @return Bool
449449 */
450 - public function isIncludable(){
 450+ public function isIncludable() {
451451 return $this->mIncludable;
452452 }
453453
@@ -466,7 +466,7 @@
467467 * @return Mixed
468468 * @deprecated since 1.18
469469 */
470 - function restriction( $x = null) { wfDeprecated( __METHOD__, '1.18' ); return wfSetVar( $this->mRestriction, $x ); }
 470+ function restriction( $x = null ) { wfDeprecated( __METHOD__, '1.18' ); return wfSetVar( $this->mRestriction, $x ); }
471471
472472 /**
473473 * These mutators are very evil, as the relevant variables should not mutate. So
@@ -475,7 +475,7 @@
476476 * @return Mixed
477477 * @deprecated since 1.18
478478 */
479 - function func( $x = null) { wfDeprecated( __METHOD__, '1.18' ); return wfSetVar( $this->mFunction, $x ); }
 479+ function func( $x = null ) { wfDeprecated( __METHOD__, '1.18' ); return wfSetVar( $this->mFunction, $x ); }
480480
481481 /**
482482 * These mutators are very evil, as the relevant variables should not mutate. So
@@ -484,7 +484,7 @@
485485 * @return Mixed
486486 * @deprecated since 1.18
487487 */
488 - function file( $x = null) { wfDeprecated( __METHOD__, '1.18' ); return wfSetVar( $this->mFile, $x ); }
 488+ function file( $x = null ) { wfDeprecated( __METHOD__, '1.18' ); return wfSetVar( $this->mFile, $x ); }
489489
490490 /**
491491 * These mutators are very evil, as the relevant variables should not mutate. So
@@ -536,7 +536,7 @@
537537 public function isRestricted() {
538538 global $wgGroupPermissions;
539539 // DWIM: If all anons can do something, then it is not restricted
540 - return $this->mRestriction != '' && empty($wgGroupPermissions['*'][$this->mRestriction]);
 540+ return $this->mRestriction != '' && empty( $wgGroupPermissions['*'][$this->mRestriction] );
541541 }
542542
543543 /**
@@ -605,7 +605,7 @@
606606
607607 $func = $this->mFunction;
608608 // only load file if the function does not exist
609 - if( !is_callable($func) && $this->mFile ) {
 609+ if ( !is_callable( $func ) && $this->mFile ) {
610610 require_once( $this->mFile );
611611 }
612612 $this->outputHeader();
@@ -623,7 +623,7 @@
624624 function outputHeader( $summaryMessageKey = '' ) {
625625 global $wgContLang;
626626
627 - if( $summaryMessageKey == '' ) {
 627+ if ( $summaryMessageKey == '' ) {
628628 $msg = $wgContLang->lc( $this->getName() ) . '-summary';
629629 } else {
630630 $msg = $summaryMessageKey;
@@ -781,7 +781,7 @@
782782
783783 $feedTemplate = wfScript( 'api' ) . '?';
784784
785 - foreach( $wgFeedClasses as $format => $class ) {
 785+ foreach ( $wgFeedClasses as $format => $class ) {
786786 $theseParams = $params + array( 'feedformat' => $format );
787787 $url = $feedTemplate . wfArrayToCGI( $theseParams );
788788 $this->getOutput()->addFeedLink( $format, $url );
@@ -878,7 +878,7 @@
879879 * Maybe do something interesting with the subpage parameter
880880 * @param $par String
881881 */
882 - protected function setParameter( $par ){}
 882+ protected function setParameter( $par ) {}
883883
884884 /**
885885 * Called from execute() to check if the given user can perform this action.
@@ -928,7 +928,7 @@
929929 parent::__construct( $name, $restriction, false, $function, $file );
930930 }
931931
932 - public function isListed(){
 932+ public function isListed() {
933933 return false;
934934 }
935935 }
@@ -944,7 +944,7 @@
945945 parent::__construct( $name, $restriction, $listed, $function, $file, true );
946946 }
947947
948 - public function isIncludable(){
 948+ public function isIncludable() {
949949 return true;
950950 }
951951 }
@@ -961,7 +961,7 @@
962962 // Query parameteres added by redirects
963963 protected $mAddedRedirectParams = array();
964964
965 - public function execute( $par ){
 965+ public function execute( $par ) {
966966 $redirect = $this->getRedirect( $par );
967967 $query = $this->getRedirectQuery();
968968 // Redirect to a page title with possible query parameters
@@ -1001,13 +1001,13 @@
10021002 public function getRedirectQuery() {
10031003 $params = array();
10041004
1005 - foreach( $this->mAllowedRedirectParams as $arg ) {
1006 - if( $this->getRequest()->getVal( $arg, null ) !== null ){
 1005+ foreach ( $this->mAllowedRedirectParams as $arg ) {
 1006+ if ( $this->getRequest()->getVal( $arg, null ) !== null ) {
10071007 $params[$arg] = $this->getRequest()->getVal( $arg );
10081008 }
10091009 }
10101010
1011 - foreach( $this->mAddedRedirectParams as $arg => $val ) {
 1011+ foreach ( $this->mAddedRedirectParams as $arg => $val ) {
10121012 $params[$arg] = $val;
10131013 }
10141014
@@ -1044,7 +1044,7 @@
10451045 * ListAdmins --> ListUsers/sysop
10461046 */
10471047 class SpecialListAdmins extends SpecialRedirectToSpecial {
1048 - function __construct(){
 1048+ function __construct() {
10491049 parent::__construct( 'Listadmins', 'Listusers', 'sysop' );
10501050 }
10511051 }
@@ -1053,7 +1053,7 @@
10541054 * ListBots --> ListUsers/bot
10551055 */
10561056 class SpecialListBots extends SpecialRedirectToSpecial {
1057 - function __construct(){
 1057+ function __construct() {
10581058 parent::__construct( 'Listbots', 'Listusers', 'bot' );
10591059 }
10601060 }
@@ -1063,7 +1063,7 @@
10641064 * @todo FIXME: This (and the rest of the login frontend) needs to die a horrible painful death
10651065 */
10661066 class SpecialCreateAccount extends SpecialRedirectToSpecial {
1067 - function __construct(){
 1067+ function __construct() {
10681068 parent::__construct( 'CreateAccount', 'Userlogin', 'signup', array( 'uselang' ) );
10691069 }
10701070 }
@@ -1158,7 +1158,7 @@
11591159
11601160 function getRedirect( $subpage ) {
11611161 $subpage = intval( $subpage );
1162 - if( $subpage === 0 ) {
 1162+ if ( $subpage === 0 ) {
11631163 # throw an error page when no subpage was given
11641164 throw new ErrorPageError( 'nopagetitle', 'nopagetext' );
11651165 }

Status & tagging log