No spaces after (casts)
[lhc/web/wiklou.git] / includes / EditPage.php
index fe1ca00..63e3e66 100644 (file)
@@ -666,6 +666,11 @@ class EditPage {
                        $this->edittime = $request->getVal( 'wpEdittime' );
                        $this->starttime = $request->getVal( 'wpStarttime' );
 
+                       $undidRev = $request->getInt( 'wpUndidRevision' );
+                       if ( $undidRev ) {
+                               $this->undidRev = $undidRev;
+                       }
+
                        $this->scrolltop = $request->getIntOrNull( 'wpScrolltop' );
 
                        if ( $this->textbox1 === '' && $request->getVal( 'wpTextbox1' ) === null ) {
@@ -967,6 +972,7 @@ class EditPage {
                                                $undoMsg = 'norev';
                                        }
 
+                                       // Messages: undo-success, undo-failure, undo-norev
                                        $class = ( $undoMsg == 'success' ? '' : 'error ' ) . "mw-undo-{$undoMsg}";
                                        $this->editFormPageTop .= $wgOut->parse( "<div class=\"{$class}\">" .
                                                wfMessage( 'undo-' . $undoMsg )->plain() . '</div>', true, /* interface */true );
@@ -1403,9 +1409,14 @@ class EditPage {
                # Check for spam
                $match = self::matchSummarySpamRegex( $this->summary );
                if ( $match === false && $this->section == 'new' ) {
+                       # $wgSpamRegex is enforced on this new heading/summary because, unlike
+                       # regular summaries, it is added to the actual wikitext.
                        if ( $this->sectiontitle !== '' ) {
+                               # This branch is taken when the API is used with the 'sectiontitle' parameter.
                                $match = self::matchSpamRegex( $this->sectiontitle );
                        } else {
+                               # This branch is taken when the "Add Topic" user interface is used, or the API
+                               # is used with the 'summary' parameter.
                                $match = self::matchSpamRegex( $this->summary );
                        }
                }
@@ -1520,7 +1531,7 @@ class EditPage {
                        // message with content equivalent to default (allow empty pages
                        // in this case to disable messages, see bug 50124)
                        $defaultMessageText = $this->mTitle->getDefaultMessageText();
-                       if( $this->mTitle->getNamespace() === NS_MEDIAWIKI && $defaultMessageText !== false ) {
+                       if ( $this->mTitle->getNamespace() === NS_MEDIAWIKI && $defaultMessageText !== false ) {
                                $defaultText = $defaultMessageText;
                        } else {
                                $defaultText = '';
@@ -1603,8 +1614,7 @@ class EditPage {
                                }
                        }
 
-                       // If sectiontitle is set, use it, otherwise use the summary as the section title (for
-                       // backwards compatibility with old forms/bots).
+                       // If sectiontitle is set, use it, otherwise use the summary as the section title.
                        if ( $this->sectiontitle !== '' ) {
                                $sectionTitle = $this->sectiontitle;
                        } else {
@@ -1889,11 +1899,11 @@ class EditPage {
        }
 
        /**
-        * Check given input text against $wgSpamRegex, and return the text of the first match.
+        * Check given input text against $wgSummarySpamRegex, and return the text of the first match.
         *
         * @param $text string
         *
-        * @return string|bool  matching string or false
+        * @return string|bool matching string or false
         */
        public static function matchSummarySpamRegex( $text ) {
                global $wgSummarySpamRegex;
@@ -1920,6 +1930,7 @@ class EditPage {
                global $wgOut, $wgUser;
 
                $wgOut->addModules( 'mediawiki.action.edit' );
+               $wgOut->addModuleStyles( 'mediawiki.action.edit.styles' );
 
                if ( $wgUser->getOption( 'uselivepreview', false ) ) {
                        $wgOut->addModules( 'mediawiki.action.edit.preview' );
@@ -2554,7 +2565,7 @@ class EditPage {
                global $wgParser;
 
                if ( $isSubjectPreview ) {
-                       $summary = wfMessage( 'newsectionsummary', $wgParser->stripSectionName( $summary ) )
+                       $summary = wfMessage( 'newsectionsummary' )->rawParams( $wgParser->stripSectionName( $summary ) )
                                ->inContentLanguage()->text();
                }
 
@@ -2936,7 +2947,9 @@ HTML
 
                $cancel = $this->getCancelLink();
                if ( $cancel !== '' ) {
-                       $cancel .= wfMessage( 'pipe-separator' )->text();
+                       $cancel .= Html::element( 'span',
+                               array( 'class' => 'mw-editButtons-pipe-separator' ),
+                               wfMessage( 'pipe-separator' )->text() );
                }
                $edithelpurl = Skin::makeInternalOrExternalUrl( wfMessage( 'edithelppage' )->inContentLanguage()->text() );
                $edithelp = '<a target="helpwindow" href="' . $edithelpurl . '">' .