public $location_id;
public $location_ns;
private $_url;
+ private $_rdfurl;
var $names = array();
static function fromId($id, $ns, $language=null)
{
+ if (is_null($language)) {
+ $language = common_language();
+ }
+
$location = null;
// Let a third-party handle it
function getURL()
{
- if ($this->_url == false) { // cached failure
- return null;
- } else if (is_string($this->_url)) { // cached value
+ // Keep one cached
+
+ if (is_string($this->_url)) {
return $this->_url;
}
Event::handle('LocationUrl', array($this, &$url));
- // Save it for later
+ $this->_url = $url;
- if (is_null($url)) {
- $this->_url = false;
- } else {
- $this->_url = $url;
+ return $url;
+ }
+
+ /**
+ * Get an URL for this location, suitable for embedding in RDF
+ *
+ * @return string URL for this location or NULL
+ */
+
+ function getRdfURL()
+ {
+ // Keep one cached
+
+ if (is_string($this->_rdfurl)) {
+ return $this->_rdfurl;
}
- return $this->_url;
+ $url = null;
+
+ Event::handle('LocationRdfUrl', array($this, &$url));
+
+ $this->_rdfurl = $url;
+
+ return $url;
}
}