Add enable option for unfurled urls
authorjoshuaruesweg <ruesweg@woltlab.com>
Wed, 21 Apr 2021 12:41:18 +0000 (14:41 +0200)
committerjoshuaruesweg <ruesweg@woltlab.com>
Wed, 21 Apr 2021 12:41:36 +0000 (14:41 +0200)
See #4036

com.woltlab.wcf/option.xml
constants.php
wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeProcessor.class.php
wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeProcessor.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index f2fe415f7c052231f990322204d84c4401fd4d7a..6af1a00d7892a1ddd9cea89a173d84b17df39d53 100644 (file)
                        <category name="message.general.imageProxy">
                                <parent>message.general</parent>
                        </category>
+                       <category name="message.general.unfurl">
+                               <parent>message.general</parent>
+                       </category>
                        <category name="message.attachment">
                                <parent>message</parent>
                        </category>
@@ -1116,6 +1119,13 @@ XING</selectoptions>
                                <optiontype>lineBreakSeparatedText</optiontype>
                        </option>
                        <!-- /message.general.image -->
+                       <!-- message.general.unfurl -->
+                       <option name="module_url_unfurling">
+                               <categoryname>message.general.unfurl</categoryname>
+                               <optiontype>boolean</optiontype>
+                               <defaultvalue>1</defaultvalue>
+                       </option>
+                       <!-- /message.general.unfurl -->
                        <!-- message.censorship -->
                        <option name="enable_censorship">
                                <categoryname>message.censorship</categoryname>
index 407d5a855c53ef6a3784a7e59bc618b4613972f2..c368f8e30f3e33db108eb1b251000a0f1e0ca8fb 100644 (file)
 \define('MESSAGE_ENABLE_USER_CONSENT', 1);
 \define('MODIFICATION_LOG_EXPIRATION', 0);
 \define('INTERNAL_HOSTNAMES', '');
+\define('MODULE_URL_UNFURLING', 1);
index 379b47936d9249f072a81e1ebca54c9265d36ffc..e7ac9b3169af60f96a356bf0f5ee3cdd7f14f931 100644 (file)
@@ -746,7 +746,7 @@ class HtmlInputNodeProcessor extends AbstractHtmlNodeProcessor
         EventHandler::getInstance()->fireAction($this, 'convertPlainLinks');
 
         $isWorkerAction = \class_exists(AbstractWorker::class, false);
-        if (!$isWorkerAction) {
+        if (MODULE_URL_UNFURLING && !$isWorkerAction) {
             foreach ($this->plainLinks as $plainLink) {
                 if ($plainLink->isPristine()) {
                     HtmlNodeUnfurlLink::setUnfurl($plainLink);
index 7592666094aeb247cb8a67bc398171413c884b09..e8bcfd124f8adfdc9bfdb9bb57cfef0be50515a4 100644 (file)
@@ -94,7 +94,9 @@ class HtmlOutputNodeProcessor extends AbstractHtmlNodeProcessor
 
         $this->invokeHtmlNode(new HtmlOutputNodeWoltlabMetacode());
 
-        $this->invokeHtmlNode(new HtmlOutputUnfurlUrlNode());
+        if (MODULE_URL_UNFURLING) {
+            $this->invokeHtmlNode(new HtmlOutputUnfurlUrlNode());
+        }
 
         // dynamic node handlers
         $this->invokeNodeHandlers('wcf\system\html\output\node\HtmlOutputNode', ['woltlab-metacode']);
index 6e8bdb397614a3639e16191f9c73b04b75a2e681..d570edb19988773786fabdcd268b7575f35d3051 100644 (file)
@@ -1769,6 +1769,9 @@ Die Datenbestände werden sorgfältig gepflegt, aber es ist nicht ausgeschlossen
                <item name="wcf.acp.option.type.lineBreakSeparatedText.placeholder"><![CDATA[Neuen Eintrag hinzufügen]]></item>
                <item name="wcf.acp.option.type.lineBreakSeparatedText.error.duplicate"><![CDATA[Der Eintrag <strong>{$item}</strong> existiert bereits.]]></item>
                <item name="wcf.acp.option.type.lineBreakSeparatedText.clearList.confirmMessage"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Willst du{else}Wollen Sie{/if} alle Einträge wirklich löschen?]]></item>
+               <item name="wcf.acp.option.category.message.general.unfurl"><![CDATA[Rich Embeds]]></item>
+               <item name="wcf.acp.option.module_url_unfurling"><![CDATA[Rich Embeds aktivieren]]></item>
+               <item name="wcf.acp.option.module_url_unfurling.description"><![CDATA[Erzeugt eine Vorschau mit Titel, Beschreibung und Bild für externe Links in Nachrichten.]]></item>
        </category>
        <category name="wcf.acp.customOption">
                <item name="wcf.acp.customOption.list"><![CDATA[Eingabefelder]]></item>
index 48b22a08528d9636805370d367fdf02a053d9bb3..b3caad7bd1e4c15bb4bd0fe57dab07302d54c6b8 100644 (file)
@@ -1559,7 +1559,7 @@ ATTENTION: The messages listed above are greatly shortened. You can view details
                <item name="wcf.acp.option.show_update_notice_frontend"><![CDATA[Display a notice for outstanding updates on the frontend]]></item>
                <item name="wcf.acp.option.url_omit_index_php"><![CDATA[Enable url-rewrite]]></item>
                <item name="wcf.acp.option.url_omit_index_php.button.runTestAgain"><![CDATA[Rerun Test]]></item>
-               <item name="wcf.acp.option.url_omit_index_php.description"><![CDATA[Attention! This option requires a rewrite module installed on your webserver and an appropriate configuration; It will not work without any prior configuration applied by you! Please read the following article for instructions: <a href="https://www.woltlab.com/article/25-setting-up-user-friendly-urls/" class="externalURL">Setting up user friendly URLs</a>. Enabling this option will rewrite URLs into a better readable representation. Examples: 
+               <item name="wcf.acp.option.url_omit_index_php.description"><![CDATA[Attention! This option requires a rewrite module installed on your webserver and an appropriate configuration; It will not work without any prior configuration applied by you! Please read the following article for instructions: <a href="https://www.woltlab.com/article/25-setting-up-user-friendly-urls/" class="externalURL">Setting up user friendly URLs</a>. Enabling this option will rewrite URLs into a better readable representation. Examples:
 <ul class="nativeList">
 <li>the link “https://example.com/index.php?thread/1-hello-i-am-john-doe/” will turn into “https://example.com/thread/1-hello-i-am-john-doe/”</li>
 <li>the link “https://example.com/index.php?members-list/” will turn into “https://example.com/members-list/”</li>
@@ -1754,6 +1754,9 @@ The database is carefully maintained, but there will be always be a margin of er
                <item name="wcf.acp.option.type.lineBreakSeparatedText.placeholder"><![CDATA[Add new entry]]></item>
                <item name="wcf.acp.option.type.lineBreakSeparatedText.error.duplicate"><![CDATA[The entry <strong>{$item}</strong> already exists.]]></item>
                <item name="wcf.acp.option.type.lineBreakSeparatedText.clearList.confirmMessage"><![CDATA[Do you really want to delete all entries?]]></item>
+               <item name="wcf.acp.option.category.message.general.unfurl"><![CDATA[Rich Embeds]]></item>
+               <item name="wcf.acp.option.module_url_unfurling"><![CDATA[Enable Rich Embeds]]></item>
+               <item name="wcf.acp.option.module_url_unfurling.description"><![CDATA[Creates a preview with title, description and image for external links in messages.]]></item>
        </category>
        <category name="wcf.acp.customOption">
                <item name="wcf.acp.customOption.list"><![CDATA[Option Fields]]></item>