X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=gnot%2Fgnot.php;h=2168f97a2f17b3b8baaccd963639810f9e755c18;hb=d74c5ff0f91a63c014173dca147f07cc4d5c0240;hp=3cab85393c127647aba4bdc9f4a2cd90620fbc26;hpb=2d745b11d762ceb10f8d621cbbcb6fd25791dbaa;p=friendica-addons.git diff --git a/gnot/gnot.php b/gnot/gnot.php index 3cab8539..2168f97a 100644 --- a/gnot/gnot.php +++ b/gnot/gnot.php @@ -7,16 +7,17 @@ * * */ -use Friendica\Core\Addon; +use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; function gnot_install() { - Addon::registerHook('addon_settings', 'addon/gnot/gnot.php', 'gnot_settings'); - Addon::registerHook('addon_settings_post', 'addon/gnot/gnot.php', 'gnot_settings_post'); - Addon::registerHook('enotify_mail', 'addon/gnot/gnot.php', 'gnot_enotify_mail'); + Hook::register('addon_settings', 'addon/gnot/gnot.php', 'gnot_settings'); + Hook::register('addon_settings_post', 'addon/gnot/gnot.php', 'gnot_settings_post'); + Hook::register('enotify_mail', 'addon/gnot/gnot.php', 'gnot_enotify_mail'); Logger::log("installed gnot"); } @@ -24,9 +25,9 @@ function gnot_install() { function gnot_uninstall() { - Addon::unregisterHook('addon_settings', 'addon/gnot/gnot.php', 'gnot_settings'); - Addon::unregisterHook('addon_settings_post', 'addon/gnot/gnot.php', 'gnot_settings_post'); - Addon::unregisterHook('enotify_mail', 'addon/gnot/gnot.php', 'gnot_enotify_mail'); + 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"); @@ -44,7 +45,7 @@ function gnot_uninstall() { */ function gnot_settings_post($a,$post) { - if(! local_user() || (! x($_POST,'gnot-submit'))) + if(! local_user() || empty($_POST['gnot-submit'])) return; PConfig::set(local_user(),'gnot','enable',intval($_POST['gnot'])); @@ -76,20 +77,16 @@ function gnot_settings(&$a,&$s) { $gnot_checked = (($gnot) ? ' checked="checked" ' : '' ); + $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/gnot/'); /* Add some HTML to the existing form */ - $s .= '
'; - $s .= '

' . L10n::t('Gnot Settings') . '

'; - $s .= '
'; - $s .= '
' . L10n::t("Allows threading of email comment notifications on Gmail and anonymising the subject line.") . '
'; - $s .= ''; - $s .= ''; - $s .= '
'; - - /* provide a submit button */ - - $s .= '
'; - + $s .= Renderer::replaceMacros($t, [ + '$title' => L10n::t('Gnot Settings') , + '$submit' => L10n::t('Save Settings'), + '$enable' => L10n::t('Enable this addon?'), + '$enabled' => $gnot_checked, + '$text' => L10n::t("Allows threading of email comment notifications on Gmail and anonymising the subject line.") + ]); }