summaryrefslogtreecommitdiff
path: root/lib/activity.php
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-03-22 18:53:09 -0700
committerZach Copley <zach@status.net>2010-03-22 18:55:17 -0700
commitb8e97ac7098783f0380c7f8f61c20a100e814dc0 (patch)
tree0ede4a61bcbbcd475ac3d339a08c23d54ef792a9 /lib/activity.php
parent073e3a1572d0cd5934c6578f4245c39e8376351f (diff)
Some initial media parsing
- Activity now returns a list of activity objects - Processing of photo objects
Diffstat (limited to 'lib/activity.php')
-rw-r--r--lib/activity.php24
1 files changed, 15 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) {