From: Alexander Ebert Date: Sun, 24 Jul 2016 11:15:43 +0000 (+0200) Subject: Discarding bbcode content if it matches the first attribute X-Git-Tag: 3.0.0_Beta_1~980 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ec023d564c87af792043178bc192a4f8e1b0e411;p=GitHub%2FWoltLab%2FWCF.git Discarding bbcode content if it matches the first attribute --- 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; }