summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
+ }
}