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\Addon;
10 use Friendica\Core\Cache;
11 use Friendica\Core\Logger
13 function googlemaps_install()
15 Addon::registerHook('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location');
17 Logger::log("installed googlemaps");
20 function googlemaps_uninstall()
22 Addon::unregisterHook('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location');
24 Logger::log("removed googlemaps");
27 function googlemaps_location($a, &$item)
30 if(! (strlen($item['location']) || strlen($item['coord']))) {
34 if ($item['coord'] != ""){
35 $target = "http://maps.google.com/?q=".urlencode($item['coord']);
37 $target = "http://maps.google.com/?q=".urlencode($item['location']);
40 if ($item['location'] != "") {
41 $title = $item['location'];
43 $title = $item['coord'];
46 $item['html'] = '<a target="map" title="'.$title.'" href= "'.$target.'">'.$title.'</a>';