Merge "Even more out-factoring to methods in the header"
[lhc/web/wiklou.git] / includes / EditPage.php
index cd6fb56..78ef2e3 100644 (file)
@@ -1044,7 +1044,6 @@ class EditPage {
 
                // Allow extensions to modify form data
                Hooks::run( 'EditPage::importFormData', [ $this, $request ] );
-
        }
 
        /**
@@ -1646,7 +1645,7 @@ class EditPage {
                                // being set. This is used by ConfirmEdit to display a captcha
                                // without any error message cruft.
                        } else {
-                               $this->hookError = $this->formatStatusErrors( $status );
+                               $this->hookError = $status->getWikiText();
                        }
                        // Use the existing $status->value if the hook set it
                        if ( !$status->value ) {
@@ -1656,7 +1655,7 @@ class EditPage {
                } elseif ( !$status->isOK() ) {
                        # ...or the hook could be expecting us to produce an error
                        // FIXME this sucks, we should just use the Status object throughout
-                       $this->hookError = $this->formatStatusErrors( $status );
+                       $this->hookError = $status->getWikiText();
                        $status->fatal( 'hookaborted' );
                        $status->value = self::AS_HOOK_ERROR_EXPECTED;
                        return false;
@@ -1665,26 +1664,6 @@ class EditPage {
                return true;
        }
 
-       /**
-        * Wrap status errors in an errorbox for increased visiblity
-        *
-        * @param Status $status
-        * @return string
-        */
-       private function formatStatusErrors( Status $status ) {
-               $errmsg = $status->getHTML(
-                       'edit-error-short',
-                       'edit-error-long',
-                       $this->context->getLanguage()
-               );
-               return <<<ERROR
-<div class="errorbox">
-{$errmsg}
-</div>
-<br clear="all" />
-ERROR;
-       }
-
        /**
         * Return the summary to be used for a new section.
         *
@@ -2257,7 +2236,6 @@ ERROR;
         * @return bool
         */
        private function mergeChangesIntoContent( &$editContent ) {
-
                $db = wfGetDB( DB_MASTER );
 
                // This is the revision the editor started from
@@ -2844,7 +2822,6 @@ ERROR;
                if ( !$wgUser->getOption( 'previewontop' ) ) {
                        $this->displayPreviewArea( $previewOutput, false );
                }
-
        }
 
        /**
@@ -2870,7 +2847,6 @@ ERROR;
                return Html::rawElement( 'div', [ 'class' => 'templatesUsed' ],
                        $templateListFormatter->format( $templates, $type )
                );
-
        }
 
        /**
@@ -3512,22 +3488,16 @@ HTML
                ] ) .
                        Html::openElement( 'tbody' );
 
-               foreach ( $output->getLimitReportData()['limitreport'] as $key => $value ) {
+               foreach ( $output->getLimitReportData() as $key => $value ) {
                        if ( Hooks::run( 'ParserLimitReportFormat',
                                [ $key, &$value, &$limitReport, true, true ]
                        ) ) {
-                               $keyMsg = wfMessage( "limitreport-$key" );
-                               $valueMsg = wfMessage(
-                                       [ "limitreport-$key-value-html", "limitreport-$key-value" ]
-                               );
+                               $keyMsg = wfMessage( $key );
+                               $valueMsg = wfMessage( [ "$key-value-html", "$key-value" ] );
                                if ( !$valueMsg->exists() ) {
                                        $valueMsg = new RawMessage( '$1' );
                                }
                                if ( !$keyMsg->isDisabled() && !$valueMsg->isDisabled() ) {
-                                       // If it's a value/limit array, convert it for $1/$2
-                                       if ( is_array( $value ) && isset( $value['value'] ) ) {
-                                               $value = [ $value['value'], $value['limit'] ];
-                                       }
                                        $limitReport .= Html::openElement( 'tr' ) .
                                                Html::rawElement( 'th', null, $keyMsg->parse() ) .
                                                Html::rawElement( 'td', null, $valueMsg->params( $value )->parse() ) .
@@ -4359,6 +4329,9 @@ HTML
                return strtr( $result, [ "&#x0" => "&#x" ] );
        }
 
+       /**
+        * @since 1.29
+        */
        protected function addEditNotices() {
                global $wgOut;
 
@@ -4377,6 +4350,9 @@ HTML
                }
        }
 
+       /**
+        * @since 1.29
+        */
        protected function addTalkPageText() {
                global $wgOut;