X-Git-Url: https://git.mxchange.org/?p=friendica-addons.git;a=blobdiff_plain;f=blockem%2Fblockem.php;fp=blockem%2Fblockem.php;h=6f2b6d89e0929840e1785fe53c0fa276671faf1f;hp=223a1990c336d17a20635017e16d6d222695fad8;hb=39dd3dffe07efd69fa1ac6d0bd243c7fc0e3a66f;hpb=5360f08f4295f2306d815a7659fbdff94fda01a3 diff --git a/blockem/blockem.php b/blockem/blockem.php index 223a1990..6f2b6d89 100644 --- a/blockem/blockem.php +++ b/blockem/blockem.php @@ -1,41 +1,39 @@ * */ - -function blockem_install() { - register_hook('prepare_body', 'addon/blockem/blockem.php', 'blockem_prepare_body'); - register_hook('display_item', 'addon/blockem/blockem.php', 'blockem_display_item'); - register_hook('plugin_settings', 'addon/blockem/blockem.php', 'blockem_addon_settings'); - register_hook('plugin_settings_post', 'addon/blockem/blockem.php', 'blockem_addon_settings_post'); - register_hook('conversation_start', 'addon/blockem/blockem.php', 'blockem_conversation_start'); - register_hook('item_photo_menu', 'addon/blockem/blockem.php', 'blockem_item_photo_menu'); - register_hook('enotify_store', 'addon/blockem/blockem.php', 'blockem_enotify_store' ); +use Friendica\Core\Addon; +use Friendica\Core\L10n; +use Friendica\Core\PConfig; + +function blockem_install() +{ + Addon::registerHook('prepare_body', 'addon/blockem/blockem.php', 'blockem_prepare_body'); + Addon::registerHook('display_item', 'addon/blockem/blockem.php', 'blockem_display_item'); + Addon::registerHook('addon_settings', 'addon/blockem/blockem.php', 'blockem_addon_settings'); + Addon::registerHook('addon_settings_post', 'addon/blockem/blockem.php', 'blockem_addon_settings_post'); + Addon::registerHook('conversation_start', 'addon/blockem/blockem.php', 'blockem_conversation_start'); + Addon::registerHook('item_photo_menu', 'addon/blockem/blockem.php', 'blockem_item_photo_menu'); + Addon::registerHook('enotify_store', 'addon/blockem/blockem.php', 'blockem_enotify_store'); } - -function blockem_uninstall() { - unregister_hook('prepare_body', 'addon/blockem/blockem.php', 'blockem_prepare_body'); - unregister_hook('display_item', 'addon/blockem/blockem.php', 'blockem_display_item'); - unregister_hook('plugin_settings', 'addon/blockem/blockem.php', 'blockem_addon_settings'); - unregister_hook('plugin_settings_post', 'addon/blockem/blockem.php', 'blockem_addon_settings_post'); - unregister_hook('conversation_start', 'addon/blockem/blockem.php', 'blockem_conversation_start'); - unregister_hook('item_photo_menu', 'addon/blockem/blockem.php', 'blockem_item_photo_menu'); - unregister_hook('enotify_store', 'addon/blockem/blockem.php', 'blockem_enotify_store' ); - +function blockem_uninstall() +{ + Addon::unregisterHook('prepare_body', 'addon/blockem/blockem.php', 'blockem_prepare_body'); + Addon::unregisterHook('display_item', 'addon/blockem/blockem.php', 'blockem_display_item'); + Addon::unregisterHook('addon_settings', 'addon/blockem/blockem.php', 'blockem_addon_settings'); + Addon::unregisterHook('addon_settings_post', 'addon/blockem/blockem.php', 'blockem_addon_settings_post'); + Addon::unregisterHook('conversation_start', 'addon/blockem/blockem.php', 'blockem_conversation_start'); + Addon::unregisterHook('item_photo_menu', 'addon/blockem/blockem.php', 'blockem_item_photo_menu'); + Addon::unregisterHook('enotify_store', 'addon/blockem/blockem.php', 'blockem_enotify_store'); } - - - - -function blockem_addon_settings(&$a,&$s) { +function blockem_addon_settings(&$a, &$s) +{ if(! local_user()) return; @@ -45,24 +43,25 @@ function blockem_addon_settings(&$a,&$s) { $a->page['htmlhead'] .= '' . "\r\n"; - $words = get_pconfig(local_user(),'blockem','words'); + $words = PConfig::get(local_user(), 'blockem', 'words'); if(! $words) $words = ''; $s .= ''; - $s .= '

' . t('"Blockem"') . '

'; + $s .= '

' . L10n::t('"Blockem"') . '

'; $s .= '
'; $s .= ''; + $s .= '
'; return; @@ -74,12 +73,11 @@ function blockem_addon_settings_post(&$a,&$b) { return; if($_POST['blockem-submit']) { - set_pconfig(local_user(),'blockem','words',trim($_POST['blockem-words'])); - info( t('BLOCKEM Settings saved.') . EOL); + PConfig::set(local_user(),'blockem','words',trim($_POST['blockem-words'])); + info(L10n::t('BLOCKEM Settings saved.') . EOL); } } - function blockem_enotify_store(&$a,&$b) { $words = get_pconfig($b['uid'],'blockem','words'); @@ -139,17 +137,15 @@ function blockem_prepare_body(&$a,&$b) { } if($found) { $rnd = random_string(8); - $b['html'] = ''; + $b['html'] = ''; } } - function blockem_display_item(&$a,&$b) { if(strstr($b['output']['body'],'id="blockem-wrap-')) $b['output']['thumb'] = $a->get_baseurl() . "/images/person-80.jpg"; } - function blockem_conversation_start(&$a,&$b) { if(! local_user()) @@ -194,9 +190,9 @@ function blockem_item_photo_menu(&$a,&$b) { } } if($blocked) - $b['menu'][ t('Unblock Author')] = 'javascript:blockemUnblock(\'' . $author . '\');'; + $b['menu'][L10n::t('Unblock Author')] = 'javascript:blockemUnblock(\'' . $author . '\');'; else - $b['menu'][ t('Block Author')] = 'javascript:blockemBlock(\'' . $author . '\');'; + $b['menu'][L10n::t('Block Author')] = 'javascript:blockemBlock(\'' . $author . '\');'; } function blockem_module() {} @@ -227,7 +223,7 @@ function blockem_init(&$a) { $words = implode(',',$newarr); } - set_pconfig(local_user(),'blockem','words',$words); - info( t('blockem settings updated') . EOL ); + PConfig::set(local_user(),'blockem','words',$words); + info(L10n::t('blockem settings updated') . EOL ); killme(); }