diff options
author | Brenda Wallace <shiny@cpan.org> | 2009-10-30 09:41:04 +1300 |
---|---|---|
committer | Brenda Wallace <shiny@cpan.org> | 2009-10-30 09:41:04 +1300 |
commit | c0f8c0178a3cccead97fb0800a514b0ac9dbde64 (patch) | |
tree | 9d2f26feccaa85e73a7bc4985a1f899d9b89f730 /classes | |
parent | 7f5fbee2e36889fae1d1c5043d76625e197e39ea (diff) | |
parent | 24c3a15124ab866bf7e9401f638156e102074608 (diff) |
Merge commit 'mainline/0.9.x' into 0.9.x
Diffstat (limited to 'classes')
-rw-r--r-- | classes/Notice.php | 17 | ||||
-rw-r--r-- | classes/Profile.php | 25 |
2 files changed, 42 insertions, 0 deletions
diff --git a/classes/Notice.php b/classes/Notice.php index fdf5cd4c8..c08a66790 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -1412,4 +1412,21 @@ class Notice extends Memcached_DataObject $contentlimit = self::maxContent(); return ($contentlimit > 0 && !empty($content) && (mb_strlen($content) > $contentlimit)); } + + 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); + } + } + + return $location; + } } 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; + } } |