From ec023d564c87af792043178bc192a4f8e1b0e411 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 24 Jul 2016 13:15:43 +0200 Subject: [PATCH] Discarding bbcode content if it matches the first attribute --- .../node/HtmlInputNodeWoltlabMetacode.class.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacode.class.php b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacode.class.php index d0874ddc4a..e3e46b7ee5 100644 --- a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacode.class.php +++ b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacode.class.php @@ -1,9 +1,11 @@ ` and converts them if appropriate. @@ -91,6 +93,19 @@ class HtmlInputNodeWoltlabMetacode extends AbstractHtmlInputNode { } if ($converter === null) { + // check if the bbcode's content should be used as first attribute and it + // matches the elements content + $bbcode = BBCodeCache::getInstance()->getBBCodeByTag($name); + if ($bbcode !== null) { + $bbcodeAttributes = $bbcode->getAttributes(); + $attr = (isset($bbcodeAttributes[0])) ? $bbcodeAttributes[0] : null; + + if ($attr !== null && $attr->useText && !empty($attributes[0]) && StringUtil::trim($attributes[0]) == StringUtil::trim($element->textContent)) { + // discard content as it is already present in the first attribute + $element->textContent = ''; + } + } + // no available converter, metacode will be handled during output generation continue; } -- 2.20.1