summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-09-01 16:15:22 -0400
committerEvan Prodromou <evan@status.net>2010-09-01 16:15:22 -0400
commit7bec455a2120607a0aacb8be03cd60372cc5d0c1 (patch)
treea56075a86b36a04dd329e13cd08c57d2b8607cd0 /classes
parentc82b1cda825f3b84e3c3bef5474eccf8963b0475 (diff)
Static method to get a profile based on an URI
Diffstat (limited to 'classes')
-rw-r--r--classes/Profile.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/classes/Profile.php b/classes/Profile.php
index d7617f0b7..87cfab0e0 100644
--- a/classes/Profile.php
+++ b/classes/Profile.php
@@ -960,4 +960,24 @@ class Profile extends Memcached_DataObject
return $feed;
}
+
+ static function fromURI($uri)
+ {
+ $profile = null;
+
+ if (Event::handle('StartGetProfileFromURI', array($uri, &$profile))) {
+ // Get a local user or remote (OMB 0.1) profile
+ $user = User::staticGet('uri', $uri);
+ if (!empty($user)) {
+ $profile = $user->getProfile();
+ } else {
+ $remote_profile = Remote_profile::staticGet('uri', $uri);
+ if (!empty($remote_profile)) {
+ $profile = Profile::staticGet('id', $remote_profile->profile_id);
+ }
+ }
+ Event::handle('EndGetProfileFromURI', array($uri, $profile));
+ }
+
+ }
}