4 * Description: Use Google Maps for displaying locations. After activation the post location just beneath your avatar in your posts will link to Google Maps.
6 * Author: Michael Vogel <https://pirati.ca/profile/heluecht>
9 use Friendica\Core\Hook;
10 use Friendica\Core\Logger;
12 function googlemaps_install()
14 Hook::register('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location');
16 Logger::log("installed googlemaps");
19 function googlemaps_uninstall()
21 Hook::unregister('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location');
23 Logger::log("removed googlemaps");
26 function googlemaps_location($a, &$item)
29 if(! (strlen($item['location']) || strlen($item['coord']))) {
33 if ($item['coord'] != ""){
34 $target = "http://maps.google.com/?q=".urlencode($item['coord']);
36 $target = "http://maps.google.com/?q=".urlencode($item['location']);
39 if ($item['location'] != "") {
40 $title = $item['location'];
42 $title = $item['coord'];
45 $item['html'] = '<a target="map" title="'.$title.'" href= "'.$target.'">'.$title.'</a>';