]> git.mxchange.org Git - friendica-addons.git/blobdiff - gnot/gnot.php
Merge pull request #948 from nupplaphil/task/di_config
[friendica-addons.git] / gnot / gnot.php
index 46012e5eaeadcb8eddbf2e93c95cd5c3fd12aa69..686b1f65d3c204aad38a5cf6079043eb5ab513b2 100644 (file)
@@ -8,9 +8,7 @@
  *
  */
 use Friendica\Core\Hook;
-use Friendica\Core\L10n;
 use Friendica\Core\Logger;
-use Friendica\Core\PConfig;
 use Friendica\Core\Renderer;
 use Friendica\DI;
 
@@ -49,8 +47,8 @@ function gnot_settings_post($a,$post) {
        if(! local_user() || empty($_POST['gnot-submit']))
                return;
 
-       PConfig::set(local_user(),'gnot','enable',intval($_POST['gnot']));
-       info(L10n::t('Gnot settings updated.') . EOL);
+       DI::pConfig()->set(local_user(),'gnot','enable',intval($_POST['gnot']));
+       info(DI::l10n()->t('Gnot settings updated.') . EOL);
 }
 
 
@@ -70,11 +68,11 @@ function gnot_settings(&$a,&$s) {
 
        /* Add our stylesheet to the page so we can make our settings look nice */
 
-       $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . DI::baseUrl()->get() . '/addon/gnot/gnot.css' . '" media="all" />' . "\r\n";
+       DI::page()['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . DI::baseUrl()->get() . '/addon/gnot/gnot.css' . '" media="all" />' . "\r\n";
 
        /* Get the current state of our config variable */
 
-       $gnot = intval(PConfig::get(local_user(),'gnot','enable'));
+       $gnot = intval(DI::pConfig()->get(local_user(),'gnot','enable'));
 
        $gnot_checked = (($gnot) ? ' checked="checked" ' : '' );
        
@@ -82,18 +80,18 @@ function gnot_settings(&$a,&$s) {
        /* Add some HTML to the existing form */
 
        $s .= Renderer::replaceMacros($t, [
-               '$title' => L10n::t('Gnot Settings') ,
-               '$submit' => L10n::t('Save Settings'),
-               '$enable' => L10n::t('Enable this addon?'),
+               '$title' => DI::l10n()->t('Gnot Settings') ,
+               '$submit' => DI::l10n()->t('Save Settings'),
+               '$enable' => DI::l10n()->t('Enable this addon?'),
                '$enabled' => $gnot_checked,
-               '$text' => L10n::t("Allows threading of email comment notifications on Gmail and anonymising the subject line.") 
+               '$text' => DI::l10n()->t("Allows threading of email comment notifications on Gmail and anonymising the subject line.")
        ]);
 }
 
 
 function gnot_enotify_mail(&$a,&$b) {
-       if((! $b['uid']) || (! intval(PConfig::get($b['uid'], 'gnot','enable'))))
+       if((! $b['uid']) || (! intval(DI::pConfig()->get($b['uid'], 'gnot','enable'))))
                return;
        if($b['type'] == NOTIFY_COMMENT)
-               $b['subject'] = L10n::t('[Friendica:Notify] Comment to conversation #%d', $b['parent']);
+               $b['subject'] = DI::l10n()->t('[Friendica:Notify] Comment to conversation #%d', $b['parent']);
 }