X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=openstreetmap%2Fopenstreetmap.php;h=5df1c7d7d42db85428c9701d1c46e796dc08f2d0;hb=b11e418f3570a5a61bab3fb3bc2660b92635b108;hp=a4aafcd38597bbadf7add59e8622b77190665a46;hpb=f2fc22227a0dfae8f5c85f24f1c5bfa6e5c4c245;p=friendica-addons.git
diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php
index a4aafcd3..5df1c7d7 100644
--- a/openstreetmap/openstreetmap.php
+++ b/openstreetmap/openstreetmap.php
@@ -11,7 +11,6 @@
use Friendica\DI;
use Friendica\Core\Cache\Duration;
-use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
@@ -82,10 +81,10 @@ function openstreetmap_location($a, &$item)
* ?mlat=lat&mlon=lon for markers.
*/
- $tmsserver = Config::get('openstreetmap', 'tmsserver', OSM_TMS);
- $nomserver = Config::get('openstreetmap', 'nomserver', OSM_NOM);
- $zoom = Config::get('openstreetmap', 'zoom', OSM_ZOOM);
- $marker = Config::get('openstreetmap', 'marker', OSM_MARKER);
+ $tmsserver = DI::config()->get('openstreetmap', 'tmsserver', OSM_TMS);
+ $nomserver = DI::config()->get('openstreetmap', 'nomserver', OSM_NOM);
+ $zoom = DI::config()->get('openstreetmap', 'zoom', OSM_ZOOM);
+ $marker = DI::config()->get('openstreetmap', 'marker', OSM_MARKER);
// This is needed since we stored an empty string in the config in previous versions
if (empty($nomserver)) {
@@ -120,7 +119,7 @@ function openstreetmap_location($a, &$item)
function openstreetmap_get_coordinates($a, &$b)
{
- $nomserver = Config::get('openstreetmap', 'nomserver', OSM_NOM);
+ $nomserver = DI::config()->get('openstreetmap', 'nomserver', OSM_NOM);
// This is needed since we stored an empty string in the config in previous versions
if (empty($nomserver)) {
@@ -157,14 +156,14 @@ function openstreetmap_generate_named_map(&$a, &$b)
function openstreetmap_generate_map(&$a, &$b)
{
- $tmsserver = Config::get('openstreetmap', 'tmsserver', OSM_TMS);
+ $tmsserver = DI::config()->get('openstreetmap', 'tmsserver', OSM_TMS);
if (strpos(DI::baseUrl()->get(true), 'https:') !== false) {
$tmsserver = str_replace('http:','https:',$tmsserver);
}
- $zoom = Config::get('openstreetmap', 'zoom', OSM_ZOOM);
- $marker = Config::get('openstreetmap', 'marker', OSM_MARKER);
+ $zoom = DI::config()->get('openstreetmap', 'zoom', OSM_ZOOM);
+ $marker = DI::config()->get('openstreetmap', 'marker', OSM_MARKER);
$lat = $b['lat']; // round($b['lat'], 5);
$lon = $b['lon']; // round($b['lon'], 5);
@@ -194,10 +193,10 @@ function openstreetmap_generate_map(&$a, &$b)
function openstreetmap_addon_admin(&$a, &$o)
{
$t = Renderer::getMarkupTemplate("admin.tpl", "addon/openstreetmap/");
- $tmsserver = Config::get('openstreetmap', 'tmsserver', OSM_TMS);
- $nomserver = Config::get('openstreetmap', 'nomserver', OSM_NOM);
- $zoom = Config::get('openstreetmap', 'zoom', OSM_ZOOM);
- $marker = Config::get('openstreetmap', 'marker', OSM_MARKER);
+ $tmsserver = DI::config()->get('openstreetmap', 'tmsserver', OSM_TMS);
+ $nomserver = DI::config()->get('openstreetmap', 'nomserver', OSM_NOM);
+ $zoom = DI::config()->get('openstreetmap', 'zoom', OSM_ZOOM);
+ $marker = DI::config()->get('openstreetmap', 'marker', OSM_MARKER);
// This is needed since we stored an empty string in the config in previous versions
if (empty($nomserver)) {
@@ -206,8 +205,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.')],
]);
@@ -220,10 +219,10 @@ function openstreetmap_addon_admin_post(&$a)
$zoom = ($_POST['zoom'] ?? '') ?: OSM_ZOOM;
$marker = ($_POST['marker'] ?? '') ?: OSM_MARKER;
- Config::set('openstreetmap', 'tmsserver', $urltms);
- Config::set('openstreetmap', 'nomserver', $urlnom);
- Config::set('openstreetmap', 'zoom', $zoom);
- Config::set('openstreetmap', 'marker', $marker);
+ DI::config()->set('openstreetmap', 'tmsserver', $urltms);
+ 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);
}