Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -37,7 +37,7 @@ |
38 | 38 | const AS_HOOK_ERROR = 210; |
39 | 39 | |
40 | 40 | /** |
41 | | - * Status: The filter function set in $wgFilterCallback returned true (= block it) |
| 41 | + * Status: The filter function set in $wgFilterCallback returned true (= block it) |
42 | 42 | */ |
43 | 43 | const AS_FILTERING = 211; |
44 | 44 | |
— | — | @@ -182,7 +182,7 @@ |
183 | 183 | * @var ParserOutput |
184 | 184 | */ |
185 | 185 | var $mParserOutput; |
186 | | - |
| 186 | + |
187 | 187 | /** |
188 | 188 | * Has a summary been preset using GET parameter &summary= ? |
189 | 189 | * @var Bool |
— | — | @@ -288,7 +288,7 @@ |
289 | 289 | } |
290 | 290 | |
291 | 291 | wfProfileIn( __METHOD__ ); |
292 | | - wfDebug( __METHOD__.": enter\n" ); |
| 292 | + wfDebug( __METHOD__ . ": enter\n" ); |
293 | 293 | |
294 | 294 | // If they used redlink=1 and the page exists, redirect to the main article |
295 | 295 | if ( $wgRequest->getBool( 'redlink' ) && $this->mTitle->exists() ) { |
— | — | @@ -339,7 +339,7 @@ |
340 | 340 | return; |
341 | 341 | } |
342 | 342 | |
343 | | - wfProfileIn( __METHOD__."-business-end" ); |
| 343 | + wfProfileIn( __METHOD__ . "-business-end" ); |
344 | 344 | |
345 | 345 | $this->isConflict = false; |
346 | 346 | // css / js subpages of user pages get a special treatment |
— | — | @@ -361,7 +361,7 @@ |
362 | 362 | |
363 | 363 | if ( 'save' == $this->formtype ) { |
364 | 364 | if ( !$this->attemptSave() ) { |
365 | | - wfProfileOut( __METHOD__."-business-end" ); |
| 365 | + wfProfileOut( __METHOD__ . "-business-end" ); |
366 | 366 | wfProfileOut( __METHOD__ ); |
367 | 367 | return; |
368 | 368 | } |
— | — | @@ -372,7 +372,7 @@ |
373 | 373 | if ( 'initial' == $this->formtype || $this->firsttime ) { |
374 | 374 | if ( $this->initialiseForm() === false ) { |
375 | 375 | $this->noSuchSectionPage(); |
376 | | - wfProfileOut( __METHOD__."-business-end" ); |
| 376 | + wfProfileOut( __METHOD__ . "-business-end" ); |
377 | 377 | wfProfileOut( __METHOD__ ); |
378 | 378 | return; |
379 | 379 | } |
— | — | @@ -383,7 +383,7 @@ |
384 | 384 | } |
385 | 385 | |
386 | 386 | $this->showEditForm(); |
387 | | - wfProfileOut( __METHOD__."-business-end" ); |
| 387 | + wfProfileOut( __METHOD__ . "-business-end" ); |
388 | 388 | wfProfileOut( __METHOD__ ); |
389 | 389 | } |
390 | 390 | |
— | — | @@ -400,7 +400,7 @@ |
401 | 401 | } |
402 | 402 | # Ignore some permissions errors when a user is just previewing/viewing diffs |
403 | 403 | $remove = array(); |
404 | | - foreach( $permErrors as $error ) { |
| 404 | + foreach ( $permErrors as $error ) { |
405 | 405 | if ( ( $this->preview || $this->diff ) && |
406 | 406 | ( $error[0] == 'blockedtext' || $error[0] == 'autoblockedtext' ) ) |
407 | 407 | { |
— | — | @@ -475,7 +475,7 @@ |
476 | 476 | */ |
477 | 477 | function readOnlyPage( $source = null, $protected = false, $reasons = array(), $action = null ) { |
478 | 478 | wfDeprecated( __METHOD__, '1.19' ); |
479 | | - |
| 479 | + |
480 | 480 | global $wgRequest, $wgOut; |
481 | 481 | if ( $wgRequest->getBool( 'redlink' ) ) { |
482 | 482 | // The edit page was reached via a red link. |
— | — | @@ -507,7 +507,7 @@ |
508 | 508 | // Standard preference behaviour |
509 | 509 | return true; |
510 | 510 | } elseif ( !$this->mTitle->exists() && |
511 | | - isset($wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()]) && |
| 511 | + isset( $wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()] ) && |
512 | 512 | $wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()] ) |
513 | 513 | { |
514 | 514 | // Categories are special |
— | — | @@ -524,7 +524,7 @@ |
525 | 525 | * @return bool |
526 | 526 | */ |
527 | 527 | protected function isWrongCaseCssJsPage() { |
528 | | - if( $this->mTitle->isCssJsSubpage() ) { |
| 528 | + if ( $this->mTitle->isCssJsSubpage() ) { |
529 | 529 | $name = $this->mTitle->getSkinFromCssJsSubpage(); |
530 | 530 | $skins = array_merge( |
531 | 531 | array_keys( Skin::getSkinNames() ), |
— | — | @@ -564,15 +564,15 @@ |
565 | 565 | # Also remove trailing whitespace, but don't remove _initial_ |
566 | 566 | # whitespace from the text boxes. This may be significant formatting. |
567 | 567 | $this->textbox1 = $this->safeUnicodeInput( $request, 'wpTextbox1' ); |
568 | | - if ( !$request->getCheck('wpTextbox2') ) { |
| 568 | + if ( !$request->getCheck( 'wpTextbox2' ) ) { |
569 | 569 | // Skip this if wpTextbox2 has input, it indicates that we came |
570 | 570 | // from a conflict page with raw page text, not a custom form |
571 | 571 | // modified by subclasses |
572 | | - wfProfileIn( get_class($this)."::importContentFormData" ); |
| 572 | + wfProfileIn( get_class( $this ) . "::importContentFormData" ); |
573 | 573 | $textbox1 = $this->importContentFormData( $request ); |
574 | | - if ( isset($textbox1) ) |
| 574 | + if ( isset( $textbox1 ) ) |
575 | 575 | $this->textbox1 = $textbox1; |
576 | | - wfProfileOut( get_class($this)."::importContentFormData" ); |
| 576 | + wfProfileOut( get_class( $this ) . "::importContentFormData" ); |
577 | 577 | } |
578 | 578 | |
579 | 579 | # Truncate for whole multibyte characters. +5 bytes for ellipsis |
— | — | @@ -582,7 +582,7 @@ |
583 | 583 | # header syntax, e.g. 'Foobar'. This is mainly an issue when we are using wpSummary for |
584 | 584 | # section titles. |
585 | 585 | $this->summary = preg_replace( '/^\s*=+\s*(.*?)\s*=+\s*$/', '$1', $this->summary ); |
586 | | - |
| 586 | + |
587 | 587 | # Treat sectiontitle the same way as summary. |
588 | 588 | # Note that wpSectionTitle is not yet a part of the actual edit form, as wpSummary is |
589 | 589 | # currently doing double duty as both edit summary and section title. Right now this |
— | — | @@ -656,7 +656,7 @@ |
657 | 657 | { |
658 | 658 | $this->allowBlankSummary = true; |
659 | 659 | } else { |
660 | | - $this->allowBlankSummary = $request->getBool( 'wpIgnoreBlankSummary' ) || !$wgUser->getOption( 'forceeditsummary'); |
| 660 | + $this->allowBlankSummary = $request->getBool( 'wpIgnoreBlankSummary' ) || !$wgUser->getOption( 'forceeditsummary' ); |
661 | 661 | } |
662 | 662 | |
663 | 663 | $this->autoSumm = $request->getText( 'wpAutoSummary' ); |
— | — | @@ -675,7 +675,7 @@ |
676 | 676 | $this->minoredit = false; |
677 | 677 | $this->watchthis = $request->getBool( 'watchthis', false ); // Watch may be overriden by request parameters |
678 | 678 | $this->recreate = false; |
679 | | - |
| 679 | + |
680 | 680 | // When creating a new section, we can preload a section title by passing it as the |
681 | 681 | // preloadtitle parameter in the URL (Bug 13100) |
682 | 682 | if ( $this->section == 'new' && $request->getVal( 'preloadtitle' ) ) { |
— | — | @@ -915,7 +915,7 @@ |
916 | 916 | if ( !empty( $this->mPreloadText ) ) { |
917 | 917 | return $this->mPreloadText; |
918 | 918 | } |
919 | | - |
| 919 | + |
920 | 920 | if ( $preload === '' ) { |
921 | 921 | return ''; |
922 | 922 | } |
— | — | @@ -1229,10 +1229,10 @@ |
1230 | 1230 | if ( $this->sectiontitle !== '' ) { |
1231 | 1231 | // Insert the section title above the content. |
1232 | 1232 | $text = wfMsgForContent( 'newsectionheaderdefaultlevel', $this->sectiontitle ) . "\n\n" . $text; |
1233 | | - |
| 1233 | + |
1234 | 1234 | // Jump to the new section |
1235 | 1235 | $result['sectionanchor'] = $wgParser->guessLegacySectionNameFromWikiText( $this->sectiontitle ); |
1236 | | - |
| 1236 | + |
1237 | 1237 | // If no edit summary was specified, create one automatically from the section |
1238 | 1238 | // title and have it link to the new section. Otherwise, respect the summary as |
1239 | 1239 | // passed. |
— | — | @@ -1243,7 +1243,7 @@ |
1244 | 1244 | } elseif ( $this->summary !== '' ) { |
1245 | 1245 | // Insert the section title above the content. |
1246 | 1246 | $text = wfMsgForContent( 'newsectionheaderdefaultlevel', $this->summary ) . "\n\n" . $text; |
1247 | | - |
| 1247 | + |
1248 | 1248 | // Jump to the new section |
1249 | 1249 | $result['sectionanchor'] = $wgParser->guessLegacySectionNameFromWikiText( $this->summary ); |
1250 | 1250 | |
— | — | @@ -1276,7 +1276,7 @@ |
1277 | 1277 | } else { |
1278 | 1278 | // New comment; suppress conflict. |
1279 | 1279 | $this->isConflict = false; |
1280 | | - wfDebug( __METHOD__ .": conflict suppressed; new section\n" ); |
| 1280 | + wfDebug( __METHOD__ . ": conflict suppressed; new section\n" ); |
1281 | 1281 | } |
1282 | 1282 | } elseif ( $this->section == '' && $this->userWasLastToEdit( $wgUser->getId(), $this->edittime ) ) { |
1283 | 1283 | # Suppress edit conflict with self, except for section edits where merging is required. |
— | — | @@ -1284,7 +1284,7 @@ |
1285 | 1285 | $this->isConflict = false; |
1286 | 1286 | } |
1287 | 1287 | } |
1288 | | - |
| 1288 | + |
1289 | 1289 | // If sectiontitle is set, use it, otherwise use the summary as the section title (for |
1290 | 1290 | // backwards compatibility with old forms/bots). |
1291 | 1291 | if ( $this->sectiontitle !== '' ) { |
— | — | @@ -1292,7 +1292,7 @@ |
1293 | 1293 | } else { |
1294 | 1294 | $sectionTitle = $this->summary; |
1295 | 1295 | } |
1296 | | - |
| 1296 | + |
1297 | 1297 | if ( $this->isConflict ) { |
1298 | 1298 | wfDebug( __METHOD__ . ": conflict! getting section '$this->section' for time '$this->edittime' (article time '{$timestamp}')\n" ); |
1299 | 1299 | $text = $this->mArticle->replaceSection( $this->section, $this->textbox1, $sectionTitle, $this->edittime ); |
— | — | @@ -1472,18 +1472,18 @@ |
1473 | 1473 | * @return bool |
1474 | 1474 | */ |
1475 | 1475 | protected function userWasLastToEdit( $id, $edittime ) { |
1476 | | - if( !$id ) return false; |
| 1476 | + if ( !$id ) return false; |
1477 | 1477 | $dbw = wfGetDB( DB_MASTER ); |
1478 | 1478 | $res = $dbw->select( 'revision', |
1479 | 1479 | 'rev_user', |
1480 | 1480 | array( |
1481 | 1481 | 'rev_page' => $this->mTitle->getArticleId(), |
1482 | | - 'rev_timestamp > '.$dbw->addQuotes( $dbw->timestamp($edittime) ) |
| 1482 | + 'rev_timestamp > ' . $dbw->addQuotes( $dbw->timestamp( $edittime ) ) |
1483 | 1483 | ), |
1484 | 1484 | __METHOD__, |
1485 | 1485 | array( 'ORDER BY' => 'rev_timestamp ASC', 'LIMIT' => 50 ) ); |
1486 | 1486 | foreach ( $res as $row ) { |
1487 | | - if( $row->rev_user != $id ) { |
| 1487 | + if ( $row->rev_user != $id ) { |
1488 | 1488 | return false; |
1489 | 1489 | } |
1490 | 1490 | } |
— | — | @@ -1498,7 +1498,7 @@ |
1499 | 1499 | * |
1500 | 1500 | * @return bool |
1501 | 1501 | */ |
1502 | | - function mergeChangesInto( &$editText ){ |
| 1502 | + function mergeChangesInto( &$editText ) { |
1503 | 1503 | wfProfileIn( __METHOD__ ); |
1504 | 1504 | |
1505 | 1505 | $db = wfGetDB( DB_MASTER ); |
— | — | @@ -1577,9 +1577,9 @@ |
1578 | 1578 | * @return bool|string |
1579 | 1579 | */ |
1580 | 1580 | protected static function matchSpamRegexInternal( $text, $regexes ) { |
1581 | | - foreach( $regexes as $regex ) { |
| 1581 | + foreach ( $regexes as $regex ) { |
1582 | 1582 | $matches = array(); |
1583 | | - if( preg_match( $regex, $text, $matches ) ) { |
| 1583 | + if ( preg_match( $regex, $text, $matches ) ) { |
1584 | 1584 | return $matches[0]; |
1585 | 1585 | } |
1586 | 1586 | } |
— | — | @@ -1642,7 +1642,7 @@ |
1643 | 1643 | $username = $parts[0]; |
1644 | 1644 | $user = User::newFromName( $username, false /* allow IP users*/ ); |
1645 | 1645 | $ip = User::isIP( $username ); |
1646 | | - if ( !($user && $user->isLoggedIn()) && !$ip ) { # User does not exist |
| 1646 | + if ( !( $user && $user->isLoggedIn() ) && !$ip ) { # User does not exist |
1647 | 1647 | $wgOut->wrapWikiMsg( "<div class=\"mw-userpage-userdoesnotexist error\">\n$1\n</div>", |
1648 | 1648 | array( 'userpage-userdoesnotexist', wfEscapeWikiText( $username ) ) ); |
1649 | 1649 | } elseif ( $user->isBlocked() ) { # Show log extract if the user is currently blocked |
— | — | @@ -1676,7 +1676,7 @@ |
1677 | 1677 | '', array( 'lim' => 10, |
1678 | 1678 | 'conds' => array( "log_action != 'revision'" ), |
1679 | 1679 | 'showIfEmpty' => false, |
1680 | | - 'msgKey' => array( 'recreate-moveddeleted-warn') ) |
| 1680 | + 'msgKey' => array( 'recreate-moveddeleted-warn' ) ) |
1681 | 1681 | ); |
1682 | 1682 | } |
1683 | 1683 | } |
— | — | @@ -1712,10 +1712,10 @@ |
1713 | 1713 | |
1714 | 1714 | wfProfileIn( __METHOD__ ); |
1715 | 1715 | |
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 |
1720 | 1720 | $previewOutput = ''; |
1721 | 1721 | if ( $this->formtype == 'preview' ) { |
1722 | 1722 | $previewOutput = $this->getPreviewText(); |
— | — | @@ -1797,9 +1797,9 @@ |
1798 | 1798 | // If a summary has been preset using &summary= we dont want to prompt for |
1799 | 1799 | // a different summary. Only prompt for a summary if the summary is blanked. |
1800 | 1800 | // (Bug 17416) |
1801 | | - $this->autoSumm = md5(''); |
| 1801 | + $this->autoSumm = md5( '' ); |
1802 | 1802 | } |
1803 | | - |
| 1803 | + |
1804 | 1804 | $autosumm = $this->autoSumm ? $this->autoSumm : md5( $this->summary ); |
1805 | 1805 | $wgOut->addHTML( Html::hidden( 'wpAutoSummary', $autosumm ) ); |
1806 | 1806 | |
— | — | @@ -1874,7 +1874,7 @@ |
1875 | 1875 | preg_match( "/^(=+)(.+)\\1(\n|$)/i", $text, $matches ); |
1876 | 1876 | if ( !empty( $matches[2] ) ) { |
1877 | 1877 | global $wgParser; |
1878 | | - return $wgParser->stripSectionName(trim($matches[2])); |
| 1878 | + return $wgParser->stripSectionName( trim( $matches[2] ) ); |
1879 | 1879 | } else { |
1880 | 1880 | return false; |
1881 | 1881 | } |
— | — | @@ -1888,7 +1888,7 @@ |
1889 | 1889 | } |
1890 | 1890 | |
1891 | 1891 | # Optional notices on a per-namespace and per-page basis |
1892 | | - $editnotice_ns = 'editnotice-'.$this->mTitle->getNamespace(); |
| 1892 | + $editnotice_ns = 'editnotice-' . $this->mTitle->getNamespace(); |
1893 | 1893 | $editnotice_ns_message = wfMessage( $editnotice_ns )->inContentLanguage(); |
1894 | 1894 | if ( $editnotice_ns_message->exists() ) { |
1895 | 1895 | $wgOut->addWikiText( $editnotice_ns_message->plain() ); |
— | — | @@ -1897,10 +1897,10 @@ |
1898 | 1898 | $parts = explode( '/', $this->mTitle->getDBkey() ); |
1899 | 1899 | $editnotice_base = $editnotice_ns; |
1900 | 1900 | while ( count( $parts ) > 0 ) { |
1901 | | - $editnotice_base .= '-'.array_shift( $parts ); |
| 1901 | + $editnotice_base .= '-' . array_shift( $parts ); |
1902 | 1902 | $editnotice_base_msg = wfMessage( $editnotice_base )->inContentLanguage(); |
1903 | 1903 | if ( $editnotice_base_msg->exists() ) { |
1904 | | - $wgOut->addWikiText( $editnotice_base_msg->plain() ); |
| 1904 | + $wgOut->addWikiText( $editnotice_base_msg->plain() ); |
1905 | 1905 | } |
1906 | 1906 | } |
1907 | 1907 | } else { |
— | — | @@ -2014,12 +2014,12 @@ |
2015 | 2015 | } |
2016 | 2016 | if ( $this->mTitle->isCascadeProtected() ) { |
2017 | 2017 | # Is this page under cascading protection from some source pages? |
2018 | | - list($cascadeSources, /* $restrictions */) = $this->mTitle->getCascadeProtectionSources(); |
| 2018 | + list( $cascadeSources, /* $restrictions */ ) = $this->mTitle->getCascadeProtectionSources(); |
2019 | 2019 | $notice = "<div class='mw-cascadeprotectedwarning'>\n$1\n"; |
2020 | 2020 | $cascadeSourcesCount = count( $cascadeSources ); |
2021 | 2021 | if ( $cascadeSourcesCount > 0 ) { |
2022 | 2022 | # Explain, and list the titles responsible |
2023 | | - foreach( $cascadeSources as $page ) { |
| 2023 | + foreach ( $cascadeSources as $page ) { |
2024 | 2024 | $notice .= '* [[:' . $page->getPrefixedText() . "]]\n"; |
2025 | 2025 | } |
2026 | 2026 | } |
— | — | @@ -2028,7 +2028,7 @@ |
2029 | 2029 | } |
2030 | 2030 | if ( !$this->mTitle->exists() && $this->mTitle->getRestrictions( 'create' ) ) { |
2031 | 2031 | LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle, '', |
2032 | | - array( 'lim' => 1, |
| 2032 | + array( 'lim' => 1, |
2033 | 2033 | 'showIfEmpty' => false, |
2034 | 2034 | 'msgKey' => array( 'titleprotectedwarning' ), |
2035 | 2035 | 'wrap' => "<div class=\"mw-titleprotectedwarning\">\n$1</div>" ) ); |
— | — | @@ -2042,7 +2042,7 @@ |
2043 | 2043 | $wgOut->wrapWikiMsg( "<div class='error' id='mw-edit-longpageerror'>\n$1\n</div>", |
2044 | 2044 | array( 'longpageerror', $wgLang->formatNum( $this->kblength ), $wgLang->formatNum( $wgMaxArticleSize ) ) ); |
2045 | 2045 | } else { |
2046 | | - if( !wfMessage('longpage-hint')->isDisabled() ) { |
| 2046 | + if ( !wfMessage( 'longpage-hint' )->isDisabled() ) { |
2047 | 2047 | $wgOut->wrapWikiMsg( "<div id='mw-edit-longpage-hint'>\n$1\n</div>", |
2048 | 2048 | array( 'longpage-hint', $wgLang->formatSize( strlen( $this->textbox1 ) ), strlen( $this->textbox1 ) ) |
2049 | 2049 | ); |
— | — | @@ -2064,9 +2064,9 @@ |
2065 | 2065 | * |
2066 | 2066 | * @return array An array in the format array( $label, $input ) |
2067 | 2067 | */ |
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( |
2071 | 2071 | 'id' => 'wpSummary', |
2072 | 2072 | 'maxlength' => '200', |
2073 | 2073 | 'tabindex' => '1', |
— | — | @@ -2074,7 +2074,7 @@ |
2075 | 2075 | 'spellcheck' => 'true', |
2076 | 2076 | ) + Linker::tooltipAndAccesskeyAttribs( 'summary' ); |
2077 | 2077 | |
2078 | | - $spanLabelAttrs = ( is_array($spanLabelAttrs) ? $spanLabelAttrs : array() ) + array( |
| 2078 | + $spanLabelAttrs = ( is_array( $spanLabelAttrs ) ? $spanLabelAttrs : array() ) + array( |
2079 | 2079 | 'class' => $this->missingSummary ? 'mw-summarymissed' : 'mw-summary', |
2080 | 2080 | 'id' => "wpSummaryLabel" |
2081 | 2081 | ); |
— | — | @@ -2112,8 +2112,8 @@ |
2113 | 2113 | } |
2114 | 2114 | $summary = $wgContLang->recodeForEdit( $summary ); |
2115 | 2115 | $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}" ); |
2118 | 2118 | } |
2119 | 2119 | |
2120 | 2120 | /** |
— | — | @@ -2150,7 +2150,7 @@ |
2151 | 2151 | HTML |
2152 | 2152 | ); |
2153 | 2153 | if ( !$this->checkUnicodeCompliantBrowser() ) |
2154 | | - $wgOut->addHTML(Html::hidden( 'safemode', '1' )); |
| 2154 | + $wgOut->addHTML( Html::hidden( 'safemode', '1' ) ); |
2155 | 2155 | } |
2156 | 2156 | |
2157 | 2157 | protected function showFormAfterText() { |
— | — | @@ -2234,7 +2234,7 @@ |
2235 | 2235 | global $wgOut, $wgUser; |
2236 | 2236 | |
2237 | 2237 | $wikitext = $this->safeUnicodeOutput( $content ); |
2238 | | - if ( strval($wikitext) !== '' ) { |
| 2238 | + if ( strval( $wikitext ) !== '' ) { |
2239 | 2239 | // Ensure there's a newline at the end, otherwise adding lines |
2240 | 2240 | // is awkward. |
2241 | 2241 | // But don't add a newline if the ext is empty, or Firefox in XHTML |
— | — | @@ -2276,7 +2276,7 @@ |
2277 | 2277 | |
2278 | 2278 | $wgOut->addHTML( '</div>' ); |
2279 | 2279 | |
2280 | | - if ( $this->formtype == 'diff') { |
| 2280 | + if ( $this->formtype == 'diff' ) { |
2281 | 2281 | $this->showDiff(); |
2282 | 2282 | } |
2283 | 2283 | } |
— | — | @@ -2289,12 +2289,12 @@ |
2290 | 2290 | */ |
2291 | 2291 | protected function showPreview( $text ) { |
2292 | 2292 | global $wgOut; |
2293 | | - if ( $this->mTitle->getNamespace() == NS_CATEGORY) { |
| 2293 | + if ( $this->mTitle->getNamespace() == NS_CATEGORY ) { |
2294 | 2294 | $this->mArticle->openShowCategory(); |
2295 | 2295 | } |
2296 | 2296 | # This hook seems slightly odd here, but makes things more |
2297 | 2297 | # consistent for extensions. |
2298 | | - wfRunHooks( 'OutputPageBeforeHTML',array( &$wgOut, &$text ) ); |
| 2298 | + wfRunHooks( 'OutputPageBeforeHTML', array( &$wgOut, &$text ) ); |
2299 | 2299 | $wgOut->addHTML( $text ); |
2300 | 2300 | if ( $this->mTitle->getNamespace() == NS_CATEGORY ) { |
2301 | 2301 | $this->mArticle->closeShowCategory(); |
— | — | @@ -2346,7 +2346,7 @@ |
2347 | 2347 | protected function showTosSummary() { |
2348 | 2348 | $msg = 'editpage-tos-summary'; |
2349 | 2349 | wfRunHooks( 'EditPageTosSummary', array( $this->mTitle, &$msg ) ); |
2350 | | - if( !wfMessage( $msg )->isDisabled() ) { |
| 2350 | + if ( !wfMessage( $msg )->isDisabled() ) { |
2351 | 2351 | global $wgOut; |
2352 | 2352 | $wgOut->addHTML( '<div class="mw-tos-summary">' ); |
2353 | 2353 | $wgOut->addWikiMsg( $msg ); |
— | — | @@ -2375,7 +2375,7 @@ |
2376 | 2376 | wfRunHooks( 'EditPageCopyrightWarning', array( $this->mTitle, &$copywarnMsg ) ); |
2377 | 2377 | |
2378 | 2378 | return "<div id=\"editpage-copywarn\">\n" . |
2379 | | - call_user_func_array("wfMsgNoTrans", $copywarnMsg) . "\n</div>"; |
| 2379 | + call_user_func_array( "wfMsgNoTrans", $copywarnMsg ) . "\n</div>"; |
2380 | 2380 | } |
2381 | 2381 | |
2382 | 2382 | protected function showStandardInputs( &$tabindex = 2 ) { |
— | — | @@ -2398,8 +2398,8 @@ |
2399 | 2399 | $cancel .= wfMsgExt( 'pipe-separator' , 'escapenoentities' ); |
2400 | 2400 | } |
2401 | 2401 | $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> ' . |
2404 | 2404 | htmlspecialchars( wfMsg( 'newwindow' ) ); |
2405 | 2405 | $wgOut->addHTML( " <span class='editHelp'>{$cancel}{$edithelp}</span>\n" ); |
2406 | 2406 | $wgOut->addHTML( "</div><!-- editButtons -->\n</div><!-- editOptions -->\n" ); |
— | — | @@ -2503,10 +2503,10 @@ |
2504 | 2504 | array( 'LIMIT' => 1, 'ORDER BY' => 'log_timestamp DESC' ) |
2505 | 2505 | ); |
2506 | 2506 | // 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 ) |
2509 | 2509 | $data->user_name = wfMsgHtml( 'rev-deleted-user' ); |
2510 | | - if( $data->log_deleted & LogPage::DELETED_COMMENT ) |
| 2510 | + if ( $data->log_deleted & LogPage::DELETED_COMMENT ) |
2511 | 2511 | $data->log_comment = wfMsgHtml( 'rev-deleted-comment' ); |
2512 | 2512 | } |
2513 | 2513 | return $data; |
— | — | @@ -2552,15 +2552,15 @@ |
2553 | 2553 | $parserOptions->setEditSection( false ); |
2554 | 2554 | $parserOptions->setTidy( true ); |
2555 | 2555 | $parserOptions->setIsPreview( true ); |
2556 | | - $parserOptions->setIsSectionPreview( !is_null($this->section) && $this->section !== '' ); |
| 2556 | + $parserOptions->setIsSectionPreview( !is_null( $this->section ) && $this->section !== '' ); |
2557 | 2557 | |
2558 | 2558 | # don't parse non-wikitext pages, show message about preview |
2559 | 2559 | # 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? |
2560 | 2560 | |
2561 | 2561 | if ( $this->isCssJsSubpage || !$this->mTitle->isWikitextPage() ) { |
2562 | | - if( $this->mTitle->isCssJsSubpage() ) { |
| 2562 | + if ( $this->mTitle->isCssJsSubpage() ) { |
2563 | 2563 | $level = 'user'; |
2564 | | - } elseif( $this->mTitle->isCssOrJsPage() ) { |
| 2564 | + } elseif ( $this->mTitle->isCssOrJsPage() ) { |
2565 | 2565 | $level = 'site'; |
2566 | 2566 | } else { |
2567 | 2567 | $level = false; |
— | — | @@ -2568,11 +2568,11 @@ |
2569 | 2569 | |
2570 | 2570 | # Used messages to make sure grep find them: |
2571 | 2571 | # 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() ) ) { |
2574 | 2574 | $previewtext = "<div id='mw-{$level}csspreview'>\n" . wfMsg( "{$level}csspreview" ) . "\n</div>"; |
2575 | 2575 | $class = "mw-code mw-css"; |
2576 | | - } elseif (preg_match( "/\\.js$/", $this->mTitle->getText() ) ) { |
| 2576 | + } elseif ( preg_match( "/\\.js$/", $this->mTitle->getText() ) ) { |
2577 | 2577 | $previewtext = "<div id='mw-{$level}jspreview'>\n" . wfMsg( "{$level}jspreview" ) . "\n</div>"; |
2578 | 2578 | $class = "mw-code mw-js"; |
2579 | 2579 | } else { |
— | — | @@ -2614,7 +2614,7 @@ |
2615 | 2615 | } |
2616 | 2616 | } |
2617 | 2617 | |
2618 | | - if( $this->isConflict ) { |
| 2618 | + if ( $this->isConflict ) { |
2619 | 2619 | $conflict = '<h2 id="mw-previewconflict">' . htmlspecialchars( wfMsg( 'previewconflict' ) ) . "</h2>\n"; |
2620 | 2620 | } else { |
2621 | 2621 | $conflict = '<hr />'; |
— | — | @@ -2626,7 +2626,7 @@ |
2627 | 2627 | |
2628 | 2628 | $pageLang = $this->mTitle->getPageLanguage(); |
2629 | 2629 | $attribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir(), |
2630 | | - 'class' => 'mw-content-'.$pageLang->getDir() ); |
| 2630 | + 'class' => 'mw-content-' . $pageLang->getDir() ); |
2631 | 2631 | $previewHTML = Html::rawElement( 'div', $attribs, $previewHTML ); |
2632 | 2632 | |
2633 | 2633 | wfProfileOut( __METHOD__ ); |
— | — | @@ -2642,9 +2642,9 @@ |
2643 | 2643 | if ( !isset( $this->mParserOutput ) ) { |
2644 | 2644 | return $templates; |
2645 | 2645 | } |
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 ); |
2649 | 2649 | } |
2650 | 2650 | } |
2651 | 2651 | return $templates; |
— | — | @@ -2743,7 +2743,7 @@ |
2744 | 2744 | 'tip' => wfMsg( 'media_tip' ), |
2745 | 2745 | 'key' => 'M' |
2746 | 2746 | ) : false, |
2747 | | - $wgUseTeX ? array( |
| 2747 | + $wgUseTeX ? array( |
2748 | 2748 | 'image' => $wgLang->getImageFile( 'button-math' ), |
2749 | 2749 | 'id' => 'mw-editbutton-math', |
2750 | 2750 | 'open' => "<math>", |
— | — | @@ -2802,7 +2802,7 @@ |
2803 | 2803 | |
2804 | 2804 | $script .= Xml::encodeJsCall( 'mw.toolbar.addButton', $params ); |
2805 | 2805 | } |
2806 | | - |
| 2806 | + |
2807 | 2807 | // This used to be called on DOMReady from mediawiki.action.edit, which |
2808 | 2808 | // ended up causing race conditions with the setup code above. |
2809 | 2809 | $script .= "\n" . |
— | — | @@ -2888,9 +2888,9 @@ |
2889 | 2889 | 'tabindex' => ++$tabindex, |
2890 | 2890 | 'value' => wfMsg( 'savearticle' ), |
2891 | 2891 | 'accesskey' => wfMsg( 'accesskey-save' ), |
2892 | | - 'title' => wfMsg( 'tooltip-save' ).' ['.wfMsg( 'accesskey-save' ).']', |
| 2892 | + 'title' => wfMsg( 'tooltip-save' ) . ' [' . wfMsg( 'accesskey-save' ) . ']', |
2893 | 2893 | ); |
2894 | | - $buttons['save'] = Xml::element('input', $temp, ''); |
| 2894 | + $buttons['save'] = Xml::element( 'input', $temp, '' ); |
2895 | 2895 | |
2896 | 2896 | ++$tabindex; // use the same for preview and live preview |
2897 | 2897 | $temp = array( |
— | — | @@ -3008,7 +3008,7 @@ |
3009 | 3009 | */ |
3010 | 3010 | static function spamPage( $match = false ) { |
3011 | 3011 | wfDeprecated( __METHOD__, '1.17' ); |
3012 | | - |
| 3012 | + |
3013 | 3013 | global $wgOut, $wgTitle; |
3014 | 3014 | |
3015 | 3015 | $wgOut->prepareErrorPage( wfMessage( 'spamprotectiontitle' ) ); |
— | — | @@ -3078,7 +3078,7 @@ |
3079 | 3079 | } |
3080 | 3080 | $currentbrowser = $_SERVER["HTTP_USER_AGENT"]; |
3081 | 3081 | foreach ( $wgBrowserBlackList as $browser ) { |
3082 | | - if ( preg_match($browser, $currentbrowser) ) { |
| 3082 | + if ( preg_match( $browser, $currentbrowser ) ) { |
3083 | 3083 | return false; |
3084 | 3084 | } |
3085 | 3085 | } |
— | — | @@ -3149,25 +3149,25 @@ |
3150 | 3150 | $bytesleft = 0; |
3151 | 3151 | $result = ""; |
3152 | 3152 | $working = 0; |
3153 | | - for( $i = 0; $i < strlen( $invalue ); $i++ ) { |
| 3153 | + for ( $i = 0; $i < strlen( $invalue ); $i++ ) { |
3154 | 3154 | $bytevalue = ord( $invalue[$i] ); |
3155 | | - if ( $bytevalue <= 0x7F ) { //0xxx xxxx |
| 3155 | + if ( $bytevalue <= 0x7F ) { // 0xxx xxxx |
3156 | 3156 | $result .= chr( $bytevalue ); |
3157 | 3157 | $bytesleft = 0; |
3158 | | - } elseif ( $bytevalue <= 0xBF ) { //10xx xxxx |
| 3158 | + } elseif ( $bytevalue <= 0xBF ) { // 10xx xxxx |
3159 | 3159 | $working = $working << 6; |
3160 | | - $working += ($bytevalue & 0x3F); |
| 3160 | + $working += ( $bytevalue & 0x3F ); |
3161 | 3161 | $bytesleft--; |
3162 | 3162 | if ( $bytesleft <= 0 ) { |
3163 | 3163 | $result .= "&#x" . strtoupper( dechex( $working ) ) . ";"; |
3164 | 3164 | } |
3165 | | - } elseif ( $bytevalue <= 0xDF ) { //110x xxxx |
| 3165 | + } elseif ( $bytevalue <= 0xDF ) { // 110x xxxx |
3166 | 3166 | $working = $bytevalue & 0x1F; |
3167 | 3167 | $bytesleft = 1; |
3168 | | - } elseif ( $bytevalue <= 0xEF ) { //1110 xxxx |
| 3168 | + } elseif ( $bytevalue <= 0xEF ) { // 1110 xxxx |
3169 | 3169 | $working = $bytevalue & 0x0F; |
3170 | 3170 | $bytesleft = 2; |
3171 | | - } else { //1111 0xxx |
| 3171 | + } else { // 1111 0xxx |
3172 | 3172 | $working = $bytevalue & 0x07; |
3173 | 3173 | $bytesleft = 3; |
3174 | 3174 | } |
— | — | @@ -3186,20 +3186,20 @@ |
3187 | 3187 | */ |
3188 | 3188 | function unmakesafe( $invalue ) { |
3189 | 3189 | $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' ) ) { |
3192 | 3192 | $i += 3; |
3193 | 3193 | $hexstring = ""; |
3194 | 3194 | do { |
3195 | 3195 | $hexstring .= $invalue[$i]; |
3196 | 3196 | $i++; |
3197 | | - } while( ctype_xdigit( $invalue[$i] ) && ( $i < strlen( $invalue ) ) ); |
| 3197 | + } while ( ctype_xdigit( $invalue[$i] ) && ( $i < strlen( $invalue ) ) ); |
3198 | 3198 | |
3199 | 3199 | // Do some sanity checks. These aren't needed for reversability, |
3200 | 3200 | // but should help keep the breakage down if the editor |
3201 | 3201 | // 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 ); |
3204 | 3204 | $result .= codepointToUtf8( $codepoint ); |
3205 | 3205 | } else { |
3206 | 3206 | $result .= "&#x" . $hexstring . substr( $invalue, $i, 1 ); |