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>
10 require_once('include/cache.php');
13 function googlemaps_install() {
14 register_hook('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location');
16 logger("installed googlemaps");
19 function googlemaps_uninstall() {
20 unregister_hook('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location');
22 logger("removed googlemaps");
25 function googlemaps_location($a, &$item) {
27 if(! (strlen($item['location']) || strlen($item['coord'])))
30 if ($item['coord'] != "")
31 $target = "http://maps.google.com/?q=".urlencode($item['coord']);
33 $target = "http://maps.google.com/?q=".urlencode($item['location']);
35 if ($item['location'] != "")
36 $title = $item['location'];
38 $title = $item['coord'];
40 $item['html'] = '<a target="map" title="'.$title.'" href= "'.$target.'">'.$title.'</a>';