X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=blockem%2Fblockem.php;h=3a32aa2d4f8831470bd3186ba65a97c82589b303;hb=86b2d830a5da62f90c22b5d3f15921a60de25f37;hp=e0c0a74a29894870218f17afc584c9f1c0e97373;hpb=ffe5038102b53dc9e00ef0b52d33e27226d35f7f;p=friendica-addons.git
diff --git a/blockem/blockem.php b/blockem/blockem.php
index e0c0a74a..3a32aa2d 100644
--- a/blockem/blockem.php
+++ b/blockem/blockem.php
@@ -9,8 +9,7 @@
use Friendica\App;
use Friendica\Core\Hook;
-use Friendica\Core\L10n;
-use Friendica\Core\PConfig;
+use Friendica\DI;
use Friendica\Util\Strings;
function blockem_install()
@@ -43,29 +42,29 @@ function blockem_addon_settings (App $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";
- $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;
@@ -78,14 +77,14 @@ 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']));
+ info(DI::l10n()->t('BLOCKEM Settings saved.') . EOL);
}
}
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);
@@ -109,7 +108,8 @@ function blockem_enotify_store(App $a, array &$b)
}
if ($found) {
- $b['abort'] = true;
+ // empty out the fields
+ $b = [];
}
}
@@ -122,7 +122,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) {
@@ -141,14 +141,14 @@ 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']);
}
}
function blockem_display_item(App $a, array &$b = null)
{
if (!empty($b['output']['body']) && strstr($b['output']['body'], 'id="blockem-wrap-')) {
- $b['output']['thumb'] = $a->getBaseURL() . "/images/person-80.jpg";
+ $b['output']['thumb'] = DI::baseUrl()->get() . "/images/person-80.jpg";
}
}
@@ -158,13 +158,13 @@ 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);
}
- $a->page['htmlhead'] .= <<< EOT
+ DI::page()['htmlhead'] .= <<< EOT