*/
function smileybutton_install() {
/**
*
* Register hooks for jot_tool and plugin_settings
*
*/
register_hook('jot_tool', 'addon/smileybutton/smileybutton.php', 'show_button');
register_hook('plugin_settings', 'addon/smileybutton/smileybutton.php', 'smileybutton_settings');
register_hook('plugin_settings_post', 'addon/smileybutton/smileybutton.php', 'smileybutton_settings_post');
logger("installed smileybutton");
}
function smileybutton_uninstall() {
/**
*
* Delet registered hooks
*
*/
unregister_hook('jot_tool', 'addon/smileybutton/smileybutton.php', 'show_button');
unregister_hook('plugin_settings', 'addon/smileybutton/smileybutton.php', 'smileybutton_settings');
unregister_hook('plugin_settings_post', 'addon/smileybutton/smileybutton.php', 'smileybutton_settings_post');
logger("removed smileybutton");
}
function show_button($a, &$b) {
/**
*
* Check if it is a local user and he has enabled smileybutton
*
*/
if(! local_user()) {
$nobutton = false;
} else {
$nobutton = get_pconfig(local_user(), 'smileybutton', 'nobutton');
}
/**
*
* Prepare the Smilie-Arrays
*
*/
/**
*
* I have copied this from /include/text.php, removed dobles
* and some escapes.
*
*/
$texts = array(
'<3',
'</3',
':-)',
';-)',
':-(',
':-P',
':-X',
':-D',
':-O',
'\\\\o/',
'O_o',
":\'(",
":-!",
":-/",
":-[",
"8-)",
':beer',
':coffee',
':facepalm',
':like',
':dislike',
'~friendica',
'red#'
);
$icons = array(
'',
'
',
'
',
'
',
'
',
'
',
'
',
'
',
'
',
'
',
'
',
'
',
'
',
'
',
'
',
'
',
'
',
'
',
'
',
'
',
'
',
'
',
'
'
);
/**
*
* 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
" . $icon . " | "; if (($x+1) % (sqrt(count($params['texts']))+1) == 0) { $s .= "