]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/Feed.php
Continued:
[friendica.git] / src / Protocol / Feed.php
index fced3526d49ff4e96ea4b6648070a03c2c234f6a..4438c31fde2143623eb7e3760ff31b45eafe78af 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2023, the Friendica project
+ * @copyright Copyright (C) 2010-2024, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -25,6 +25,7 @@ use DOMDocument;
 use DOMElement;
 use DOMXPath;
 use Friendica\App;
+use Friendica\Contact\LocalRelationship\Entity\LocalRelationship;
 use Friendica\Content\PageInfo;
 use Friendica\Content\Text\BBCode;
 use Friendica\Content\Text\HTML;
@@ -566,8 +567,10 @@ class Feed
                                continue;
                        }
 
+                       $fetch_further_information = $contact['fetch_further_information'] ?? LocalRelationship::FFI_NONE;
+
                        $preview = '';
-                       if (!empty($contact['fetch_further_information']) && ($contact['fetch_further_information'] < 3)) {
+                       if (in_array($fetch_further_information, [LocalRelationship::FFI_INFORMATION, LocalRelationship::FFI_BOTH])) {
                                // Handle enclosures and treat them as preview picture
                                foreach ($attachments as $attachment) {
                                        if ($attachment['mimetype'] == 'image/jpeg') {
@@ -611,7 +614,12 @@ class Feed
                                        }
                                }
 
-                               $data = PageInfo::queryUrl($item['plink'], false, $preview, ($contact['fetch_further_information'] == 2), $contact['ffi_keyword_denylist'] ?? '');
+                               $data = PageInfo::queryUrl(
+                                       $item['plink'],
+                                       false,
+                                       $fetch_further_information == LocalRelationship::FFI_BOTH,
+                                       $contact['ffi_keyword_blacklist'] ?? ''
+                               );
 
                                if (!empty($data)) {
                                        // Take the data that was provided by the feed if the query is empty
@@ -630,7 +638,7 @@ class Feed
                                        // We always strip the title since it will be added in the page information
                                        $item['title'] = '';
                                        $item['body'] = $item['body'] . "\n" . PageInfo::getFooterFromData($data, false);
-                                       $taglist = $contact['fetch_further_information'] == 2 ? PageInfo::getTagsFromUrl($item['plink'], $preview, $contact['ffi_keyword_denylist'] ?? '') : [];
+                                       $taglist = $contact['fetch_further_information'] == 2 ? PageInfo::getTagsFromUrl($item['plink'], $preview, $contact['ffi_keyword_blacklist'] ?? '') : [];
                                        $item['object-type'] = Activity\ObjectType::BOOKMARK;
                                        $attachments = [];
 
@@ -662,9 +670,9 @@ class Feed
                                        $item['body'] = '[abstract]' . HTML::toBBCode($summary, $basepath) . "[/abstract]\n" . $item['body'];
                                }
 
-                               if (!empty($contact['fetch_further_information']) && ($contact['fetch_further_information'] == 3)) {
+                               if ($fetch_further_information == LocalRelationship::FFI_KEYWORD) {
                                        if (empty($taglist)) {
-                                               $taglist = PageInfo::getTagsFromUrl($item['plink'], $preview, $contact['ffi_keyword_denylist'] ?? '');
+                                               $taglist = PageInfo::getTagsFromUrl($item['plink'], $preview, $contact['ffi_keyword_blacklist'] ?? '');
                                        }
                                        $item['body'] .= "\n" . self::tagToString($taglist);
                                } else {