summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-10-29 14:43:25 -0400
committerEvan Prodromou <evan@status.net>2009-10-29 14:43:25 -0400
commit5d2b35cce6bbe8a760f273093b6a105a930f83fb (patch)
tree06fdeb3ad4260ab57b22ee9195bb898b45786290 /classes
parente9644f03de3e30d46764ca0046ed29730cbe414e (diff)
get location from a Profile
Diffstat (limited to 'classes')
-rw-r--r--classes/Profile.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/classes/Profile.php b/classes/Profile.php
index 53d07fb2f..7c1e9db33 100644
--- a/classes/Profile.php
+++ b/classes/Profile.php
@@ -562,4 +562,29 @@ class Profile extends Memcached_DataObject
$block->blocked = $this->id;
$block->delete();
}
+
+ // XXX: identical to Notice::getLocation.
+
+ function getLocation()
+ {
+ $location = null;
+
+ if (!empty($this->location_id) && !empty($this->location_ns)) {
+ $location = Location::fromId($this->location_id, $this->location_ns);
+ }
+
+ if (is_null($location)) { // no ID, or Location::fromId() failed
+ if (!empty($this->lat) && !empty($this->lon)) {
+ $location = Location::fromLatLon($this->lat, $this->lon);
+ }
+ }
+
+ if (is_null($location)) { // still haven't found it!
+ if (!empty($this->location)) {
+ $location = Location::fromName($this->location);
+ }
+ }
+
+ return $location;
+ }
}