diff options
author | Brion Vibber <brion@pobox.com> | 2010-02-24 15:47:51 -0800 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-02-24 15:47:51 -0800 |
commit | 59be4b8cae992476628b23c2976d335e4f704c89 (patch) | |
tree | a1e94f2b11a5e640bf55f6977576fdca237f323f /classes/Profile.php | |
parent | 2d9d444b05e29105082d3a443b8b71de6498b7e9 (diff) | |
parent | e04f55630473f5f8b17554d14cfd047b93af8609 (diff) |
Merge branch 'testing' of gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'classes/Profile.php')
-rw-r--r-- | classes/Profile.php | 59 |
1 files changed, 13 insertions, 46 deletions
diff --git a/classes/Profile.php b/classes/Profile.php index 6b396c8c3..78223b34a 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -792,44 +792,17 @@ class Profile extends Memcached_DataObject * 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. + * Assumes that 'activity', 'georss', and 'poco' 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:' . $element); - $xs->element( - 'activity:object-type', - null, - 'http://activitystrea.ms/schema/1.0/person' - ); - $xs->element( - 'id', - null, - $this->getUri() - ); - $xs->element('title', null, $this->getBestName()); - - $avatar = $this->getAvatar(AVATAR_PROFILE_SIZE); - - $xs->element( - 'link', array( - 'type' => empty($avatar) ? 'image/png' : $avatar->mediatype, - 'rel' => 'avatar', - 'href' => empty($avatar) - ? Avatar::defaultImage(AVATAR_PROFILE_SIZE) - : $avatar->displayUrl() - ), - '' - ); - - $xs->elementEnd('activity:' . $element); - - return $xs->getString(); + $noun = ActivityObject::fromProfile($this); + return $noun->asString('activity:' . $element); } /** @@ -841,28 +814,22 @@ class Profile extends Memcached_DataObject { $uri = null; - // check for a local user first - $user = User::staticGet('id', $this->id); + // give plugins a chance to set the URI + if (Event::handle('StartGetProfileUri', array($this, &$uri))) { - if (!empty($user)) { - $uri = common_local_url( - 'userbyid', - array('id' => $user->id) - ); - } else { - - // give plugins a chance to set the URI - if (Event::handle('StartGetProfileUri', array($this, &$uri))) { + // check for a local user first + $user = User::staticGet('id', $this->id); + if (!empty($user)) { + $uri = $user->uri; + } else { // return OMB profile if any $remote = Remote_profile::staticGet('id', $this->id); - if (!empty($remote)) { $uri = $remote->uri; } - - Event::handle('EndGetProfileUri', array($this, &$uri)); } + Event::handle('EndGetProfileUri', array($this, &$uri)); } return $uri; |