X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=numfriends%2Fnumfriends.php;h=f12badeb40a5cd4f4811256c8c494c8b5343734a;hb=c7771ac8c3da73ee626be079df5d639767ff282e;hp=8bb4e74773528377f6b5b91be92d76a429ccf1bf;hpb=ffe5038102b53dc9e00ef0b52d33e27226d35f7f;p=friendica-addons.git diff --git a/numfriends/numfriends.php b/numfriends/numfriends.php index 8bb4e747..f12badeb 100644 --- a/numfriends/numfriends.php +++ b/numfriends/numfriends.php @@ -6,9 +6,8 @@ * Author: Mike Macgirvin */ use Friendica\Core\Hook; -use Friendica\Core\L10n; use Friendica\Core\Logger; -use Friendica\Core\PConfig; +use Friendica\DI; function numfriends_install() { @@ -18,16 +17,6 @@ function numfriends_install() { Logger::log("installed numfriends"); } - -function numfriends_uninstall() { - - Hook::unregister('addon_settings', 'addon/numfriends/numfriends.php', 'numfriends_settings'); - Hook::unregister('addon_settings_post', 'addon/numfriends/numfriends.php', 'numfriends_settings_post'); - - - Logger::log("removed numfriends"); -} - /** * * Callback from the settings post function. @@ -40,8 +29,7 @@ function numfriends_settings_post($a,$post) { if(! local_user() || empty($_POST['numfriends-submit'])) return; - PConfig::set(local_user(),'system','display_friend_count',intval($_POST['numfriends'])); - info( L10n::t('Numfriends settings updated.') . EOL); + DI::pConfig()->set(local_user(),'system','display_friend_count',intval($_POST['numfriends'])); } @@ -59,22 +47,22 @@ function numfriends_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 */ - $numfriends = PConfig::get(local_user(), 'system', 'display_friend_count', 24); + $numfriends = DI::pConfig()->get(local_user(), 'system', 'display_friend_count', 24); /* Add some HTML to the existing form */ $s .= '
'; - $s .= '

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

'; + $s .= '

' . DI::l10n()->t('Numfriends Settings') . '

'; $s .= '
'; - $s .= ''; + $s .= ''; $s .= ''; $s .= '
'; /* provide a submit button */ - $s .= '
'; + $s .= '
'; }