]> git.mxchange.org Git - friendica-addons.git/blobdiff - showmore/showmore.php
[securemail] Bump phpseclib dependency to version 3.0.19
[friendica-addons.git] / showmore / showmore.php
index e7d53f8a051693612e86ca870c6e4da4a8b5d7e9..8e85925aec8e5f19fa0884af4e587f868bfd4b48 100644 (file)
@@ -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;