r86787 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86786‎ | r86787 | r86788 >
Date:19:28, 23 April 2011
Author:mah
Status:ok
Tags:
Comment:
random w/s cleanup
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/tests/phpunit/includes/TitlePermissionTest.php (modified) (history)
  • /trunk/phase3/tests/phpunit/includes/api/ApiSetup.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/TitlePermissionTest.php
@@ -28,14 +28,14 @@
2929 $this->title = Title::makeTitle( NS_MAIN, "Main Page" );
3030 if ( !isset( $this->userUser ) || !( $this->userUser instanceOf User ) ) {
3131 $this->userUser = User::newFromName( $this->userName );
32 -
 32+
3333 if ( !$this->userUser->getID() ) {
3434 $this->userUser = User::createNew( $this->userName, array(
3535 "email" => "test@example.com",
3636 "real_name" => "Test User" ) );
3737 $this->userUser->load();
3838 }
39 -
 39+
4040 $this->altUser = User::newFromName( $this->altUserName );
4141 if ( !$this->altUser->getID() ) {
4242 $this->altUser = User::createNew( $this->altUserName, array(
@@ -334,7 +334,7 @@
335335 $prefix = $wgContLang->getFormattedNsText( NS_PROJECT );
336336
337337 $this->setTitle( NS_SPECIAL );
338 -
 338+
339339 $this->assertEquals( array( array( 'badaccess-group0' ), array( 'ns-specialprotected' ) ),
340340 $this->title->getUserPermissionsErrors( 'bogus', $this->user ) );
341341 $this->assertEquals( array( array( 'badaccess-group0' ) ),
Index: trunk/phase3/tests/phpunit/includes/api/ApiSetup.php
@@ -27,7 +27,7 @@
2828 $data[0] = $module->getResultData();
2929 $data[1] = $req;
3030 $data[2] = $_SESSION;
31 -
 31+
3232 if( $appendModule ) $data[3] = $module;
3333
3434 return $data;
@@ -41,7 +41,7 @@
4242
4343 $GLOBALS['wgUser'] = $this->sysopUser->user;
4444 }
45 -
 45+
4646 function doLogin() {
4747 $data = $this->doApiRequest( array(
4848 'action' => 'login',
@@ -55,10 +55,10 @@
5656 "lgtoken" => $token,
5757 "lgname" => $this->sysopUser->userName,
5858 "lgpassword" => $this->sysopUser->password ), $data );
59 -
 59+
6060 return $data;
6161 }
62 -
 62+
6363 function getTokenList( $user ) {
6464 $GLOBALS['wgUser'] = $user->user;
6565 $data = $this->doApiRequest( array(
@@ -68,7 +68,7 @@
6969 'prop' => 'info' ) );
7070 return $data;
7171 }
72 -
 72+
7373 }
7474
7575 class UserWrapper {
Index: trunk/phase3/includes/OutputPage.php
@@ -10,9 +10,9 @@
1111 *
1212 * This class is used to prepare the final rendering. A skin is then
1313 * applied to the output parameters (links, javascript, html, categories ...).
14 - *
 14+ *
1515 * Another class (fixme) handles sending the whole page to the client.
16 - *
 16+ *
1717 * Some comments comes from a pairing session between Zak Greant and Ashar Voultoiz
1818 * in November 2010.
1919 *
@@ -1161,7 +1161,7 @@
11621162 /**
11631163 * Return whether user JavaScript is allowed for this page
11641164 * @deprecated since 1.18 Load modules with ResourceLoader, and origin and
1165 - * trustworthiness is identified and enforced automagically.
 1165+ * trustworthiness is identified and enforced automagically.
11661166 * @return Boolean
11671167 */
11681168 public function isUserJsAllowed() {
@@ -1672,11 +1672,11 @@
16731673 }
16741674
16751675 /**
1676 - * Set a flag which will cause an X-Frame-Options header appropriate for
1677 - * edit pages to be sent. The header value is controlled by
 1676+ * Set a flag which will cause an X-Frame-Options header appropriate for
 1677+ * edit pages to be sent. The header value is controlled by
16781678 * $wgEditPageFrameOptions.
16791679 *
1680 - * This is the default for special pages. If you display a CSRF-protected
 1680+ * This is the default for special pages. If you display a CSRF-protected
16811681 * form on an ordinary view page, then you need to call this function.
16821682 */
16831683 public function preventClickjacking( $enable = true ) {
@@ -1693,8 +1693,8 @@
16941694 }
16951695
16961696 /**
1697 - * Get the X-Frame-Options header value (without the name part), or false
1698 - * if there isn't one. This is used by Skin to determine whether to enable
 1697+ * Get the X-Frame-Options header value (without the name part), or false
 1698+ * if there isn't one. This is used by Skin to determine whether to enable
16991699 * JavaScript frame-breaking, for clients that don't support X-Frame-Options.
17001700 */
17011701 public function getFrameOptions() {
@@ -2381,7 +2381,7 @@
23822382 $this->mResourceLoader = new ResourceLoader();
23832383 }
23842384 return $this->mResourceLoader;
2385 - }
 2385+ }
23862386
23872387 /**
23882388 * TODO: Document
@@ -2460,7 +2460,7 @@
24612461 if ( ( $group === 'user' || $group === 'private' ) && $this->getUser()->isLoggedIn() ) {
24622462 $query['user'] = $this->getUser()->getName();
24632463 }
2464 -
 2464+
24652465 // Create a fake request based on the one we are about to make so modules return
24662466 // correct timestamp and emptiness data
24672467 $context = new ResourceLoaderContext( $resourceLoader, new FauxRequest( $query ) );
@@ -2474,9 +2474,9 @@
24752475 if ( $modules === array() ) {
24762476 continue;
24772477 }
2478 -
 2478+
24792479 $query['modules'] = implode( '|', array_keys( $modules ) );
2480 -
 2480+
24812481 // Support inlining of private modules if configured as such
24822482 if ( $group === 'private' && $wgResourceLoaderInlinePrivateModules ) {
24832483 if ( $only == ResourceLoaderModule::TYPE_STYLES ) {
@@ -2545,14 +2545,14 @@
25462546 function getHeadScripts( Skin $sk ) {
25472547 // Startup - this will immediately load jquery and mediawiki modules
25482548 $scripts = $this->makeResourceLoaderLink( $sk, 'startup', ResourceLoaderModule::TYPE_SCRIPTS, true );
2549 -
 2549+
25502550 // Load config before anything else
25512551 $scripts .= Html::inlineScript(
25522552 ResourceLoader::makeLoaderConditionalScript(
25532553 ResourceLoader::makeConfigSetScript( $this->getJSVars() )
25542554 )
25552555 );
2556 -
 2556+
25572557 // Script and Messages "only" requests marked for top inclusion
25582558 // Messages should go first
25592559 $scripts .= $this->makeResourceLoaderLink( $sk, $this->getModuleMessages( true, 'top' ), ResourceLoaderModule::TYPE_MESSAGES );
@@ -2572,14 +2572,14 @@
25732573
25742574 return $scripts;
25752575 }
2576 -
 2576+
25772577 /**
25782578 * JS stuff to put at the bottom of the <body>: modules marked with position 'bottom',
25792579 * legacy scripts ($this->mScripts), user preferences, site JS and user JS
25802580 */
25812581 function getBottomScripts( Skin $sk ) {
25822582 global $wgUseSiteJs, $wgAllowUserJs;
2583 -
 2583+
25842584 // Script and Messages "only" requests marked for bottom inclusion
25852585 // Messages should go first
25862586 $scripts = $this->makeResourceLoaderLink( $sk, $this->getModuleMessages( true, 'bottom' ), ResourceLoaderModule::TYPE_MESSAGES );
@@ -2597,7 +2597,7 @@
25982598 )
25992599 );
26002600 }
2601 -
 2601+
26022602 // Legacy Scripts
26032603 $scripts .= "\n" . $this->mScripts;
26042604
@@ -2624,13 +2624,13 @@
26252625 }
26262626 }
26272627 $scripts .= $this->makeResourceLoaderLink( $sk, $userScripts, ResourceLoaderModule::TYPE_SCRIPTS );
2628 -
 2628+
26292629 return $scripts;
26302630 }
26312631
26322632 /**
26332633 * Get an array containing global JS variables
2634 - *
 2634+ *
26352635 * Do not add things here which can be evaluated in
26362636 * ResourceLoaderStartupScript - in other words, without state.
26372637 * You will only be adding bloat to the page and causing page caches to
@@ -2672,10 +2672,10 @@
26732673 if ( $wgUseAjax && $wgEnableMWSuggest && !$this->getUser()->getOption( 'disablesuggest', false ) ) {
26742674 $vars['wgSearchNamespaces'] = SearchEngine::userNamespaces( $this->getUser() );
26752675 }
2676 -
 2676+
26772677 // Allow extensions to add their custom variables to the global JS variables
26782678 wfRunHooks( 'MakeGlobalVariablesScript', array( &$vars ) );
2679 -
 2679+
26802680 return $vars;
26812681 }
26822682
@@ -3007,7 +3007,7 @@
30083008 // Add marker tag to mark the place where the client-side loader should inject dynamic styles
30093009 // We use a <meta> tag with a made-up name for this because that's valid HTML
30103010 $ret .= Html::element( 'meta', array( 'name' => 'ResourceLoaderDynamicStyles', 'content' => '' ) ) . "\n";
3011 -
 3011+
30123012 // Add site, private and user styles
30133013 // 'private' at present only contains user.options, so put that before 'user'
30143014 // Any future private modules will likely have a similar user-specific character

Status & tagging log