]> git.mxchange.org Git - friendica.git/commitdiff
Adding the "abstract" element to the imported feed
authorMichael <heluecht@pirati.ca>
Sat, 16 Mar 2019 10:59:11 +0000 (10:59 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 16 Mar 2019 10:59:11 +0000 (10:59 +0000)
src/Protocol/Feed.php

index 3981a8860cbf4c3f949885634bf9b703015c01a0..2a2ea0363010f36dbf16253294fba0ee3b3ece64 100644 (file)
@@ -356,11 +356,20 @@ class Feed {
                        if (empty($body)) {
                                $body = trim(XML::getFirstNodeValue($xpath, 'content:encoded/text()', $entry));
                        }
-                       if (empty($body)) {
-                               $body = trim(XML::getFirstNodeValue($xpath, 'description/text()', $entry));
+
+                       $summary = trim(XML::getFirstNodeValue($xpath, 'atom:summary/text()', $entry));
+
+                       if (empty($summary)) {
+                               $summary = trim(XML::getFirstNodeValue($xpath, 'description/text()', $entry));
                        }
+
                        if (empty($body)) {
-                               $body = trim(XML::getFirstNodeValue($xpath, 'atom:summary/text()', $entry));
+                               $body = $summary;
+                               $summary = '';
+                       }
+
+                       if ($body == $summary) {
+                               $summary = '';
                        }
 
                        // remove the content of the title if it is identically to the body
@@ -411,6 +420,10 @@ class Feed {
                                $item["object-type"] = ACTIVITY_OBJ_BOOKMARK;
                                unset($item["attach"]);
                        } else {
+                               if (!empty($summary)) {
+                                       $item["body"] = '[abstract]' . HTML::toBBCode($summary, $basepath) . '[/abstract]' . $item["body"];
+                               }
+
                                if ($contact["fetch_further_information"] == 3) {
                                        if (!empty($tags)) {
                                                $item["tag"] = $tags;