]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/Feed.php
Merge pull request #8629 from annando/item-insert
[friendica.git] / src / Protocol / Feed.php
index fd6dc10df5604ce173218ec2c22e89df86a7bc64..35e2cd5778487d8611de09b4f389da0e86d1898d 100644 (file)
@@ -481,7 +481,7 @@ class Feed {
                                        if (empty($taglist)) {
                                                $taglist = get_page_keywords($item["plink"], $preview, true, $contact["ffi_keyword_blacklist"]);
                                        }
-                                       /// @todo $item["body"] .= "\n" . $tags;
+                                       $item["body"] .= "\n" . self::tagToString($taglist);
                                } else {
                                        $taglist = [];
                                }
@@ -511,7 +511,7 @@ class Feed {
                                        $notify = PRIORITY_MEDIUM;
                                }
 
-                               $id = Item::insert($item, false, $notify);
+                               $id = Item::insert($item, $notify);
 
                                Logger::info("Feed for contact " . $contact["url"] . " stored under id " . $id);
 
@@ -527,6 +527,27 @@ class Feed {
                return ["header" => $author, "items" => $items];
        }
 
+       /**
+        * Convert a tag array to a tag string
+        *
+        * @param array $tags
+        * @return string tag string
+        */
+       private static function tagToString(array $tags)
+       {
+               $tagstr = '';
+
+               foreach ($tags as $tag) {
+                       if ($tagstr != "") {
+                               $tagstr .= ", ";
+                       }
+       
+                       $tagstr .= "#[url=" . DI::baseUrl() . "/search?tag=" . urlencode($tag) . "]" . $tag . "[/url]";
+               }
+
+               return $tagstr;
+       }
+
        private static function titleIsBody($title, $body)
        {
                $title = strip_tags($title);