]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
make an URL for a geonames location
authorEvan Prodromou <evan@status.net>
Thu, 29 Oct 2009 19:07:26 +0000 (15:07 -0400)
committerEvan Prodromou <evan@status.net>
Thu, 29 Oct 2009 19:07:26 +0000 (15:07 -0400)
plugins/GeonamesPlugin.php

index 745cd4126f80463a347c327a77694550b56292e4..80ef44cc9693d67244289d4ae251aa8dba135204 100644 (file)
@@ -278,4 +278,28 @@ class GeonamesPlugin extends Plugin
 
         return true;
     }
+
+    /**
+     * Human-readable name for a location
+     *
+     * Given a location, we try to retrieve a geonames.org URL.
+     *
+     * @param Location $location Location to get the url for
+     * @param string   &$url     Place to put the url
+     *
+     * @return boolean whether to continue
+     */
+
+    function onLocationUrl($location, &$url)
+    {
+        if ($location->location_ns != self::NAMESPACE) {
+            // It's not one of our IDs... keep processing
+            return true;
+        }
+
+        $url = 'http://www.geonames.org/' . $location->location_id;
+
+        // it's been filled, so don't process further.
+        return false;
+    }
 }