X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=group_text%2Fgroup_text.php;h=b8a1d21fd0b7e5fcdd1f30c103c379a691676105;hb=0ea84cfb66366edbbe333e9fe3db6a35d07a9c17;hp=151ff0ae982ed456e2a3b81bc243b181fb1a32eb;hpb=47396b1d284dffbb994233597cb9fca8a1e33be7;p=friendica-addons.git diff --git a/group_text/group_text.php b/group_text/group_text.php old mode 100755 new mode 100644 index 151ff0ae..b8a1d21f --- a/group_text/group_text.php +++ b/group_text/group_text.php @@ -4,27 +4,27 @@ * Description: Disable images in group edit menu * Version: 1.0 * Author: Thomas Willingham - * - * */ - +use Friendica\Core\Hook; +use Friendica\Core\Logger; +use Friendica\DI; function group_text_install() { - register_hook('plugin_settings', 'addon/group_text/group_text.php', 'group_text_settings'); - register_hook('plugin_settings_post', 'addon/group_text/group_text.php', 'group_text_settings_post'); + Hook::register('addon_settings', 'addon/group_text/group_text.php', 'group_text_settings'); + Hook::register('addon_settings_post', 'addon/group_text/group_text.php', 'group_text_settings_post'); - logger("installed group_text"); + Logger::log("installed group_text"); } function group_text_uninstall() { - unregister_hook('plugin_settings', 'addon/group_text/group_text.php', 'group_text_settings'); - unregister_hook('plugin_settings_post', 'addon/group_text/group_text.php', 'group_text_settings_post'); + Hook::unregister('addon_settings', 'addon/group_text/group_text.php', 'group_text_settings'); + Hook::unregister('addon_settings_post', 'addon/group_text/group_text.php', 'group_text_settings_post'); - logger("removed group_text"); + Logger::log("removed group_text"); } @@ -39,17 +39,17 @@ function group_text_uninstall() { */ function group_text_settings_post($a,$post) { - if(! local_user() || (! x($_POST,'group_text-submit'))) + if(! local_user() || empty($_POST['group_text-submit'])) return; - set_pconfig(local_user(),'system','groupedit_image_limit',intval($_POST['group_text'])); + DI::pConfig()->set(local_user(),'system','groupedit_image_limit',intval($_POST['group_text'])); - info( t('Editplain settings updated.') . EOL); + info(DI::l10n()->t('Group Text settings updated.') . EOL); } /** * - * Called from the Plugin Setting form. + * Called from the Addon Setting form. * Add our own settings info to the page. * */ @@ -63,24 +63,24 @@ function group_text_settings(&$a,&$s) { /* Add our stylesheet to the page so we can make our settings look nice */ - $a->page['htmlhead'] .= '' . "\r\n"; + DI::page()['htmlhead'] .= '' . "\r\n"; /* Get the current state of our config variable */ - $enabled = get_pconfig(local_user(),'system','groupedit_image_limit'); + $enabled = DI::pConfig()->get(local_user(),'system','groupedit_image_limit'); $checked = (($enabled) ? ' checked="checked" ' : ''); /* Add some HTML to the existing form */ $s .= '
'; - $s .= '

' . t('Group Text') . '

'; + $s .= '

' . DI::l10n()->t('Group Text') . '

'; $s .= '
'; - $s .= ''; + $s .= ''; $s .= ''; $s .= '
'; /* provide a submit button */ - $s .= '
'; + $s .= '
'; }