X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FProtocol%2FFeed.php;h=fdfe9be7d5e836b57621b65cb6a6f693124ac48c;hb=d27576059670faf87f80eaae2b4560f85b5310fc;hp=a43124c69199ff283e634fe8378e2ee00310ace9;hpb=32688d34b633ab7a072198a81f0bca2988407409;p=friendica.git diff --git a/src/Protocol/Feed.php b/src/Protocol/Feed.php index a43124c691..fdfe9be7d5 100644 --- a/src/Protocol/Feed.php +++ b/src/Protocol/Feed.php @@ -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; @@ -308,6 +309,7 @@ class Feed $entry = $entries->item($i); $item = array_merge($header, $author); + $body = ''; $alternate = XML::getFirstAttributes($xpath, $atomns . ":link[@rel='alternate']", $entry); if (!is_object($alternate)) { @@ -477,7 +479,7 @@ class Feed $attachments = []; - $enclosures = $xpath->query("enclosure|' . $atomns . ':link[@rel='enclosure']", $entry); + $enclosures = $xpath->query("enclosure|$atomns:link[@rel='enclosure']", $entry); if (!empty($enclosures)) { foreach ($enclosures as $enclosure) { $href = ''; @@ -565,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') { @@ -610,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_denylist'] ?? '' + ); if (!empty($data)) { // Take the data that was provided by the feed if the query is empty @@ -629,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 = $fetch_further_information == LocalRelationship::FFI_BOTH ? PageInfo::getTagsFromUrl($item['plink'], $preview, $contact['ffi_keyword_denylist'] ?? '') : []; $item['object-type'] = Activity\ObjectType::BOOKMARK; $attachments = []; @@ -661,7 +670,7 @@ 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'] ?? ''); }