<?php
namespace wcf\system\html\input\node;
+use wcf\data\bbcode\BBCodeCache;
use wcf\system\bbcode\BBCodeHandler;
use wcf\system\html\metacode\converter\IMetacodeConverter;
use wcf\system\html\node\AbstractHtmlNodeProcessor;
use wcf\util\DOMUtil;
+use wcf\util\StringUtil;
/**
* Processes `<woltlab-metacode>` and converts them if appropriate.
}
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;
}