From 6d857aed3b1428906975974eafaf51d1a890be63 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 5 Oct 2017 15:06:55 +0200 Subject: [PATCH] Avoid replacement of internal string inside code blocks --- .../html/node/AbstractHtmlNodeProcessor.class.php | 14 +++++++++----- .../html/output/node/HtmlOutputNodePre.class.php | 3 ++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/wcfsetup/install/files/lib/system/html/node/AbstractHtmlNodeProcessor.class.php b/wcfsetup/install/files/lib/system/html/node/AbstractHtmlNodeProcessor.class.php index 89d3e947f0..86563f448c 100644 --- a/wcfsetup/install/files/lib/system/html/node/AbstractHtmlNodeProcessor.class.php +++ b/wcfsetup/install/files/lib/system/html/node/AbstractHtmlNodeProcessor.class.php @@ -109,11 +109,15 @@ abstract class AbstractHtmlNodeProcessor implements IHtmlNodeProcessor { $obj = $data['object']; $string = $obj->replaceTag($data['data']); - if (mb_strpos($string, '') !== false) { - return str_replace('', $matches['content'], $string); - } - else if (mb_strpos($string, '<!-- META_CODE_INNER_CONTENT -->') !== false) { - return str_replace('<!-- META_CODE_INNER_CONTENT -->', $matches['content'], $string); + if (!isset($data['data']['skipInnerContent']) || $data['data']['skipInnerContent'] !== true) { + if (mb_strpos($string, '') !== false) { + return str_replace('', $matches['content'], $string); + } + else { + if (mb_strpos($string, '<!-- META_CODE_INNER_CONTENT -->') !== false) { + return str_replace('<!-- META_CODE_INNER_CONTENT -->', $matches['content'], $string); + } + } } return $string; diff --git a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodePre.class.php b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodePre.class.php index 81ef19923d..437e23d11c 100644 --- a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodePre.class.php +++ b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodePre.class.php @@ -52,7 +52,8 @@ class HtmlOutputNodePre extends AbstractHtmlOutputNode { 'content' => $element->textContent, 'file' => $element->getAttribute('data-file'), 'highlighter' => $element->getAttribute('data-highlighter'), - 'line' => $element->hasAttribute('data-line') ? $element->getAttribute('data-line') : 1 + 'line' => $element->hasAttribute('data-line') ? $element->getAttribute('data-line') : 1, + 'skipInnerContent' => true ]); $htmlNodeProcessor->renameTag($element, 'wcfNode-' . $nodeIdentifier); -- 2.20.1