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 /lib/location.php | |
parent | 7f5fbee2e36889fae1d1c5043d76625e197e39ea (diff) | |
parent | 24c3a15124ab866bf7e9401f638156e102074608 (diff) |
Merge commit 'mainline/0.9.x' into 0.9.x
Diffstat (limited to 'lib/location.php')
-rw-r--r-- | lib/location.php | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/lib/location.php b/lib/location.php index 048554f0f..bbfc15a36 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(); @@ -90,6 +91,10 @@ class Location static function fromId($id, $ns, $language=null) { + if (is_null($language)) { + $language = common_language(); + } + $location = null; // Let a third-party handle it @@ -157,4 +162,27 @@ class Location } } } + + /** + * Get an URL suitable for this location + * + * @return string URL for this location or NULL + */ + + function getURL() + { + // Keep one cached + + if (is_string($this->_url)) { + return $this->_url; + } + + $url = null; + + Event::handle('LocationUrl', array($this, &$url)); + + $this->_url = $url; + + return $url; + } } |