From ad6e4c2ba058163a73e6d3dbb91ff38dbbcc4697 Mon Sep 17 00:00:00 2001 From: Johannes Schwab Date: Sat, 7 Sep 2013 18:35:00 +0200 Subject: [PATCH] Add an option to hide the button --- smileybutton/smileybutton.php | 72 ++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 30 deletions(-) diff --git a/smileybutton/smileybutton.php b/smileybutton/smileybutton.php index afd3e214c..abedf27ea 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 .= "