Update activity streams JSON to match spec

Squashed commit of the following:

commit 0722450267a1d0f4bdc2853f52a85b850329db73
Author: Zach Copley <zach@status.net>
Date:   Thu Aug 25 09:58:29 2011 -0700

    Updgrade activity object json

commit 882ba1dceaba8a0b3ec3513760aa09f68e41f270
Author: Zach Copley <zach@status.net>
Date:   Wed Aug 24 16:30:07 2011 -0700

    Update to the JSON activity serialization document

commit 121e441b314b93e184711c3dcc79ada69d429eba
Author: Zach Copley <zach@status.net>
Date:   Wed Aug 24 15:08:06 2011 -0700

    Output application/json instead of application/stream+json (at least for now)

commit e045e214bffe5e0ddeb0a42555d440b75ae4edde
Author: Zach Copley <zach@status.net>
Date:   Wed Aug 24 15:06:40 2011 -0700

    Update to use latest property names from the JSON activity spec
This commit is contained in:
Zach Copley
2011-08-25 10:00:20 -07:00
parent 94503a50fd
commit 297d603feb
4 changed files with 126 additions and 40 deletions

View File

@@ -679,16 +679,19 @@ class ActivityObject
$object = array();
if (Event::handle('StartActivityObjectOutputJson', array($this, &$object))) {
// XXX: attachedObjects are added by Activity
// XXX: attachments are added by Activity
// author (Add object for author? Could be useful for repeats.)
// content (Add rendered version of the notice?)
// displayName
$object['displayName'] = $this->title;
// TODO: downstreamDuplicates
// embedCode (used for video)
// downstreamDuplicates
// id
$object['id'] = $this->id;
//
// XXX: Should we use URL here? or a crazy tag URI?
$object['id'] = $this->id;
@@ -736,9 +739,13 @@ class ActivityObject
// @fixme this breaks extension URIs
$object['type'] = substr($this->type, strrpos($this->type, '/') + 1);
// published (probably don't need. Might be useful for repeats.)
// summary
$object['summary'] = $this->summary;
// udpated (probably don't need this)
// TODO: upstreamDuplicates
// url (XXX: need to put the right thing here...)
@@ -753,8 +760,6 @@ class ActivityObject
$object[$objectName] = $props;
}
// GeoJSON
if (!empty($this->geopoint)) {
list($lat, $long) = explode(' ', $this->geopoint);
@@ -766,7 +771,7 @@ class ActivityObject
}
if (!empty($this->poco)) {
$object['contact'] = $this->poco->asArray();
$object['contact'] = array_filter($this->poco->asArray());
}
Event::handle('EndActivityObjectOutputJson', array($this, &$object));
}