function smileys_build_menu()
{
    $smileyarray = smiley_listall();
    $content = "<b>Smileys</b><br />\n";
    foreach ($smileyarray as $graphic => $keylist) {
        $graphic_size = getimagesize("{$_SERVER['FILE_ROOT']}/resources/smileys/{$graphic}");
        $key = $keylist[0];
        if (!strstr($key, ':') && !strstr($key, '>') && !strstr($key, '8') && !strstr($key, ')')) {
            $key = ":{$key}:";
        }
        $content .= "<a href=\"javascript:insertTag('textbox',' {$key} ','');document.getElementById('smiley').style.display='none';void(0);\"><img border='0' src='/resources/smileys/{$graphic}' align='middle' {$graphic_size['3']} /></a>\n";
    }
    return $content;
}
Esempio n. 2
0
function plan_process_smileys($plan, $hate = FALSE)
{
    profile('smileys');
    if ($_SERVER['USERINFO_ARRAY']['hatessmileys'] == FALSE) {
        include_once 'smiley_functions.php';
        $smileyarray = smiley_listall();
        foreach ($smileyarray as $graphic => $keylist) {
            $graphic_size = getimagesize("{$_SERVER['FILE_ROOT']}/resources/smileys/{$graphic}");
            foreach ($keylist as $i => $key) {
                if (strpos($key, ':') === FALSE && strpos($key, '>') === FALSE && strpos($key, '8') === FALSE && strpos($key, ')') === FALSE) {
                    $key = ":{$key}:";
                } else {
                    $key = " {$key}";
                }
                if (!$hate) {
                    $plan = str_replace($key, "<img src='{$_SERVER['WEB_ROOT']}/resources/smileys/{$graphic}' {$graphic_size['3']} />", $plan);
                } elseif (substr_count($key, ':') > 1) {
                    $plan = str_replace($key, "", $plan);
                }
                if ($key == " {$keylist[$i]}" && !$hate) {
                    $plan = str_replace("{$keylist[$i]} ", "<img src='{$_SERVER['WEB_ROOT']}/resources/smileys/{$graphic}' {$graphic_size['3']} />", $plan);
                }
                if ($key == " {$keylist[$i]}" && $hate && substr_count($key, ':') > 1) {
                    $plan = str_replace("{$keylist[$i]} ", "", $plan);
                }
            }
        }
    }
    profile('smileys');
    return $plan;
}