summaryrefslogtreecommitdiff
path: root/lib/activityobject.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-03-21 16:25:12 -0700
committerBrion Vibber <brion@pobox.com>2010-03-21 16:25:12 -0700
commitfcb614d0eb1f98bf8704654ed06e1f9d9733d359 (patch)
tree7c1dcd44885ed262dc92f58b2968ba6182617a54 /lib/activityobject.php
parentb228da628da51337a28ecb1d5f7416717489496c (diff)
Pull <atom:author> info as well as <activity:actor> when we have an old-style ActivityStreams feed. This fixes subscription setup for Cliqset feeds, which currently have a bogus activity:actor/atom:id but a good atom:author/atom:uri
Diffstat (limited to 'lib/activityobject.php')
-rw-r--r--lib/activityobject.php21
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/activityobject.php b/lib/activityobject.php
index e5cea727b..0a358ccab 100644
--- a/lib/activityobject.php
+++ b/lib/activityobject.php
@@ -156,7 +156,11 @@ class ActivityObject
{
$this->type = self::PERSON; // XXX: is this fair?
$this->title = $this->_childContent($element, self::NAME);
- $this->id = $this->_childContent($element, self::URI);
+
+ $id = $this->_childContent($element, self::URI);
+ if (ActivityUtils::validateUri($id)) {
+ $this->id = $id;
+ }
if (empty($this->id)) {
$email = $this->_childContent($element, self::EMAIL);
@@ -169,6 +173,15 @@ class ActivityObject
private function _fromAtomEntry($element)
{
+ if ($element->localName == 'actor') {
+ // Old-fashioned <activity:actor>...
+ // First pull anything from <author>, then we'll add on top.
+ $author = ActivityUtils::child($element->parentNode, 'author');
+ if ($author) {
+ $this->_fromAuthor($author);
+ }
+ }
+
$this->type = $this->_childContent($element, Activity::OBJECTTYPE,
Activity::SPEC);
@@ -176,7 +189,11 @@ class ActivityObject
$this->type = ActivityObject::NOTE;
}
- $this->id = $this->_childContent($element, self::ID);
+ $id = $this->_childContent($element, self::ID);
+ if (ActivityUtils::validateUri($id)) {
+ $this->id = $id;
+ }
+
$this->summary = ActivityUtils::childHtmlContent($element, self::SUMMARY);
$this->content = ActivityUtils::getContent($element);