X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=showmore_dyn%2Fshowmore_dyn.php;h=7cb64bcca7c10fc3a57a984aa068c2573e9d8698;hb=c2dfda5d721215b0796a1214be312cc3a5b09476;hp=bf8f5608dc1d80004c35509cdd97660568937f4b;hpb=4d7c1e795d8010316eadb9e72284ed8d25a0bf36;p=friendica-addons.git diff --git a/showmore_dyn/showmore_dyn.php b/showmore_dyn/showmore_dyn.php index bf8f5608..7cb64bcc 100644 --- a/showmore_dyn/showmore_dyn.php +++ b/showmore_dyn/showmore_dyn.php @@ -24,48 +24,51 @@ function showmore_dyn_install() Hook::register('addon_settings_post', __FILE__, 'showmore_dyn_settings_post'); } -function showmore_dyn_head(App $a, &$b) +function showmore_dyn_head(string &$body) { DI::page()->registerStylesheet(__DIR__ . '/showmore_dyn.css'); } -function showmore_dyn_footer(App $a, &$b) +function showmore_dyn_footer(string &$body) { DI::page()->registerFooterScript(__DIR__ . '/showmore_dyn.js'); } function showmore_dyn_settings_post() { - if(!local_user()) { + if(!DI::userSession()->getLocalUserId()) { return; } if (isset($_POST['showmore_dyn-submit'])) { - DI::pConfig()->set(local_user(), 'showmore_dyn', 'limitHeight', $_POST['limitHeight'] ?? 0); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'showmore_dyn', 'limitHeight', $_POST['limitHeight'] ?? 0); } } -function showmore_dyn_settings(App &$a, &$o) +function showmore_dyn_settings(array &$data) { - if(!local_user()) { + if(!DI::userSession()->getLocalUserId()) { return; } - $limitHeight = DI::pConfig()->get(local_user(), 'showmore_dyn', 'limitHeight', 250); - DI::pConfig()->set(local_user(), 'showmore_dyn', 'limitHeight', $limitHeight); + $limitHeight = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'showmore_dyn', 'limitHeight', 250); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'showmore_dyn', 'limitHeight', $limitHeight); $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/showmore_dyn/'); - $o .= Renderer::replaceMacros($t, [ - '$submit' => DI::l10n()->t('Save Settings'), - '$header' => DI::l10n()->t('Show More Dynamic'), + $html = Renderer::replaceMacros($t, [ '$limitHeight' => ['limitHeight', DI::l10n()->t('Limit Height'), $limitHeight, DI::l10n()->t('The maximal pixel height of posts before the Show More link is added, 0 to disable'), '', '', 'number'], ]); + $data = [ + 'addon' => 'showmore_dyn', + 'title' => DI::l10n()->t('Show More Dynamic'), + 'html' => $html, + ]; } function showmore_dyn_script() { - $limitHeight = intval(DI::pConfig()->get(local_user(), 'showmore_dyn', 'limitHeight', 250)); + $limitHeight = intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'showmore_dyn', 'limitHeight', 250)); $showmore_dyn_showmore_linktext = DI::l10n()->t('Show more...'); DI::page()['htmlhead'] .= <<