X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=gnot%2Fgnot.php;h=686b1f65d3c204aad38a5cf6079043eb5ab513b2;hb=1357817fc38de7be7dc8ebffc1fa0961796fd32d;hp=ccc2c77a8967fd4657cd91199ad10bc87448ddbe;hpb=f8c162cbfb777793891f885e019eb8eae319dce1;p=friendica-addons.git diff --git a/gnot/gnot.php b/gnot/gnot.php index ccc2c77a..686b1f65 100644 --- a/gnot/gnot.php +++ b/gnot/gnot.php @@ -7,28 +7,29 @@ * * */ -use Friendica\Core\Addon; -use Friendica\Core\L10n; -use Friendica\Core\PConfig; +use Friendica\Core\Hook; +use Friendica\Core\Logger; +use Friendica\Core\Renderer; +use Friendica\DI; 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("installed gnot"); + Logger::log("installed gnot"); } 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("removed gnot"); + Logger::log("removed gnot"); } @@ -43,11 +44,11 @@ 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'])); - 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); } @@ -67,34 +68,30 @@ function gnot_settings(&$a,&$s) { /* Add our stylesheet to the page so we can make our settings look nice */ - $a->page['htmlhead'] .= '' . "\r\n"; + DI::page()['htmlhead'] .= '' . "\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" ' : '' ); + $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/gnot/'); /* Add some HTML to the existing form */ - $s .= '