From 873c89fcc47e637d7ce681d477fab3a910c62211 Mon Sep 17 00:00:00 2001 From: "C. Scott Ananian" Date: Fri, 26 Oct 2018 12:59:01 -0400 Subject: [PATCH] Only expand `{{...}}` in messages once (part 2) If we're going to call `OutputPage::addWikiTextAs*` or `OutputPage::parseAs*` to parse the message, we don't need to pre-expand `{{...}}` markup before passing it to the parser. Follow up to I2f68f73365df876e6f9d017e4e3ddea39c4a1284. Bug: T206574 Change-Id: I0ee493207ea80c1caba7e60a31714805dc54c64e --- includes/EditPage.php | 4 ++-- includes/installer/WebInstaller.php | 2 +- includes/specials/SpecialVersion.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index a79b974ed8..bb5d642bf1 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -3945,7 +3945,7 @@ ERROR; # sitecsspreview, sitejsonpreview, sitejspreview if ( $level && $format ) { $note = "
" . - $this->context->msg( "{$level}{$format}preview" )->text() . + $this->context->msg( "{$level}{$format}preview" )->plain() . ' ' . $continueEditing . "
"; } } @@ -3979,7 +3979,7 @@ ERROR; $this->contentFormat, $ex->getMessage() ); - $note .= "\n\n" . $m->parse(); + $note .= "\n\n" . $m->plain(); # gets parsed down below $previewHTML = ''; } diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php index f555c0f1b0..cda8612956 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -920,7 +920,7 @@ class WebInstaller extends Installer { if ( !isset( $params['labelAttribs'] ) ) { $params['labelAttribs'] = []; } - $labelText = $params['rawtext'] ?? $this->parse( wfMessage( $params['label'] )->text() ); + $labelText = $params['rawtext'] ?? $this->parse( wfMessage( $params['label'] )->plain() ); return "
\n" . $params['help'] . diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index 4e9245f318..b7bd9e3600 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -1177,9 +1177,9 @@ class SpecialVersion extends SpecialPage { foreach ( $entryPoints as $message => $value ) { $url = wfExpandUrl( $value, PROTO_RELATIVE ); $out .= Html::openElement( 'tr' ) . - // ->text() looks like it should be ->parse(), but this function + // ->plain() looks like it should be ->parse(), but this function // returns wikitext, not HTML, boo - Html::rawElement( 'td', [], $this->msg( $message )->text() ) . + Html::rawElement( 'td', [], $this->msg( $message )->plain() ) . Html::rawElement( 'td', [], Html::rawElement( 'code', [], "[$url $value]" ) ) . Html::closeElement( 'tr' ); } -- 2.20.1