]> git.mxchange.org Git - friendica-addons.git/blobdiff - googlemaps/googlemaps.php
Merge pull request #1154 from annando/blockbot2
[friendica-addons.git] / googlemaps / googlemaps.php
index 1a2a974f34aedce312560a598f33cf9c9ebce56b..5555ec5accfe624d25303c3536d04955f15f6125 100644 (file)
@@ -6,37 +6,34 @@
  * Author: Michael Vogel <https://pirati.ca/profile/heluecht>
  *
  */
-use Friendica\Core\Addon;
-use Friendica\Core\Cache;
+use Friendica\Core\Hook;
+use Friendica\Core\Logger;
 
 function googlemaps_install()
 {
-       Addon::registerHook('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location');
+       Hook::register('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location');
 
-       logger("installed googlemaps");
+       Logger::log("installed googlemaps");
 }
 
-function googlemaps_uninstall()
+function googlemaps_location($a, &$item)
 {
-       Addon::unregisterHook('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location');
 
-       logger("removed googlemaps");
-}
-
-function googlemaps_location($a, &$item) {
-
-       if(! (strlen($item['location']) || strlen($item['coord'])))
+       if(! (strlen($item['location']) || strlen($item['coord']))) {
                return;
+       }
 
-       if ($item['coord'] != "")
+       if ($item['coord'] != "")
                $target = "http://maps.google.com/?q=".urlencode($item['coord']);
-       else
+       } else {
                $target = "http://maps.google.com/?q=".urlencode($item['location']);
+       }
 
-       if ($item['location'] != "")
+       if ($item['location'] != "") {
                $title = $item['location'];
-       else
+       } else {
                $title = $item['coord'];
+       }
 
        $item['html'] = '<a target="map" title="'.$title.'" href= "'.$target.'">'.$title.'</a>';
 }