From: Marcel Werk Date: Fri, 7 Aug 2020 10:11:10 +0000 (+0200) Subject: Applied suggestions X-Git-Tag: 5.3.0_Alpha_1~83^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=88234b2b419712d4c55248b69463f426ff8ae943;p=GitHub%2FWoltLab%2FWCF.git Applied suggestions --- diff --git a/wcfsetup/install/files/lib/data/article/content/ArticleContent.class.php b/wcfsetup/install/files/lib/data/article/content/ArticleContent.class.php index b2b200597a..1fcdfd9fd0 100644 --- a/wcfsetup/install/files/lib/data/article/content/ArticleContent.class.php +++ b/wcfsetup/install/files/lib/data/article/content/ArticleContent.class.php @@ -81,7 +81,7 @@ class ArticleContent extends DatabaseObject implements ILinkableObject, IRouteCo else { $htmlOutputProcessor = new HtmlOutputProcessor(); $htmlOutputProcessor->setOutputType('text/plain'); - $htmlOutputProcessor->setUgc(false); + $htmlOutputProcessor->enableUgc = false; $htmlOutputProcessor->process($this->content, 'com.woltlab.wcf.article.content', $this->articleContentID, false, $this->languageID); return nl2br(StringUtil::encodeHTML(StringUtil::truncate($htmlOutputProcessor->getHtml(), 500)), false); @@ -95,7 +95,7 @@ class ArticleContent extends DatabaseObject implements ILinkableObject, IRouteCo */ public function getFormattedContent() { $processor = new HtmlOutputProcessor(); - $processor->setUgc(false); + $processor->enableUgc = false; $processor->process($this->content, 'com.woltlab.wcf.article.content', $this->articleContentID, false, $this->languageID); return $processor->getHtml(); @@ -108,7 +108,7 @@ class ArticleContent extends DatabaseObject implements ILinkableObject, IRouteCo */ public function getAmpFormattedContent() { $processor = new AmpHtmlOutputProcessor(); - $processor->setUgc(false); + $processor->enableUgc = false; $processor->process($this->content, 'com.woltlab.wcf.article.content', $this->articleContentID); return $processor->getHtml(); @@ -152,7 +152,7 @@ class ArticleContent extends DatabaseObject implements ILinkableObject, IRouteCo case 'text/plain': $processor = new HtmlOutputProcessor(); $processor->setOutputType('text/plain'); - $processor->setUgc(false); + $processor->enableUgc = false; $processor->process($this->content, 'com.woltlab.wcf.article.content', $this->articleContentID); return $processor->getHtml(); @@ -160,7 +160,7 @@ class ArticleContent extends DatabaseObject implements ILinkableObject, IRouteCo // parse and return message $processor = new HtmlOutputProcessor(); $processor->setOutputType('text/simplified-html'); - $processor->setUgc(false); + $processor->enableUgc = false; $processor->process($this->content, 'com.woltlab.wcf.article.content', $this->articleContentID); return $processor->getHtml(); diff --git a/wcfsetup/install/files/lib/data/box/content/BoxContent.class.php b/wcfsetup/install/files/lib/data/box/content/BoxContent.class.php index 29b055fa50..eb46f3b1bb 100644 --- a/wcfsetup/install/files/lib/data/box/content/BoxContent.class.php +++ b/wcfsetup/install/files/lib/data/box/content/BoxContent.class.php @@ -103,7 +103,7 @@ class BoxContent extends DatabaseObject { */ public function getFormattedContent() { $processor = new HtmlOutputProcessor(); - $processor->setUgc(false); + $processor->enableUgc = false; $processor->process($this->content, 'com.woltlab.wcf.box.content', $this->boxContentID); return $processor->getHtml(); diff --git a/wcfsetup/install/files/lib/data/page/content/PageContent.class.php b/wcfsetup/install/files/lib/data/page/content/PageContent.class.php index 956559b1ad..95a2299826 100644 --- a/wcfsetup/install/files/lib/data/page/content/PageContent.class.php +++ b/wcfsetup/install/files/lib/data/page/content/PageContent.class.php @@ -47,7 +47,7 @@ class PageContent extends DatabaseObject implements ILinkableObject { MessageEmbeddedObjectManager::getInstance()->loadObjects('com.woltlab.wcf.page.content', [$this->pageContentID]); $processor = new HtmlOutputProcessor(); - $processor->setUgc(false); + $processor->enableUgc = false; $processor->process($this->content, 'com.woltlab.wcf.page.content', $this->pageContentID); return $processor->getHtml(); diff --git a/wcfsetup/install/files/lib/system/html/output/HtmlOutputProcessor.class.php b/wcfsetup/install/files/lib/system/html/output/HtmlOutputProcessor.class.php index 6264184058..0a6a1296f8 100644 --- a/wcfsetup/install/files/lib/system/html/output/HtmlOutputProcessor.class.php +++ b/wcfsetup/install/files/lib/system/html/output/HtmlOutputProcessor.class.php @@ -51,7 +51,7 @@ class HtmlOutputProcessor extends AbstractHtmlProcessor { * enables rel=ugc for external links * @var bool */ - protected $ugc = true; + public $enableUgc = true; /** * Processes the input html string. @@ -119,22 +119,4 @@ class HtmlOutputProcessor extends AbstractHtmlProcessor { return $this->htmlOutputNodeProcessor; } - - /** - * Enables rel=ugc for external links. - * - * @param bool $enable - */ - public function setUgc($enable = true) { - $this->ugc = $enable; - } - - /** - * Returns true, if content is user-generated. - * - * @return bool - */ - public function isUgc() { - return $this->ugc; - } } diff --git a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeA.class.php b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeA.class.php index 9ec37e7af6..9ddc5dcebb 100644 --- a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeA.class.php +++ b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeA.class.php @@ -33,7 +33,7 @@ class HtmlOutputNodeA extends AbstractHtmlOutputNode { } else { /** @var HtmlOutputNodeProcessor $htmlNodeProcessor */ - self::markLinkAsExternal($element, $htmlNodeProcessor->getHtmlProcessor()->isUgc()); + self::markLinkAsExternal($element, $htmlNodeProcessor->getHtmlProcessor()->enableUgc); } $value = StringUtil::trim($element->textContent); diff --git a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeImg.class.php b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeImg.class.php index 0b9fa6ca41..d03f0c1137 100644 --- a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeImg.class.php +++ b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeImg.class.php @@ -86,7 +86,7 @@ class HtmlOutputNodeImg extends AbstractHtmlOutputNode { // proxy is enabled for insecure connections only if (!IMAGE_ALLOW_EXTERNAL_SOURCE && !$this->isAllowedOrigin($src)) { /** @var HtmlOutputNodeProcessor $htmlNodeProcessor */ - $this->replaceExternalSource($element, $src, $htmlNodeProcessor->getHtmlProcessor()->isUgc()); + $this->replaceExternalSource($element, $src, $htmlNodeProcessor->getHtmlProcessor()->enableUgc); } continue; @@ -135,7 +135,7 @@ class HtmlOutputNodeImg extends AbstractHtmlOutputNode { } else if (!IMAGE_ALLOW_EXTERNAL_SOURCE && !$this->isAllowedOrigin($src)) { /** @var HtmlOutputNodeProcessor $htmlNodeProcessor */ - $this->replaceExternalSource($element, $src, $htmlNodeProcessor->getHtmlProcessor()->isUgc()); + $this->replaceExternalSource($element, $src, $htmlNodeProcessor->getHtmlProcessor()->enableUgc); } else if (MESSAGE_FORCE_SECURE_IMAGES && Url::parse($src)['scheme'] === 'http') { // rewrite protocol to `https` diff --git a/wcfsetup/install/files/lib/system/template/plugin/AnchorAttributesFunctionTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/AnchorAttributesFunctionTemplatePlugin.class.php index 5548165135..5ec59f33cd 100644 --- a/wcfsetup/install/files/lib/system/template/plugin/AnchorAttributesFunctionTemplatePlugin.class.php +++ b/wcfsetup/install/files/lib/system/template/plugin/AnchorAttributesFunctionTemplatePlugin.class.php @@ -45,7 +45,7 @@ class AnchorAttributesFunctionTemplatePlugin implements IFunctionTemplatePlugin $attributes = ''; if ($appendHref) { - $attributes = 'href="' . StringUtil::encodeHTML($url) . '"'; + $attributes .= ' href="' . StringUtil::encodeHTML($url) . '"'; } if ($external) {