From: Evan Prodromou Date: Thu, 29 Oct 2009 18:43:18 +0000 (-0400) Subject: get location from a Notice X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e9644f03de3e30d46764ca0046ed29730cbe414e;p=quix0rs-gnu-social.git get location from a Notice --- diff --git a/classes/Notice.php b/classes/Notice.php index fdf5cd4c87..c08a66790f 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; + } }