X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=googlemaps%2Fgooglemaps.php;h=09a566e8b46b2071027cc85fe0cd678ac783b459;hb=7603b237998d7225839b4eeb565a5f25bdd5d5fb;hp=0b031f4da215b6ce10a1a07f43d4d4be94d34970;hpb=6d6e73096afb22e95678c651e055337f1bf5405d;p=friendica-addons.git diff --git a/googlemaps/googlemaps.php b/googlemaps/googlemaps.php index 0b031f4d..09a566e8 100644 --- a/googlemaps/googlemaps.php +++ b/googlemaps/googlemaps.php @@ -6,36 +6,41 @@ * Author: Michael Vogel * */ +use Friendica\Core\Hook; +use Friendica\Core\Logger; -require_once('include/cache.php'); +function googlemaps_install() +{ + Hook::register('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location'); - -function googlemaps_install() { - register_hook('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location'); - - logger("installed googlemaps"); + Logger::log("installed googlemaps"); } -function googlemaps_uninstall() { - unregister_hook('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location'); +function googlemaps_uninstall() +{ + Hook::unregister('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location'); - logger("removed googlemaps"); + Logger::log("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.''; }