I use the functions.php code as is from the wp-includes directory, with my own smilies -- relevant portion below.
/**
* Convert smiley code to the icon graphic file equivalent.
*
* You can turn off smilies, by going to the write setting screen and unchecking
* the box, or by setting 'use_smilies' option to false or removing the option.
*
* Plugins may override the default smiley list by setting the $wpsmiliestrans
* to an array, with the key the code the blogger types in and the value the
* image file.
*
* The $wp_smiliessearch global is for the regular expression and is set each
* time the function is called.
*
* The full list of smilies can be found in the function and won't be listed in
* the description. Probably should create a Codex page for it, so that it is
* available.
*
* @global array $wpsmiliestrans
* @global array $wp_smiliessearch
* @since 2.2.0
*/
function smilies_init() {
global $wpsmiliestrans, $wp_smiliessearch;
// don't bother setting up smilies if they are disabled
if ( !get_option( 'use_smilies' ) )
return;
if ( !isset( $wpsmiliestrans ) ) {
$wpsmiliestrans = array(
'%%' => '4leafclover.gif',
'*clover*' => '4leafclover.gif',
'*alien*' => 'alien.gif',
'>-)' => 'alien.gif',
'O:-)' => 'angel.gif',
'O:)' => 'angel.gif',
'*angel*' => 'angel.gif',
'*innocent*' => 'angel.gif',
'X(' => 'angry.gif',
'x(' => 'angry.gif',
'X-(' => 'angry.gif',
'x-(' => 'angry.gif',
'*mad*' => 'angry.gif',
'*fumes*' => 'angry.gif',
'*mad*' => 'icon_mad.gif',
'=D>' => 'applause.gif',
'*applause*' => 'applause.gif',
'*claps*' => 'applause.gif',
'~X(' => 'atwitsend.gif',
'~x(' => 'atwitsend.gif',
'*at wits end*' => 'atwitsend.gif',
';;)' => 'battingeyelashes.gif',
'*bats eyelashes*' => 'battingeyelashes.gif',
'b-(' => 'beatup.gif',
'*punch*' => 'beatup.gif',
'*bee*' => 'bee.gif',
':bz' => 'bee.gif',
':-D' => 'biggrin.gif',
':D' => 'biggrin.gif',
'*grin*' => 'biggrin.gif',
'*big grin*' => 'biggrin.gif',
':grin:' => 'icon_biggrin.gif',
'>:D<' => 'bighug.gif',
'*hug*' => 'bighug.gif',
'*hugs*' => 'bighug.gif',
'*blush*' => 'blushing.gif',
':oops:' => 'blushing.gif',
'>:/' => 'bringiton.gif',
'=((' => 'brokenheart.gif',
'*bug*' => 'bug.gif',
'=:)' => 'bug.gif',
':-c' => 'callme.gif',
':-C' => 'callme.gif',
':c' => 'callme.gif',
':C' => 'callme.gif',
'*call me*' => 'callme.gif',
':-@' => 'chatterbox.gif',
':@' => 'chatterbox.gif',
'*chatterbox*' => 'chatterbox.gif',
'~:>' => 'chicken.gif',
'*chicken*' => 'chicken.gif',
':O)' => 'clown.gif',
'*clown*' => 'clown.gif',
'~O)' => 'coffee.gif',
'*coffee*' => 'coffee.gif',
'*confused*' => 'confused.gif',
':-???' => 'confused.gif',
':???' => 'confused.gif',
':???:' => 'icon_confused.gif',
'B-)' => 'cool.gif',
'B)' => 'cool.gif',
'*is cool*' => 'cool.gif',
'8)' => 'icon_cool.gif',
':cool:' => 'icon_cool.gif',
'8-)' => 'icon_cool.gif',
'3:-O' => 'cow.gif',
'*cow*' => 'cow.gif',
'<):)' => 'cowboy.gif',
'*cowboy*' => 'cowboy.gif',
':((' => 'crying.gif',
'*cries*' => 'crying.gif',
':cry:' => 'icon_cry.gif',
'\:D/' => 'dancing.gif',
'*dances*' => 'dancing.gif',
'8->' => 'daydreaming.gif',
'8>' => 'daydreaming.gif',
'*daydreams*' => 'daydreaming.gif',
'>:)' => 'devil.gif',
'>:-)' => 'devil.gif',
'*evil*' => 'devil.gif',
':evil:' => 'icon_evil.gif',
'#-o' => 'doh.gif',
'#o' => 'doh.gif',
'#O' => 'doh.gif',
'#-O' => 'doh.gif',
'*doh*' => 'doh.gif',
'*doh!*' => 'doh.gif',
'=P~' => 'drooling.gif',
'=p~' => 'drooling.gif',
'*drools*' => 'drooling.gif',
'/:)' => 'eyebrow.gif',
'*eyebrow*' => 'eyebrow.gif',
'*raises eyebrow*' => 'eyebrow.gif',
':-L' => 'frustrated.gif',
':L' => 'frustrated.gif',
'*frustrated*' => 'frustrated.gif',
':smile:' => 'icon_smile.gif',
'*smile*' => 'happy.gif',
'*smiles*' => 'happy.gif',
':-)' => 'happy.gif',
':)' => 'happy.gif',
'X_X' => 'hideseyes.gif',
'x_x' => 'hideseyes.gif',
'*hides*' => 'hideseyes.gif',
'*hides eyes*' => 'hideseyes.gif',
':!!' => 'hurryup.gif',
':-!!' => 'hurryup.gif',
'*hurry*' => 'hurryup.gif',
'*hurry up*' => 'hurryup.gif',
'@-)' => 'hypnotized.gif',
'@)' => 'hypnotized.gif',
'*hypnotized*' => 'hypnotized.gif',
'*-:)' => 'idealightbulb.gif',
'*idea*' => 'idealightbulb.gif',
':idea:' => 'icon_idea.gif',
':-??' => 'Idontknow.gif',
':??' => 'Idontknow.gif',
'*dunno*' => 'Idontknow.gif',
':-*' => 'kiss.gif',
':*' => 'kiss.gif',
'*kiss*' => 'kiss.gif',
'*smooch*' => 'kiss.gif',
':))' => 'laughing.gif',
':-))' => 'laughing.gif',
'*lol*' => 'laughing.gif',
'*laugh*' => 'laughing.gif',
':lol:' => 'icon_lol.gif',
':^o' => 'liar.gif',
':^O' => 'liar.gif',
'*liar*' => 'liar.gif',
'L-)' => 'loser.gif',
'L)' => 'loser.gif',
'*loser*' => 'loser.gif',
':x' => 'lovestruck.gif',
':-x' => 'lovestruck.gif',
':-X' => 'lovestruck.gif',
':X' => 'lovestruck.gif',
'*love*' => 'lovestruck.gif',
'$-)' => 'moneyeyes.gif',
'$)' => 'moneyeyes.gif',
'*money*' => 'moneyeyes.gif',
':(|)' => 'monkey.gif',
'*monkey*' => 'monkey.gif',
':-SS' => 'nailbiting.gif',
':SS' => 'nailbiting.gif',
':-ss' => 'nailbiting.gif',
':ss' => 'nailbiting.gif',
'*bites nails*' => 'nailbiting.gif',
':-B' => 'nerd.gif',
':B' => 'nerd.gif',
':-b' => 'nerd.gif',
':b' => 'nerd.gif',
'*nerd*' => 'nerd.gif',
'%-(' => 'notlistening.gif',
'%(' => 'notlistening.gif',
'*not listening*' => 'notlistening.gif',
'^#(^' => 'notme.gif',
'*not me*' => 'notme.gif',
'[-(' => 'nottalking.gif',
'*shakes head*' => 'nottalking.gif',
'^:)^' => 'notworthy.gif',
'*not worthy' => 'notworthy.gif',
':-j' => 'ohgoon.gif',
':j' => 'ohgoon.gif',
'*oh go on*' => 'ohgoon.gif',
':)]' => 'onphone.gif',
'*phone hang on*' => 'onphone.gif',
'*phone*' => 'onphone.gif',
'<:-P' => 'party.gif',
'*party*' => 'party.gif',
'*noisemaker*' => 'party.gif',
':)>-' => 'peacesign.gif',
'*peace*' => 'peacesign.gif',
'*victory*' => 'peacesign.gif',
'>:P' => 'phbbbt.gif',
'>:-P' => 'phbbbt.gif',
'*phbbbt*' => 'phbbbt.gif',
'*raspberry*' => 'phbbbt.gif',
':@)' => 'pig.gif',
'*pig*' => 'pig.gif',
':ar!' => 'pirate.gif',
'*pirate*' => 'pirate.gif',
'[-O<' => 'praying.gif',
'*prays*' => 'praying.gif',
'(~~)' => 'pumpkin.gif',
'*pumpkin*' => 'pumpkin.gif',
':o3' => 'puppyeyes.gif',
'*puppy eyes*' => 'puppyeyes.gif',
'\m/' => 'rockon.gif',
'*rocks out*' => 'rockon.gif',
'=))' => 'rofl.gif',
'*rofl*' => 'rofl.gif',
'*lmao*' => 'rofl.gif',
'8-|' => 'rollingeyes.gif',
'*rolls eyes*' => 'rollingeyes.gif',
'*eyeroll*' => 'rollingeyes.gif',
':roll:' => 'icon_rolleyes.gif',
'@};-' => 'rose.gif',
'*rose*' => 'rose.gif',
':(' => 'sad.gif',
':-(' => 'sad.gif',
'*sad*' => 'sad.gif',
':sad:' => 'icon_sad.gif',
'[-X' => 'shameonyou.gif',
'[X' => 'shameonyou.gif',
'*shame*' => 'shameonyou.gif',
'*tsk*' => 'shameonyou.gif',
':-&' => 'sick.gif',
':&' => 'sick.gif',
'*sick*' => 'sick.gif',
'*retch*' => 'sick.gif',
'*green*' => 'sick.gif',
'*eww*' => 'sick.gif',
':-<' => 'sigh.gif',
':<' => 'sigh.gif',
'*sigh*' => 'sigh.gif',
'8-}' => 'silly.gif',
'*silly*' => 'silly.gif',
'8-X' => 'skull.gif',
'*skull*' => 'skull.gif',
'I-)' => 'sleepy.gif',
'i-)' => 'sleepy.gif',
'I)' => 'sleepy.gif',
'i)' => 'sleepy.gif',
'*sleepy*' => 'sleepy.gif',
':-$' => 'ssshhhh.gif',
':$' => 'ssshhhh.gif',
'*shh*' => 'ssshhhh.gif',
'*shhh*' => 'ssshhhh.gif',
'(*)' => 'star.gif',
'*star*' => 'star.gif',
'*gold star*' => 'star.gif',
':-/' => 'straightface.gif',
':/' => 'straightface.gif',
':|' => 'straightface.gif',
':-|' => 'straightface.gif',
'*frowns*' => 'straightface.gif',
'*frown*' => 'straightface.gif',
':neutral:' => 'icon_neutral.gif',
':O' => 'surprised.gif',
':-O' => 'surprised.gif',
':o' => 'surprised.gif',
':-o' => 'surprised.gif',
'*omg*' => 'surprised.gif',
':eek:' => 'icon_surprised.gif',
':shock:' => 'icon_eek.gif',
'8-O' => 'icon_eek.gif',
'8O' => 'icon_eek.gif',
'=;' => 'talktothehand.gif',
'*talk to the hand*' => 'talktothehand.gif',
';))' => 'teehee.gif',
'*tee hee*' => 'teehee.gif',
'*giggle*' => 'teehee.gif',
':-?' => 'thinking.gif',
':?' => 'thinking.gif',
'*thinks*' => 'thinking.gif',
':-q' => 'thumbsdown.gif',
'*thumbs down*' => 'thumbsdown.gif',
':-bd' => 'thumbsup.gif',
'*thumbs up*' => 'thumbsup.gif',
':-t' => 'timeout.gif',
'*time out*' => 'timeout.gif',
'*timeout*' => 'timeout.gif',
':P' => 'tongue.gif',
':-P' => 'tongue.gif',
'*tongue*' => 'tongue.gif',
':razz:' => 'icon_razz.gif',
':>' => 'wagglingeyebrows.gif',
':->' => 'wagglingeyebrows.gif',
'*waggle*' => 'wagglingeyebrows.gif',
':-w' => 'waiting.gif',
'*drums fingers*' => 'waiting.gif',
'*waits*' => 'waiting.gif',
':-h' => 'wave.gif',
'*wave*' => 'wave.gif',
'*waves*' => 'wave.gif',
'#:-S' => 'whew.gif',
'*whew*' => 'whew.gif',
'*whistles*' => 'whistling.gif',
';)' => 'wink.gif',
';-)' => 'wink.gif',
'*wink*' => 'wink.gif',
'*winks*' => 'wink.gis',
':wink:' => 'icon_wink.gif',
':-S' => 'worried.gif',
':-s' => 'worried.gif',
':S' => 'worried.gif',
':s' => 'worried.gif',
'*worries*' => 'worried.gif',
'(:|' => 'yawn.gif',
'*yawn*' => 'yawn.gif',
'*yawns*' => 'yawns.gif',
'(%)' => 'yinyang.gif',
'*yin yang*' => 'yinyang.gif',
':mrgreen:' => 'icon_mrgreen.gif',
':twisted:' => 'icon_twisted.gif',
':arrow:' => 'icon_arrow.gif',
':!:' => 'icon_exclaim.gif',
':?:' => 'icon_question.gif',
);
}
if (count($wpsmiliestrans) == 0) {
return;
}
/*
* NOTE: we sort the smilies in reverse key order. This is to make sure
* we match the longest possible smilie (:???: vs :?) as the regular
* expression used below is first-match
*/
krsort($wpsmiliestrans);
$wp_smiliessearch = '/(?:\s|^)';
$subchar = '';
foreach ( (array) $wpsmiliestrans as $smiley => $img ) {
$firstchar = substr($smiley, 0, 1);
$rest = substr($smiley, 1);
// new subpattern?
if ($firstchar != $subchar) {
if ($subchar != '') {
$wp_smiliessearch .= ')|(?:\s|^)';
}
$subchar = $firstchar;
$wp_smiliessearch .= preg_quote($firstchar, '/') . '(?:';
} else {
$wp_smiliessearch .= '|';
}
$wp_smiliessearch .= preg_quote($rest);
}
$wp_smiliessearch .= ')(?:\s|$)/m';
}
That's probably way more than you needed to see. ;)
Thanks!