X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=openstreetmap%2Fopenstreetmap.php;h=5df1c7d7d42db85428c9701d1c46e796dc08f2d0;hb=b11e418f3570a5a61bab3fb3bc2660b92635b108;hp=ab6ec27fc9987ceb2ddcbcca01204d123125e90d;hpb=7aa076074252cac1a7e6fa0bc5e667e1dfbc2e6c;p=friendica-addons.git
diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php
index ab6ec27f..5df1c7d7 100644
--- a/openstreetmap/openstreetmap.php
+++ b/openstreetmap/openstreetmap.php
@@ -9,12 +9,12 @@
*
*/
-use Friendica\Core\Cache;
-use Friendica\Core\Config;
+use Friendica\DI;
+use Friendica\Core\Cache\Duration;
use Friendica\Core\Hook;
-use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
+use Friendica\Util\ConfigFileLoader;
use Friendica\Util\Network;
use Friendica\Util\Strings;
@@ -47,15 +47,15 @@ function openstreetmap_uninstall()
Logger::log("removed openstreetmap");
}
-function openstreetmap_load_config(\Friendica\App $a, Config\ConfigCacheLoader $loader)
+function openstreetmap_load_config(\Friendica\App $a, ConfigFileLoader $loader)
{
- $a->getConfig()->loadConfigArray($loader->loadAddonConfig('openstreetmap'));
+ $a->getConfigCache()->load($loader->loadAddonConfig('openstreetmap'));
}
function openstreetmap_alterheader($a, &$navHtml)
{
- $addScriptTag = '' . "\r\n";
- $a->page['htmlhead'] .= $addScriptTag;
+ $addScriptTag = '' . "\r\n";
+ DI::page()['htmlhead'] .= $addScriptTag;
}
/**
@@ -81,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)) {
@@ -119,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)) {
@@ -129,13 +129,13 @@ function openstreetmap_get_coordinates($a, &$b)
$args = '?q=' . urlencode($b['location']) . '&format=json';
$cachekey = "openstreetmap:" . $b['location'];
- $j = Cache::get($cachekey);
+ $j = DI::cache()->get($cachekey);
if (is_null($j)) {
$curlResult = Network::curl($nomserver . $args);
if ($curlResult->isSuccess()) {
$j = json_decode($curlResult->getBody(), true);
- Cache::set($cachekey, $j, Cache::MONTH);
+ DI::cache()->set($cachekey, $j, Duration::MONTH);
}
}
@@ -156,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($a->getBaseURL(true), 'https:') !== false) {
+ 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);
@@ -177,7 +177,7 @@ function openstreetmap_generate_map(&$a, &$b)
$cardlink .= '?mlat=' . $lat . '&mlon=' . $lon;
}
- $cardlink .= '#map=' . $zoom . '/' . $lat . '/' . $lon . '">' . ($b['location'] ? Strings::escapeHtml($b['location']) : L10n::t('View Larger')) . '';
+ $cardlink .= '#map=' . $zoom . '/' . $lat . '/' . $lon . '">' . ($b['location'] ? Strings::escapeHtml($b['location']) : DI::l10n()->t('View Larger')) . '';
if (empty($b['mode'])) {
$b['html'] = '