Enhance feed information

This commit is contained in:
Michael 2017-10-17 09:10:19 +00:00
parent ae1afebe26
commit aa284a2ae6

View file

@ -319,22 +319,6 @@ function feed_import($xml,$importer,&$contact, &$hub, $simulate = false) {
$item["attach"] .= '[attach]href="'.$href.'" length="'.$length.'" type="'.$type.'"[/attach]'; $item["attach"] .= '[attach]href="'.$href.'" length="'.$length.'" type="'.$type.'"[/attach]';
} }
if ($contact["fetch_further_information"]) {
$preview = "";
// Handle enclosures and treat them as preview picture
foreach ($attachments AS $attachment) {
if ($attachment["type"] == "image/jpeg") {
$preview = $attachment["link"];
}
}
$item["body"] = $item["title"].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["title"] = "";
$item["object-type"] = ACTIVITY_OBJ_BOOKMARK;
unset($item["attach"]);
} else {
$body = trim($xpath->evaluate('atom:content/text()', $entry)->item(0)->nodeValue); $body = trim($xpath->evaluate('atom:content/text()', $entry)->item(0)->nodeValue);
if ($body == "") { if ($body == "") {
@ -359,6 +343,26 @@ function feed_import($xml,$importer,&$contact, &$hub, $simulate = false) {
$item["title"] = ''; $item["title"] = '';
} }
if ($contact["fetch_further_information"]) {
$preview = "";
// Handle enclosures and treat them as preview picture
foreach ($attachments AS $attachment) {
if ($attachment["type"] == "image/jpeg") {
$preview = $attachment["link"];
}
}
if (strlen($item["title"]) > strlen($item["body"])) {
//echo "*".strlen($item["title"]).">".strlen($item["body"])."\n";
$item["body"] = $item["title"];
$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;
unset($item["attach"]);
} else {
if (!strstr($item["body"], '[url') && ($item['plink'] != '')) { if (!strstr($item["body"], '[url') && ($item['plink'] != '')) {
$item["body"] .= "[hr][url]".$item['plink']."[/url]"; $item["body"] .= "[hr][url]".$item['plink']."[/url]";
} }