From a9b2b48d082b5e97fd3bb1481d2b01e81d04735a Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Fri, 27 Nov 2015 23:16:54 +0100 Subject: [PATCH] Some small improvements to the OStatus export --- include/bbcode.php | 2 +- include/items.php | 2 +- include/ostatus.php | 13 +++++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/bbcode.php b/include/bbcode.php index 81536d3720..e07b63313a 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -100,7 +100,7 @@ function bb_attachment($Text, $simplehtml = false, $tryoembed = true) { } if ($simplehtml == 7) - $text = sprintf('%s', + $text = sprintf('%s
', $url, $title, $title); elseif (($simplehtml != 4) AND ($simplehtml != 0)) $text = sprintf('%s
', $url, $title); diff --git a/include/items.php b/include/items.php index 53f4784c2d..f86c6453f6 100644 --- a/include/items.php +++ b/include/items.php @@ -4645,7 +4645,7 @@ function item_getfeedtags($item) { if($cnt) { for($x = 0; $x < $cnt; $x ++) { if($matches[1][$x]) - $ret[] = array('#',$matches[1][$x], $matches[2][$x]); + $ret[$matches[2][$x]] = array('#',$matches[1][$x], $matches[2][$x]); } } $matches = false; diff --git a/include/ostatus.php b/include/ostatus.php index ce254ed61a..2c6480fd32 100644 --- a/include/ostatus.php +++ b/include/ostatus.php @@ -1201,6 +1201,14 @@ function ostatus_get_attachment($doc, $root, $item) { break; } + if (($siteinfo["type"] != "photo") AND isset($siteinfo["image"])) { + $photodata = get_photo_info($siteinfo["image"]); + + $attributes = array("rel" => "preview", "href" => $siteinfo["image"], "media:width" => $photodata[0], "media:height" => $photodata[1]); + xml_add_element($doc, $root, "link", "", $attributes); + } + + $arr = explode('[/attach],',$item['attach']); if(count($arr)) { foreach($arr as $r) { @@ -1327,6 +1335,7 @@ function ostatus_entry($doc, $item, $owner, $toplevel = false) { if ($item['title'] != "") $body = "[b]".$item['title']."[/b]\n\n".$body; + $body = bb_remove_share_information($body); $body = bbcode($body, false, false, 7); xml_add_element($doc, $entry, "content", $body, array("type" => "html")); @@ -1440,7 +1449,7 @@ function ostatus_feed(&$a, $owner_nick, $last_update) { $root->appendChild($entry); } - return($doc->saveXML()); + return(trim($doc->saveXML())); } function ostatus_salmon($item,$owner) { @@ -1452,6 +1461,6 @@ function ostatus_salmon($item,$owner) { $doc->appendChild($entry); - return($doc->saveXML()); + return(trim($doc->saveXML())); } ?>