diff --git a/include/api.php b/include/api.php index 38555706b5..3f71ecf9c4 100644 --- a/include/api.php +++ b/include/api.php @@ -2047,7 +2047,6 @@ } function api_convert_item($item) { - $body = $item['body']; $attachments = api_get_attachments($body); @@ -2084,8 +2083,13 @@ $statushtml = "
"; var_dump($status); killme();
}
// "uid" and "self" are only needed for some internal stuff, so remove it from here
@@ -3055,12 +3073,12 @@
if (($shared_body == "") OR ($profile == "") OR ($author == "") OR ($avatar == ""))
return(false);
- $item["body"] = $shared_body;
- $item["author-name"] = $author;
- $item["author-link"] = $profile;
- $item["author-avatar"] = $avatar;
- $item["plink"] = $link;
-
+ $item["retweet-body"] = $shared_body;
+ $item["retweet-author-name"] = $author;
+ $item["retweet-author-link"] = $profile;
+ $item["retweet-author-avatar"] = $avatar;
+ $item["retweet-plink"] = $link;
+ $item["is_retweet"] = true;
return(true);
}
diff --git a/view/templates/api_single_status_xml.tpl b/view/templates/api_single_status_xml.tpl
new file mode 100644
index 0000000000..88c56f935b
--- /dev/null
+++ b/view/templates/api_single_status_xml.tpl
@@ -0,0 +1,25 @@
+{{* shared structure for statuses. includers must define root element *}}
+ {{$status.text}}
+ {{$status.truncated}}
+ {{$status.created_at}}
+ {{$status.in_reply_to_status_id}}
+ {{$status.source}}
+ {{$status.id}}
+ {{$status.in_reply_to_user_id}}
+ {{$status.in_reply_to_screen_name}}
+ {{$status.geo}}
+ {{$status.favorited}}
+ {{include file="api_user_xml.tpl" user=$status.user}}
+ {{include file="api_user_xml.tpl" user=$status.friendica_owner}}
+ {{$status.statusnet_html}}
+ {{$status.statusnet_conversation_id}}
+ {{$status.url}}
+ {{$status.coordinates}}
+ {{$status.place}}
+ {{$status.contributors}}
+ {{if $status.retweeted_status}}{{include file="api_single_status_xml.tpl" status=$status.retweeted_status}} {{/if}}
+
+ {{foreach $status.friendica_activities as $k=>$v}}
+ {{$v|count}}
+ {{/foreach}}
+
\ No newline at end of file
diff --git a/view/templates/api_status_xml.tpl b/view/templates/api_status_xml.tpl
index c3b702baab..a382810ff4 100644
--- a/view/templates/api_status_xml.tpl
+++ b/view/templates/api_status_xml.tpl
@@ -1,47 +1,8 @@
-
-{{if $status}}
- {{$status.created_at}}
- {{$status.id}}
- {{$status.text}}
- {{$status.source}}
- {{$status.truncated}}
- {{$status.in_reply_to_status_id}}
- {{$status.in_reply_to_user_id}}
- {{$status.favorited}}
- {{$status.in_reply_to_screen_name}}
- {{$status.geo}}
- {{$status.coordinates}}
- {{$status.place}}
- {{$status.contributors}}
-
- {{$status.user.id}}
- {{$status.user.name}}
- {{$status.user.screen_name}}
- {{$status.user.location}}
- {{$status.user.description}}
- {{$status.user.profile_image_url}}
- {{$status.user.url}}
- {{$status.user.protected}}
- {{$status.user.followers}}
- {{$status.user.profile_background_color}}
- {{$status.user.profile_text_color}}
- {{$status.user.profile_link_color}}
- {{$status.user.profile_sidebar_fill_color}}
- {{$status.user.profile_sidebar_border_color}}
- {{$status.user.friends_count}}
- {{$status.user.created_at}}
- {{$status.user.favourites_count}}
- {{$status.user.utc_offset}}
- {{$status.user.time_zone}}
- {{$status.user.profile_background_image_url}}
- {{$status.user.profile_background_tile}}
- {{$status.user.profile_use_background_image}}
-
- {{$status.user.geo_enabled}}
- {{$status.user.verified}}
-
- {{$status.user.statuses_count}}
- {{$status.user.lang}}
- {{$status.user.contributors_enabled}}
-
-{{/if}}
+{{* used in api.php to return a single status *}}
+
+ {{if $status}}
+ {{include file="api_single_status_xml.tpl" status=$status}}
+ {{/if}}
+
diff --git a/view/templates/api_timeline_xml.tpl b/view/templates/api_timeline_xml.tpl
index 2579331495..01b71c0bcc 100644
--- a/view/templates/api_timeline_xml.tpl
+++ b/view/templates/api_timeline_xml.tpl
@@ -2,27 +2,9 @@
-{{foreach $statuses as $status}}
- {{$status.text}}
- {{$status.truncated}}
- {{$status.created_at}}
- {{$status.in_reply_to_status_id}}
- {{$status.source}}
- {{$status.id}}
- {{$status.in_reply_to_user_id}}
- {{$status.in_reply_to_screen_name}}
- {{$status.geo}}
- {{$status.favorited}}
- {{include file="api_user_xml.tpl" user=$status.user}}
- {{include file="api_user_xml.tpl" user=$status.friendica_owner}}
- {{$status.statusnet_html}}
- {{$status.statusnet_conversation_id}}
- {{$status.url}}
- {{$status.coordinates}}
- {{$status.place}}
- {{$status.contributors}}
- {{foreach $status.friendica_activities as $k=>$v}}
- {{$v}}
- {{/foreach}}
+{{foreach $statuses as $status}}
+
+ {{include file="api_single_status_xml.tpl" status=$status}}
-{{/foreach}}
+{{/foreach}}
+