X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=gnot%2Fgnot.php;h=c7678a2185e8dbc0e08308e633df7d553980f7f6;hb=3e8eb868a67f40754c4dcaac9c14ab53f8ed1bab;hp=fcdc7319f1520205258a55ace1f84e27558c0693;hpb=dfa4cfc7cde6c6f755beae5818fe3eee99724c5c;p=friendica-addons.git diff --git a/gnot/gnot.php b/gnot/gnot.php old mode 100755 new mode 100644 index fcdc7319..c7678a21 --- a/gnot/gnot.php +++ b/gnot/gnot.php @@ -7,13 +7,15 @@ * * */ - +use Friendica\Core\Addon; +use Friendica\Core\L10n; +use Friendica\Core\PConfig; function gnot_install() { - register_hook('plugin_settings', 'addon/gnot/gnot.php', 'gnot_settings'); - register_hook('plugin_settings_post', 'addon/gnot/gnot.php', 'gnot_settings_post'); - register_hook('enotify_mail', 'addon/gnot/gnot.php', 'gnot_enotify_mail'); + 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'); logger("installed gnot"); } @@ -21,9 +23,9 @@ function gnot_install() { function gnot_uninstall() { - unregister_hook('plugin_settings', 'addon/gnot/gnot.php', 'gnot_settings'); - unregister_hook('plugin_settings_post', 'addon/gnot/gnot.php', 'gnot_settings_post'); - unregister_hook('enotify_mail', 'addon/gnot/gnot.php', 'gnot_enotify_mail'); + 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'); logger("removed gnot"); @@ -44,14 +46,14 @@ function gnot_settings_post($a,$post) { if(! local_user() || (! x($_POST,'gnot-submit'))) return; - set_pconfig(local_user(),'gnot','enable',intval($_POST['gnot'])); - info( t('Gnot settings updated.') . EOL); + PConfig::set(local_user(),'gnot','enable',intval($_POST['gnot'])); + info(L10n::t('Gnot settings updated.') . EOL); } /** * - * Called from the Plugin Setting form. + * Called from the Addon Setting form. * Add our own settings info to the page. * */ @@ -69,31 +71,30 @@ function gnot_settings(&$a,&$s) { /* Get the current state of our config variable */ - $gnot = intval(get_pconfig(local_user(),'gnot','enable')); + $gnot = intval(PConfig::get(local_user(),'gnot','enable')); $gnot_checked = (($gnot) ? ' checked="checked" ' : '' ); /* Add some HTML to the existing form */ $s .= '
'; - $s .= '

' . t('Gnot Settings') . '

'; + $s .= '

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

'; $s .= '
'; - $s .= '
' . t("Allows threading of email comment notifications on Gmail and anonymising the subject line.") . '
'; - $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 .= '
'; } function gnot_enotify_mail(&$a,&$b) { - if((! $b['uid']) || (! intval(get_pconfig($b['uid'], 'gnot','enable')))) + if((! $b['uid']) || (! intval(PConfig::get($b['uid'], 'gnot','enable')))) return; if($b['type'] == NOTIFY_COMMENT) - $b['subject'] = sprintf( t('[Friendica:Notify] Comment to conversation #%d'), $b['parent']); + $b['subject'] = L10n::t('[Friendica:Notify] Comment to conversation #%d', $b['parent']); } -