projects
/
GitHub
/
WoltLab
/
WCF.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4fab50a
)
Properly handling bbcodes with content being treated as source
author
Alexander Ebert
<ebert@woltlab.com>
Mon, 29 Aug 2016 09:52:56 +0000
(11:52 +0200)
committer
Alexander Ebert
<ebert@woltlab.com>
Mon, 29 Aug 2016 09:53:02 +0000
(11:53 +0200)
wcfsetup/install/files/lib/system/bbcode/HtmlBBCodeParser.class.php
patch
|
blob
|
blame
|
history
wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeWoltlabMetacode.class.php
patch
|
blob
|
blame
|
history
diff --git
a/wcfsetup/install/files/lib/system/bbcode/HtmlBBCodeParser.class.php
b/wcfsetup/install/files/lib/system/bbcode/HtmlBBCodeParser.class.php
index d7b314c37eb63e235cb7875b28f89744bc75fdd8..acddebcc22be96f0ec1ef411d10b4ba6949a141a 100644
(file)
--- a/
wcfsetup/install/files/lib/system/bbcode/HtmlBBCodeParser.class.php
+++ b/
wcfsetup/install/files/lib/system/bbcode/HtmlBBCodeParser.class.php
@@
-323,16
+323,22
@@
class HtmlBBCodeParser extends BBCodeParser {
*
* @param string $name bbcode identifier
* @param array $attributes list of attributes
*
* @param string $name bbcode identifier
* @param array $attributes list of attributes
+ * @param \DOMElement $element element
* @return string parsed bbcode
*/
* @return string parsed bbcode
*/
- public function getHtmlOutput($name, array $attributes) {
+ public function getHtmlOutput($name, array $attributes
, \DOMElement $element
) {
if (isset($this->bbcodes[$name])) {
if (isset($this->bbcodes[$name])) {
+ $bbcode = $this->bbcodes[$name];
+ if ($bbcode->isSourceCode) {
+ array_unshift($attributes, $element->textContent);
+ }
+
$openingTag = ['attributes' => $attributes, 'name' => $name];
$closingTag = ['name' => $name];
$openingTag = ['attributes' => $attributes, 'name' => $name];
$closingTag = ['name' => $name];
- if ($
this->bbcodes[$name]
->getProcessor()) {
+ if ($
bbcode
->getProcessor()) {
/** @var IBBCode $processor */
/** @var IBBCode $processor */
- $processor = $
this->bbcodes[$name]
->getProcessor();
+ $processor = $
bbcode
->getProcessor();
return $processor->getParsedTag($openingTag, '<!-- META_CODE_INNER_CONTENT -->', $closingTag, $this);
}
else {
return $processor->getParsedTag($openingTag, '<!-- META_CODE_INNER_CONTENT -->', $closingTag, $this);
}
else {
diff --git
a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeWoltlabMetacode.class.php
b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeWoltlabMetacode.class.php
index 368c418e6b7f857fc2c6ca34ac9b0ffbd9ffdc48..eec7967800b38de3a85ae8017578d5e627fb9dd9 100644
(file)
--- a/
wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeWoltlabMetacode.class.php
+++ b/
wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeWoltlabMetacode.class.php
@@
-29,12
+29,14
@@
class HtmlOutputNodeWoltlabMetacode extends AbstractHtmlOutputNode {
$attributes = $element->getAttribute('data-attributes');
$nodeIdentifier = StringUtil::getRandomID();
$attributes = $element->getAttribute('data-attributes');
$nodeIdentifier = StringUtil::getRandomID();
+
+ $element = $htmlNodeProcessor->renameTag($element, 'wcfNode-' . $nodeIdentifier);
+
$htmlNodeProcessor->addNodeData($this, $nodeIdentifier, [
'name' => $name,
$htmlNodeProcessor->addNodeData($this, $nodeIdentifier, [
'name' => $name,
- 'attributes' => $htmlNodeProcessor->parseAttributes($attributes)
+ 'attributes' => $htmlNodeProcessor->parseAttributes($attributes),
+ 'element' => $element
]);
]);
-
- $htmlNodeProcessor->renameTag($element, 'wcfNode-' . $nodeIdentifier);
}
}
}
}
@@
-44,6
+46,6
@@
class HtmlOutputNodeWoltlabMetacode extends AbstractHtmlOutputNode {
public function replaceTag(array $data) {
HtmlBBCodeParser::getInstance()->setOutputType($this->outputType);
public function replaceTag(array $data) {
HtmlBBCodeParser::getInstance()->setOutputType($this->outputType);
- return HtmlBBCodeParser::getInstance()->getHtmlOutput($data['name'], $data['attributes']);
+ return HtmlBBCodeParser::getInstance()->getHtmlOutput($data['name'], $data['attributes']
, $data['element']
);
}
}
}
}