diff options
author | Evan Prodromou <evan@status.net> | 2010-03-20 16:53:30 -0500 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-03-20 16:53:30 -0500 |
commit | 323ff31fbd59181f4cd9a3fc4da40a1f9ff8bc99 (patch) | |
tree | fa1cf4c7af9e10d515a69cc14e1d35499a55f2e2 /lib/activityobject.php | |
parent | 99454be38cf1dc7f962441d23ccc0a59e7b05f3d (diff) |
special-case Posterous author element for activity actor
Diffstat (limited to 'lib/activityobject.php')
-rw-r--r-- | lib/activityobject.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/activityobject.php b/lib/activityobject.php index b1e9071ed..18e3e21dd 100644 --- a/lib/activityobject.php +++ b/lib/activityobject.php @@ -80,6 +80,13 @@ class ActivityObject const URI = 'uri'; const EMAIL = 'email'; + const POSTEROUS = 'http://posterous.com/help/rss/1.0'; + const AUTHOR = 'author'; + const USERIMAGE = 'userImage'; + const PROFILEURL = 'profileUrl'; + const NICKNAME = 'nickName'; + const DISPLAYNAME = 'displayName'; + public $element; public $type; public $id; @@ -296,6 +303,31 @@ class ActivityObject return $obj; } + public static function fromPosterousAuthor($el) + { + $obj = new ActivityObject(); + + $obj->type = ActivityObject::PERSON; // @fixme any others...? + + $userImage = ActivityUtils::childContent($el, self::USERIMAGE, self::POSTEROUS); + + if (!empty($userImage)) { + $obj->avatarLinks[] = $userImage; + } + + $obj->link = ActivityUtils::childContent($el, self::PROFILEURL, self::POSTEROUS); + $obj->id = $obj->link; + + $obj->poco = new PoCo(); + + $obj->poco->preferredUsername = ActivityUtils::childContent($el, self::NICKNAME, self::POSTEROUS); + $obj->poco->displayName = ActivityUtils::childContent($el, self::DISPLAYNAME, self::POSTEROUS); + + $obj->title = $obj->poco->displayName; + + return $obj; + } + private function _childContent($element, $tag, $namespace=ActivityUtils::ATOM) { return ActivityUtils::childContent($element, $tag, $namespace); |