X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=gnot%2Fgnot.php;h=ca32d6d5e6134ef932ee2d713e13a1d2b4ca1b4d;hb=3157c99ea7c281286ddbf711f4bc1ef62de25ca4;hp=c89b3aba81b3f2296bb6e02ef5430ae7386bd15a;hpb=8504f2e9997e83c19d76a01a4fdbafd480b0926d;p=friendica-addons.git diff --git a/gnot/gnot.php b/gnot/gnot.php index c89b3aba..ca32d6d5 100644 --- a/gnot/gnot.php +++ b/gnot/gnot.php @@ -7,12 +7,12 @@ * * */ + 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\Model\Notification; function gnot_install() { @@ -23,19 +23,6 @@ function gnot_install() { Logger::log("installed gnot"); } - -function gnot_uninstall() { - - Hook::unregister('addon_settings', 'addon/gnot/gnot.php', 'gnot_settings'); - Hook::unregister('addon_settings_post', 'addon/gnot/gnot.php', 'gnot_settings_post'); - Hook::unregister('enotify_mail', 'addon/gnot/gnot.php', 'gnot_enotify_mail'); - - - Logger::log("removed gnot"); -} - - - /** * * Callback from the settings post function. @@ -49,8 +36,7 @@ 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'])); } @@ -74,7 +60,7 @@ function gnot_settings(&$a,&$s) { /* 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 +68,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']); + if($b['type'] == Notification\Type::COMMENT) + $b['subject'] = DI::l10n()->t('[Friendica:Notify] Comment to conversation #%d', $b['parent']); }