summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-10-29 14:49:00 -0400
committerEvan Prodromou <evan@status.net>2009-10-29 14:49:00 -0400
commita6ed4e5bf7e7c15bc649c91451bbe7b6aa1f0735 (patch)
tree93cc7d2157a2cc3721e14ac4ae023668d0cee2c9 /lib
parent5d2b35cce6bbe8a760f273093b6a105a930f83fb (diff)
a location method for getting an URL
Diffstat (limited to 'lib')
-rw-r--r--lib/location.php38
1 files changed, 34 insertions, 4 deletions
diff --git a/lib/location.php b/lib/location.php
index 048554f0f..c9411b55d 100644
--- a/lib/location.php
+++ b/lib/location.php
@@ -47,10 +47,11 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
class Location
{
- public $lat;
- public $lon;
- public $location_id;
- public $location_ns;
+ public $lat;
+ public $lon;
+ public $location_id;
+ public $location_ns;
+ private $_url;
var $names = array();
@@ -157,4 +158,33 @@ class Location
}
}
}
+
+ /**
+ * Get an URL suitable for this location
+ *
+ * @return string URL for this location or NULL
+ */
+
+ function getURL()
+ {
+ if ($this->_url == false) { // cached failure
+ return null;
+ } else if (is_string($this->_url)) { // cached value
+ return $this->_url;
+ }
+
+ $url = null;
+
+ Event::handle('LocationUrl', array($this, &$url));
+
+ // Save it for later
+
+ if (is_null($url)) {
+ $this->_url = false;
+ } else {
+ $this->_url = $url;
+ }
+
+ return $this->_url;
+ }
}