]> git.mxchange.org Git - friendica.git/blobdiff - include/ostatus.php
Merge remote-tracking branch 'upstream/develop' into 1704-mastodon
[friendica.git] / include / ostatus.php
index e0ed1df19a9f2a8123cddaa35978186e61432cb6..c1d730eb130c4980c263a302ddc231a020636679 100644 (file)
@@ -1479,15 +1479,7 @@ class ostatus {
                $o = "";
                $siteinfo = get_attached_data($item["body"]);
 
-               switch($siteinfo["type"]) {
-                       case 'link':
-                               $attributes = array("rel" => "enclosure",
-                                               "href" => $siteinfo["url"],
-                                               "type" => "text/html; charset=UTF-8",
-                                               "length" => "",
-                                               "title" => $siteinfo["title"]);
-                               xml::add_element($doc, $root, "link", "", $attributes);
-                               break;
+               switch ($siteinfo["type"]) {
                        case 'photo':
                                $imgdata = get_photo_info($siteinfo["image"]);
                                $attributes = array("rel" => "enclosure",
@@ -1509,29 +1501,31 @@ class ostatus {
                }
 
                if (($siteinfo["type"] != "photo") AND isset($siteinfo["image"])) {
-                       $photodata = get_photo_info($siteinfo["image"]);
+                       $imgdata = get_photo_info($siteinfo["image"]);
+                       $attributes = array("rel" => "enclosure",
+                                       "href" => $siteinfo["image"],
+                                       "type" => $imgdata["mime"],
+                                       "length" => intval($imgdata["size"]));
 
-                       $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) {
+               $arr = explode('[/attach],', $item['attach']);
+               if (count($arr)) {
+                       foreach ($arr as $r) {
                                $matches = false;
-                               $cnt = preg_match('|\[attach\]href=\"(.*?)\" length=\"(.*?)\" type=\"(.*?)\" title=\"(.*?)\"|',$r,$matches);
-                               if($cnt) {
+                               $cnt = preg_match('|\[attach\]href=\"(.*?)\" length=\"(.*?)\" type=\"(.*?)\" title=\"(.*?)\"|', $r, $matches);
+                               if ($cnt) {
                                        $attributes = array("rel" => "enclosure",
                                                        "href" => $matches[1],
                                                        "type" => $matches[3]);
 
-                                       if(intval($matches[2]))
+                                       if (intval($matches[2])) {
                                                $attributes["length"] = intval($matches[2]);
-
-                                       if(trim($matches[4]) != "")
+                                       }
+                                       if (trim($matches[4]) != "") {
                                                $attributes["title"] = trim($matches[4]);
-
+                                       }
                                        xml::add_element($doc, $root, "link", "", $attributes);
                                }
                        }
@@ -2089,7 +2083,13 @@ class ostatus {
                if (intval($item["parent"]) > 0) {
                        $conversation = App::get_baseurl()."/display/".$owner["nick"]."/".$item["parent"];
                        xml::add_element($doc, $entry, "link", "", array("rel" => "ostatus:conversation", "href" => $conversation));
-                       xml::add_element($doc, $entry, "ostatus:conversation", $conversation);
+
+                       $attributes = array(
+                                       "href" => $conversation,
+                                       "local_id" => $item["parent"],
+                                       "ref" => $conversation);
+
+                       xml::add_element($doc, $entry, "ostatus:conversation", $conversation, $attributes);
                }
 
                $tags = item_getfeedtags($item);