mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-06-07 09:54:27 +02:00
New plugin GoogleMaps, changed map format for OSM
This commit is contained in:
parent
0c8565c51b
commit
5dc30229d4
2 changed files with 57 additions and 22 deletions
41
googlemaps/googlemaps.php
Normal file
41
googlemaps/googlemaps.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
/**
|
||||
* Name: Google Maps
|
||||
* Description: Use Google Maps for displaying locations. After activation the post location just beneath your avatar in your posts will link to Google Maps.
|
||||
* Version: 0.1
|
||||
* Author: Michael Vogel <https://pirati.ca/profile/heluecht>
|
||||
*
|
||||
*/
|
||||
|
||||
require_once('include/cache.php');
|
||||
|
||||
|
||||
function googlemaps_install() {
|
||||
register_hook('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location');
|
||||
|
||||
logger("installed googlemaps");
|
||||
}
|
||||
|
||||
function googlemaps_uninstall() {
|
||||
unregister_hook('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location');
|
||||
|
||||
logger("removed googlemaps");
|
||||
}
|
||||
|
||||
function googlemaps_location($a, &$item) {
|
||||
|
||||
if(! (strlen($item['location']) || strlen($item['coord'])))
|
||||
return;
|
||||
|
||||
if ($item['coord'] != "")
|
||||
$target = "http://maps.google.com/?q=".urlencode($item['coord']);
|
||||
else
|
||||
$target = "http://maps.google.com/?q=".urlencode($item['location']);
|
||||
|
||||
if ($item['location'] != "")
|
||||
$title = $item['location'];
|
||||
else
|
||||
$title = $item['coord'];
|
||||
|
||||
$item['html'] = '<a target="map" title="'.$title.'" href= "'.$target.'">'.$title.'</a>';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue