r90905 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90904‎ | r90905 | r90906 >
Date:20:36, 27 June 2011
Author:aaron
Status:ok
Tags:
Comment:
* Fixed 'Fatal error: Class 'SpecialMyuploads' not found in C:\wamp\www\MW_trunk\includes\SpecialPageFactory.php on line 318'
* Made use of $this->getUser() with special pages rather than wgUser
* Broke long lines
Modified paths:
  • /trunk/phase3/includes/AutoLoader.php (modified) (history)
  • /trunk/phase3/includes/SpecialPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/AutoLoader.php
@@ -203,6 +203,7 @@
204204 'SpecialMycontributions' => 'includes/SpecialPage.php',
205205 'SpecialMypage' => 'includes/SpecialPage.php',
206206 'SpecialMytalk' => 'includes/SpecialPage.php',
 207+ 'SpecialMyuploads' => 'includes/SpecialPage.php',
207208 'SpecialPage' => 'includes/SpecialPage.php',
208209 'SpecialPageFactory' => 'includes/SpecialPageFactory.php',
209210 'SpecialRedirectToSpecial' => 'includes/SpecialPage.php',
Index: trunk/phase3/includes/SpecialPage.php
@@ -321,7 +321,10 @@
322322 * @param $file String: file which is included by execute(). It is also constructed from $name by default
323323 * @param $includable Bool: whether the page can be included in normal pages
324324 */
325 - public function __construct( $name = '', $restriction = '', $listed = true, $function = false, $file = 'default', $includable = false ) {
 325+ public function __construct(
 326+ $name = '', $restriction = '', $listed = true,
 327+ $function = false, $file = 'default', $includable = false
 328+ ) {
326329 $this->init( $name, $restriction, $listed, $function, $file, $includable );
327330 }
328331
@@ -569,7 +572,8 @@
570573 $msg = $summaryMessageKey;
571574 }
572575 if ( !wfMessage( $msg )->isBlank() and ! $this->including() ) {
573 - $this->getOutput()->wrapWikiMsg( "<div class='mw-specialpage-summary'>\n$1\n</div>", $msg );
 576+ $this->getOutput()->wrapWikiMsg(
 577+ "<div class='mw-specialpage-summary'>\n$1\n</div>", $msg );
574578 }
575579
576580 }
@@ -691,7 +695,8 @@
692696 * @see wfMessage
693697 */
694698 public function msg( /* $args */ ) {
695 - return call_user_func_array( 'wfMessage', func_get_args() )->title( $this->getFullTitle() );
 699+ return call_user_func_array( 'wfMessage',
 700+ func_get_args() )->title( $this->getFullTitle() );
696701 }
697702
698703 /**
@@ -751,10 +756,12 @@
752757 $form = new HTMLForm( $this->fields, $this->getContext() );
753758 $form->setSubmitCallback( array( $this, 'onSubmit' ) );
754759 $form->setWrapperLegend( wfMessage( strtolower( $this->getName() ) . '-legend' ) );
755 - $form->addHeaderText( wfMessage( strtolower( $this->getName() ) . '-text' )->parseAsBlock() );
 760+ $form->addHeaderText(
 761+ wfMessage( strtolower( $this->getName() ) . '-text' )->parseAsBlock() );
756762
757763 // Retain query parameters (uselang etc)
758 - $params = array_diff_key( $this->getRequest()->getQueryValues(), array( 'title' => null ) );
 764+ $params = array_diff_key(
 765+ $this->getRequest()->getQueryValues(), array( 'title' => null ) );
759766 $form->addHiddenField( 'redirectparams', wfArrayToCGI( $params ) );
760767
761768 $form->addPreText( $this->preText() );
@@ -868,7 +875,9 @@
869876 */
870877 class IncludableSpecialPage extends SpecialPage
871878 {
872 - function __construct( $name, $restriction = '', $listed = true, $function = false, $file = 'default' ) {
 879+ function __construct(
 880+ $name, $restriction = '', $listed = true, $function = false, $file = 'default'
 881+ ) {
873882 parent::__construct( $name, $restriction, $listed, $function, $file, true );
874883 }
875884
@@ -946,10 +955,12 @@
947956 }
948957
949958 abstract class SpecialRedirectToSpecial extends RedirectSpecialPage {
950 -
951959 var $redirName, $redirSubpage;
952960
953 - function __construct( $name, $redirName, $redirSubpage = false, $allowedRedirectParams = array(), $addedRedirectParams = array() ) {
 961+ function __construct(
 962+ $name, $redirName, $redirSubpage = false,
 963+ $allowedRedirectParams = array(), $addedRedirectParams = array()
 964+ ) {
954965 parent::__construct( $name );
955966 $this->redirName = $redirName;
956967 $this->redirSubpage = $redirSubpage;
@@ -1013,11 +1024,10 @@
10141025 }
10151026
10161027 function getRedirect( $subpage ) {
1017 - global $wgUser;
10181028 if ( strval( $subpage ) !== '' ) {
1019 - return Title::makeTitle( NS_USER, $wgUser->getName() . '/' . $subpage );
 1029+ return Title::makeTitle( NS_USER, $this->getUser()->getName() . '/' . $subpage );
10201030 } else {
1021 - return Title::makeTitle( NS_USER, $wgUser->getName() );
 1031+ return Title::makeTitle( NS_USER, $this->getUser()->getName() );
10221032 }
10231033 }
10241034 }
@@ -1034,11 +1044,10 @@
10351045 }
10361046
10371047 function getRedirect( $subpage ) {
1038 - global $wgUser;
10391048 if ( strval( $subpage ) !== '' ) {
1040 - return Title::makeTitle( NS_USER_TALK, $wgUser->getName() . '/' . $subpage );
 1049+ return Title::makeTitle( NS_USER_TALK, $this->getUser()->getName() . '/' . $subpage );
10411050 } else {
1042 - return Title::makeTitle( NS_USER_TALK, $wgUser->getName() );
 1051+ return Title::makeTitle( NS_USER_TALK, $this->getUser()->getName() );
10431052 }
10441053 }
10451054 }
@@ -1055,8 +1064,7 @@
10561065 }
10571066
10581067 function getRedirect( $subpage ) {
1059 - global $wgUser;
1060 - return SpecialPage::getTitleFor( 'Contributions', $wgUser->getName() );
 1068+ return SpecialPage::getTitleFor( 'Contributions', $this->getUser()->getName() );
10611069 }
10621070 }
10631071
@@ -1070,8 +1078,7 @@
10711079 }
10721080
10731081 function getRedirect( $subpage ) {
1074 - global $wgUser;
1075 - return SpecialPage::getTitleFor( 'Listfiles', $wgUser->getName() );
 1082+ return SpecialPage::getTitleFor( 'Listfiles', $this->getUser()->getName() );
10761083 }
10771084 }
10781085

Status & tagging log