From a36c8a01730561fb63568aeb4460049d397f075a Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 27 Aug 2017 06:59:07 +0000 Subject: [PATCH 1/3] Possibly Issue 3611: Better feed handling when there is no body --- include/feed.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/feed.php b/include/feed.php index 1545ff34c..91bbb286e 100644 --- a/include/feed.php +++ b/include/feed.php @@ -338,12 +338,24 @@ function feed_import($xml,$importer,&$contact, &$hub, $simulate = false) { if ($body == "") { $body = trim($xpath->evaluate('atom:summary/text()', $entry)->item(0)->nodeValue); } + // remove the content of the title if it is identically to the body // This helps with auto generated titles e.g. from tumblr if (title_is_body($item["title"], $body)) { $item["title"] = ""; } $item["body"] = html2bbcode($body); + + if ($item["body"] == "") { + if ($item["title"] != '') { + $item["body"] = $item["title"]; + $item["title"] = ''; + } + } + + if (!strstr($item["body"], '[url') && ($item['plink'] != '')) { + $item["body"] .= "\n[hr]\n[url]".$item['plink']."[/url]"; + } } if (!$simulate) { From d8acb62ba66bdd1ce317b2d283def116e5318f79 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 27 Aug 2017 07:02:44 +0000 Subject: [PATCH 2/3] Small formatting issue --- include/feed.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/include/feed.php b/include/feed.php index 91bbb286e..74cff7673 100644 --- a/include/feed.php +++ b/include/feed.php @@ -346,11 +346,9 @@ function feed_import($xml,$importer,&$contact, &$hub, $simulate = false) { } $item["body"] = html2bbcode($body); - if ($item["body"] == "") { - if ($item["title"] != '') { - $item["body"] = $item["title"]; - $item["title"] = ''; - } + if (($item["body"] == '') && ($item["title"] != '')) { + $item["body"] = $item["title"]; + $item["title"] = ''; } if (!strstr($item["body"], '[url') && ($item['plink'] != '')) { From 12ae59dba31fbd745f727eb6dd726d0ea6234581 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 27 Aug 2017 07:12:27 +0000 Subject: [PATCH 3/3] No linefeeds --- include/feed.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/feed.php b/include/feed.php index 74cff7673..12cf06ca5 100644 --- a/include/feed.php +++ b/include/feed.php @@ -352,7 +352,7 @@ function feed_import($xml,$importer,&$contact, &$hub, $simulate = false) { } if (!strstr($item["body"], '[url') && ($item['plink'] != '')) { - $item["body"] .= "\n[hr]\n[url]".$item['plink']."[/url]"; + $item["body"] .= "[hr][url]".$item['plink']."[/url]"; } }