use Friendica\Core\System;
use Friendica\Util\Network;
-const OSM_TMS = 'http://www.openstreetmap.org';
-const OSM_NOM = 'http://nominatim.openstreetmap.org/search.php';
+const OSM_TMS = 'https://www.openstreetmap.org';
+const OSM_NOM = 'https://nominatim.openstreetmap.org/search.php';
const OSM_ZOOM = 16;
const OSM_MARKER = 0;
function openstreetmap_install()
{
+ Addon::registerHook('load_config', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_load_config');
Addon::registerHook('render_location', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_location');
Addon::registerHook('generate_map', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_generate_map');
Addon::registerHook('generate_named_map', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_generate_named_map');
function openstreetmap_uninstall()
{
+ Addon::unregisterHook('load_config', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_load_config');
Addon::unregisterHook('render_location', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_location');
Addon::unregisterHook('generate_map', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_generate_map');
Addon::unregisterHook('generate_named_map', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_generate_named_map');
logger("removed openstreetmap");
}
-function openstreetmap_alterheader($a, &$navHtml) {
+function openstreetmap_load_config(\Friendica\App $a)
+{
+ $a->loadConfigFile(__DIR__. '/config/openstreetmap.ini.php');
+}
+
+function openstreetmap_alterheader($a, &$navHtml)
+{
$addScriptTag = '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/openstreetmap/openstreetmap.js"></script>' . "\r\n";
$a->page['htmlhead'] .= $addScriptTag;
}
*
* If an item has coordinates add link to a tile map server, e.g. openstreetmap.org.
* If an item has a location open it with the help of OSM's Nominatim reverse geocode search.
- *
+ *
* @param mixed $a
* @param array& $item
*/
{
if (!(strlen($item['location']) || strlen($item['coord']))) {
return;
+ }
/*
* Get the configuration variables from the config.
}
}
- if ($target == "")
+ if (empty($target)) {
$target = $nomserver.'?q='.urlencode($item['location']);
+ }
- if ($item['location'] != "")
+ if ($item['location'] != "") {
$title = $item['location'];
- else
+ } else {
$title = $item['coord'];
+ }
$item['html'] = '<a target="map" title="'.$title.'" href= "'.$target.'">'.$title.'</a>';
}
info(L10n::t('Settings updated.') . EOL);
}
-
-