X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=openstreetmap%2Fopenstreetmap.php;h=168d3d2ff4bb71b5dc507d9045cad2f32ab256ac;hb=14c09c1bbba1324bd03f58d6af123ba53b29070c;hp=dd56b07c769af5dc3904b2ebca8173190fc13d14;hpb=75143e27b5d617887a757f6943b61fc88b69097e;p=friendica-addons.git
diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php
index dd56b07c..168d3d2f 100644
--- a/openstreetmap/openstreetmap.php
+++ b/openstreetmap/openstreetmap.php
@@ -9,14 +9,12 @@
*
*/
-use Friendica\DI;
use Friendica\Core\Cache\Duration;
-use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
+use Friendica\DI;
use Friendica\Util\ConfigFileLoader;
-use Friendica\Util\Network;
use Friendica\Util\Strings;
const OSM_TMS = 'https://www.openstreetmap.org';
@@ -36,18 +34,6 @@ function openstreetmap_install()
Logger::log("installed openstreetmap");
}
-function openstreetmap_uninstall()
-{
- Hook::unregister('load_config', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_load_config');
- Hook::unregister('render_location', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_location');
- Hook::unregister('generate_map', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_generate_map');
- Hook::unregister('generate_named_map', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_generate_named_map');
- Hook::unregister('Map::getCoordinates', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_get_coordinates');
- Hook::unregister('page_header', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_alterheader');
-
- Logger::log("removed openstreetmap");
-}
-
function openstreetmap_load_config(\Friendica\App $a, ConfigFileLoader $loader)
{
$a->getConfigCache()->load($loader->loadAddonConfig('openstreetmap'));
@@ -133,7 +119,7 @@ function openstreetmap_get_coordinates($a, &$b)
$j = DI::cache()->get($cachekey);
if (is_null($j)) {
- $curlResult = Network::curl($nomserver . $args);
+ $curlResult = DI::httpRequest()->get($nomserver . $args);
if ($curlResult->isSuccess()) {
$j = json_decode($curlResult->getBody(), true);
DI::cache()->set($cachekey, $j, Duration::MONTH);
@@ -206,8 +192,8 @@ function openstreetmap_addon_admin(&$a, &$o)
$o = Renderer::replaceMacros($t, [
'$submit' => DI::l10n()->t('Submit'),
- '$tmsserver' => ['tmsserver', DI::l10n()->t('Tile Server URL'), $tmsserver, DI::l10n()->t('A list of public tile servers')],
- '$nomserver' => ['nomserver', DI::l10n()->t('Nominatim (reverse geocoding) Server URL'), $nomserver, DI::l10n()->t('A list of Nominatim servers')],
+ '$tmsserver' => ['tmsserver', DI::l10n()->t('Tile Server URL'), $tmsserver, DI::l10n()->t('A list of public tile servers')],
+ '$nomserver' => ['nomserver', DI::l10n()->t('Nominatim (reverse geocoding) Server URL'), $nomserver, DI::l10n()->t('A list of Nominatim servers')],
'$zoom' => ['zoom', DI::l10n()->t('Default zoom'), $zoom, DI::l10n()->t('The default zoom level. (1:world, 18:highest, also depends on tile server)')],
'$marker' => ['marker', DI::l10n()->t('Include marker on map'), $marker, DI::l10n()->t('Include a marker on the map.')],
]);
@@ -224,6 +210,4 @@ function openstreetmap_addon_admin_post(&$a)
DI::config()->set('openstreetmap', 'nomserver', $urlnom);
DI::config()->set('openstreetmap', 'zoom', $zoom);
DI::config()->set('openstreetmap', 'marker', $marker);
-
- info(DI::l10n()->t('Settings updated.') . EOL);
}