Hook::register('addon_settings_post', 'addon/showmore/showmore.php', 'showmore_addon_settings_post');
}
-function showmore_addon_settings(App &$a, array &$data)
+function showmore_addon_settings(array &$data)
{
- if (!local_user()) {
+ if (!DI::userSession()->getLocalUserId()) {
return;
}
DI::page()->registerStylesheet(__DIR__ . '/showmore.css', 'all');
- $enabled = !DI::pConfig()->get(local_user(), 'showmore', 'disable');
- $chars = DI::pConfig()->get(local_user(), 'showmore', 'chars', 1100);
+ $enabled = !DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'showmore', 'disable');
+ $chars = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'showmore', 'chars', 1100);
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/showmore/');
$html = Renderer::replaceMacros($t, [
];
}
-function showmore_addon_settings_post(App $a, array &$b)
+function showmore_addon_settings_post(array &$b)
{
- if (!local_user()) {
+ if (!DI::userSession()->getLocalUserId()) {
return;
}
if (!empty($_POST['showmore-submit'])) {
- DI::pConfig()->set(local_user(), 'showmore', 'chars', trim($_POST['showmore-chars']));
+ DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'showmore', 'chars', trim($_POST['showmore-chars']));
$enable = (!empty($_POST['showmore-enable']) ? intval($_POST['showmore-enable']) : 0);
$disable = 1-$enable;
- DI::pConfig()->set(local_user(), 'showmore', 'disable', $disable);
+ DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'showmore', 'disable', $disable);
}
}
return strlen($string);
}
-function showmore_prepare_body(App $a, &$hook_data)
+function showmore_prepare_body(&$hook_data)
{
// No combination with content filters
if (!empty($hook_data['filter_reasons'])) {
return;
}
- if (DI::pConfig()->get(local_user(), 'showmore', 'disable')) {
+ if (DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'showmore', 'disable')) {
return;
}
- $chars = (int) DI::pConfig()->get(local_user(), 'showmore', 'chars', 1100);
+ $chars = (int) DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'showmore', 'chars', 1100);
if (get_body_length($hook_data['html']) > $chars) {
$found = true;