// Here you can add additional smilies if you like (please note that you must escape singlequote and backslash)
$smiley_text = array(':)', '=)', ':(', '=(', ':D', '=D', ';)', ':x', ':rolleyes:', ':scared:', ':afro:', ':blink:', ':bash:', ':cyklop:', ':gun:', ':aniolek:', ':ok:', ':down:', ':kujon:', ':oops:', ':cool:', ':eek:');
$smiley_img = array('smile.gif', 'smile.gif', 'sad.gif', 'sad.gif', 'laugh.gif', 'laugh.gif', 'wink2.gif', 'mad.gif', 'rolleyes.gif', 'scared.gif', 'afro.gif', 'blink.gif', 'bash.gif', 'cyklop.gif', 'gunsmilie.gif', 'hypocrite.gif', 'thumbsup.gif', 'thumbdown.gif', 'smartass.gif', 'oops.gif', 'cool.gif', 'eek.gif');// Uncomment the next row if you add smilies that contain any of the characters &"'<>
//$smiley_text = array_map('pun_htmlspecialchars', $smiley_text);
Could you check is it correct?
And this is the part where I deleted
width="15" height="15"
I think it should be ok.
$num_smilies = count($smiley_text);
for ($i = 0; $i < $num_smilies; ++$i)
$message = preg_replace("#(?<=.\W|\W.|^\W)".preg_quote($smiley_text[$i], '#')."(?=.\W|\W.|\W$)#m", '$1<img src="img/smilies/'.$smiley_img[$i].'" alt="'.$smiley_text[$i].'">$2', $message);