[twitter] Fix contact image handling in twitter_fetch_contact
[friendica-addons.git/.git] / discourse / discourse.php
index 262ee55..f684425 100644 (file)
@@ -9,14 +9,12 @@
  */
 use Friendica\App;
 use Friendica\Core\Hook;
-use Friendica\Core\L10n;
 use Friendica\Core\Logger;
-use Friendica\Core\PConfig;
 use Friendica\Core\Renderer;
 use Friendica\Core\Protocol;
 use Friendica\Database\DBA;
+use Friendica\DI;
 use Friendica\Model\Contact;
-use Friendica\Util\XML;
 use Friendica\Content\Text\Markdown;
 use Friendica\Util\Network;
 use Friendica\Util\Strings;
@@ -44,13 +42,13 @@ function discourse_settings(App $a, &$s)
                return;
        }
 
-       $enabled = intval(PConfig::get(local_user(), 'discourse', 'enabled'));
+       $enabled = intval(DI::pConfig()->get(local_user(), 'discourse', 'enabled'));
 
        $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/discourse/');
        $s .= Renderer::replaceMacros($t, [
-               '$title'   => L10n::t('Discourse'),
-               '$enabled' => ['enabled', L10n::t('Enable processing of Discourse mailing list mails'), $enabled, L10n::t('If enabled, incoming mails from Discourse will be improved so they look much better. To make it work, you have to configure the e-mail settings in Friendica. You also have to enable the mailing list mode in Discourse. Then you have to add the Discourse mail account as contact.')],
-               '$submit'  => L10n::t('Save Settings'),
+               '$title'   => DI::l10n()->t('Discourse'),
+               '$enabled' => ['enabled', DI::l10n()->t('Enable processing of Discourse mailing list mails'), $enabled, DI::l10n()->t('If enabled, incoming mails from Discourse will be improved so they look much better. To make it work, you have to configure the e-mail settings in Friendica. You also have to enable the mailing list mode in Discourse. Then you have to add the Discourse mail account as contact.')],
+               '$submit'  => DI::l10n()->t('Save Settings'),
        ]);
 }
 
@@ -60,7 +58,7 @@ function discourse_settings_post(App $a)
                 return;
         }
 
-       PConfig::set(local_user(), 'discourse', 'enabled', intval($_POST['enabled']));
+       DI::pConfig()->set(local_user(), 'discourse', 'enabled', intval($_POST['enabled']));
 }
 
 function discourse_email_getmessage(App $a, &$message)
@@ -69,7 +67,7 @@ function discourse_email_getmessage(App $a, &$message)
                return;
        }
 
-       if (!PConfig::get($message['item']['uid'], 'discourse', 'enabled')) {
+       if (!DI::pConfig()->get($message['item']['uid'], 'discourse', 'enabled')) {
                return;
        }