X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=blockem%2Fblockem.php;h=1880b9be44e5029bcc36a7da1e20c78746177bc8;hb=e34b227e614c9299326ab3ddabac3befe30da7fe;hp=e44ac622cc1a343bd59c5b02099926ba2889946f;hpb=b351fabb4f39b8dda09be8401cd84653ba4eab85;p=friendica-addons.git
diff --git a/blockem/blockem.php b/blockem/blockem.php
index e44ac622..1880b9be 100644
--- a/blockem/blockem.php
+++ b/blockem/blockem.php
@@ -9,8 +9,6 @@
use Friendica\App;
use Friendica\Core\Hook;
-use Friendica\Core\L10n;
-use Friendica\Core\PConfig;
use Friendica\DI;
use Friendica\Util\Strings;
@@ -25,18 +23,6 @@ function blockem_install()
Hook::register('enotify_store' , 'addon/blockem/blockem.php', 'blockem_enotify_store');
}
-function blockem_uninstall()
-{
- Hook::unregister('prepare_body_content_filter', 'addon/blockem/blockem.php', 'blockem_prepare_body_content_filter');
- Hook::unregister('prepare_body' , 'addon/blockem/blockem.php', 'blockem_prepare_body');
- Hook::unregister('display_item' , 'addon/blockem/blockem.php', 'blockem_display_item');
- Hook::unregister('addon_settings' , 'addon/blockem/blockem.php', 'blockem_addon_settings');
- Hook::unregister('addon_settings_post' , 'addon/blockem/blockem.php', 'blockem_addon_settings_post');
- Hook::unregister('conversation_start' , 'addon/blockem/blockem.php', 'blockem_conversation_start');
- Hook::unregister('item_photo_menu' , 'addon/blockem/blockem.php', 'blockem_item_photo_menu');
- Hook::unregister('enotify_store' , 'addon/blockem/blockem.php', 'blockem_enotify_store');
-}
-
function blockem_addon_settings (App $a, &$s)
{
if (!local_user()) {
@@ -46,27 +32,27 @@ function blockem_addon_settings (App $a, &$s)
/* Add our stylesheet to the page so we can make our settings look nice */
DI::page()['htmlhead'] .= '' . "\r\n";
- $words = PConfig::get(local_user(), 'blockem', 'words');
+ $words = DI::pConfig()->get(local_user(), 'blockem', 'words');
if (!$words) {
$words = '';
}
$s .= '';
- $s .= '' . L10n::t('Blockem') . '
';
+ $s .= '' . DI::l10n()->t('Blockem') . '
';
$s .= '';
$s .= '
';
$s .= '
';
- $s .= '' . L10n::t('Blockem') . '
';
+ $s .= '' . DI::l10n()->t('Blockem') . '
';
$s .= '';
$s .= '
';
- $s .= '
'. L10n::t("Hides user's content by collapsing posts. Also replaces their avatar with generic image.") . '
';
- $s .= '
';
+ $s .= '
'. DI::l10n()->t("Hides user's content by collapsing posts. Also replaces their avatar with generic image.") . '
';
+ $s .= '
';
$s .= '
';
$s .= '
';
- $s .= '
';
+ $s .= '';
return;
@@ -79,14 +65,13 @@ function blockem_addon_settings_post(App $a, array &$b)
}
if (!empty($_POST['blockem-submit'])) {
- PConfig::set(local_user(), 'blockem', 'words', trim($_POST['blockem-words']));
- info(L10n::t('BLOCKEM Settings saved.') . EOL);
+ DI::pConfig()->set(local_user(), 'blockem', 'words', trim($_POST['blockem-words']));
}
}
function blockem_enotify_store(App $a, array &$b)
{
- $words = PConfig::get($b['uid'], 'blockem', 'words');
+ $words = DI::pConfig()->get($b['uid'], 'blockem', 'words');
if ($words) {
$arr = explode(',', $words);
@@ -110,7 +95,8 @@ function blockem_enotify_store(App $a, array &$b)
}
if ($found) {
- $b['abort'] = true;
+ // empty out the fields
+ $b = [];
}
}
@@ -123,7 +109,7 @@ function blockem_prepare_body_content_filter(App $a, array &$hook_data)
$profiles_string = null;
if (local_user()) {
- $profiles_string = PConfig::get(local_user(), 'blockem', 'words');
+ $profiles_string = DI::pConfig()->get(local_user(), 'blockem', 'words');
}
if ($profiles_string) {
@@ -142,7 +128,7 @@ function blockem_prepare_body_content_filter(App $a, array &$hook_data)
}
if ($found) {
- $hook_data['filter_reasons'][] = L10n::t('Filtered user: %s', $hook_data['item']['author-name']);
+ $hook_data['filter_reasons'][] = DI::l10n()->t('Filtered user: %s', $hook_data['item']['author-name']);
}
}
@@ -159,7 +145,7 @@ function blockem_conversation_start(App $a, array &$b)
return;
}
- $words = PConfig::get(local_user(), 'blockem', 'words');
+ $words = DI::pConfig()->get(local_user(), 'blockem', 'words');
if ($words) {
$a->data['blockem'] = explode(',', $words);
@@ -201,9 +187,9 @@ function blockem_item_photo_menu(App $a, array &$b)
}
}
if ($blocked) {
- $b['menu'][L10n::t('Unblock Author')] = 'javascript:blockemUnblock(\'' . $author . '\');';
+ $b['menu'][DI::l10n()->t('Unblock Author')] = 'javascript:blockemUnblock(\'' . $author . '\');';
} else {
- $b['menu'][L10n::t('Block Author')] = 'javascript:blockemBlock(\'' . $author . '\');';
+ $b['menu'][DI::l10n()->t('Block Author')] = 'javascript:blockemBlock(\'' . $author . '\');';
}
}
@@ -217,7 +203,7 @@ function blockem_init(App $a)
return;
}
- $words = PConfig::get(local_user(), 'blockem', 'words');
+ $words = DI::pConfig()->get(local_user(), 'blockem', 'words');
if (array_key_exists('block', $_GET) && $_GET['block']) {
if (strlen($words)) {
@@ -242,7 +228,6 @@ function blockem_init(App $a)
$words = implode(',', $newarr);
}
- PConfig::set(local_user(), 'blockem', 'words', $words);
- info(L10n::t('blockem settings updated') . EOL);
+ DI::pConfig()->set(local_user(), 'blockem', 'words', $words);
exit();
}