summaryrefslogtreecommitdiff
path: root/classes/Notice.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-10-29 14:43:18 -0400
committerEvan Prodromou <evan@status.net>2009-10-29 14:43:18 -0400
commite9644f03de3e30d46764ca0046ed29730cbe414e (patch)
tree3158ed53a05049d42b65ab84d175d159ae29ecae /classes/Notice.php
parentc911c66fe1ddb9fcea4a1817496f2efaffe26a98 (diff)
get location from a Notice
Diffstat (limited to 'classes/Notice.php')
-rw-r--r--classes/Notice.php17
1 files changed, 17 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;
+ }
}