X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=planets%2Fplanets.php;h=9fed41862ab45010f3b6e5dc46d2693ba70d5d07;hb=ca4c76ce413d52660c4019f4a693ed732ecaed58;hp=04fb72ca77ef2a5b7bb8094cc0ca483fe65b44fe;hpb=c6e5bc3429c9c610895ba826d841cddd8c0f378b;p=friendica-addons.git diff --git a/planets/planets.php b/planets/planets.php index 04fb72ca..9fed4186 100644 --- a/planets/planets.php +++ b/planets/planets.php @@ -6,8 +6,9 @@ * Author: Mike Macgirvin * Author: Tony Baldwin */ -use Friendica\Core\Addon; -use Friendica\Core\PConfig; +use Friendica\Core\Hook; +use Friendica\Core\Logger; +use Friendica\DI; function planets_install() { @@ -18,7 +19,7 @@ function planets_install() { * */ - Addon::registerHook('post_local', 'addon/planets/planets.php', 'planets_post_hook'); + Hook::register('post_local', 'addon/planets/planets.php', 'planets_post_hook'); /** * @@ -28,33 +29,12 @@ function planets_install() { * */ - Addon::registerHook('addon_settings', 'addon/planets/planets.php', 'planets_settings'); - Addon::registerHook('addon_settings_post', 'addon/planets/planets.php', 'planets_settings_post'); + Hook::register('addon_settings', 'addon/planets/planets.php', 'planets_settings'); + Hook::register('addon_settings_post', 'addon/planets/planets.php', 'planets_settings_post'); - logger("installed planets"); + Logger::log("installed planets"); } - -function planets_uninstall() { - - /** - * - * uninstall unregisters any hooks created with register_hook - * during install. It may also delete configuration settings - * and any other cleanup. - * - */ - - Addon::unregisterHook('post_local', 'addon/planets/planets.php', 'planets_post_hook'); - Addon::unregisterHook('addon_settings', 'addon/planets/planets.php', 'planets_settings'); - Addon::unregisterHook('addon_settings_post', 'addon/planets/planets.php', 'planets_settings_post'); - - - logger("removed planets"); -} - - - function planets_post_hook($a, &$item) { /** @@ -66,7 +46,7 @@ function planets_post_hook($a, &$item) { * */ - logger('planets invoked'); + Logger::log('planets invoked'); if(! local_user()) /* non-zero if this is a logged in user of this system */ return; @@ -79,7 +59,7 @@ function planets_post_hook($a, &$item) { /* Retrieve our personal config setting */ - $active = PConfig::get(local_user(), 'planets', 'enable'); + $active = DI::pConfig()->get(local_user(), 'planets', 'enable'); if(! $active) return; @@ -117,7 +97,7 @@ function planets_settings_post($a,$post) { if(! local_user()) return; if($_POST['planets-submit']) - PConfig::set(local_user(),'planets','enable',intval($_POST['planets'])); + DI::pConfig()->set(local_user(),'planets','enable',intval($_POST['planets'])); } @@ -137,33 +117,33 @@ function planets_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 */ - $enabled = PConfig::get(local_user(),'planets','enable'); + $enabled = DI::pConfig()->get(local_user(),'planets','enable'); $checked = (($enabled) ? ' checked="checked" ' : ''); /* Add some HTML to the existing form */ $s .= ''; - $s .= '

' . t('Planets') . '

'; + $s .= '

' . DI::l10n()->t('Planets') . '

'; $s .= '
'; $s .= ''; + $s .= '
'; }