continue;
}
- $item["body"] = add_page_info_to_body(html2bbcode($xpath->query('atom:content/text()', $entry)->item(0)->nodeValue));
+ $item["body"] = html2bbcode($xpath->query('atom:content/text()', $entry)->item(0)->nodeValue);
+ //$item["body"] = add_page_info_to_body(html2bbcode($xpath->query('atom:content/text()', $entry)->item(0)->nodeValue));
$item["object-type"] = $xpath->query('activity:object-type/text()', $entry)->item(0)->nodeValue;
$item["verb"] = $xpath->query('activity:verb/text()', $entry)->item(0)->nodeValue;
- // Mastodon Content Warning
- if (($item["verb"] == ACTIVITY_POST) && $xpath->evaluate('boolean(atom:summary)', $entry)) {
- $clear_text = $xpath->query('atom:summary/text()', $entry)->item(0)->nodeValue;
-
- $item["body"] = html2bbcode($clear_text) . '[spoiler]' . $item["body"] . '[/spoiler]';
- }
-
if (($item["object-type"] == ACTIVITY_OBJ_BOOKMARK) || ($item["object-type"] == ACTIVITY_OBJ_EVENT)) {
$item["title"] = $xpath->query('atom:title/text()', $entry)->item(0)->nodeValue;
$item["body"] = $xpath->query('atom:summary/text()', $entry)->item(0)->nodeValue;
}
$self = "";
- $enclosure = "";
$links = $xpath->query('atom:link', $entry);
if ($links) {
}
break;
case "enclosure":
- $enclosure = $attribute['href'];
- if (strlen($item["attach"])) {
- $item["attach"] .= ',';
- }
- if (!isset($attribute['length'])) {
- $attribute['length'] = "0";
+ $filetype = strtolower(substr($attribute['type'], 0, strpos($attribute['type'],'/')));
+ if ($filetype == 'image') {
+ $item['body'] .= "\n[img]".$attribute['href'].'[/img]';
+ } else {
+ if (strlen($item["attach"])) {
+ $item["attach"] .= ',';
+ }
+ if (!isset($attribute['length'])) {
+ $attribute['length'] = "0";
+ }
+ $item["attach"] .= '[attach]href="'.$attribute['href'].'" length="'.$attribute['length'].'" type="'.$attribute['type'].'" title="'.$attribute['title'].'"[/attach]';
}
- $item["attach"] .= '[attach]href="'.$attribute['href'].'" length="'.$attribute['length'].'" type="'.$attribute['type'].'" title="'.$attribute['title'].'"[/attach]';
break;
case "related":
if ($item["object-type"] != ACTIVITY_OBJ_BOOKMARK) {
}
}
+ // Only add additional data when there is no picture in the post
+ if (!strstr($item["body"],'[/img]')) {
+ $item["body"] = add_page_info_to_body($item["body"]);
+ }
+
+ // Mastodon Content Warning
+ if (($item["verb"] == ACTIVITY_POST) && $xpath->evaluate('boolean(atom:summary)', $entry)) {
+ $clear_text = $xpath->query('atom:summary/text()', $entry)->item(0)->nodeValue;
+
+ $item["body"] = html2bbcode($clear_text) . '[spoiler]' . $item["body"] . '[/spoiler]';
+ }
+
$local_id = "";
$repeat_of = "";
foreach ($enclosures AS $link) {
$attribute = self::read_attributes($link);
if ($href != "") {
- $enclosure = $attribute['href'];
if (strlen($item["attach"])) {
$item["attach"] .= ',';
}
}
}
- //if ($enclosure != "")
- // $item["body"] .= add_page_info($enclosure);
-
if (isset($item["parent-uri"])) {
$r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `uri` = '%s'",
intval($importer["uid"]), dbesc($item["parent-uri"]));
$title = ((strlen(trim($mtch[4]))) ? escape_tags(trim($mtch[4])) : escape_tags($mtch[1]));
$title .= ' ' . $mtch[2] . ' ' . t('bytes');
- if (($filetype == 'image') AND ($item['network'] == NETWORK_OSTATUS)) {
- /// @todo Respect the spoiler for mastodon
- $icon = '<img class="attached" src="'.$the_url.'" alt="" title="'.$title.'">';
- $s .= '<br><a href="' . strip_tags($the_url) . '" title="' . $title . '" class="attached" target="_blank" >' . $icon . '</a>';
- } else {
- $icon = '<div class="attachtype icon s22 type-' . $filetype . ' subtype-' . $filesubtype . '"></div>';
- $as .= '<a href="' . strip_tags($the_url) . '" title="' . $title . '" class="attachlink" target="_blank" >' . $icon . '</a>';
- }
-
+ $icon = '<div class="attachtype icon s22 type-' . $filetype . ' subtype-' . $filesubtype . '"></div>';
+ $as .= '<a href="' . strip_tags($the_url) . '" title="' . $title . '" class="attachlink" target="_blank" >' . $icon . '</a>';
}
}
}