]> git.mxchange.org Git - friendica.git/commitdiff
Better rule to replace content
authorMichael <heluecht@pirati.ca>
Tue, 17 Oct 2017 09:58:29 +0000 (09:58 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 17 Oct 2017 09:58:29 +0000 (09:58 +0000)
include/feed.php

index 6c0b3b145a21d89749974c0f8f13f76bdd2a0c02..11ccd6af2765ed2418b0629c604158121162b92b 100644 (file)
@@ -353,7 +353,20 @@ function feed_import($xml,$importer,&$contact, &$hub, $simulate = false) {
                                }
                        }
 
-                       if (strlen($item["title"]) > strlen($item["body"])) {
+                       // Replace the content when the title is longer than the body
+                       $replace = (strlen($item["title"]) > strlen($item["body"]));
+
+                       // Replace it, when there is an image in the body
+                       if (strstr($item["body"], '[/img]')) {
+                               $replace = true;
+                       }
+
+                       // Replace it, when there is a link in the body
+                       if (strstr($item["body"], '[/url]')) {
+                               $replace = true;
+                       }
+
+                       if ($replace) {
                                $item["body"] = $item["title"];
                                $item["title"] = "";
                        }