Use OutputPage::wrapWikiTextAsInterface() to add safe <div> wrappers
[lhc/web/wiklou.git] / includes / EditPage.php
index 8c4b3c8..90db70f 100644 (file)
@@ -794,7 +794,7 @@ class EditPage {
                $out->addHTML( $this->editFormTextTop );
 
                if ( $errorMessage !== '' ) {
-                       $out->addWikiText( $errorMessage );
+                       $out->addWikiTextAsInterface( $errorMessage );
                        $out->addHTML( "<hr />\n" );
                }
 
@@ -943,7 +943,7 @@ class EditPage {
                        # Note that wpSectionTitle is not yet a part of the actual edit form, as wpSummary is
                        # currently doing double duty as both edit summary and section title. Right now this
                        # is just to allow API edits to work around this limitation, but this should be
-                       # incorporated into the actual edit form when EditPage is rewritten (Bugs 18654, 26312).
+                       # incorporated into the actual edit form when EditPage is rewritten (T20654, T28312).
                        $this->sectiontitle = $request->getText( 'wpSectionTitle' );
                        $this->sectiontitle = preg_replace( '/^\s*=+\s*(.*?)\s*=+\s*$/', '$1', $this->sectiontitle );
 
@@ -1640,7 +1640,7 @@ class EditPage {
                        case self::AS_CANNOT_USE_CUSTOM_MODEL:
                        case self::AS_PARSE_ERROR:
                        case self::AS_UNICODE_NOT_SUPPORTED:
-                               $out->addWikiText( '<div class="error">' . "\n" . $status->getWikiText() . '</div>' );
+                               $out->wrapWikiTextAsInterface( 'error', $status->getWikiText() );
                                return true;
 
                        case self::AS_SUCCESS_NEW_ARTICLE:
@@ -2666,8 +2666,9 @@ ERROR;
                        $title = Title::newFromText( $this->editintro );
                        if ( $title instanceof Title && $title->exists() && $title->userCan( 'read' ) ) {
                                // Added using template syntax, to take <noinclude>'s into account.
-                               $this->context->getOutput()->addWikiTextTitleTidy(
+                               $this->context->getOutput()->addWikiTextAsContent(
                                        '<div class="mw-editintro">{{:' . $title->getFullText() . '}}</div>',
+                                       /*linestart*/true,
                                        $this->mTitle
                                );
                                return true;
@@ -2990,7 +2991,7 @@ ERROR;
                                        $this->contentFormat,
                                        $ex->getMessage()
                                );
-                               $out->addWikiText( '<div class="error">' . $msg->text() . '</div>' );
+                               $out->wrapWikiTextAsInterface( 'error', $msg->plain() );
                        }
                }
 
@@ -3108,7 +3109,7 @@ ERROR;
                        }
 
                        if ( $this->hookError !== '' ) {
-                               $out->addWikiText( $this->hookError );
+                               $out->addWikiTextAsInterface( $this->hookError );
                        }
 
                        if ( $this->section != 'new' ) {
@@ -3465,7 +3466,7 @@ ERROR;
                                        $this->contentFormat,
                                        $ex->getMessage()
                                );
-                               $out->addWikiText( '<div class="error">' . $msg->text() . '</div>' );
+                               $out->wrapWikiTextAsInterface( 'error', $msg->plain() );
                        }
                }
        }
@@ -3706,7 +3707,7 @@ ERROR;
                $out->addHTML( "<div class='editCheckboxes'>" . $checkboxesHTML . "</div>\n" );
 
                // Show copyright warning.
-               $out->addWikiText( $this->getCopywarn() );
+               $out->addWikiTextAsInterface( $this->getCopywarn() );
                $out->addHTML( $this->editFormTextAfterWarn );
 
                $out->addHTML( "<div class='editButtons'>\n" );