From 899b127b000d41db3b0fae385e5e3ff5efc4d05e Mon Sep 17 00:00:00 2001 From: grunny Date: Thu, 16 Jun 2016 17:39:06 +0000 Subject: [PATCH] (DAT-4494) Don't perform replacements on JSON encoded content --- .../PortableInfoboxParserTagController.class.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/controllers/PortableInfoboxParserTagController.class.php b/controllers/PortableInfoboxParserTagController.class.php index a43d206..4e665b5 100644 --- a/controllers/PortableInfoboxParserTagController.class.php +++ b/controllers/PortableInfoboxParserTagController.class.php @@ -144,7 +144,17 @@ class PortableInfoboxParserTagController extends WikiaController { } public function replaceMarkers( $text ) { - return strtr( $text, $this->markers ); + global $wgArticleAsJson; + if ( $wgArticleAsJson ) { + $contentArray = json_decode( $text, true ); + $text = $contentArray['content']; + } + $text = strtr( $text, $this->markers ); + if ( $wgArticleAsJson ) { + $contentArray['content'] = $text; + $text = json_encode( $contentArray ); + } + return $text; } protected function saveToParserOutput( \ParserOutput $parserOutput, Nodes\NodeInfobox $raw ) {