From: Johannes Schwab Date: Sat, 7 Sep 2013 16:35:00 +0000 (+0200) Subject: Add an option to hide the button X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ad6e4c2ba058163a73e6d3dbb91ff38dbbcc4697;p=friendica-addons.git Add an option to hide the button --- diff --git a/smileybutton/smileybutton.php b/smileybutton/smileybutton.php index afd3e214..abedf27e 100755 --- a/smileybutton/smileybutton.php +++ b/smileybutton/smileybutton.php @@ -1,9 +1,9 @@ + * Author: Johannes Schwab */ @@ -48,13 +48,11 @@ function show_button($a, &$b) { * */ - if(! local_user()) - return; - - $active = get_pconfig(local_user(), 'smileybutton', 'enable'); - - if(! $active) - return; + if(! local_user()) { + $nobutton = false; + } else { + $nobutton = get_pconfig(local_user(), 'smileybutton', 'nobutton'); + } /** * @@ -64,7 +62,8 @@ function show_button($a, &$b) { /** * - * I have copied this from /include/text.php and removed dobles + * I have copied this from /include/text.php, removed dobles + * and some escapes. * */ @@ -161,18 +160,24 @@ function show_button($a, &$b) { * Add the button to the Inputbox * */ + if (! $nobutton) { + $b = "
\n"; + $b .= "\tget_baseurl() . "/addon/smileybutton/icon.gif\" id=\"smileybutton\" onclick=\"toggle_smileybutton()\" alt=\"smiley\">\n"; + $b .= "\t
\n"; + } - $b = "
\n"; - $b .= "\tget_baseurl() . "/addon/smileybutton/icon.gif\" onclick=\"toggle_smileybutton()\" alt=\"smiley\">\n"; - $b .= "\t
\n"; /** * - * Write the smileies to an hidden div + * Write the smileies to an (hidden) div * */ - $b .= "\t
\n"; + if ($nobutton) { + $b .= "\t
\n"; + } else { + $b .= "\t
\n"; + } $b .= $s . "\n"; $b .= "
\n"; @@ -183,15 +188,18 @@ function show_button($a, &$b) { */ $b .= "