X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=randplace%2Frandplace.php;h=886d79d125a58f240d63404ddcee5521367a3daf;hb=30eb87e939f0a94df3caaa89f5404169a01c99d2;hp=7784d80b41d90e00f48d1e523bb989890d349720;hpb=2d745b11d762ceb10f8d621cbbcb6fd25791dbaa;p=friendica-addons.git diff --git a/randplace/randplace.php b/randplace/randplace.php index 7784d80b..886d79d1 100644 --- a/randplace/randplace.php +++ b/randplace/randplace.php @@ -18,10 +18,9 @@ * system will call the name_uninstall() function. * */ -use Friendica\Core\Addon; -use Friendica\Core\L10n; +use Friendica\Core\Hook; use Friendica\Core\Logger; -use Friendica\Core\PConfig; +use Friendica\DI; function randplace_install() { @@ -32,7 +31,7 @@ function randplace_install() { * */ - Addon::registerHook('post_local', 'addon/randplace/randplace.php', 'randplace_post_hook'); + Hook::register('post_local', 'addon/randplace/randplace.php', 'randplace_post_hook'); /** * @@ -42,8 +41,8 @@ function randplace_install() { * */ - Addon::registerHook('addon_settings', 'addon/randplace/randplace.php', 'randplace_settings'); - Addon::registerHook('addon_settings_post', 'addon/randplace/randplace.php', 'randplace_settings_post'); + Hook::register('addon_settings', 'addon/randplace/randplace.php', 'randplace_settings'); + Hook::register('addon_settings_post', 'addon/randplace/randplace.php', 'randplace_settings_post'); Logger::log("installed randplace"); } @@ -59,9 +58,9 @@ function randplace_uninstall() { * */ - Addon::unregisterHook('post_local', 'addon/randplace/randplace.php', 'randplace_post_hook'); - Addon::unregisterHook('addon_settings', 'addon/randplace/randplace.php', 'randplace_settings'); - Addon::unregisterHook('addon_settings_post', 'addon/randplace/randplace.php', 'randplace_settings_post'); + Hook::unregister('post_local', 'addon/randplace/randplace.php', 'randplace_post_hook'); + Hook::unregister('addon_settings', 'addon/randplace/randplace.php', 'randplace_settings'); + Hook::unregister('addon_settings_post', 'addon/randplace/randplace.php', 'randplace_settings_post'); Logger::log("removed randplace"); @@ -93,7 +92,7 @@ function randplace_post_hook($a, &$item) { /* Retrieve our personal config setting */ - $active = PConfig::get(local_user(), 'randplace', 'enable'); + $active = DI::pConfig()->get(local_user(), 'randplace', 'enable'); if(! $active) return; @@ -138,7 +137,7 @@ function randplace_settings_post($a,$post) { if(! local_user()) return; if($_POST['randplace-submit']) - PConfig::set(local_user(),'randplace','enable',intval($_POST['randplace'])); + DI::pConfig()->set(local_user(),'randplace','enable',intval($_POST['randplace'])); } @@ -158,25 +157,25 @@ function randplace_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(),'randplace','enable'); + $enabled = DI::pConfig()->get(local_user(),'randplace','enable'); $checked = (($enabled) ? ' checked="checked" ' : ''); /* Add some HTML to the existing form */ $s .= '
'; - $s .= '

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

'; + $s .= '

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

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