X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=googlemaps%2Fgooglemaps.php;h=f5b573ac5a29787d68e1fc74e6bb482e71171950;hb=d20e60ef9180ea7c0c921a03de5466a04b286565;hp=0b031f4da215b6ce10a1a07f43d4d4be94d34970;hpb=6d6e73096afb22e95678c651e055337f1bf5405d;p=friendica-addons.git diff --git a/googlemaps/googlemaps.php b/googlemaps/googlemaps.php index 0b031f4d..f5b573ac 100644 --- a/googlemaps/googlemaps.php +++ b/googlemaps/googlemaps.php @@ -7,35 +7,40 @@ * */ -require_once('include/cache.php'); +use Friendica\Core\Cache; - -function googlemaps_install() { +function googlemaps_install() +{ register_hook('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location'); logger("installed googlemaps"); } -function googlemaps_uninstall() { +function googlemaps_uninstall() +{ unregister_hook('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location'); logger("removed googlemaps"); } -function googlemaps_location($a, &$item) { +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'] = ''.$title.''; }