From: joshuaruesweg Date: Wed, 10 Mar 2021 15:17:10 +0000 (+0100) Subject: Add plain url feature X-Git-Tag: 5.4.0_Alpha_1~146^2~9 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ec31b0b89eda0db6d25f1c089c121818d300da04;p=GitHub%2FWoltLab%2FWCF.git Add plain url feature Display urls, which have neither an image nor a description as a simple titled link. --- diff --git a/com.woltlab.wcf/templates/unfurlUrl.tpl b/com.woltlab.wcf/templates/unfurlUrl.tpl index 2d61160797..02e81c7243 100644 --- a/com.woltlab.wcf/templates/unfurlUrl.tpl +++ b/com.woltlab.wcf/templates/unfurlUrl.tpl @@ -1,18 +1,22 @@ {if $object->status == "SUCCESSFUL"} -
- -
getImageUrl()|empty} style="background-image: url('{$object->getImageUrl()}')"{/if}>
-
-
{$object->title}
-
{$object->description}
-
{$object->getHost()}
+ {if $object->isPlainUrl()} + url isUgc=true}>{$object->title} + {else} +
+ +
getImageUrl()|empty} style="background-image: url('{$object->getImageUrl()}')"{/if}>
+
+
{$object->title}
+
{$object->description}
+
{$object->getHost()}
+
+ url appendClassname=false isUgc=true}>
- url appendClassname=false isUgc=true}> -
+ {/if} {else} url isUgc=true}>{$object->url} {/if} \ No newline at end of file diff --git a/wcfsetup/install/files/lib/data/unfurl/url/UnfurlUrl.class.php b/wcfsetup/install/files/lib/data/unfurl/url/UnfurlUrl.class.php index a6169d3043..b06db35058 100644 --- a/wcfsetup/install/files/lib/data/unfurl/url/UnfurlUrl.class.php +++ b/wcfsetup/install/files/lib/data/unfurl/url/UnfurlUrl.class.php @@ -130,6 +130,11 @@ class UnfurlUrl extends DatabaseObject return $this->getImageType() === self::IMAGE_SQUARED && !empty($this->getImageUrl()); } + public function isPlainUrl(): bool + { + return empty($this->description) && empty($this->imageID); + } + private function getImageType(): string { if (!$this->imageID) {