mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-12 11:28:49 +00:00
Massive reworking of the export connectors using the plaintext function, improving of the tumblr export, option to prevent too short wordpress postings
This commit is contained in:
parent
8ce597cb4d
commit
021d6265cd
11 changed files with 191 additions and 880 deletions
|
@ -10,7 +10,7 @@
|
|||
|
||||
function openstreetmap_install() {
|
||||
register_hook('render_location', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_location');
|
||||
register_hook('page_header', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_alterheader');
|
||||
register_hook('page_header', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_alterheader');
|
||||
|
||||
logger("installed openstreetmap");
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ function openstreetmap_uninstall() {
|
|||
}
|
||||
|
||||
function openstreetmap_alterheader($a, &$navHtml) {
|
||||
$addScriptTag='<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/openstreetmap/openstreetmap.js' . '"></script>' . "\r\n";
|
||||
$addScriptTag='<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/openstreetmap/openstreetmap.js' . '"></script>' . "\r\n";
|
||||
$a->page['htmlhead'] .= $addScriptTag;
|
||||
}
|
||||
|
||||
|
@ -47,34 +47,34 @@ function openstreetmap_location($a, &$item) {
|
|||
$location = '';
|
||||
$coord = '';
|
||||
|
||||
|
||||
|
||||
if($item['location'] && !$item['coord'] && true){ //if only a location is given, find the lat-lon
|
||||
$geo_account='demo';
|
||||
|
||||
$s = fetch_url('http://api.geonames.org/search?maxRows=1&fuzzy=0.8&q=' . $item['location'] . '&username=' . $geo_account);
|
||||
|
||||
if($s){
|
||||
$xml = parse_xml_string($s);
|
||||
|
||||
if($xml->geoname->lat && $xml->geoname->lng){
|
||||
$item['coord'] = $xml->geoname->lat . ' ' . $xml->geoname->lng;
|
||||
}
|
||||
|
||||
$s = fetch_url('http://api.geonames.org/search?maxRows=1&fuzzy=0.8&q=' . $item['location'] . '&username=' . $geo_account);
|
||||
|
||||
if($s){
|
||||
$xml = parse_xml_string($s);
|
||||
|
||||
if($xml->geoname->lat && $xml->geoname->lng){
|
||||
$item['coord'] = $xml->geoname->lat.' '.$xml->geoname->lng;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$location = (($item['location']) ? '<a target="map" title="' . $item['location'] . '" href="'.$tmsserver.'?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : '');
|
||||
$location = (($item['location']) ? '<a target="map" title="'.$item['location'].'" href="'.$tmsserver.'?q='.urlencode($item['location']).'">'.$item['location'].'</a>' : '');
|
||||
|
||||
if($item['coord']) {
|
||||
$coords = explode(' ', $item['coord']);
|
||||
if(count($coords) > 1) {
|
||||
$coord = '<a target="map" class="OSMMapLink" title="' . $item['coord'] . '" href="'.$tmsserver.'?lat=' . urlencode($coords[0]) . '&lon=' . urlencode($coords[1]) . '&zoom='.$zoom.'"> Map </a>' ;
|
||||
$coord = '<a target="map" class="OSMMapLink" title="'.$item['coord'].'" href="'.$tmsserver.'?lat='.urlencode($coords[0]).'&lon=' . urlencode($coords[1]).'&zoom='.$zoom.'">'.t("Map").'</a>' ;
|
||||
}
|
||||
}
|
||||
if(strlen($coord)) {
|
||||
if($location)
|
||||
$location .= '<br /><span class="smalltext">(' . $coord . ')</span>';
|
||||
$location .= ' <span class="smalltext">('.$coord.')</span>';
|
||||
else
|
||||
$location = '<span class="smalltext">' . $coord . '</span>';
|
||||
$location = '<span class="smalltext">'.$coord.'</span>';
|
||||
}
|
||||
$item['html'] = $location;
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue