*
*/
use Friendica\Core\Hook;
-use Friendica\Core\L10n;
-use Friendica\Core\PConfig;
+use Friendica\DI;
use Friendica\Util\Strings;
function superblock_install()
/* Add our stylesheet to the page so we can make our settings look nice */
- $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->getBaseURL() . '/addon/superblock/superblock.css' . '" media="all" />' . "\r\n";
+ DI::page()['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . DI::baseUrl()->get() . '/addon/superblock/superblock.css' . '" media="all" />' . "\r\n";
- $words = PConfig::get(local_user(), 'system', 'blocked');
+ $words = DI::pConfig()->get(local_user(), 'system', 'blocked');
if (!$words) {
$words = '';
}
$s .= '<span id="settings_superblock_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_superblock_expanded\'); openClose(\'settings_superblock_inflated\');">';
- $s .= '<h3>' . L10n::t('Superblock') . '</h3>';
+ $s .= '<h3>' . DI::l10n()->t('Superblock') . '</h3>';
$s .= '</span>';
$s .= '<div id="settings_superblock_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_superblock_expanded\'); openClose(\'settings_superblock_inflated\');">';
- $s .= '<h3>' . L10n::t('Superblock') . '</h3>';
+ $s .= '<h3>' . DI::l10n()->t('Superblock') . '</h3>';
$s .= '</span>';
$s .= '<div id="superblock-wrapper">';
- $s .= '<label id="superblock-label" for="superblock-words">' . L10n::t('Comma separated profile URLS to block') . ' </label>';
+ $s .= '<label id="superblock-label" for="superblock-words">' . DI::l10n()->t('Comma separated profile URLS to block') . ' </label>';
$s .= '<textarea id="superblock-words" type="text" name="superblock-words" >' . htmlspecialchars($words) . '</textarea>';
$s .= '</div><div class="clear"></div>';
- $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="superblock-submit" name="superblock-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
+ $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="superblock-submit" name="superblock-submit" class="settings-submit" value="' . DI::l10n()->t('Save Settings') . '" /></div></div>';
return;
}
}
if (!empty($_POST['superblock-submit'])) {
- PConfig::set(local_user(), 'system', 'blocked',trim($_POST['superblock-words']));
- info(L10n::t('SUPERBLOCK Settings saved.') . EOL);
+ DI::pConfig()->set(local_user(), 'system', 'blocked',trim($_POST['superblock-words']));
+ info(DI::l10n()->t('SUPERBLOCK Settings saved.') . EOL);
}
}
function superblock_enotify_store(&$a,&$b) {
- $words = PConfig::get($b['uid'], 'system', 'blocked');
+ $words = DI::pConfig()->get($b['uid'], 'system', 'blocked');
if ($words) {
$arr = explode(',', $words);
} else {
}
}
if ($found) {
- $b['abort'] = true;
+ // Empty out the fields
+ $b = [];
}
}
return;
}
- $words = PConfig::get(local_user(), 'system', 'blocked');
+ $words = DI::pConfig()->get(local_user(), 'system', 'blocked');
if ($words) {
$a->data['superblock'] = explode(',', $words);
}
- $a->page['htmlhead'] .= <<< EOT
+ DI::page()['htmlhead'] .= <<< EOT
<script>
function superblockBlock(author) {
}
}
- $b['menu'][L10n::t('Block Completely')] = 'javascript:superblockBlock(\'' . $author . '\'); return false;';
+ $b['menu'][DI::l10n()->t('Block Completely')] = 'javascript:superblockBlock(\'' . $author . '\'); return false;';
}
function superblock_module() {}
return;
}
- $words = PConfig::get(local_user(), 'system', 'blocked');
+ $words = DI::pConfig()->get(local_user(), 'system', 'blocked');
if (array_key_exists('block', $_GET) && $_GET['block']) {
if (strlen($words))
$words .= trim($_GET['block']);
}
- PConfig::set(local_user(), 'system', 'blocked', $words);
- info(L10n::t('superblock settings updated') . EOL );
+ DI::pConfig()->set(local_user(), 'system', 'blocked', $words);
+ info(DI::l10n()->t('superblock settings updated') . EOL );
exit();
}