get_baseurl() . '/images/smiley-heart.gif" alt="<3" />', '</3', ':-)', ';-)', ':-(', ':-P', ':-X', ':-D', ':-O', '\\o/', 'O_o', ':\'(', ':-!', ':-/', ':-[', '8-)', ':beer', ':coffee', ':facepalm', ':like', ':dislike', 'red' ); /** * * Call hooks to get aditional smileies from other addons * */ $params = array('texts' => $texts, 'icons' => $icons, 'string' => ""); //changed call_hooks('smilie', $params); /** * * Generate html for smileylist * */ $s = "\t\n"; for($x = 0; $x < count($params['texts']); $x ++) { $icon = $params['icons'][$x]; $icon = str_replace('/>', 'onclick="smileybutton_addsmiley(\'' . $params['texts'][$x] . '\')"/>', $icon); $icon = str_replace('class="smiley"', 'class="smiley_preview"', $icon); $s .= ""; if (($x+1) % (sqrt(count($params['texts']))+1) == 0) { $s .= "\n\t"; } } $s .= "\t
" . $icon . "
\n"; /** * * Add css to page * */ $a->page['htmlhead'] .= '' . "\r\n"; /** * * Add the button to the Inputbox * */ if (! $nobutton and ! $deactivated) { $b .= "
\n"; //$b .= "\tget_baseurl() . "/addon/smileybutton/icon.gif\" onclick=\"toggle_smileybutton(); return false;\" alt=\"smiley\">\n"; $b .= "\t\n"; $b .= "\t
\n"; } /** * * Write the smileies to an (hidden) div * */ if ($deactivated){ return; } else { if ($nobutton) { $b .= "\t
\n"; } else { $b .= "\t
\n"; } } $b .= $s . "\n"; $b .= "
\n"; /** * * Function to show and hide the smiley-list in the hidden div * */ $b .= "\n"; } /** * * Set the configuration * */ function smileybutton_settings_post($a,$post) { if(! local_channel()) return; if($_POST['smileybutton-submit']) set_pconfig(local_channel(),'smileybutton','nobutton',intval($_POST['smileybutton'])); set_pconfig(local_channel(),'smileybutton','deactivated',intval($_POST['deactivated'])); } /** * * Add configuration-dialog to form * */ function smileybutton_settings(&$a,&$s) { if(! local_channel()) return; /* Add our stylesheet to the page so we can make our settings look nice */ //$a->page['htmlhead'] .= '' . "\r\n"; /* Get the current state of our config variable */ $nobutton = get_pconfig(local_channel(),'smileybutton','nobutton'); $checked['nobutton'] = (($nobutton) ? 1 : false); $deactivated = get_pconfig(local_channel(),'smileybutton','deactivated'); $checked['deactivated'] = (($deactivated) ? 1 : false); /* Add some HTML to the existing form */ $sc .= replace_macros(get_markup_template('field_checkbox.tpl'), array( '$field' => array('deactivated', t('Deactivate the feature'), $checked['deactivated'], '', array(t('No'),t('Yes'))), )); $sc .= replace_macros(get_markup_template('field_checkbox.tpl'), array( '$field' => array('smileybutton', t('Hide the button and show the smilies directly.'), $checked['nobutton'], '', array(t('No'),t('Yes'))), )); $s .= replace_macros(get_markup_template('generic_addon_settings.tpl'), array( '$addon' => array('smileybutton', t('Smileybutton Settings'), '', t('Submit')), '$content' => $sc )); }