X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=numfriends%2Fnumfriends.php;h=247c7dc7593e98aa9fa66e4ba42c12e12b7cd55c;hb=c48776586093e178c9ea94183e44b978456bebf1;hp=98295bfbb2e332b8cdc3d298c1ddf8ad01cebaf0;hpb=be1342fe5dee55f30f4c83d2da5cdc4f5bc46b16;p=friendica-addons.git diff --git a/numfriends/numfriends.php b/numfriends/numfriends.php index 98295bfb..247c7dc7 100644 --- a/numfriends/numfriends.php +++ b/numfriends/numfriends.php @@ -4,16 +4,15 @@ * Description: Change number of contacts shown of profile sidebar * Version: 1.0 * Author: Mike Macgirvin - * - * */ - +use Friendica\Core\Addon; +use Friendica\Core\L10n; use Friendica\Core\PConfig; function numfriends_install() { - register_hook('plugin_settings', 'addon/numfriends/numfriends.php', 'numfriends_settings'); - register_hook('plugin_settings_post', 'addon/numfriends/numfriends.php', 'numfriends_settings_post'); + Addon::registerHook('addon_settings', 'addon/numfriends/numfriends.php', 'numfriends_settings'); + Addon::registerHook('addon_settings_post', 'addon/numfriends/numfriends.php', 'numfriends_settings_post'); logger("installed numfriends"); } @@ -21,15 +20,13 @@ function numfriends_install() { function numfriends_uninstall() { - unregister_hook('plugin_settings', 'addon/numfriends/numfriends.php', 'numfriends_settings'); - unregister_hook('plugin_settings_post', 'addon/numfriends/numfriends.php', 'numfriends_settings_post'); + Addon::unregisterHook('addon_settings', 'addon/numfriends/numfriends.php', 'numfriends_settings'); + Addon::unregisterHook('addon_settings_post', 'addon/numfriends/numfriends.php', 'numfriends_settings_post'); logger("removed numfriends"); } - - /** * * Callback from the settings post function. @@ -38,25 +35,21 @@ function numfriends_uninstall() { * and if so set our configuration setting for this person. * */ - function numfriends_settings_post($a,$post) { if(! local_user() || (! x($_POST,'numfriends-submit'))) return; PConfig::set(local_user(),'system','display_friend_count',intval($_POST['numfriends'])); - info( t('Numfriends settings updated.') . EOL); + info( L10n::t('Numfriends settings updated.') . EOL); } /** * - * Called from the Plugin Setting form. + * Called from the Addon Setting form. * Add our own settings info to the page. * */ - - - function numfriends_settings(&$a, &$s) { if (! local_user()) { @@ -74,13 +67,13 @@ function numfriends_settings(&$a, &$s) /* Add some HTML to the existing form */ $s .= '
'; - $s .= '

' . t('Numfriends Settings') . '

'; + $s .= '

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

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