X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Ffeed.php;h=fb97c14ba126aa1875d1202df05a5caa8aad64e7;hb=a492a13aeb53891d4f0b8601f66720531b92af45;hp=db6f631d45af6accbbef5c97c6c98b334c7ecbae;hpb=aa284a2ae60cca7f2f80013801999ad8a6596d84;p=friendica.git diff --git a/include/feed.php b/include/feed.php index db6f631d45..fb97c14ba1 100644 --- a/include/feed.php +++ b/include/feed.php @@ -353,11 +353,28 @@ function feed_import($xml,$importer,&$contact, &$hub, $simulate = false) { } } - if (strlen($item["title"]) > strlen($item["body"])) { -//echo "*".strlen($item["title"]).">".strlen($item["body"])."\n"; + // Remove a possible link to the item itself + $item["body"] = str_replace($item["plink"], '', $item["body"]); + $item["body"] = preg_replace('/\[url\=\](\w+.*?)\[\/url\]/i', '', $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"] = ""; } + // We always strip the title since it will be added in the page information + $item["title"] = ""; $item["body"] = $item["body"].add_page_info($item["plink"], false, $preview, ($contact["fetch_further_information"] == 2), $contact["ffi_keyword_blacklist"]); $item["tag"] = add_page_keywords($item["plink"], false, $preview, ($contact["fetch_further_information"] == 2), $contact["ffi_keyword_blacklist"]); $item["object-type"] = ACTIVITY_OBJ_BOOKMARK;