X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=showmore%2Fshowmore.php;h=f7bb0c505e9ae2e05ad5ba3d9fec19373bf87ec3;hb=f3804ee7ddcaf1d6edee2b1fcc235f024aacee0b;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..f7bb0c50 --- a/showmore/showmore.php +++ b/showmore/showmore.php @@ -7,70 +7,83 @@ * 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\Core\L10n; +use Friendica\Core\PConfig; +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"; + $a->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(PConfig::get(local_user(), 'showmore', 'disable')) ? '' : ' checked="checked"'); + $chars = PConfig::get(local_user(), 'showmore', 'chars', 1100); + + $s .= ''; + $s .= '

' . L10n::t('"Show more" Settings').'

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