X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=planets%2Fplanets.php;h=ea543f4097fa77f0160928a61a45f70b396d6ef3;hb=1357817fc38de7be7dc8ebffc1fa0961796fd32d;hp=067db51d6132e2f82d14604282a8e480bf2f314d;hpb=39dd3dffe07efd69fa1ac6d0bd243c7fc0e3a66f;p=friendica-addons.git diff --git a/planets/planets.php b/planets/planets.php index 067db51d..ea543f40 100644 --- a/planets/planets.php +++ b/planets/planets.php @@ -6,9 +6,9 @@ * Author: Mike Macgirvin * Author: Tony Baldwin */ -use Friendica\Core\Addon; -use Friendica\Core\L10n; -use Friendica\Core\PConfig; +use Friendica\Core\Hook; +use Friendica\Core\Logger; +use Friendica\DI; function planets_install() { @@ -19,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'); /** * @@ -29,10 +29,10 @@ 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"); } @@ -46,12 +46,12 @@ function planets_uninstall() { * */ - 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'); + Hook::unregister('post_local', 'addon/planets/planets.php', 'planets_post_hook'); + Hook::unregister('addon_settings', 'addon/planets/planets.php', 'planets_settings'); + Hook::unregister('addon_settings_post', 'addon/planets/planets.php', 'planets_settings_post'); - logger("removed planets"); + Logger::log("removed planets"); } @@ -67,7 +67,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; @@ -80,7 +80,7 @@ function planets_post_hook($a, &$item) { /* Retrieve our personal config setting */ - $active = get_pconfig(local_user(), 'planets', 'enable'); + $active = DI::pConfig()->get(local_user(), 'planets', 'enable'); if(! $active) return; @@ -94,7 +94,7 @@ function planets_post_hook($a, &$item) { * */ - $planets = array('Alderaan','Tatooine','Dagobah','Polis Massa','Coruscant','Hoth','Endor','Kamino','Rattatak','Mustafar','Iego','Geonosis','Felucia','Dantooine','Ansion','Artaru','Bespin','Boz Pity','Cato Neimoidia','Christophsis','Kashyyyk','Kessel','Malastare','Mygeeto','Nar Shaddaa','Ord Mantell','Saleucami','Subterrel','Death Star','Teth','Tund','Utapau','Yavin'); + $planets = ['Alderaan','Tatooine','Dagobah','Polis Massa','Coruscant','Hoth','Endor','Kamino','Rattatak','Mustafar','Iego','Geonosis','Felucia','Dantooine','Ansion','Artaru','Bespin','Boz Pity','Cato Neimoidia','Christophsis','Kashyyyk','Kessel','Malastare','Mygeeto','Nar Shaddaa','Ord Mantell','Saleucami','Subterrel','Death Star','Teth','Tund','Utapau','Yavin']; $planet = array_rand($planets,1); $item['location'] = $planets[$planet]; @@ -118,7 +118,7 @@ function planets_settings_post($a,$post) { if(! local_user()) return; if($_POST['planets-submit']) - set_pconfig(local_user(),'planets','enable',intval($_POST['planets'])); + DI::pConfig()->set(local_user(),'planets','enable',intval($_POST['planets'])); } @@ -138,33 +138,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 = get_pconfig(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 .= '

' . L10n::t('Planets') . '

'; + $s .= '

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

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