From ec31b0b89eda0db6d25f1c089c121818d300da04 Mon Sep 17 00:00:00 2001 From: joshuaruesweg Date: Wed, 10 Mar 2021 16:17:10 +0100 Subject: [PATCH] Add plain url feature Display urls, which have neither an image nor a description as a simple titled link. --- com.woltlab.wcf/templates/unfurlUrl.tpl | 30 +++++++++++-------- .../lib/data/unfurl/url/UnfurlUrl.class.php | 5 ++++ 2 files changed, 22 insertions(+), 13 deletions(-) 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) { -- 2.20.1