3 * Name: Open Street Map
4 * Description: Use openstreetmap.org for displaying locations.
6 * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
12 function openstreetmap_install() {
14 register_hook('render_location', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_location');
16 logger("installed openstreetmap");
20 function openstreetmap_uninstall() {
22 unregister_hook('render_location', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_location');
24 logger("removed openstreetmap");
29 function openstreetmap_location($a, &$item) {
34 $location = (($item['location']) ? '<a target="map" title="' . $item['location'] . '" href="http://www.openstreetmap.org/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : '');
37 $coords = explode(' ', $item['coord']);
38 if(count($coords) > 1) {
39 $coord = '<a target="map" title="' . $item['coord'] . '" href="http://www.openstreetmap.org/?lat=' . urlencode($coords[0]) . '&lon=' . urlencode($coords[1]) . '&zoom=10">' . $item['coord'] . '</a>' ;
44 $location .= '<br /><span class="smalltext">(' . $coord . ')</span>';
46 $location = '<span class="smalltext">' . $coord . '</span>';
48 $item['html'] = $location;