]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/location.php
??? Not callable?
[quix0rs-gnu-social.git] / lib / location.php
index c9411b55df5ebff2916caf3676768b85418c4835..191550d6d6ca53e213f4a13f3b6b8bd2fc763a65 100644 (file)
@@ -52,6 +52,7 @@ class Location
     public  $location_id;
     public  $location_ns;
     private $_url;
+    private $_rdfurl;
 
     var $names = array();
 
@@ -91,6 +92,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
@@ -167,9 +172,9 @@ class Location
 
     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;
         }
 
@@ -177,14 +182,31 @@ class Location
 
         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;
     }
 }