Merge "Deprecate $wgFixArabicUnicode / $wgFixMalayalamUnicode"
[lhc/web/wiklou.git] / includes / page / Article.php
index 803bf0a..af4f293 100644 (file)
@@ -120,7 +120,7 @@ class Article implements Page {
         * here, there doesn't seem to be any other way to stop calling
         * OutputPage::enableSectionEditLinks() and still have it work as it did before.
         */
-       private $disableSectionEditForRender = false;
+       protected $viewIsRenderAction = false;
 
        /**
         * Constructor and clear the article
@@ -633,7 +633,7 @@ class Article implements Page {
                if ( $outputPage->isPrintable() ) {
                        $parserOptions->setIsPrintable( true );
                        $poOptions['enableSectionEditLinks'] = false;
-               } elseif ( $this->disableSectionEditForRender
+               } elseif ( $this->viewIsRenderAction
                        || !$this->isCurrent() || !$this->getTitle()->quickUserCan( 'edit', $user )
                ) {
                        $poOptions['enableSectionEditLinks'] = false;
@@ -792,7 +792,7 @@ class Article implements Page {
                                                        $outputPage->setRobotPolicy( 'noindex,nofollow' );
 
                                                        $errortext = $error->getWikiText( false, 'view-pool-error' );
-                                                       $outputPage->addWikiText( Html::errorBox( $errortext ) );
+                                                       $outputPage->wrapWikiTextAsInterface( 'errorbox', $errortext );
                                                }
                                                # Connection or timeout error
                                                return;
@@ -822,7 +822,7 @@ class Article implements Page {
                $pOutput = ( $outputDone instanceof ParserOutput )
                        // phpcs:ignore MediaWiki.Usage.NestedInlineTernary.UnparenthesizedTernary -- FIXME T203805
                        ? $outputDone // object fetched by hook
-                       : $this->mParserOutput ?: null; // ParserOutput or null, avoid false
+                       : ( $this->mParserOutput ?: null ); // ParserOutput or null, avoid false
 
                # Adjust title for main page & pages with displaytitle
                if ( $pOutput ) {
@@ -1461,7 +1461,7 @@ class Article implements Page {
 
                        $dir = $this->getContext()->getLanguage()->getDir();
                        $lang = $this->getContext()->getLanguage()->getHtmlCode();
-                       $outputPage->addWikiText( Xml::openElement( 'div', [
+                       $outputPage->addWikiTextAsInterface( Xml::openElement( 'div', [
                                'class' => "noarticletext mw-content-$dir",
                                'dir' => $dir,
                                'lang' => $lang,
@@ -1735,7 +1735,8 @@ class Article implements Page {
        public function render() {
                $this->getContext()->getRequest()->response()->header( 'X-Robots-Tag: noindex' );
                $this->getContext()->getOutput()->setArticleBodyOnly( true );
-               $this->disableSectionEditForRender = true;
+               // We later set 'enableSectionEditLinks=false' based on this; also used by ImagePage
+               $this->viewIsRenderAction = true;
                $this->view();
        }
 
@@ -2087,8 +2088,9 @@ class Article implements Page {
                        );
 
                        if ( $error == '' ) {
-                               $outputPage->addWikiText(
-                                       "<div class=\"error mw-error-cannotdelete\">\n" . $status->getWikiText() . "\n</div>"
+                               $outputPage->wrapWikiTextAsInterface(
+                                       'error mw-error-cannotdelete',
+                                       $status->getWikiText()
                                );
                                $deleteLogPage = new LogPage( 'delete' );
                                $outputPage->addHTML( Xml::element( 'h2', null, $deleteLogPage->getName()->text() ) );