X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=krynn%2Fkrynn.php;h=8f92daf75e9d3d56a704dd96fe8d88500a1d56f9;hb=101d3603245b17bd2e6d4880e94bb27887257238;hp=3f114073c8d300a1043ea06260e0596e10f46c44;hpb=39dd3dffe07efd69fa1ac6d0bd243c7fc0e3a66f;p=friendica-addons.git diff --git a/krynn/krynn.php b/krynn/krynn.php index 3f114073..8f92daf7 100644 --- a/krynn/krynn.php +++ b/krynn/krynn.php @@ -9,8 +9,9 @@ * *"My body was my sacrifice... for my magic. This damage is permanent." - Raistlin Majere */ -use Friendica\Core\Addon; +use Friendica\Core\Hook; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; function krynn_install() { @@ -22,7 +23,7 @@ function krynn_install() { * */ - Addon::registerHook('post_local', 'addon/krynn/krynn.php', 'krynn_post_hook'); + Hook::register('post_local', 'addon/krynn/krynn.php', 'krynn_post_hook'); /** * @@ -32,10 +33,10 @@ function krynn_install() { * */ - Addon::registerHook('addon_settings', 'addon/krynn/krynn.php', 'krynn_settings'); - Addon::registerHook('addon_settings_post', 'addon/krynn/krynn.php', 'krynn_settings_post'); + Hook::register('addon_settings', 'addon/krynn/krynn.php', 'krynn_settings'); + Hook::register('addon_settings_post', 'addon/krynn/krynn.php', 'krynn_settings_post'); - logger("installed krynn"); + Logger::log("installed krynn"); } @@ -49,12 +50,12 @@ function krynn_uninstall() { * */ - Addon::unregisterHook('post_local', 'addon/krynn/krynn.php', 'krynn_post_hook'); - Addon::unregisterHook('addon_settings', 'addon/krynn/krynn.php', 'krynn_settings'); - Addon::unregisterHook('addon_settings_post', 'addon/krynn/krynn.php', 'krynn_settings_post'); + Hook::unregister('post_local', 'addon/krynn/krynn.php', 'krynn_post_hook'); + Hook::unregister('addon_settings', 'addon/krynn/krynn.php', 'krynn_settings'); + Hook::unregister('addon_settings_post', 'addon/krynn/krynn.php', 'krynn_settings_post'); - logger("removed krynn"); + Logger::log("removed krynn"); } @@ -70,7 +71,7 @@ function krynn_post_hook($a, &$item) { * */ - logger('krynn invoked'); + Logger::log('krynn invoked'); if(! local_user()) /* non-zero if this is a logged in user of this system */ return; @@ -83,7 +84,7 @@ function krynn_post_hook($a, &$item) { /* Retrieve our personal config setting */ - $active = get_pconfig(local_user(), 'krynn', 'enable'); + $active = PConfig::get(local_user(), 'krynn', 'enable'); if(! $active) return; @@ -97,7 +98,7 @@ function krynn_post_hook($a, &$item) { * */ - $krynn = array('Ansalon','Abanasinia','Solace','Haven','Gateway','Qualinost','Ankatavaka','Pax Tharkas','Ergoth','Newsea','Straights of Schallsea','Plains of Dust','Tarsis','Barren Hills','Que Shu','Citadel of Light','Solinari','Hedge Maze','Tower of High Sorcery','Inn of the Last Home','Last Heroes Tomb','Academy of Sorcery','Gods Row','Temple of Majere','Temple of Kiri-Jolith','Temple of Mishakal','Temple of Zeboim','The Trough','Sad Town','Xak Tsaroth','Zhaman','Skullcap','Saifhum','Karthay','Mithas','Kothas','Silver Dragon Mountain','Silvanesti'); + $krynn = ['Ansalon','Abanasinia','Solace','Haven','Gateway','Qualinost','Ankatavaka','Pax Tharkas','Ergoth','Newsea','Straights of Schallsea','Plains of Dust','Tarsis','Barren Hills','Que Shu','Citadel of Light','Solinari','Hedge Maze','Tower of High Sorcery','Inn of the Last Home','Last Heroes Tomb','Academy of Sorcery','Gods Row','Temple of Majere','Temple of Kiri-Jolith','Temple of Mishakal','Temple of Zeboim','The Trough','Sad Town','Xak Tsaroth','Zhaman','Skullcap','Saifhum','Karthay','Mithas','Kothas','Silver Dragon Mountain','Silvanesti']; $planet = array_rand($krynn,1); $item['location'] = $krynn[$planet]; @@ -121,7 +122,7 @@ function krynn_settings_post($a,$post) { if(! local_user()) return; if($_POST['krynn-submit']) - set_pconfig(local_user(),'krynn','enable',intval($_POST['krynn'])); + PConfig::set(local_user(),'krynn','enable',intval($_POST['krynn'])); } @@ -141,11 +142,11 @@ function krynn_settings(&$a,&$s) { /* Add our stylesheet to the page so we can make our settings look nice */ - $a->page['htmlhead'] .= '' . "\r\n"; + $a->page['htmlhead'] .= '' . "\r\n"; /* Get the current state of our config variable */ - $enabled = get_pconfig(local_user(),'krynn','enable'); + $enabled = PConfig::get(local_user(),'krynn','enable'); $checked = (($enabled) ? ' checked="checked" ' : '');