]> git.mxchange.org Git - friendica-addons.git/blobdiff - geocoordinates/geocoordinates.php
Move Config::get() to DI::config()->get()
[friendica-addons.git] / geocoordinates / geocoordinates.php
index 77bfa8e6e9f89759d02da18dbfd18ad4f824d3a1..fbb89d1c4a88bc517ab4d09d6cf7afa779671161 100644 (file)
@@ -8,9 +8,9 @@
 use Friendica\Core\Cache;
 use Friendica\Core\Config;
 use Friendica\Core\Hook;
-use Friendica\Core\L10n;
 use Friendica\Core\Logger;
 use Friendica\Core\Renderer;
+use Friendica\DI;
 use Friendica\Util\Network;
 use Friendica\Util\Strings;
 
@@ -32,11 +32,11 @@ function geocoordinates_resolve_item(&$item)
        if((!$item["coord"]) || ($item["location"]))
                return;
 
-       $key = Config::get("geocoordinates", "api_key");
+       $key = DI::config()->get("geocoordinates", "api_key");
        if ($key == "")
                return;
 
-       $language = Config::get("geocoordinates", "language");
+       $language = DI::config()->get("geocoordinates", "language");
        if ($language == "")
                $language = "de";
 
@@ -48,7 +48,7 @@ function geocoordinates_resolve_item(&$item)
        $coords[0] = round($coords[0], 5);
        $coords[1] = round($coords[1], 5);
 
-       $result = Cache::get("geocoordinates:".$language.":".$coords[0]."-".$coords[1]);
+       $result = DI::cache()->get("geocoordinates:".$language.":".$coords[0]."-".$coords[1]);
        if (!is_null($result)) {
                $item["location"] = $result;
                return;
@@ -78,7 +78,7 @@ function geocoordinates_resolve_item(&$item)
        Logger::log("Got location for coordinates ".$coords[0]."-".$coords[1].": ".$item["location"], Logger::DEBUG);
 
        if ($item["location"] != "")
-               Cache::set("geocoordinates:".$language.":".$coords[0]."-".$coords[1], $item["location"]);
+               DI::cache()->set("geocoordinates:".$language.":".$coords[0]."-".$coords[1], $item["location"]);
 }
 
 function geocoordinates_post_hook($a, &$item)
@@ -92,9 +92,9 @@ function geocoordinates_addon_admin(&$a, &$o)
        $t = Renderer::getMarkupTemplate("admin.tpl", "addon/geocoordinates/");
 
        $o = Renderer::replaceMacros($t, [
-               '$submit' => L10n::t('Save Settings'),
-               '$api_key' => ['api_key', L10n::t('API Key'), Config::get('geocoordinates', 'api_key'), ''],
-               '$language' => ['language', L10n::t('Language code (IETF format)'), Config::get('geocoordinates', 'language'), ''],
+               '$submit' => DI::l10n()->t('Save Settings'),
+               '$api_key' => ['api_key', DI::l10n()->t('API Key'), DI::config()->get('geocoordinates', 'api_key'), ''],
+               '$language' => ['language', DI::l10n()->t('Language code (IETF format)'), DI::config()->get('geocoordinates', 'language'), ''],
        ]);
 }
 
@@ -105,5 +105,5 @@ function geocoordinates_addon_admin_post(&$a)
 
        $language  = (!empty($_POST['language']) ? Strings::escapeTags(trim($_POST['language']))   : '');
        Config::set('geocoordinates', 'language', $language);
-       info(L10n::t('Settings updated.'). EOL);
+       info(DI::l10n()->t('Settings updated.') . EOL);
 }