]> git.mxchange.org Git - friendica-addons.git/blobdiff - geonames/geonames.php
Move Config::get() to DI::config()->get()
[friendica-addons.git] / geonames / geonames.php
index c052cef6bea1187db9e080e19ee5601b976f8197..8009a654ef17159f7a556c1c3bb2d0d67f74da75 100644 (file)
@@ -9,10 +9,9 @@
 use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\Hook;
-use Friendica\Core\L10n;
 use Friendica\Core\Logger;
-use Friendica\Core\PConfig;
 use Friendica\Core\Renderer;
+use Friendica\DI;
 use Friendica\Util\ConfigFileLoader;
 use Friendica\Util\Network;
 use Friendica\Util\XML;
@@ -65,8 +64,8 @@ function geonames_post_hook(App $a, array &$item)
 
        /* Retrieve our personal config setting */
 
-       $geo_account = Config::get('geonames', 'username');
-       $active = PConfig::get(local_user(), 'geonames', 'enable');
+       $geo_account = DI::config()->get('geonames', 'username');
+       $active = DI::pConfig()->get(local_user(), 'geonames', 'enable');
 
        if (!$geo_account || !$active) {
                return;
@@ -109,9 +108,9 @@ function geonames_addon_settings_post(App $a, array $post)
                return;
        }
 
-       PConfig::set(local_user(), 'geonames', 'enable', intval($_POST['geonames-enable']));
+       DI::pConfig()->set(local_user(), 'geonames', 'enable', intval($_POST['geonames-enable']));
 
-       info(L10n::t('Geonames settings updated.'));
+       info(DI::l10n()->t('Geonames settings updated.'));
 }
 
 /**
@@ -128,7 +127,7 @@ function geonames_addon_settings(App $a, &$s)
                return;
        }
 
-       $geo_account = Config::get('geonames', 'username');
+       $geo_account = DI::config()->get('geonames', 'username');
 
        if (!$geo_account) {
                return;
@@ -136,16 +135,16 @@ function geonames_addon_settings(App $a, &$s)
 
        /* Add our stylesheet to the page so we can make our settings look nice */
        $stylesheetPath = __DIR__ . '/geonames.css';
-       $a->registerStylesheet($stylesheetPath);
+       DI::page()->registerStylesheet($stylesheetPath);
 
        /* Get the current state of our config variable */
-       $enabled = intval(PConfig::get(local_user(), 'geonames', 'enable'));
+       $enabled = intval(DI::pConfig()->get(local_user(), 'geonames', 'enable'));
 
        $t = Renderer::getMarkupTemplate('settings.tpl', __DIR__);
        $s .= Renderer::replaceMacros($t, [
-               '$title' => L10n::t('Geonames Settings'),
-               '$description' => L10n::t('Replace numerical coordinates by the nearest populated location name in your posts.'),
-               '$enable' => ['geonames-enable', L10n::t('Enable Geonames Addon'), $enabled],
-               '$submit' => L10n::t('Save Settings')
+               '$title' => DI::l10n()->t('Geonames Settings'),
+               '$description' => DI::l10n()->t('Replace numerical coordinates by the nearest populated location name in your posts.'),
+               '$enable' => ['geonames-enable', DI::l10n()->t('Enable Geonames Addon'), $enabled],
+               '$submit' => DI::l10n()->t('Save Settings')
        ]);
 }