]> git.mxchange.org Git - friendica.git/blobdiff - include/feed.php
Parameter should fit ...
[friendica.git] / include / feed.php
index 1545ff34ce34843037edba79fc131d5cac2e2987..5676566c422d5538bcde68cc4279f5aff4e9ca39 100644 (file)
@@ -28,7 +28,7 @@ function feed_import($xml,$importer,&$contact, &$hub, $simulate = false) {
        }
 
        $doc = new DOMDocument();
-       @$doc->loadXML($xml);
+       @$doc->loadXML(trim($xml));
        $xpath = new DomXPath($doc);
        $xpath->registerNamespace('atom', NAMESPACE_ATOM1);
        $xpath->registerNamespace('dc', "http://purl.org/dc/elements/1.1/");
@@ -338,12 +338,22 @@ 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"] == '') && ($item["title"] != '')) {
+                               $item["body"] = $item["title"];
+                               $item["title"] = '';
+                       }
+
+                       if (!strstr($item["body"], '[url') && ($item['plink'] != '')) {
+                               $item["body"] .= "[hr][url]".$item['plink']."[/url]";
+                       }
                }
 
                if (!$simulate) {