diff options
author | Brion Vibber <brion@pobox.com> | 2010-03-23 08:21:32 -0700 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-03-23 08:21:32 -0700 |
commit | a5c78a6f1a7bef591e136ca23f7a133f8905475a (patch) | |
tree | 5ab54039ea0ce4982ebf84e0ba05109f0ec467a9 /lib | |
parent | 68a5fba24847991330d1a31b3c3f875c5d02cb6e (diff) | |
parent | 5b0b6097e0e47c84c2e47c8a14421a58be1fac19 (diff) |
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'lib')
-rw-r--r-- | lib/activity.php | 24 | ||||
-rw-r--r-- | lib/activityobject.php | 20 |
2 files changed, 35 insertions, 9 deletions
diff --git a/lib/activity.php b/lib/activity.php index bd1d5d56c..f9192c6b8 100644 --- a/lib/activity.php +++ b/lib/activity.php @@ -53,6 +53,7 @@ class Activity { const SPEC = 'http://activitystrea.ms/spec/1.0/'; const SCHEMA = 'http://activitystrea.ms/schema/1.0/'; + const MEDIA = 'http://purl.org/syndication/atommedia'; const VERB = 'verb'; const OBJECT = 'object'; @@ -85,7 +86,7 @@ class Activity public $actor; // an ActivityObject public $verb; // a string (the URL) - public $object; // an ActivityObject + public $objects = array(); // an array of ActivityObjects public $target; // an ActivityObject public $context; // an ActivityObject public $time; // Time of the activity @@ -161,12 +162,15 @@ class Activity // XXX: do other implied stuff here } - $objectEl = $this->_child($entry, self::OBJECT); + $objectEls = $entry->getElementsByTagNameNS(self::SPEC, self::OBJECT); - if (!empty($objectEl)) { - $this->object = new ActivityObject($objectEl); + if ($objectEls->length > 0) { + for ($i = 0; $i < $objectEls->length; $i++) { + $objectEl = $objectEls->item($i); + $this->objects[] = new ActivityObject($objectEl); + } } else { - $this->object = new ActivityObject($entry); + $this->objects[] = new ActivityObject($entry); } $actorEl = $this->_child($entry, self::ACTOR); @@ -280,8 +284,8 @@ class Activity } } - $this->object = new ActivityObject($item); - $this->context = new ActivityContext($item); + $this->objects[] = new ActivityObject($item); + $this->context = new ActivityContext($item); } /** @@ -339,8 +343,10 @@ class Activity $xs->element('activity:verb', null, $this->verb); - if ($this->object) { - $xs->raw($this->object->asString()); + if (!empty($this->objects)) { + foreach($this->objects as $object) { + $xs->raw($object->asString()); + } } if ($this->target) { diff --git a/lib/activityobject.php b/lib/activityobject.php index 0a358ccab..34d1b9170 100644 --- a/lib/activityobject.php +++ b/lib/activityobject.php @@ -100,6 +100,13 @@ class ActivityObject public $poco; public $displayName; + // @todo move this stuff to it's own PHOTO activity object + const MEDIA_DESCRIPTION = 'description'; + + public $thumbnail; + public $largerImage; + public $description; + /** * Constructor * @@ -150,6 +157,19 @@ class ActivityObject $this->poco = new PoCo($element); } + + if ($this->type == self::PHOTO) { + + $this->thumbnail = ActivityUtils::getLink($element, 'preview'); + $this->largerImage = ActivityUtils::getLink($element, 'enclosure'); + + $this->description = ActivityUtils::childContent( + $element, + ActivityObject::MEDIA_DESCRIPTION, + Activity::MEDIA + ); + + } } private function _fromAuthor($element) |