X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=showmore%2Fshowmore.php;h=8e85925aec8e5f19fa0884af4e587f868bfd4b48;hb=3f2cc739369597b2199a5801397443ba03dbfcdc;hp=e7d53f8a051693612e86ca870c6e4da4a8b5d7e9;hpb=3c5d0dc0cdd002862ce90deafb2a3f0cd914cd3e;p=friendica-addons.git diff --git a/showmore/showmore.php b/showmore/showmore.php index e7d53f8a..8e85925a 100644 --- a/showmore/showmore.php +++ b/showmore/showmore.php @@ -21,16 +21,16 @@ function showmore_install() 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, [ @@ -45,17 +45,17 @@ function showmore_addon_settings(App &$a, array &$data) ]; } -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); } } @@ -93,18 +93,18 @@ function get_body_length($body) 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;