Merge "Ensure <h5> and <h6> have different computed font size"
[lhc/web/wiklou.git] / includes / EditPage.php
index f88dc90..27f4556 100644 (file)
@@ -621,6 +621,7 @@ class EditPage {
                $this->section = $request->getVal( 'wpSection', $request->getVal( 'section' ) );
 
                if ( $this->section !== null && $this->section !== '' && !$this->isSectionEditSupported() ) {
+                       wfProfileOut( __METHOD__ );
                        throw new ErrorPageError( 'sectioneditnotsupported-title', 'sectioneditnotsupported-text' );
                }
 
@@ -897,7 +898,9 @@ class EditPage {
                                $orig = $this->getOriginalContent();
                                $content = $orig ? $orig->getSection( $this->section ) : null;
 
-                               if ( !$content ) $content = $def_content;
+                               if ( !$content ) {
+                                       $content = $def_content;
+                               }
                        } else {
                                $undoafter = $wgRequest->getInt( 'undoafter' );
                                $undo = $wgRequest->getInt( 'undo' );
@@ -985,7 +988,9 @@ class EditPage {
                }
                $revision = $this->mArticle->getRevisionFetched();
                if ( $revision === null ) {
-                       if ( !$this->contentModel ) $this->contentModel = $this->getTitle()->getContentModel();
+                       if ( !$this->contentModel ) {
+                               $this->contentModel = $this->getTitle()->getContentModel();
+                       }
                        $handler = ContentHandler::getForModelID( $this->contentModel );
 
                        return $handler->makeEmptyContent();
@@ -1007,7 +1012,9 @@ class EditPage {
                $content = $rev ? $rev->getContent( Revision::RAW ) : null;
 
                if ( $content === false || $content === null ) {
-                       if ( !$this->contentModel ) $this->contentModel = $this->getTitle()->getContentModel();
+                       if ( !$this->contentModel ) {
+                               $this->contentModel = $this->getTitle()->getContentModel();
+                       }
                        $handler = ContentHandler::getForModelID( $this->contentModel );
 
                        return $handler->makeEmptyContent();
@@ -1213,7 +1220,7 @@ class EditPage {
 
                        case self::AS_SUCCESS_NEW_ARTICLE:
                                $query = $resultDetails['redirect'] ? 'redirect=no' : '';
-                               $anchor = isset ( $resultDetails['sectionanchor'] ) ? $resultDetails['sectionanchor'] : '';
+                               $anchor = isset( $resultDetails['sectionanchor'] ) ? $resultDetails['sectionanchor'] : '';
                                $wgOut->redirect( $this->mTitle->getFullURL( $query ) . $anchor );
                                return false;
 
@@ -1889,6 +1896,11 @@ class EditPage {
                if ( $wgUser->getOption( 'uselivepreview', false ) ) {
                        $wgOut->addModules( 'mediawiki.action.edit.preview' );
                }
+
+               if ( $wgUser->getOption( 'useeditwarning', false ) ) {
+                       $wgOut->addModules( 'mediawiki.action.edit.editWarning' );
+               }
+
                // Bug #19334: textarea jumps when editing articles in IE8
                $wgOut->addStyle( 'common/IE80Fixes.css', 'screen', 'IE 8' );
 
@@ -1928,15 +1940,15 @@ class EditPage {
                if ( $namespace == NS_MEDIAWIKI ) {
                        # Show a warning if editing an interface message
                        $wgOut->wrapWikiMsg( "<div class='mw-editinginterface'>\n$1\n</div>", 'editinginterface' );
-               } else if( $namespace == NS_FILE ) {
+               } elseif ( $namespace == NS_FILE ) {
                        # Show a hint to shared repo
                        $file = wfFindFile( $this->mTitle );
-                       if( $file && !$file->isLocal() ) {
+                       if ( $file && !$file->isLocal() ) {
                                $descUrl = $file->getDescriptionUrl();
                                # there must be a description url to show a hint to shared repo
-                               if( $descUrl ) {
-                                       if( !$this->mTitle->exists() ) {
-                                               $wgOut->wrapWikiMsg( "<div class=\"mw-sharedupload-desc-create\">\n$1\n</div>", array (
+                               if ( $descUrl ) {
+                                       if ( !$this->mTitle->exists() ) {
+                                               $wgOut->wrapWikiMsg( "<div class=\"mw-sharedupload-desc-create\">\n$1\n</div>", array(
                                                                        'sharedupload-desc-create', $file->getRepo()->getDisplayName(), $descUrl
                                                ) );
                                        } else {
@@ -2126,7 +2138,7 @@ class EditPage {
                        }
                }
 
-               //@todo: add EditForm plugin interface and use it here!
+               // @todo add EditForm plugin interface and use it here!
                //       search for textarea1 and textares2, and allow EditForm to override all uses.
                $wgOut->addHTML( Html::openElement( 'form', array( 'id' => self::EDITFORM_ID, 'name' => self::EDITFORM_ID,
                        'method' => 'post', 'action' => $this->getActionURL( $this->getContextTitle() ),
@@ -2161,7 +2173,7 @@ class EditPage {
                }
 
                # When the summary is hidden, also hide them on preview/show changes
-               if( $this->nosummary ) {
+               if ( $this->nosummary ) {
                        $wgOut->addHTML( Html::hidden( 'nosummary', true ) );
                }
 
@@ -2626,7 +2638,7 @@ HTML
 
                $attribs = $customAttribs + array(
                        'accesskey' => ',',
-                       'id'   => $name,
+                       'id' => $name,
                        'cols' => $wgUser->getIntOption( 'cols' ),
                        'rows' => $wgUser->getIntOption( 'rows' ),
                        'style' => '' // avoid php notices when appending preferences (appending allows customAttribs['style'] to still work
@@ -2702,9 +2714,9 @@ HTML
 
                $oldtitlemsg = 'currentrev';
                # if message does not exist, show diff against the preloaded default
-               if( $this->mTitle->getNamespace() == NS_MEDIAWIKI && !$this->mTitle->exists() ) {
+               if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI && !$this->mTitle->exists() ) {
                        $oldtext = $this->mTitle->getDefaultMessageText();
-                       if( $oldtext !== false ) {
+                       if ( $oldtext !== false ) {
                                $oldtitlemsg = 'defaultmessagetext';
                                $oldContent = $this->toEditContent( $oldtext );
                        } else {
@@ -3028,9 +3040,9 @@ HTML
 
                        # don't parse non-wikitext pages, show message about preview
                        if ( $this->mTitle->isCssJsSubpage() || $this->mTitle->isCssOrJsPage() ) {
-                               if( $this->mTitle->isCssJsSubpage() ) {
+                               if ( $this->mTitle->isCssJsSubpage() ) {
                                        $level = 'user';
-                               } elseif( $this->mTitle->isCssOrJsPage() ) {
+                               } elseif ( $this->mTitle->isCssOrJsPage() ) {
                                        $level = 'site';
                                } else {
                                        $level = false;
@@ -3046,7 +3058,7 @@ HTML
 
                                # Used messages to make sure grep find them:
                                # Messages: usercsspreview, userjspreview, sitecsspreview, sitejspreview
-                               if( $level && $format ) {
+                               if ( $level && $format ) {
                                        $note = "<div id='mw-{$level}{$format}preview'>" . wfMessage( "{$level}{$format}preview" )->text() . "</div>";
                                }
                        }
@@ -3314,9 +3326,9 @@ HTML
                        $minorLabel = wfMessage( 'minoredit' )->parse();
                        if ( $wgUser->isAllowed( 'minoredit' ) ) {
                                $attribs = array(
-                                       'tabindex'  => ++$tabindex,
+                                       'tabindex' => ++$tabindex,
                                        'accesskey' => wfMessage( 'accesskey-minoredit' )->text(),
-                                       'id'        => 'wpMinoredit',
+                                       'id' => 'wpMinoredit',
                                );
                                $checkboxes['minor'] =
                                        Xml::check( 'wpMinoredit', $checked['minor'], $attribs ) .
@@ -3330,9 +3342,9 @@ HTML
                $checkboxes['watch'] = '';
                if ( $wgUser->isLoggedIn() ) {
                        $attribs = array(
-                               'tabindex'  => ++$tabindex,
+                               'tabindex' => ++$tabindex,
                                'accesskey' => wfMessage( 'accesskey-watch' )->text(),
-                               'id'        => 'wpWatchthis',
+                               'id' => 'wpWatchthis',
                        );
                        $checkboxes['watch'] =
                                Xml::check( 'wpWatchthis', $checked['watch'], $attribs ) .
@@ -3356,37 +3368,37 @@ HTML
                $buttons = array();
 
                $temp = array(
-                       'id'        => 'wpSave',
-                       'name'      => 'wpSave',
-                       'type'      => 'submit',
-                       'tabindex'  => ++$tabindex,
-                       'value'     => wfMessage( 'savearticle' )->text(),
+                       '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() . ']',
+                       'title' => wfMessage( 'tooltip-save' )->text() . ' [' . wfMessage( 'accesskey-save' )->text() . ']',
                );
                $buttons['save'] = Xml::element( 'input', $temp, '' );
 
                ++$tabindex; // use the same for preview and live preview
                $temp = array(
-                       'id'        => 'wpPreview',
-                       'name'      => 'wpPreview',
-                       'type'      => 'submit',
-                       'tabindex'  => $tabindex,
-                       'value'     => wfMessage( 'showpreview' )->text(),
+                       '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() . ']',
+                       'title' => wfMessage( 'tooltip-preview' )->text() . ' [' . wfMessage( 'accesskey-preview' )->text() . ']',
                );
                $buttons['preview'] = Xml::element( 'input', $temp, '' );
                $buttons['live'] = '';
 
                $temp = array(
-                       'id'        => 'wpDiff',
-                       'name'      => 'wpDiff',
-                       'type'      => 'submit',
-                       'tabindex'  => ++$tabindex,
-                       'value'     => wfMessage( 'showdiff' )->text(),
+                       '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() . ']',
+                       'title' => wfMessage( 'tooltip-diff' )->text() . ' [' . wfMessage( 'accesskey-diff' )->text() . ']',
                );
                $buttons['diff'] = Xml::element( 'input', $temp, '' );
 
@@ -3506,7 +3518,7 @@ HTML
                global $wgOut, $wgLang;
                $this->textbox2 = $this->textbox1;
 
-               if( is_array( $match ) ) {
+               if ( is_array( $match ) ) {
                        $match = $wgLang->listToText( $match );
                }
                $wgOut->prepareErrorPage( wfMessage( 'spamprotectiontitle' ) );