diff options
author | Brion Vibber <brion@pobox.com> | 2010-02-12 18:54:48 +0000 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-02-12 18:54:48 +0000 |
commit | b39047d95b447251de75d15b986017286aca05e0 (patch) | |
tree | 672187a4803b899f1e4d2d709a8f820b938d00d6 /classes/Profile.php | |
parent | b57e3dfae2f48ef6097fef04df218201783abed1 (diff) |
OStatus: prep work for sending notifications on sub/unsub/join/leave/favorite/unfavorite via Salmon; needs to be completed and hooked up once feed gen is fixed.
Diffstat (limited to 'classes/Profile.php')
-rw-r--r-- | classes/Profile.php | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/classes/Profile.php b/classes/Profile.php index 3e5150c18..ab05bb854 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -755,6 +755,14 @@ class Profile extends Memcached_DataObject return !empty($notice); } + /** + * Returns an XML string fragment with limited profile information + * as an Atom <author> element. + * + * Assumes that Atom has been previously set up as the base namespace. + * + * @return string + */ function asAtomAuthor() { $xs = new XMLStringer(true); @@ -767,11 +775,33 @@ class Profile extends Memcached_DataObject return $xs->getString(); } + /** + * Returns an XML string fragment with profile information as an + * Activity Streams <activity:actor> element. + * + * Assumes that 'activity' namespace has been previously defined. + * + * @return string + */ function asActivityActor() { + return $this->asActivityNoun('actor'); + } + + /** + * Returns an XML string fragment with profile information as an + * Activity Streams noun object with the given element type. + * + * Assumes that 'activity' namespace has been previously defined. + * + * @param string $element one of 'actor', 'subject', 'object', 'target' + * @return string + */ + function asActivityNoun($element) + { $xs = new XMLStringer(true); - $xs->elementStart('activity:actor'); + $xs->elementStart('activity:' . $element); $xs->element( 'activity:object-type', null, @@ -799,7 +829,7 @@ class Profile extends Memcached_DataObject '' ); - $xs->elementEnd('activity:actor'); + $xs->elementEnd('activity:' . $element); return $xs->getString(); } |