diff options
author | Michael Vogel <icarus@dabo.de> | 2012-04-08 17:23:38 +0200 |
---|---|---|
committer | Michael Vogel <icarus@dabo.de> | 2012-04-08 17:23:38 +0200 |
commit | 944f897d308a46a8f9ac80a089516f29eb096717 (patch) | |
tree | 76465bdc0eb134dbd462937ed5cdad5598c011db | |
parent | ce0eac44b5035b8f46259b6665826a94b633ec4e (diff) | |
download | volse-hubzilla-944f897d308a46a8f9ac80a089516f29eb096717.tar.gz volse-hubzilla-944f897d308a46a8f9ac80a089516f29eb096717.tar.bz2 volse-hubzilla-944f897d308a46a8f9ac80a089516f29eb096717.zip |
API: Basic support of the identica client added.
-rw-r--r-- | include/api.php | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/include/api.php b/include/api.php index 968a64a6d..5053a8ad5 100644 --- a/include/api.php +++ b/include/api.php @@ -121,6 +121,7 @@ if (strpos($a->query_string, ".json")>0) $type="json"; if (strpos($a->query_string, ".rss")>0) $type="rss"; if (strpos($a->query_string, ".atom")>0) $type="atom"; + if (strpos($a->query_string, ".as")>0) $type="as"; $r = call_user_func($info['func'], $a, $type); if ($r===false) return; @@ -144,6 +145,12 @@ header ("Content-Type: application/atom+xml"); return '<?xml version="1.0" encoding="UTF-8"?>'."\n".$r; break; + case "as": + //header ("Content-Type: application/json"); + //foreach($r as $rr) + // return json_encode($rr); + return json_encode($r); + break; } //echo "<pre>"; var_dump($r); die(); @@ -737,6 +744,71 @@ case "atom": case "rss": $data = api_rss_extra($a, $data, $user_info); + break; + case "as": + $as = array(); + $as['title'] = $a->config['sitename']." Public Timeline"; + $items = array(); + foreach ($ret as $item) { + $singleitem["actor"]["displayName"] = $item["user"]["name"]; + $singleitem["actor"]["id"] = $item["user"]["contact_url"]; + $avatar[0]["url"] = $item["user"]["profile_image_url"]; + $avatar[0]["rel"] = "avatar"; + $avatar[0]["type"] = ""; + $avatar[0]["width"] = 96; + $avatar[0]["height"] = 96; + $avatar[1]["url"] = $item["user"]["profile_image_url"]; + $avatar[1]["rel"] = "avatar"; + $avatar[1]["type"] = ""; + $avatar[1]["width"] = 48; + $avatar[1]["height"] = 48; + $avatar[2]["url"] = $item["user"]["profile_image_url"]; + $avatar[2]["rel"] = "avatar"; + $avatar[2]["type"] = ""; + $avatar[2]["width"] = 24; + $avatar[2]["height"] = 24; + $singleitem["actor"]["avatarLinks"] = $avatar; + + $singleitem["actor"]["image"]["url"] = $item["user"]["profile_image_url"]; + $singleitem["actor"]["image"]["rel"] = "avatar"; + $singleitem["actor"]["image"]["type"] = ""; + $singleitem["actor"]["image"]["width"] = 96; + $singleitem["actor"]["image"]["height"] = 96; + $singleitem["actor"]["type"] = "person"; + $singleitem["actor"]["url"] = $item["person"]["contact_url"]; + $singleitem["actor"]["statusnet:profile_info"]["local_id"] = $item["user"]["id"]; + $singleitem["actor"]["statusnet:profile_info"]["following"] = "false"; // $item["user"]["following"] + $singleitem["actor"]["statusnet:profile_info"]["blocking"] = "false"; + $singleitem["actor"]["contact"]["preferredUsername"] = $item["user"]["screen_name"]; + $singleitem["actor"]["contact"]["displayName"] = $item["user"]["name"]; + $singleitem["actor"]["contact"]["addresses"] = ""; + + $singleitem["body"] = $item["text"]; + $singleitem["object"]["displayName"] = $item["text"]; + $singleitem["object"]["id"] = $item["url"]; + $singleitem["object"]["type"] = "note"; + $singleitem["object"]["url"] = $item["url"]; + //$singleitem["context"] =; + $singleitem["postedTime"] = date("c", strtotime($item["published"])); + $singleitem["provider"]["objectType"] = "service"; + $singleitem["provider"]["displayName"] = "Test"; + $singleitem["provider"]["url"] = "http://test.tld"; + $singleitem["title"] = $item["text"]; + $singleitem["verb"] = "post"; + $singleitem["statusnet:notice_info"]["local_id"] = $item["id"]; + $singleitem["statusnet:notice_info"]["source"] = $item["source"]; + $singleitem["statusnet:notice_info"]["favorite"] = "false"; + $singleitem["statusnet:notice_info"]["repeated"] = "false"; + //$singleitem["original"] = $item; + $items[] = $singleitem; + } + $as['items'] = $items; + $link->url = $a->get_baseurl()."/".$user_info["screen_name"]."/all"; + $link->rel = "alternate"; + $link->type = "text/html"; + $as['link'][] = $link; + return($as); + break; } return api_apply_template("timeline", $type, $data); |