summaryrefslogtreecommitdiff
path: root/classes/Profile.php
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-02-10 18:55:14 -0800
committerZach Copley <zach@status.net>2010-02-11 13:56:05 -0800
commite2c0f59414dd7e9a33ffbae7307b81a85c2c168b (patch)
treed10b1f7f4b3220124a03f7f7d019632eb1e7c469 /classes/Profile.php
parentce3c3be1bf971329f82bedbf3aae636e3c8ecbf9 (diff)
Some upgrades to Atom output for OStatus
Diffstat (limited to 'classes/Profile.php')
-rw-r--r--classes/Profile.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/classes/Profile.php b/classes/Profile.php
index feabc2508..664c45f64 100644
--- a/classes/Profile.php
+++ b/classes/Profile.php
@@ -754,4 +754,53 @@ class Profile extends Memcached_DataObject
return !empty($notice);
}
+
+ function asAtomAuthor()
+ {
+ $xs = new XMLStringer(true);
+
+ $xs->elementStart('author');
+ $xs->element('name', null, $this->nickname);
+ $xs->element('uri', null, $this->profileurl);
+ $xs->elementEnd('author');
+
+ return $xs->getString();
+ }
+
+ function asActivityActor()
+ {
+ $xs = new XMLStringer(true);
+
+ $xs->elementStart('activity:actor');
+ $xs->element(
+ 'activity:object-type',
+ null,
+ 'http://activitystrea.ms/schema/1.0/person'
+ );
+ $xs->element(
+ 'id',
+ null,
+ common_local_url(
+ 'userbyid',
+ array('id' => $this->id)
+ )
+ );
+ $xs->element('title', null, $this->getBestName());
+
+ $avatar = $this->getAvatar(AVATAR_PROFILE_SIZE);
+
+ $xs->element(
+ 'link', array(
+ 'type' => empty($avatar) ? 'image/png' : $avatar->mediatype,
+ 'href' => empty($avatar)
+ ? Avatar::defaultImage(AVATAR_PROFILE_SIZE)
+ : $avatar->displayUrl()
+ ),
+ ''
+ );
+
+ $xs->elementEnd('activity:actor');
+
+ return $xs->getString();
+ }
}