r111648 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111647‎ | r111648 | r111649 >
Date:16:09, 16 February 2012
Author:ialex
Status:ok
Tags:
Comment:
Whitespaces fixes
Modified paths:
  • /trunk/phase3/includes/EditPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/EditPage.php
@@ -37,7 +37,7 @@
3838 const AS_HOOK_ERROR = 210;
3939
4040 /**
41 - * Status: The filter function set in $wgFilterCallback returned true (= block it)
 41+ * Status: The filter function set in $wgFilterCallback returned true (= block it)
4242 */
4343 const AS_FILTERING = 211;
4444
@@ -182,7 +182,7 @@
183183 * @var ParserOutput
184184 */
185185 var $mParserOutput;
186 -
 186+
187187 /**
188188 * Has a summary been preset using GET parameter &summary= ?
189189 * @var Bool
@@ -288,7 +288,7 @@
289289 }
290290
291291 wfProfileIn( __METHOD__ );
292 - wfDebug( __METHOD__.": enter\n" );
 292+ wfDebug( __METHOD__ . ": enter\n" );
293293
294294 // If they used redlink=1 and the page exists, redirect to the main article
295295 if ( $wgRequest->getBool( 'redlink' ) && $this->mTitle->exists() ) {
@@ -339,7 +339,7 @@
340340 return;
341341 }
342342
343 - wfProfileIn( __METHOD__."-business-end" );
 343+ wfProfileIn( __METHOD__ . "-business-end" );
344344
345345 $this->isConflict = false;
346346 // css / js subpages of user pages get a special treatment
@@ -361,7 +361,7 @@
362362
363363 if ( 'save' == $this->formtype ) {
364364 if ( !$this->attemptSave() ) {
365 - wfProfileOut( __METHOD__."-business-end" );
 365+ wfProfileOut( __METHOD__ . "-business-end" );
366366 wfProfileOut( __METHOD__ );
367367 return;
368368 }
@@ -372,7 +372,7 @@
373373 if ( 'initial' == $this->formtype || $this->firsttime ) {
374374 if ( $this->initialiseForm() === false ) {
375375 $this->noSuchSectionPage();
376 - wfProfileOut( __METHOD__."-business-end" );
 376+ wfProfileOut( __METHOD__ . "-business-end" );
377377 wfProfileOut( __METHOD__ );
378378 return;
379379 }
@@ -383,7 +383,7 @@
384384 }
385385
386386 $this->showEditForm();
387 - wfProfileOut( __METHOD__."-business-end" );
 387+ wfProfileOut( __METHOD__ . "-business-end" );
388388 wfProfileOut( __METHOD__ );
389389 }
390390
@@ -400,7 +400,7 @@
401401 }
402402 # Ignore some permissions errors when a user is just previewing/viewing diffs
403403 $remove = array();
404 - foreach( $permErrors as $error ) {
 404+ foreach ( $permErrors as $error ) {
405405 if ( ( $this->preview || $this->diff ) &&
406406 ( $error[0] == 'blockedtext' || $error[0] == 'autoblockedtext' ) )
407407 {
@@ -475,7 +475,7 @@
476476 */
477477 function readOnlyPage( $source = null, $protected = false, $reasons = array(), $action = null ) {
478478 wfDeprecated( __METHOD__, '1.19' );
479 -
 479+
480480 global $wgRequest, $wgOut;
481481 if ( $wgRequest->getBool( 'redlink' ) ) {
482482 // The edit page was reached via a red link.
@@ -507,7 +507,7 @@
508508 // Standard preference behaviour
509509 return true;
510510 } elseif ( !$this->mTitle->exists() &&
511 - isset($wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()]) &&
 511+ isset( $wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()] ) &&
512512 $wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()] )
513513 {
514514 // Categories are special
@@ -524,7 +524,7 @@
525525 * @return bool
526526 */
527527 protected function isWrongCaseCssJsPage() {
528 - if( $this->mTitle->isCssJsSubpage() ) {
 528+ if ( $this->mTitle->isCssJsSubpage() ) {
529529 $name = $this->mTitle->getSkinFromCssJsSubpage();
530530 $skins = array_merge(
531531 array_keys( Skin::getSkinNames() ),
@@ -564,15 +564,15 @@
565565 # Also remove trailing whitespace, but don't remove _initial_
566566 # whitespace from the text boxes. This may be significant formatting.
567567 $this->textbox1 = $this->safeUnicodeInput( $request, 'wpTextbox1' );
568 - if ( !$request->getCheck('wpTextbox2') ) {
 568+ if ( !$request->getCheck( 'wpTextbox2' ) ) {
569569 // Skip this if wpTextbox2 has input, it indicates that we came
570570 // from a conflict page with raw page text, not a custom form
571571 // modified by subclasses
572 - wfProfileIn( get_class($this)."::importContentFormData" );
 572+ wfProfileIn( get_class( $this ) . "::importContentFormData" );
573573 $textbox1 = $this->importContentFormData( $request );
574 - if ( isset($textbox1) )
 574+ if ( isset( $textbox1 ) )
575575 $this->textbox1 = $textbox1;
576 - wfProfileOut( get_class($this)."::importContentFormData" );
 576+ wfProfileOut( get_class( $this ) . "::importContentFormData" );
577577 }
578578
579579 # Truncate for whole multibyte characters. +5 bytes for ellipsis
@@ -582,7 +582,7 @@
583583 # header syntax, e.g. 'Foobar'. This is mainly an issue when we are using wpSummary for
584584 # section titles.
585585 $this->summary = preg_replace( '/^\s*=+\s*(.*?)\s*=+\s*$/', '$1', $this->summary );
586 -
 586+
587587 # Treat sectiontitle the same way as summary.
588588 # Note that wpSectionTitle is not yet a part of the actual edit form, as wpSummary is
589589 # currently doing double duty as both edit summary and section title. Right now this
@@ -656,7 +656,7 @@
657657 {
658658 $this->allowBlankSummary = true;
659659 } else {
660 - $this->allowBlankSummary = $request->getBool( 'wpIgnoreBlankSummary' ) || !$wgUser->getOption( 'forceeditsummary');
 660+ $this->allowBlankSummary = $request->getBool( 'wpIgnoreBlankSummary' ) || !$wgUser->getOption( 'forceeditsummary' );
661661 }
662662
663663 $this->autoSumm = $request->getText( 'wpAutoSummary' );
@@ -675,7 +675,7 @@
676676 $this->minoredit = false;
677677 $this->watchthis = $request->getBool( 'watchthis', false ); // Watch may be overriden by request parameters
678678 $this->recreate = false;
679 -
 679+
680680 // When creating a new section, we can preload a section title by passing it as the
681681 // preloadtitle parameter in the URL (Bug 13100)
682682 if ( $this->section == 'new' && $request->getVal( 'preloadtitle' ) ) {
@@ -915,7 +915,7 @@
916916 if ( !empty( $this->mPreloadText ) ) {
917917 return $this->mPreloadText;
918918 }
919 -
 919+
920920 if ( $preload === '' ) {
921921 return '';
922922 }
@@ -1229,10 +1229,10 @@
12301230 if ( $this->sectiontitle !== '' ) {
12311231 // Insert the section title above the content.
12321232 $text = wfMsgForContent( 'newsectionheaderdefaultlevel', $this->sectiontitle ) . "\n\n" . $text;
1233 -
 1233+
12341234 // Jump to the new section
12351235 $result['sectionanchor'] = $wgParser->guessLegacySectionNameFromWikiText( $this->sectiontitle );
1236 -
 1236+
12371237 // If no edit summary was specified, create one automatically from the section
12381238 // title and have it link to the new section. Otherwise, respect the summary as
12391239 // passed.
@@ -1243,7 +1243,7 @@
12441244 } elseif ( $this->summary !== '' ) {
12451245 // Insert the section title above the content.
12461246 $text = wfMsgForContent( 'newsectionheaderdefaultlevel', $this->summary ) . "\n\n" . $text;
1247 -
 1247+
12481248 // Jump to the new section
12491249 $result['sectionanchor'] = $wgParser->guessLegacySectionNameFromWikiText( $this->summary );
12501250
@@ -1276,7 +1276,7 @@
12771277 } else {
12781278 // New comment; suppress conflict.
12791279 $this->isConflict = false;
1280 - wfDebug( __METHOD__ .": conflict suppressed; new section\n" );
 1280+ wfDebug( __METHOD__ . ": conflict suppressed; new section\n" );
12811281 }
12821282 } elseif ( $this->section == '' && $this->userWasLastToEdit( $wgUser->getId(), $this->edittime ) ) {
12831283 # Suppress edit conflict with self, except for section edits where merging is required.
@@ -1284,7 +1284,7 @@
12851285 $this->isConflict = false;
12861286 }
12871287 }
1288 -
 1288+
12891289 // If sectiontitle is set, use it, otherwise use the summary as the section title (for
12901290 // backwards compatibility with old forms/bots).
12911291 if ( $this->sectiontitle !== '' ) {
@@ -1292,7 +1292,7 @@
12931293 } else {
12941294 $sectionTitle = $this->summary;
12951295 }
1296 -
 1296+
12971297 if ( $this->isConflict ) {
12981298 wfDebug( __METHOD__ . ": conflict! getting section '$this->section' for time '$this->edittime' (article time '{$timestamp}')\n" );
12991299 $text = $this->mArticle->replaceSection( $this->section, $this->textbox1, $sectionTitle, $this->edittime );
@@ -1472,18 +1472,18 @@
14731473 * @return bool
14741474 */
14751475 protected function userWasLastToEdit( $id, $edittime ) {
1476 - if( !$id ) return false;
 1476+ if ( !$id ) return false;
14771477 $dbw = wfGetDB( DB_MASTER );
14781478 $res = $dbw->select( 'revision',
14791479 'rev_user',
14801480 array(
14811481 'rev_page' => $this->mTitle->getArticleId(),
1482 - 'rev_timestamp > '.$dbw->addQuotes( $dbw->timestamp($edittime) )
 1482+ 'rev_timestamp > ' . $dbw->addQuotes( $dbw->timestamp( $edittime ) )
14831483 ),
14841484 __METHOD__,
14851485 array( 'ORDER BY' => 'rev_timestamp ASC', 'LIMIT' => 50 ) );
14861486 foreach ( $res as $row ) {
1487 - if( $row->rev_user != $id ) {
 1487+ if ( $row->rev_user != $id ) {
14881488 return false;
14891489 }
14901490 }
@@ -1498,7 +1498,7 @@
14991499 *
15001500 * @return bool
15011501 */
1502 - function mergeChangesInto( &$editText ){
 1502+ function mergeChangesInto( &$editText ) {
15031503 wfProfileIn( __METHOD__ );
15041504
15051505 $db = wfGetDB( DB_MASTER );
@@ -1577,9 +1577,9 @@
15781578 * @return bool|string
15791579 */
15801580 protected static function matchSpamRegexInternal( $text, $regexes ) {
1581 - foreach( $regexes as $regex ) {
 1581+ foreach ( $regexes as $regex ) {
15821582 $matches = array();
1583 - if( preg_match( $regex, $text, $matches ) ) {
 1583+ if ( preg_match( $regex, $text, $matches ) ) {
15841584 return $matches[0];
15851585 }
15861586 }
@@ -1642,7 +1642,7 @@
16431643 $username = $parts[0];
16441644 $user = User::newFromName( $username, false /* allow IP users*/ );
16451645 $ip = User::isIP( $username );
1646 - if ( !($user && $user->isLoggedIn()) && !$ip ) { # User does not exist
 1646+ if ( !( $user && $user->isLoggedIn() ) && !$ip ) { # User does not exist
16471647 $wgOut->wrapWikiMsg( "<div class=\"mw-userpage-userdoesnotexist error\">\n$1\n</div>",
16481648 array( 'userpage-userdoesnotexist', wfEscapeWikiText( $username ) ) );
16491649 } elseif ( $user->isBlocked() ) { # Show log extract if the user is currently blocked
@@ -1676,7 +1676,7 @@
16771677 '', array( 'lim' => 10,
16781678 'conds' => array( "log_action != 'revision'" ),
16791679 'showIfEmpty' => false,
1680 - 'msgKey' => array( 'recreate-moveddeleted-warn') )
 1680+ 'msgKey' => array( 'recreate-moveddeleted-warn' ) )
16811681 );
16821682 }
16831683 }
@@ -1712,10 +1712,10 @@
17131713
17141714 wfProfileIn( __METHOD__ );
17151715
1716 - #need to parse the preview early so that we know which templates are used,
1717 - #otherwise users with "show preview after edit box" will get a blank list
1718 - #we parse this near the beginning so that setHeaders can do the title
1719 - #setting work instead of leaving it in getPreviewText
 1716+ # need to parse the preview early so that we know which templates are used,
 1717+ # otherwise users with "show preview after edit box" will get a blank list
 1718+ # we parse this near the beginning so that setHeaders can do the title
 1719+ # setting work instead of leaving it in getPreviewText
17201720 $previewOutput = '';
17211721 if ( $this->formtype == 'preview' ) {
17221722 $previewOutput = $this->getPreviewText();
@@ -1797,9 +1797,9 @@
17981798 // If a summary has been preset using &summary= we dont want to prompt for
17991799 // a different summary. Only prompt for a summary if the summary is blanked.
18001800 // (Bug 17416)
1801 - $this->autoSumm = md5('');
 1801+ $this->autoSumm = md5( '' );
18021802 }
1803 -
 1803+
18041804 $autosumm = $this->autoSumm ? $this->autoSumm : md5( $this->summary );
18051805 $wgOut->addHTML( Html::hidden( 'wpAutoSummary', $autosumm ) );
18061806
@@ -1874,7 +1874,7 @@
18751875 preg_match( "/^(=+)(.+)\\1(\n|$)/i", $text, $matches );
18761876 if ( !empty( $matches[2] ) ) {
18771877 global $wgParser;
1878 - return $wgParser->stripSectionName(trim($matches[2]));
 1878+ return $wgParser->stripSectionName( trim( $matches[2] ) );
18791879 } else {
18801880 return false;
18811881 }
@@ -1888,7 +1888,7 @@
18891889 }
18901890
18911891 # Optional notices on a per-namespace and per-page basis
1892 - $editnotice_ns = 'editnotice-'.$this->mTitle->getNamespace();
 1892+ $editnotice_ns = 'editnotice-' . $this->mTitle->getNamespace();
18931893 $editnotice_ns_message = wfMessage( $editnotice_ns )->inContentLanguage();
18941894 if ( $editnotice_ns_message->exists() ) {
18951895 $wgOut->addWikiText( $editnotice_ns_message->plain() );
@@ -1897,10 +1897,10 @@
18981898 $parts = explode( '/', $this->mTitle->getDBkey() );
18991899 $editnotice_base = $editnotice_ns;
19001900 while ( count( $parts ) > 0 ) {
1901 - $editnotice_base .= '-'.array_shift( $parts );
 1901+ $editnotice_base .= '-' . array_shift( $parts );
19021902 $editnotice_base_msg = wfMessage( $editnotice_base )->inContentLanguage();
19031903 if ( $editnotice_base_msg->exists() ) {
1904 - $wgOut->addWikiText( $editnotice_base_msg->plain() );
 1904+ $wgOut->addWikiText( $editnotice_base_msg->plain() );
19051905 }
19061906 }
19071907 } else {
@@ -2014,12 +2014,12 @@
20152015 }
20162016 if ( $this->mTitle->isCascadeProtected() ) {
20172017 # Is this page under cascading protection from some source pages?
2018 - list($cascadeSources, /* $restrictions */) = $this->mTitle->getCascadeProtectionSources();
 2018+ list( $cascadeSources, /* $restrictions */ ) = $this->mTitle->getCascadeProtectionSources();
20192019 $notice = "<div class='mw-cascadeprotectedwarning'>\n$1\n";
20202020 $cascadeSourcesCount = count( $cascadeSources );
20212021 if ( $cascadeSourcesCount > 0 ) {
20222022 # Explain, and list the titles responsible
2023 - foreach( $cascadeSources as $page ) {
 2023+ foreach ( $cascadeSources as $page ) {
20242024 $notice .= '* [[:' . $page->getPrefixedText() . "]]\n";
20252025 }
20262026 }
@@ -2028,7 +2028,7 @@
20292029 }
20302030 if ( !$this->mTitle->exists() && $this->mTitle->getRestrictions( 'create' ) ) {
20312031 LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle, '',
2032 - array( 'lim' => 1,
 2032+ array( 'lim' => 1,
20332033 'showIfEmpty' => false,
20342034 'msgKey' => array( 'titleprotectedwarning' ),
20352035 'wrap' => "<div class=\"mw-titleprotectedwarning\">\n$1</div>" ) );
@@ -2042,7 +2042,7 @@
20432043 $wgOut->wrapWikiMsg( "<div class='error' id='mw-edit-longpageerror'>\n$1\n</div>",
20442044 array( 'longpageerror', $wgLang->formatNum( $this->kblength ), $wgLang->formatNum( $wgMaxArticleSize ) ) );
20452045 } else {
2046 - if( !wfMessage('longpage-hint')->isDisabled() ) {
 2046+ if ( !wfMessage( 'longpage-hint' )->isDisabled() ) {
20472047 $wgOut->wrapWikiMsg( "<div id='mw-edit-longpage-hint'>\n$1\n</div>",
20482048 array( 'longpage-hint', $wgLang->formatSize( strlen( $this->textbox1 ) ), strlen( $this->textbox1 ) )
20492049 );
@@ -2064,9 +2064,9 @@
20652065 *
20662066 * @return array An array in the format array( $label, $input )
20672067 */
2068 - function getSummaryInput($summary = "", $labelText = null, $inputAttrs = null, $spanLabelAttrs = null) {
2069 - //Note: the maxlength is overriden in JS to 250 and to make it use UTF-8 bytes, not characters.
2070 - $inputAttrs = ( is_array($inputAttrs) ? $inputAttrs : array() ) + array(
 2068+ function getSummaryInput( $summary = "", $labelText = null, $inputAttrs = null, $spanLabelAttrs = null ) {
 2069+ // Note: the maxlength is overriden in JS to 250 and to make it use UTF-8 bytes, not characters.
 2070+ $inputAttrs = ( is_array( $inputAttrs ) ? $inputAttrs : array() ) + array(
20712071 'id' => 'wpSummary',
20722072 'maxlength' => '200',
20732073 'tabindex' => '1',
@@ -2074,7 +2074,7 @@
20752075 'spellcheck' => 'true',
20762076 ) + Linker::tooltipAndAccesskeyAttribs( 'summary' );
20772077
2078 - $spanLabelAttrs = ( is_array($spanLabelAttrs) ? $spanLabelAttrs : array() ) + array(
 2078+ $spanLabelAttrs = ( is_array( $spanLabelAttrs ) ? $spanLabelAttrs : array() ) + array(
20792079 'class' => $this->missingSummary ? 'mw-summarymissed' : 'mw-summary',
20802080 'id' => "wpSummaryLabel"
20812081 );
@@ -2112,8 +2112,8 @@
21132113 }
21142114 $summary = $wgContLang->recodeForEdit( $summary );
21152115 $labelText = wfMsgExt( $isSubjectPreview ? 'subject' : 'summary', 'parseinline' );
2116 - list($label, $input) = $this->getSummaryInput($summary, $labelText, array( 'class' => $summaryClass ), array());
2117 - $wgOut->addHTML("{$label} {$input}");
 2116+ list( $label, $input ) = $this->getSummaryInput( $summary, $labelText, array( 'class' => $summaryClass ), array() );
 2117+ $wgOut->addHTML( "{$label} {$input}" );
21182118 }
21192119
21202120 /**
@@ -2150,7 +2150,7 @@
21512151 HTML
21522152 );
21532153 if ( !$this->checkUnicodeCompliantBrowser() )
2154 - $wgOut->addHTML(Html::hidden( 'safemode', '1' ));
 2154+ $wgOut->addHTML( Html::hidden( 'safemode', '1' ) );
21552155 }
21562156
21572157 protected function showFormAfterText() {
@@ -2234,7 +2234,7 @@
22352235 global $wgOut, $wgUser;
22362236
22372237 $wikitext = $this->safeUnicodeOutput( $content );
2238 - if ( strval($wikitext) !== '' ) {
 2238+ if ( strval( $wikitext ) !== '' ) {
22392239 // Ensure there's a newline at the end, otherwise adding lines
22402240 // is awkward.
22412241 // But don't add a newline if the ext is empty, or Firefox in XHTML
@@ -2276,7 +2276,7 @@
22772277
22782278 $wgOut->addHTML( '</div>' );
22792279
2280 - if ( $this->formtype == 'diff') {
 2280+ if ( $this->formtype == 'diff' ) {
22812281 $this->showDiff();
22822282 }
22832283 }
@@ -2289,12 +2289,12 @@
22902290 */
22912291 protected function showPreview( $text ) {
22922292 global $wgOut;
2293 - if ( $this->mTitle->getNamespace() == NS_CATEGORY) {
 2293+ if ( $this->mTitle->getNamespace() == NS_CATEGORY ) {
22942294 $this->mArticle->openShowCategory();
22952295 }
22962296 # This hook seems slightly odd here, but makes things more
22972297 # consistent for extensions.
2298 - wfRunHooks( 'OutputPageBeforeHTML',array( &$wgOut, &$text ) );
 2298+ wfRunHooks( 'OutputPageBeforeHTML', array( &$wgOut, &$text ) );
22992299 $wgOut->addHTML( $text );
23002300 if ( $this->mTitle->getNamespace() == NS_CATEGORY ) {
23012301 $this->mArticle->closeShowCategory();
@@ -2346,7 +2346,7 @@
23472347 protected function showTosSummary() {
23482348 $msg = 'editpage-tos-summary';
23492349 wfRunHooks( 'EditPageTosSummary', array( $this->mTitle, &$msg ) );
2350 - if( !wfMessage( $msg )->isDisabled() ) {
 2350+ if ( !wfMessage( $msg )->isDisabled() ) {
23512351 global $wgOut;
23522352 $wgOut->addHTML( '<div class="mw-tos-summary">' );
23532353 $wgOut->addWikiMsg( $msg );
@@ -2375,7 +2375,7 @@
23762376 wfRunHooks( 'EditPageCopyrightWarning', array( $this->mTitle, &$copywarnMsg ) );
23772377
23782378 return "<div id=\"editpage-copywarn\">\n" .
2379 - call_user_func_array("wfMsgNoTrans", $copywarnMsg) . "\n</div>";
 2379+ call_user_func_array( "wfMsgNoTrans", $copywarnMsg ) . "\n</div>";
23802380 }
23812381
23822382 protected function showStandardInputs( &$tabindex = 2 ) {
@@ -2398,8 +2398,8 @@
23992399 $cancel .= wfMsgExt( 'pipe-separator' , 'escapenoentities' );
24002400 }
24012401 $edithelpurl = Skin::makeInternalOrExternalUrl( wfMsgForContent( 'edithelppage' ) );
2402 - $edithelp = '<a target="helpwindow" href="'.$edithelpurl.'">'.
2403 - htmlspecialchars( wfMsg( 'edithelp' ) ).'</a> '.
 2402+ $edithelp = '<a target="helpwindow" href="' . $edithelpurl . '">' .
 2403+ htmlspecialchars( wfMsg( 'edithelp' ) ) . '</a> ' .
24042404 htmlspecialchars( wfMsg( 'newwindow' ) );
24052405 $wgOut->addHTML( " <span class='editHelp'>{$cancel}{$edithelp}</span>\n" );
24062406 $wgOut->addHTML( "</div><!-- editButtons -->\n</div><!-- editOptions -->\n" );
@@ -2503,10 +2503,10 @@
25042504 array( 'LIMIT' => 1, 'ORDER BY' => 'log_timestamp DESC' )
25052505 );
25062506 // Quick paranoid permission checks...
2507 - if( is_object( $data ) ) {
2508 - if( $data->log_deleted & LogPage::DELETED_USER )
 2507+ if ( is_object( $data ) ) {
 2508+ if ( $data->log_deleted & LogPage::DELETED_USER )
25092509 $data->user_name = wfMsgHtml( 'rev-deleted-user' );
2510 - if( $data->log_deleted & LogPage::DELETED_COMMENT )
 2510+ if ( $data->log_deleted & LogPage::DELETED_COMMENT )
25112511 $data->log_comment = wfMsgHtml( 'rev-deleted-comment' );
25122512 }
25132513 return $data;
@@ -2552,15 +2552,15 @@
25532553 $parserOptions->setEditSection( false );
25542554 $parserOptions->setTidy( true );
25552555 $parserOptions->setIsPreview( true );
2556 - $parserOptions->setIsSectionPreview( !is_null($this->section) && $this->section !== '' );
 2556+ $parserOptions->setIsSectionPreview( !is_null( $this->section ) && $this->section !== '' );
25572557
25582558 # don't parse non-wikitext pages, show message about preview
25592559 # XXX: stupid php bug won't let us use $this->getContextTitle()->isCssJsSubpage() here -- This note has been there since r3530. Sure the bug was fixed time ago?
25602560
25612561 if ( $this->isCssJsSubpage || !$this->mTitle->isWikitextPage() ) {
2562 - if( $this->mTitle->isCssJsSubpage() ) {
 2562+ if ( $this->mTitle->isCssJsSubpage() ) {
25632563 $level = 'user';
2564 - } elseif( $this->mTitle->isCssOrJsPage() ) {
 2564+ } elseif ( $this->mTitle->isCssOrJsPage() ) {
25652565 $level = 'site';
25662566 } else {
25672567 $level = false;
@@ -2568,11 +2568,11 @@
25692569
25702570 # Used messages to make sure grep find them:
25712571 # Messages: usercsspreview, userjspreview, sitecsspreview, sitejspreview
2572 - if( $level ) {
2573 - if (preg_match( "/\\.css$/", $this->mTitle->getText() ) ) {
 2572+ if ( $level ) {
 2573+ if ( preg_match( "/\\.css$/", $this->mTitle->getText() ) ) {
25742574 $previewtext = "<div id='mw-{$level}csspreview'>\n" . wfMsg( "{$level}csspreview" ) . "\n</div>";
25752575 $class = "mw-code mw-css";
2576 - } elseif (preg_match( "/\\.js$/", $this->mTitle->getText() ) ) {
 2576+ } elseif ( preg_match( "/\\.js$/", $this->mTitle->getText() ) ) {
25772577 $previewtext = "<div id='mw-{$level}jspreview'>\n" . wfMsg( "{$level}jspreview" ) . "\n</div>";
25782578 $class = "mw-code mw-js";
25792579 } else {
@@ -2614,7 +2614,7 @@
26152615 }
26162616 }
26172617
2618 - if( $this->isConflict ) {
 2618+ if ( $this->isConflict ) {
26192619 $conflict = '<h2 id="mw-previewconflict">' . htmlspecialchars( wfMsg( 'previewconflict' ) ) . "</h2>\n";
26202620 } else {
26212621 $conflict = '<hr />';
@@ -2626,7 +2626,7 @@
26272627
26282628 $pageLang = $this->mTitle->getPageLanguage();
26292629 $attribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir(),
2630 - 'class' => 'mw-content-'.$pageLang->getDir() );
 2630+ 'class' => 'mw-content-' . $pageLang->getDir() );
26312631 $previewHTML = Html::rawElement( 'div', $attribs, $previewHTML );
26322632
26332633 wfProfileOut( __METHOD__ );
@@ -2642,9 +2642,9 @@
26432643 if ( !isset( $this->mParserOutput ) ) {
26442644 return $templates;
26452645 }
2646 - foreach( $this->mParserOutput->getTemplates() as $ns => $template) {
2647 - foreach( array_keys( $template ) as $dbk ) {
2648 - $templates[] = Title::makeTitle($ns, $dbk);
 2646+ foreach ( $this->mParserOutput->getTemplates() as $ns => $template ) {
 2647+ foreach ( array_keys( $template ) as $dbk ) {
 2648+ $templates[] = Title::makeTitle( $ns, $dbk );
26492649 }
26502650 }
26512651 return $templates;
@@ -2743,7 +2743,7 @@
27442744 'tip' => wfMsg( 'media_tip' ),
27452745 'key' => 'M'
27462746 ) : false,
2747 - $wgUseTeX ? array(
 2747+ $wgUseTeX ? array(
27482748 'image' => $wgLang->getImageFile( 'button-math' ),
27492749 'id' => 'mw-editbutton-math',
27502750 'open' => "<math>",
@@ -2802,7 +2802,7 @@
28032803
28042804 $script .= Xml::encodeJsCall( 'mw.toolbar.addButton', $params );
28052805 }
2806 -
 2806+
28072807 // This used to be called on DOMReady from mediawiki.action.edit, which
28082808 // ended up causing race conditions with the setup code above.
28092809 $script .= "\n" .
@@ -2888,9 +2888,9 @@
28892889 'tabindex' => ++$tabindex,
28902890 'value' => wfMsg( 'savearticle' ),
28912891 'accesskey' => wfMsg( 'accesskey-save' ),
2892 - 'title' => wfMsg( 'tooltip-save' ).' ['.wfMsg( 'accesskey-save' ).']',
 2892+ 'title' => wfMsg( 'tooltip-save' ) . ' [' . wfMsg( 'accesskey-save' ) . ']',
28932893 );
2894 - $buttons['save'] = Xml::element('input', $temp, '');
 2894+ $buttons['save'] = Xml::element( 'input', $temp, '' );
28952895
28962896 ++$tabindex; // use the same for preview and live preview
28972897 $temp = array(
@@ -3008,7 +3008,7 @@
30093009 */
30103010 static function spamPage( $match = false ) {
30113011 wfDeprecated( __METHOD__, '1.17' );
3012 -
 3012+
30133013 global $wgOut, $wgTitle;
30143014
30153015 $wgOut->prepareErrorPage( wfMessage( 'spamprotectiontitle' ) );
@@ -3078,7 +3078,7 @@
30793079 }
30803080 $currentbrowser = $_SERVER["HTTP_USER_AGENT"];
30813081 foreach ( $wgBrowserBlackList as $browser ) {
3082 - if ( preg_match($browser, $currentbrowser) ) {
 3082+ if ( preg_match( $browser, $currentbrowser ) ) {
30833083 return false;
30843084 }
30853085 }
@@ -3149,25 +3149,25 @@
31503150 $bytesleft = 0;
31513151 $result = "";
31523152 $working = 0;
3153 - for( $i = 0; $i < strlen( $invalue ); $i++ ) {
 3153+ for ( $i = 0; $i < strlen( $invalue ); $i++ ) {
31543154 $bytevalue = ord( $invalue[$i] );
3155 - if ( $bytevalue <= 0x7F ) { //0xxx xxxx
 3155+ if ( $bytevalue <= 0x7F ) { // 0xxx xxxx
31563156 $result .= chr( $bytevalue );
31573157 $bytesleft = 0;
3158 - } elseif ( $bytevalue <= 0xBF ) { //10xx xxxx
 3158+ } elseif ( $bytevalue <= 0xBF ) { // 10xx xxxx
31593159 $working = $working << 6;
3160 - $working += ($bytevalue & 0x3F);
 3160+ $working += ( $bytevalue & 0x3F );
31613161 $bytesleft--;
31623162 if ( $bytesleft <= 0 ) {
31633163 $result .= "&#x" . strtoupper( dechex( $working ) ) . ";";
31643164 }
3165 - } elseif ( $bytevalue <= 0xDF ) { //110x xxxx
 3165+ } elseif ( $bytevalue <= 0xDF ) { // 110x xxxx
31663166 $working = $bytevalue & 0x1F;
31673167 $bytesleft = 1;
3168 - } elseif ( $bytevalue <= 0xEF ) { //1110 xxxx
 3168+ } elseif ( $bytevalue <= 0xEF ) { // 1110 xxxx
31693169 $working = $bytevalue & 0x0F;
31703170 $bytesleft = 2;
3171 - } else { //1111 0xxx
 3171+ } else { // 1111 0xxx
31723172 $working = $bytevalue & 0x07;
31733173 $bytesleft = 3;
31743174 }
@@ -3186,20 +3186,20 @@
31873187 */
31883188 function unmakesafe( $invalue ) {
31893189 $result = "";
3190 - for( $i = 0; $i < strlen( $invalue ); $i++ ) {
3191 - if ( ( substr( $invalue, $i, 3 ) == "&#x" ) && ( $invalue[$i+3] != '0' ) ) {
 3190+ for ( $i = 0; $i < strlen( $invalue ); $i++ ) {
 3191+ if ( ( substr( $invalue, $i, 3 ) == "&#x" ) && ( $invalue[$i + 3] != '0' ) ) {
31923192 $i += 3;
31933193 $hexstring = "";
31943194 do {
31953195 $hexstring .= $invalue[$i];
31963196 $i++;
3197 - } while( ctype_xdigit( $invalue[$i] ) && ( $i < strlen( $invalue ) ) );
 3197+ } while ( ctype_xdigit( $invalue[$i] ) && ( $i < strlen( $invalue ) ) );
31983198
31993199 // Do some sanity checks. These aren't needed for reversability,
32003200 // but should help keep the breakage down if the editor
32013201 // breaks one of the entities whilst editing.
3202 - if ( (substr($invalue,$i,1)==";") and (strlen($hexstring) <= 6) ) {
3203 - $codepoint = hexdec($hexstring);
 3202+ if ( ( substr( $invalue, $i, 1 ) == ";" ) and ( strlen( $hexstring ) <= 6 ) ) {
 3203+ $codepoint = hexdec( $hexstring );
32043204 $result .= codepointToUtf8( $codepoint );
32053205 } else {
32063206 $result .= "&#x" . $hexstring . substr( $invalue, $i, 1 );

Status & tagging log