mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-09 18:08:49 +00:00
[various] Convert addon_settings hook functions to the new data array format
- Add separate template files to several addons - Remove superfluous addon settings CSS files
This commit is contained in:
parent
f0522a998b
commit
779b38ec09
68 changed files with 444 additions and 953 deletions
|
@ -1,18 +0,0 @@
|
|||
|
||||
#superblock-label {
|
||||
float: left;
|
||||
width: 300px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
#superblock-words {
|
||||
float: left;
|
||||
margin-top: 10px;
|
||||
width: 400px;
|
||||
height: 150px;
|
||||
}
|
||||
|
||||
#superblock-submit {
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
|
@ -6,7 +6,10 @@
|
|||
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -19,35 +22,24 @@ function superblock_install()
|
|||
Hook::register('enotify_store', 'addon/superblock/superblock.php', 'superblock_enotify_store');
|
||||
}
|
||||
|
||||
function superblock_addon_settings(&$a, &$s)
|
||||
function superblock_addon_settings(App &$a, array &$data)
|
||||
{
|
||||
if (!local_user()) {
|
||||
return;
|
||||
}
|
||||
|
||||
DI::page()->registerStylesheet(__DIR__ . '/superblock.css', 'all');
|
||||
$blocked = DI::pConfig()->get(local_user(), 'system', 'blocked', '');
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/superblock/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
'$urls' => ['superblock-words', DI::l10n()->t('Comma separated profile URLs to block'), $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>' . 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>' . DI::l10n()->t('Superblock') . '</h3>';
|
||||
$s .= '</span>';
|
||||
$s .= '<div id="superblock-wrapper">';
|
||||
$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="' . DI::l10n()->t('Save Settings') . '" /></div></div>';
|
||||
|
||||
return;
|
||||
$data = [
|
||||
'addon' => 'superblock',
|
||||
'title' => DI::l10n()->t('Superblock'),
|
||||
'html' => $html,
|
||||
];
|
||||
}
|
||||
|
||||
function superblock_addon_settings_post(&$a, &$b)
|
||||
|
|
1
superblock/templates/settings.tpl
Normal file
1
superblock/templates/settings.tpl
Normal file
|
@ -0,0 +1 @@
|
|||
{{include file="field_textarea.tpl" field=$urls}}
|
Loading…
Add table
Add a link
Reference in a new issue