]> git.mxchange.org Git - friendica-addons.git/blobdiff - geocoordinates/geocoordinates.php
Move Notify::TYPE_COMMENT
[friendica-addons.git] / geocoordinates / geocoordinates.php
index b91cdab131aaa0c9f6350569ea3b3796306631f6..7a7a6d9ade1c4b8fa9f7059f81c6bf308cc73a14 100644 (file)
@@ -5,8 +5,6 @@
  * Version: 0.1
  * Author: Michael Vogel <https://pirati.ca/profile/heluecht>
  */
-use Friendica\Core\Cache;
-use Friendica\Core\Config;
 use Friendica\Core\Hook;
 use Friendica\Core\Logger;
 use Friendica\Core\Renderer;
@@ -32,11 +30,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 +46,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 +76,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)
@@ -93,17 +91,17 @@ function geocoordinates_addon_admin(&$a, &$o)
 
        $o = Renderer::replaceMacros($t, [
                '$submit' => DI::l10n()->t('Save Settings'),
-               '$api_key' => ['api_key', DI::l10n()->t('API Key'), Config::get('geocoordinates', 'api_key'), ''],
-               '$language' => ['language', DI::l10n()->t('Language code (IETF format)'), Config::get('geocoordinates', 'language'), ''],
+               '$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'), ''],
        ]);
 }
 
 function geocoordinates_addon_admin_post(&$a)
 {
        $api_key  = (!empty($_POST['api_key']) ? Strings::escapeTags(trim($_POST['api_key']))   : '');
-       Config::set('geocoordinates', 'api_key', $api_key);
+       DI::config()->set('geocoordinates', 'api_key', $api_key);
 
        $language  = (!empty($_POST['language']) ? Strings::escapeTags(trim($_POST['language']))   : '');
-       Config::set('geocoordinates', 'language', $language);
+       DI::config()->set('geocoordinates', 'language', $language);
        info(DI::l10n()->t('Settings updated.') . EOL);
 }