forked from GNUsocial/gnu-social
a location method for getting an URL
This commit is contained in:
parent
5d2b35cce6
commit
a6ed4e5bf7
@ -47,10 +47,11 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|||||||
|
|
||||||
class Location
|
class Location
|
||||||
{
|
{
|
||||||
public $lat;
|
public $lat;
|
||||||
public $lon;
|
public $lon;
|
||||||
public $location_id;
|
public $location_id;
|
||||||
public $location_ns;
|
public $location_ns;
|
||||||
|
private $_url;
|
||||||
|
|
||||||
var $names = array();
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user