Merge "Revert "Toolbar: Only show on WikiText pages""
[lhc/web/wiklou.git] / includes / EditPage.php
index 98e0ec4..a14191a 100644 (file)
@@ -66,11 +66,6 @@ class EditPage {
         */
        const AS_CONTENT_TOO_BIG = 216;
 
-       /**
-        * Status: User cannot edit? (not used)
-        */
-       const AS_USER_CANNOT_EDIT = 217;
-
        /**
         * Status: this anonymous user is not allowed to edit this page
         */
@@ -104,7 +99,7 @@ class EditPage {
        const AS_NO_CREATE_PERMISSION = 223;
 
        /**
-        * Status: user tried to create a blank page
+        * Status: user tried to create a blank page and wpIgnoreBlankArticle == false
         */
        const AS_BLANK_ARTICLE = 224;
 
@@ -129,11 +124,6 @@ class EditPage {
         */
        const AS_MAX_ARTICLE_SIZE_EXCEEDED = 229;
 
-       /**
-        * not used
-        */
-       const AS_OK = 230;
-
        /**
         * Status: WikiPage::doEdit() was unsuccessful
         */
@@ -227,8 +217,13 @@ class EditPage {
        /** @var bool|stdClass */
        protected $lastDelete;
 
-       /** @var bool */
-       protected $mTokenOk = false;
+       /** @var bool
+        * This is public because SemanticForms uses it (bug 67522).
+        * However, please consider using this property publicly
+        * to be deprecated.
+        * @protected
+        */
+       public $mTokenOk = false;
 
        /** @var bool */
        protected $mTokenOkExceptSuffix = false;
@@ -254,6 +249,12 @@ class EditPage {
        /** @var bool */
        protected $allowBlankSummary = false;
 
+       /** @var bool */
+       protected $blankArticle = false;
+
+       /** @var bool */
+       protected $allowBlankArticle = false;
+
        /** @var string */
        protected $autoSumm = '';
 
@@ -421,7 +422,7 @@ class EditPage {
         *
         * @param string $modelId The ID of the content model to test. Use CONTENT_MODEL_XXX constants.
         * @return bool
-        * @throws MWException if $modelId has no known handler
+        * @throws MWException If $modelId has no known handler
         */
        public function isSupportedContentModel( $modelId ) {
                return $this->allowNonTextContent ||
@@ -643,26 +644,6 @@ class EditPage {
                }
        }
 
-       /**
-        * Show a read-only error
-        * Parameters are the same as OutputPage:readOnlyPage()
-        * Redirect to the article page if redlink=1
-        * @deprecated since 1.19; use displayPermissionsError() instead
-        */
-       function readOnlyPage( $source = null, $protected = false, $reasons = array(), $action = null ) {
-               wfDeprecated( __METHOD__, '1.19' );
-
-               global $wgRequest, $wgOut;
-               if ( $wgRequest->getBool( 'redlink' ) ) {
-                       // The edit page was reached via a red link.
-                       // Redirect to the article page and let them click the edit tab if
-                       // they really want a permission error.
-                       $wgOut->redirect( $this->mTitle->getFullURL() );
-               } else {
-                       $wgOut->readOnlyPage( $source, $protected, $reasons, $action );
-               }
-       }
-
        /**
         * Should we show a preview when the edit form is first shown?
         *
@@ -720,7 +701,7 @@ class EditPage {
         * Subclasses may override this to replace the default behavior, which is
         * to check ContentHandler::supportsSections.
         *
-        * @return bool true if this edit page supports sections, false otherwise.
+        * @return bool True if this edit page supports sections, false otherwise.
         */
        protected function isSectionEditSupported() {
                $contentHandler = ContentHandler::getForTitle( $this->mTitle );
@@ -860,6 +841,8 @@ class EditPage {
                        }
 
                        $this->autoSumm = $request->getText( 'wpAutoSummary' );
+
+                       $this->allowBlankArticle = $request->getBool( 'wpIgnoreBlankArticle' );
                } else {
                        # Not a posted form? Start with nothing.
                        wfDebug( __METHOD__ . ": Not a posted form.\n" );
@@ -980,29 +963,6 @@ class EditPage {
                return true;
        }
 
-       /**
-        * Fetch initial editing page content.
-        *
-        * @param string|bool $def_text
-        * @return string|bool string on success, $def_text for invalid sections
-        * @private
-        * @deprecated since 1.21, get WikiPage::getContent() instead.
-        */
-       function getContent( $def_text = false ) {
-               ContentHandler::deprecated( __METHOD__, '1.21' );
-
-               if ( $def_text !== null && $def_text !== false && $def_text !== '' ) {
-                       $def_content = $this->toEditContent( $def_text );
-               } else {
-                       $def_content = false;
-               }
-
-               $content = $this->getContentObject( $def_content );
-
-               // Note: EditPage should only be used with text based content anyway.
-               return $this->toEditText( $content );
-       }
-
        /**
         * @param Content|null $def_content The default value to return
         *
@@ -1190,20 +1150,6 @@ class EditPage {
                }
        }
 
-       /**
-        * Use this method before edit() to preload some text into the edit box
-        *
-        * @param string $text
-        * @deprecated since 1.21, use setPreloadedContent() instead.
-        */
-       public function setPreloadedText( $text ) {
-               ContentHandler::deprecated( __METHOD__, "1.21" );
-
-               $content = $this->toEditContent( $text );
-
-               $this->setPreloadedContent( $content );
-       }
-
        /**
         * Use this method before edit() to preload some content into the edit box
         *
@@ -1215,25 +1161,6 @@ class EditPage {
                $this->mPreloadContent = $content;
        }
 
-       /**
-        * Get the contents to be preloaded into the box, either set by
-        * an earlier setPreloadText() or by loading the given page.
-        *
-        * @param string $preload representing the title to preload from.
-        *
-        * @return string
-        *
-        * @deprecated since 1.21, use getPreloadedContent() instead
-        */
-       protected function getPreloadedText( $preload ) {
-               ContentHandler::deprecated( __METHOD__, "1.21" );
-
-               $content = $this->getPreloadedContent( $preload );
-               $text = $this->toEditText( $content );
-
-               return $text;
-       }
-
        /**
         * Get the contents to be preloaded into the box, either set by
         * an earlier setPreloadText() or by loading the given page.
@@ -1331,7 +1258,7 @@ class EditPage {
         * If the variable were set on the server, it would be cached, which is unwanted
         * since the post-edit state should only apply to the load right after the save.
         *
-        * @param $statusValue int The status value (to check for new article status)
+        * @param int $statusValue The status value (to check for new article status)
         */
        protected function setPostEditCookie( $statusValue ) {
                $revisionId = $this->mArticle->getLatest();
@@ -1353,7 +1280,7 @@ class EditPage {
        /**
         * Attempt submission
         * @throws UserBlockedError|ReadOnlyError|ThrottledError|PermissionsError
-        * @return bool false if output is done, true if the rest of the form should be displayed
+        * @return bool False if output is done, true if the rest of the form should be displayed
         */
        public function attemptSave() {
                global $wgUser;
@@ -1373,7 +1300,7 @@ class EditPage {
         * @param array|bool $resultDetails
         *
         * @throws ErrorPageError
-        * @return bool false, if output is done, true if rest of the form should be displayed
+        * @return bool False, if output is done, true if rest of the form should be displayed
         */
        private function handleStatus( Status $status, $resultDetails ) {
                global $wgUser, $wgOut;
@@ -1400,6 +1327,7 @@ class EditPage {
                        case self::AS_TEXTBOX_EMPTY:
                        case self::AS_MAX_ARTICLE_SIZE_EXCEEDED:
                        case self::AS_END:
+                       case self::AS_BLANK_ARTICLE:
                                return true;
 
                        case self::AS_HOOK_ERROR:
@@ -1435,10 +1363,6 @@ class EditPage {
                                $wgOut->redirect( $this->mTitle->getFullURL( $extraQuery ) . $sectionanchor );
                                return false;
 
-                       case self::AS_BLANK_ARTICLE:
-                               $wgOut->redirect( $this->getContextTitle()->getFullURL() );
-                               return false;
-
                        case self::AS_SPAM_ERROR:
                                $this->spamPageWithContent( $resultDetails['spam'] );
                                return false;
@@ -1523,6 +1447,36 @@ class EditPage {
                return true;
        }
 
+       /**
+        * Return the summary to be used for a new section.
+        *
+        * @param string $sectionanchor Set to the section anchor text
+        * @return string
+        */
+       private function newSectionSummary( &$sectionanchor = null ) {
+               global $wgParser;
+
+               if ( $this->sectiontitle !== '' ) {
+                       $sectionanchor = $wgParser->guessLegacySectionNameFromWikiText( $this->sectiontitle );
+                       // If no edit summary was specified, create one automatically from the section
+                       // title and have it link to the new section. Otherwise, respect the summary as
+                       // passed.
+                       if ( $this->summary === '' ) {
+                               $cleanSectionTitle = $wgParser->stripSectionName( $this->sectiontitle );
+                               return wfMessage( 'newsectionsummary' )
+                                       ->rawParams( $cleanSectionTitle )->inContentLanguage()->text();
+                       }
+               } elseif ( $this->summary !== '' ) {
+                       $sectionanchor = $wgParser->guessLegacySectionNameFromWikiText( $this->summary );
+                       # This is a new section, so create a link to the new section
+                       # in the revision summary.
+                       $cleanSummary = $wgParser->stripSectionName( $this->summary );
+                       return wfMessage( 'newsectionsummary' )
+                               ->rawParams( $cleanSummary )->inContentLanguage()->text();
+               }
+               return $this->summary;
+       }
+
        /**
         * Attempt submission (no UI)
         *
@@ -1746,7 +1700,9 @@ class EditPage {
                                $defaultText = '';
                        }
 
-                       if ( $this->textbox1 === $defaultText ) {
+                       if ( !$this->allowBlankArticle && $this->textbox1 === $defaultText ) {
+                               $this->blankArticle = true;
+                               $status->fatal( 'blankarticle' );
                                $status->setResult( false, self::AS_BLANK_ARTICLE );
                                wfProfileOut( __METHOD__ );
                                return $status;
@@ -1764,31 +1720,11 @@ class EditPage {
                                if ( $this->sectiontitle !== '' ) {
                                        // Insert the section title above the content.
                                        $content = $content->addSectionHeader( $this->sectiontitle );
-
-                                       // Jump to the new section
-                                       $result['sectionanchor'] =
-                                               $wgParser->guessLegacySectionNameFromWikiText( $this->sectiontitle );
-
-                                       // If no edit summary was specified, create one automatically from the section
-                                       // title and have it link to the new section. Otherwise, respect the summary as
-                                       // passed.
-                                       if ( $this->summary === '' ) {
-                                               $cleanSectionTitle = $wgParser->stripSectionName( $this->sectiontitle );
-                                               $this->summary = wfMessage( 'newsectionsummary' )
-                                                       ->rawParams( $cleanSectionTitle )->inContentLanguage()->text();
-                                       }
                                } elseif ( $this->summary !== '' ) {
                                        // Insert the section title above the content.
                                        $content = $content->addSectionHeader( $this->summary );
-
-                                       // Jump to the new section
-                                       $result['sectionanchor'] = $wgParser->guessLegacySectionNameFromWikiText( $this->summary );
-
-                                       // Create a link to the new section from the edit summary.
-                                       $cleanSummary = $wgParser->stripSectionName( $this->summary );
-                                       $this->summary = wfMessage( 'newsectionsummary' )
-                                               ->rawParams( $cleanSummary )->inContentLanguage()->text();
                                }
+                               $this->summary = $this->newSectionSummary( $result['sectionanchor'] );
                        }
 
                        $status->value = self::AS_SUCCESS_NEW_ARTICLE;
@@ -1806,7 +1742,8 @@ class EditPage {
                                $this->isConflict = true;
                                if ( $this->section == 'new' ) {
                                        if ( $this->mArticle->getUserText() == $wgUser->getName() &&
-                                               $this->mArticle->getComment() == $this->summary ) {
+                                               $this->mArticle->getComment() == $this->newSectionSummary()
+                                       ) {
                                                // Probably a duplicate submission of a new comment.
                                                // This can happen when squid resends a request after
                                                // a timeout but the first one actually went through.
@@ -1920,24 +1857,7 @@ class EditPage {
                        wfProfileIn( __METHOD__ . '-sectionanchor' );
                        $sectionanchor = '';
                        if ( $this->section == 'new' ) {
-                               if ( $this->sectiontitle !== '' ) {
-                                       $sectionanchor = $wgParser->guessLegacySectionNameFromWikiText( $this->sectiontitle );
-                                       // If no edit summary was specified, create one automatically from the section
-                                       // title and have it link to the new section. Otherwise, respect the summary as
-                                       // passed.
-                                       if ( $this->summary === '' ) {
-                                               $cleanSectionTitle = $wgParser->stripSectionName( $this->sectiontitle );
-                                               $this->summary = wfMessage( 'newsectionsummary' )
-                                                       ->rawParams( $cleanSectionTitle )->inContentLanguage()->text();
-                                       }
-                               } elseif ( $this->summary !== '' ) {
-                                       $sectionanchor = $wgParser->guessLegacySectionNameFromWikiText( $this->summary );
-                                       # This is a new section, so create a link to the new section
-                                       # in the revision summary.
-                                       $cleanSummary = $wgParser->stripSectionName( $this->summary );
-                                       $this->summary = wfMessage( 'newsectionsummary' )
-                                               ->rawParams( $cleanSummary )->inContentLanguage()->text();
-                               }
+                               $this->summary = $this->newSectionSummary( $sectionanchor );
                        } elseif ( $this->section != '' ) {
                                # Try to get a section anchor from the section source, redirect
                                # to edited section if header found.
@@ -2022,7 +1942,7 @@ class EditPage {
 
                        // Do this in its own transaction to reduce contention...
                        $dbw = wfGetDB( DB_MASTER );
-                       $dbw->onTransactionIdle( function() use ( $dbw, $title, $watch, $wgUser, $fname ) {
+                       $dbw->onTransactionIdle( function () use ( $dbw, $title, $watch, $wgUser, $fname ) {
                                $dbw->begin( $fname );
                                WatchAction::doWatchOrUnwatch( $watch, $title, $wgUser );
                                $dbw->commit( $fname );
@@ -2030,28 +1950,6 @@ class EditPage {
                }
        }
 
-       /**
-        * Attempts to merge text content with base and current revisions
-        *
-        * @param string $editText
-        *
-        * @return bool
-        * @deprecated since 1.21, use mergeChangesIntoContent() instead
-        */
-       function mergeChangesInto( &$editText ) {
-               ContentHandler::deprecated( __METHOD__, "1.21" );
-
-               $editContent = $this->toEditContent( $editText );
-
-               $ok = $this->mergeChangesIntoContent( $editContent );
-
-               if ( $ok ) {
-                       $editText = $this->toEditText( $editContent );
-                       return true;
-               }
-               return false;
-       }
-
        /**
         * Attempts to do 3-way merge of edit content with a base revision
         * and current content, in case of edit conflict, in whichever way appropriate
@@ -2236,14 +2134,15 @@ class EditPage {
                        $username = $parts[0];
                        $user = User::newFromName( $username, false /* allow IP users*/ );
                        $ip = User::isIP( $username );
+                       $block = Block::newFromTarget( $user, $user );
                        if ( !( $user && $user->isLoggedIn() ) && !$ip ) { # User does not exist
                                $wgOut->wrapWikiMsg( "<div class=\"mw-userpage-userdoesnotexist error\">\n$1\n</div>",
                                        array( 'userpage-userdoesnotexist', wfEscapeWikiText( $username ) ) );
-                       } elseif ( $user->isBlocked() ) { # Show log extract if the user is currently blocked
+                       } elseif ( !is_null( $block ) && $block->getType() != Block::TYPE_AUTO ) { # Show log extract if the user is currently blocked
                                LogEventsList::showLogExtract(
                                        $wgOut,
                                        'block',
-                                       $user->getUserPage(),
+                                       MWNamespace::getCanonicalName( NS_USER ) . ':' . $block->getTarget(),
                                        '',
                                        array(
                                                'lim' => 1,
@@ -2328,7 +2227,7 @@ class EditPage {
         * @param Content|null|bool|string $content
         * @return string The editable text form of the content.
         *
-        * @throws MWException if $content is not an instance of TextContent and
+        * @throws MWException If $content is not an instance of TextContent and
         *   $this->allowNonTextContent is not true.
         */
        protected function toEditText( $content ) {
@@ -2360,7 +2259,7 @@ class EditPage {
         * @return Content The content object created from $text. If $text was false
         *   or null, false resp. null will be  returned instead.
         *
-        * @throws MWException if unserializing the text results in a Content
+        * @throws MWException If unserializing the text results in a Content
         *   object that is not an instance of TextContent and
         *   $this->allowNonTextContent is not true.
         */
@@ -2535,6 +2434,10 @@ class EditPage {
                        $wgOut->addHTML( EditPage::getEditToolbar() );
                }
 
+               if ( $this->blankArticle ) {
+                       $wgOut->addHTML( Html::hidden( 'wpIgnoreBlankArticle', true ) );
+               }
+
                if ( $this->isConflict ) {
                        // In an edit conflict bypass the overridable content form method
                        // and fallback to the raw wpTextbox1 since editconflicts can't be
@@ -2604,7 +2507,7 @@ class EditPage {
         * Extract the section title from current section text, if any.
         *
         * @param string $text
-        * @return string|bool string or false
+        * @return string|bool String or false
         */
        public static function extractSectionTitle( $text ) {
                preg_match( "/^(=+)(.+)\\1\\s*(\n|$)/i", $text, $matches );
@@ -2621,6 +2524,7 @@ class EditPage {
         */
        protected function showHeader() {
                global $wgOut, $wgUser, $wgMaxArticleSize, $wgLang;
+               global $wgAllowUserCss, $wgAllowUserJs;
 
                if ( $this->mTitle->isTalkPage() ) {
                        $wgOut->addWikiMsg( 'talkpagetext' );
@@ -2662,6 +2566,10 @@ class EditPage {
                                $wgOut->wrapWikiMsg( "<div id='mw-missingcommentheader'>\n$1\n</div>", 'missingcommentheader' );
                        }
 
+                       if ( $this->blankArticle ) {
+                               $wgOut->wrapWikiMsg( "<div id='mw-blankarticle'>\n$1\n</div>", 'blankarticle' );
+                       }
+
                        if ( $this->hookError !== '' ) {
                                $wgOut->addWikiText( $this->hookError );
                        }
@@ -2707,9 +2615,18 @@ class EditPage {
                        );
                } elseif ( $wgUser->isAnon() ) {
                        if ( $this->formtype != 'preview' ) {
-                               $wgOut->wrapWikiMsg( "<div id=\"mw-anon-edit-warning\">\n$1</div>", 'anoneditwarning' );
+                               $wgOut->wrapWikiMsg(
+                                       "<div id='mw-anon-edit-warning'>\n$1\n</div>",
+                                       array( 'anoneditwarning',
+                                               // Log-in link
+                                               '{{fullurl:Special:UserLogin|returnto={{FULLPAGENAMEE}}}}',
+                                               // Sign-up link
+                                               '{{fullurl:Special:UserLogin/signup|returnto={{FULLPAGENAMEE}}}}' )
+                               );
                        } else {
-                               $wgOut->wrapWikiMsg( "<div id=\"mw-anon-preview-warning\">\n$1</div>", 'anonpreviewwarning' );
+                               $wgOut->wrapWikiMsg( "<div id=\"mw-anon-preview-warning\">\n$1</div>",
+                                       'anonpreviewwarning'
+                               );
                        }
                } else {
                        if ( $this->isCssJsSubpage ) {
@@ -2721,14 +2638,14 @@ class EditPage {
                                        );
                                }
                                if ( $this->formtype !== 'preview' ) {
-                                       if ( $this->isCssSubpage ) {
+                                       if ( $this->isCssSubpage && $wgAllowUserCss ) {
                                                $wgOut->wrapWikiMsg(
                                                        "<div id='mw-usercssyoucanpreview'>\n$1\n</div>",
                                                        array( 'usercssyoucanpreview' )
                                                );
                                        }
 
-                                       if ( $this->isJsSubpage ) {
+                                       if ( $this->isJsSubpage && $wgAllowUserJs ) {
                                                $wgOut->wrapWikiMsg(
                                                        "<div id='mw-userjsyoucanpreview'>\n$1\n</div>",
                                                        array( 'userjsyoucanpreview' )
@@ -2849,11 +2766,10 @@ class EditPage {
        }
 
        /**
-        * @param bool $isSubjectPreview true if this is the section subject/title
+        * @param bool $isSubjectPreview True if this is the section subject/title
         *   up top, or false if this is the comment summary
         *   down below the textarea
         * @param string $summary The text of the summary to display
-        * @return string
         */
        protected function showSummaryInput( $isSubjectPreview, $summary = "" ) {
                global $wgOut, $wgContLang;
@@ -2880,7 +2796,7 @@ class EditPage {
        }
 
        /**
-        * @param bool $isSubjectPreview true if this is the section subject/title
+        * @param bool $isSubjectPreview True if this is the section subject/title
         *   up top, or false if this is the comment summary
         *   down below the textarea
         * @param string $summary The text of the summary to display
@@ -3195,6 +3111,7 @@ HTML
         * Get the copyright warning
         *
         * Renamed to getCopyrightWarning(), old name kept around for backwards compatibility
+        * @return string
         */
        protected function getCopywarn() {
                return self::getCopyrightWarning( $this->mTitle );
@@ -3278,7 +3195,7 @@ HTML
        }
 
        protected function showStandardInputs( &$tabindex = 2 ) {
-               global $wgOut;
+               global $wgOut, $wgUseMediaWikiUIEverywhere;
                $wgOut->addHTML( "<div class='editOptions'>\n" );
 
                if ( $this->section != 'new' ) {
@@ -3306,8 +3223,14 @@ HTML
 
                $message = wfMessage( 'edithelppage' )->inContentLanguage()->text();
                $edithelpurl = Skin::makeInternalOrExternalUrl( $message );
-               $edithelp = '<a target="helpwindow" href="' . $edithelpurl . '">' .
-                       wfMessage( 'edithelp' )->escaped() . '</a> ' .
+               $attrs = array(
+                       'target' => 'helpwindow',
+                       'href' => $edithelpurl,
+               );
+               if ( $wgUseMediaWikiUIEverywhere ) {
+                       $attrs['class'] = 'mw-ui-button mw-ui-quiet';
+               }
+               $edithelp = Html::element( 'a', $attrs, wfMessage( 'edithelp' )->text() ) .
                        wfMessage( 'newwindow' )->parse();
 
                $wgOut->addHTML( "      <span class='cancelLink'>{$cancel}</span>\n" );
@@ -3349,15 +3272,20 @@ HTML
         * @return string
         */
        public function getCancelLink() {
+               global $wgUseMediaWikiUIEverywhere;
                $cancelParams = array();
                if ( !$this->isConflict && $this->oldid > 0 ) {
                        $cancelParams['oldid'] = $this->oldid;
                }
+               $attrs = array( 'id' => 'mw-editform-cancel' );
+               if ( $wgUseMediaWikiUIEverywhere ) {
+                       $attrs['class'] = 'mw-ui-button mw-ui-quiet';
+               }
 
                return Linker::linkKnown(
                        $this->getContextTitle(),
                        wfMessage( 'cancel' )->parse(),
-                       array( 'id' => 'mw-editform-cancel' ),
+                       $attrs,
                        $cancelParams
                );
        }
@@ -3451,6 +3379,7 @@ HTML
         */
        function getPreviewText() {
                global $wgOut, $wgUser, $wgRawHtml, $wgLang;
+               global $wgAllowUserCss, $wgAllowUserJs;
 
                wfProfileIn( __METHOD__ );
 
@@ -3516,8 +3445,14 @@ HTML
 
                                if ( $content->getModel() == CONTENT_MODEL_CSS ) {
                                        $format = 'css';
+                                       if ( $level === 'user' && !$wgAllowUserCss ) {
+                                               $format = false;
+                                       }
                                } elseif ( $content->getModel() == CONTENT_MODEL_JAVASCRIPT ) {
                                        $format = 'js';
+                                       if ( $level === 'user' && !$wgAllowUserJs ) {
+                                               $format = false;
+                                       }
                                } else {
                                        $format = false;
                                }
@@ -3555,7 +3490,7 @@ HTML
 
                        $previewHTML = $parserOutput->getText();
                        $this->mParserOutput = $parserOutput;
-                       $wgOut->addParserOutputNoText( $parserOutput );
+                       $wgOut->addParserOutputMetadata( $parserOutput );
 
                        if ( count( $parserOutput->getWarnings() ) ) {
                                $note .= "\n\n" . implode( "\n\n", $parserOutput->getWarnings() );
@@ -3614,7 +3549,6 @@ HTML
        /**
         * Shows a bulletin board style toolbar for common editing functions.
         * It can be disabled in the user preferences.
-        * The necessary JavaScript code can be found in skins/common/edit.js.
         *
         * @return string
         */
@@ -3631,11 +3565,6 @@ HTML
                 * inserted between the two when no selection is highlighted
                 * and.  The tip text is shown when the user moves the mouse
                 * over the button.
-                *
-                * Also here: accesskeys (key), which are not used yet until
-                * someone can figure out a way to make them work in
-                * IE. However, we should make sure these keys are not defined
-                * on the edit page.
                 */
                $toolarray = array(
                        array(
@@ -3645,7 +3574,6 @@ HTML
                                'close'  => '\'\'\'',
                                'sample' => wfMessage( 'bold_sample' )->text(),
                                'tip'    => wfMessage( 'bold_tip' )->text(),
-                               'key'    => 'B'
                        ),
                        array(
                                'image'  => $wgLang->getImageFile( 'button-italic' ),
@@ -3654,7 +3582,6 @@ HTML
                                'close'  => '\'\'',
                                'sample' => wfMessage( 'italic_sample' )->text(),
                                'tip'    => wfMessage( 'italic_tip' )->text(),
-                               'key'    => 'I'
                        ),
                        array(
                                'image'  => $wgLang->getImageFile( 'button-link' ),
@@ -3663,7 +3590,6 @@ HTML
                                'close'  => ']]',
                                'sample' => wfMessage( 'link_sample' )->text(),
                                'tip'    => wfMessage( 'link_tip' )->text(),
-                               'key'    => 'L'
                        ),
                        array(
                                'image'  => $wgLang->getImageFile( 'button-extlink' ),
@@ -3672,7 +3598,6 @@ HTML
                                'close'  => ']',
                                'sample' => wfMessage( 'extlink_sample' )->text(),
                                'tip'    => wfMessage( 'extlink_tip' )->text(),
-                               'key'    => 'X'
                        ),
                        array(
                                'image'  => $wgLang->getImageFile( 'button-headline' ),
@@ -3681,7 +3606,6 @@ HTML
                                'close'  => " ==\n",
                                'sample' => wfMessage( 'headline_sample' )->text(),
                                'tip'    => wfMessage( 'headline_tip' )->text(),
-                               'key'    => 'H'
                        ),
                        $imagesAvailable ? array(
                                'image'  => $wgLang->getImageFile( 'button-image' ),
@@ -3690,7 +3614,6 @@ HTML
                                'close'  => ']]',
                                'sample' => wfMessage( 'image_sample' )->text(),
                                'tip'    => wfMessage( 'image_tip' )->text(),
-                               'key'    => 'D',
                        ) : false,
                        $imagesAvailable ? array(
                                'image'  => $wgLang->getImageFile( 'button-media' ),
@@ -3699,7 +3622,6 @@ HTML
                                'close'  => ']]',
                                'sample' => wfMessage( 'media_sample' )->text(),
                                'tip'    => wfMessage( 'media_tip' )->text(),
-                               'key'    => 'M'
                        ) : false,
                        array(
                                'image'  => $wgLang->getImageFile( 'button-nowiki' ),
@@ -3708,7 +3630,6 @@ HTML
                                'close'  => "</nowiki>",
                                'sample' => wfMessage( 'nowiki_sample' )->text(),
                                'tip'    => wfMessage( 'nowiki_tip' )->text(),
-                               'key'    => 'N'
                        ),
                        array(
                                'image'  => $wgLang->getImageFile( 'button-sig' ),
@@ -3717,7 +3638,6 @@ HTML
                                'close'  => '',
                                'sample' => '',
                                'tip'    => wfMessage( 'sig_tip' )->text(),
-                               'key'    => 'Y'
                        ),
                        array(
                                'image'  => $wgLang->getImageFile( 'button-hr' ),
@@ -3726,7 +3646,6 @@ HTML
                                'close'  => '',
                                'sample' => '',
                                'tip'    => wfMessage( 'hr_tip' )->text(),
-                               'key'    => 'R'
                        )
                );
 
@@ -3779,7 +3698,7 @@ HTML
         * @return array
         */
        public function getCheckboxes( &$tabindex, $checked ) {
-               global $wgUser;
+               global $wgUser, $wgUseMediaWikiUIEverywhere;
 
                $checkboxes = array();
 
@@ -3793,11 +3712,19 @@ HTML
                                        'accesskey' => wfMessage( 'accesskey-minoredit' )->text(),
                                        'id' => 'wpMinoredit',
                                );
-                               $checkboxes['minor'] =
+                               $minorEditHtml =
                                        Xml::check( 'wpMinoredit', $checked['minor'], $attribs ) .
                                        "&#160;<label for='wpMinoredit' id='mw-editpage-minoredit'" .
                                        Xml::expandAttributes( array( 'title' => Linker::titleAttrib( 'minoredit', 'withaccess' ) ) ) .
                                        ">{$minorLabel}</label>";
+
+                               if ( $wgUseMediaWikiUIEverywhere ) {
+                                       $checkboxes['minor'] = Html::openElement( 'div', array( 'class' => 'mw-ui-checkbox' ) ) .
+                                               $minorEditHtml .
+                                       Html::closeElement( 'div' );
+                               } else {
+                                       $checkboxes['minor'] = $minorEditHtml;
+                               }
                        }
                }
 
@@ -3809,11 +3736,18 @@ HTML
                                'accesskey' => wfMessage( 'accesskey-watch' )->text(),
                                'id' => 'wpWatchthis',
                        );
-                       $checkboxes['watch'] =
+                       $watchThisHtml =
                                Xml::check( 'wpWatchthis', $checked['watch'], $attribs ) .
                                "&#160;<label for='wpWatchthis' id='mw-editpage-watch'" .
                                Xml::expandAttributes( array( 'title' => Linker::titleAttrib( 'watch', 'withaccess' ) ) ) .
                                ">{$watchLabel}</label>";
+                       if ( $wgUseMediaWikiUIEverywhere ) {
+                               $checkboxes['watch'] = Html::openElement( 'div', array( 'class' => 'mw-ui-checkbox' ) ) .
+                                       $watchThisHtml .
+                                       Html::closeElement( 'div' );
+                       } else {
+                               $checkboxes['watch'] = $watchThisHtml;
+                       }
                }
                wfRunHooks( 'EditPageBeforeEditChecks', array( &$this, &$checkboxes, &$tabindex ) );
                return $checkboxes;
@@ -3828,48 +3762,47 @@ HTML
         * @return array
         */
        public function getEditButtons( &$tabindex ) {
+               global $wgUseMediaWikiUIEverywhere;
+
                $buttons = array();
 
-               // @todo FIXME: Hardcoded square brackets.
-               $temp = array(
+               $attribs = array(
                        'id' => 'wpSave',
                        'name' => 'wpSave',
                        'type' => 'submit',
                        'tabindex' => ++$tabindex,
                        'value' => wfMessage( 'savearticle' )->text(),
-                       'accesskey' => wfMessage( 'accesskey-save' )->text(),
-                       'title' => wfMessage( 'tooltip-save' )->text()
-                               . ' [' . wfMessage( 'accesskey-save' )->text() . ']',
-               );
-               $buttons['save'] = Xml::element( 'input', $temp, '' );
+               ) + Linker::tooltipAndAccesskeyAttribs( 'save' );
+               if ( $wgUseMediaWikiUIEverywhere ) {
+                       $attribs['class'] = 'mw-ui-button mw-ui-constructive';
+               }
+               $buttons['save'] = Xml::element( 'input', $attribs, '' );
 
                ++$tabindex; // use the same for preview and live preview
-               // @todo FIXME: Hardcoded square brackets.
-               $temp = array(
+               $attribs = array(
                        'id' => 'wpPreview',
                        'name' => 'wpPreview',
                        'type' => 'submit',
                        'tabindex' => $tabindex,
                        'value' => wfMessage( 'showpreview' )->text(),
-                       'accesskey' => wfMessage( 'accesskey-preview' )->text(),
-                       'title' => wfMessage( 'tooltip-preview' )->text()
-                               . ' [' . wfMessage( 'accesskey-preview' )->text() . ']',
-               );
-               $buttons['preview'] = Xml::element( 'input', $temp, '' );
+               ) + Linker::tooltipAndAccesskeyAttribs( 'preview' );
+               if ( $wgUseMediaWikiUIEverywhere ) {
+                       $attribs['class'] = 'mw-ui-button mw-ui-progressive';
+               }
+               $buttons['preview'] = Xml::element( 'input', $attribs, '' );
                $buttons['live'] = '';
 
-               // @todo FIXME: Hardcoded square brackets.
-               $temp = array(
+               $attribs = array(
                        'id' => 'wpDiff',
                        'name' => 'wpDiff',
                        'type' => 'submit',
                        'tabindex' => ++$tabindex,
                        'value' => wfMessage( 'showdiff' )->text(),
-                       'accesskey' => wfMessage( 'accesskey-diff' )->text(),
-                       'title' => wfMessage( 'tooltip-diff' )->text()
-                               . ' [' . wfMessage( 'accesskey-diff' )->text() . ']',
-               );
-               $buttons['diff'] = Xml::element( 'input', $temp, '' );
+               ) + Linker::tooltipAndAccesskeyAttribs( 'diff' );
+               if ( $wgUseMediaWikiUIEverywhere ) {
+                       $attribs['class'] = 'mw-ui-button mw-ui-progressive';
+               }
+               $buttons['diff'] = Xml::element( 'input', $attribs, '' );
 
                wfRunHooks( 'EditPageBeforeEditButtons', array( &$this, &$buttons, &$tabindex ) );
                return $buttons;
@@ -3905,40 +3838,6 @@ HTML
                echo $s;
        }
 
-       /**
-        * Call the stock "user is blocked" page
-        *
-        * @deprecated since 1.19; throw an exception directly instead
-        */
-       function blockedPage() {
-               wfDeprecated( __METHOD__, '1.19' );
-               global $wgUser;
-
-               throw new UserBlockedError( $wgUser->getBlock() );
-       }
-
-       /**
-        * Produce the stock "please login to edit pages" page
-        *
-        * @deprecated since 1.19; throw an exception directly instead
-        */
-       function userNotLoggedInPage() {
-               wfDeprecated( __METHOD__, '1.19' );
-               throw new PermissionsError( 'edit' );
-       }
-
-       /**
-        * Show an error page saying to the user that he has insufficient permissions
-        * to create a new page
-        *
-        * @deprecated since 1.19; throw an exception directly instead
-        */
-       function noCreatePermission() {
-               wfDeprecated( __METHOD__, '1.19' );
-               $permission = $this->mTitle->isTalkPage() ? 'createtalk' : 'createpage';
-               throw new PermissionsError( $permission );
-       }
-
        /**
         * Creates a basic error page which informs the user that
         * they have attempted to edit a nonexistent section.