X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=showmore%2Fshowmore.php;h=bfde40f3c473c45e8a287504210d511f6976ff03;hb=7603b237998d7225839b4eeb565a5f25bdd5d5fb;hp=1f40b027be3b7da947e3905e8a9a817ffd176c7a;hpb=7b71fec6222988a89423ee4584c87927f1a6e149;p=friendica-addons.git diff --git a/showmore/showmore.php b/showmore/showmore.php old mode 100755 new mode 100644 index 1f40b027..bfde40f3 --- a/showmore/showmore.php +++ b/showmore/showmore.php @@ -7,70 +7,82 @@ * based upon NSFW from Mike Macgirvin * */ - -function showmore_install() { - register_hook('prepare_body', 'addon/showmore/showmore.php', 'showmore_prepare_body'); - register_hook('plugin_settings', 'addon/showmore/showmore.php', 'showmore_addon_settings'); - register_hook('plugin_settings_post', 'addon/showmore/showmore.php', 'showmore_addon_settings_post'); +use Friendica\Core\Hook; +use Friendica\DI; +use Friendica\Util\Strings; + +function showmore_install() +{ + Hook::register('prepare_body', 'addon/showmore/showmore.php', 'showmore_prepare_body'); + Hook::register('addon_settings', 'addon/showmore/showmore.php', 'showmore_addon_settings'); + Hook::register('addon_settings_post', 'addon/showmore/showmore.php', 'showmore_addon_settings_post'); } -function showmore_uninstall() { - unregister_hook('prepare_body', 'addon/showmore/showmore.php', 'showmore_prepare_body'); - unregister_hook('plugin_settings', 'addon/showmore/showmore.php', 'showmore_addon_settings'); - unregister_hook('plugin_settings_post', 'addon/showmore/showmore.php', 'showmore_addon_settings_post'); +function showmore_uninstall() +{ + Hook::unregister('prepare_body', 'addon/showmore/showmore.php', 'showmore_prepare_body'); + Hook::unregister('addon_settings', 'addon/showmore/showmore.php', 'showmore_addon_settings'); + Hook::unregister('addon_settings_post', 'addon/showmore/showmore.php', 'showmore_addon_settings_post'); } -function showmore_addon_settings(&$a,&$s) { - - if(! local_user()) +function showmore_addon_settings(&$a, &$s) +{ + if (!local_user()) { return; + } /* Add our stylesheet to the page so we can make our settings look nice */ - $a->page['htmlhead'] .= ''."\r\n"; + DI::page()['htmlhead'] .= ''."\r\n"; - $enable_checked = (intval(get_pconfig(local_user(),'showmore','disable')) ? '' : ' checked="checked"'); - $chars = get_pconfig(local_user(),'showmore','chars'); - if(!$chars) - $chars = '1100'; + $enable_checked = (intval(DI::pConfig()->get(local_user(), 'showmore', 'disable')) ? '' : ' checked="checked"'); + $chars = DI::pConfig()->get(local_user(), 'showmore', 'chars', 1100); + + $s .= ''; + $s .= '

' . DI::l10n()->t('"Show more" Settings').'

'; + $s .= '
'; + $s .= '