daily gadgets, computers, and electronic news
16/04
2005

Yahoo/MSN Style Smileys Reloaded Plugin Updated

[php]< ?php

/*
Plugin Name: Yahoo/MSN Style Smileys Reloaded
Plugin URI: http://www.funponsel.com/blog/?p=48
Description: Displays Yahoo Messenger or MSN Messenger style smileys. Please deactivate 'Convert emoticons like :-) and :-P to graphics on display' under Writing Options menu when using this. Reloaded version enable BOTH smileys to be used.
Version: 4.1 *Reloaded*
Author: Cosa Aranda
Author URI: http://www.cosaaranda.tk/
*/

/*
Original Plugin Name: Yahoo/MSN Style Smileys
Original Plugin URI: http://priyadi.net/archives/2005/02/27/wordpress-yahoomsn-messenger-style-smileys-plugin/
Original Description: Displays Yahoo Messenger or MSN Messenger style smileys. Please deactivate 'Convert emoticons like :-) and :-P to graphics on display' under Writing Options menu when using this.
Version: 4.1
Original Author: Priyadi Iman Nurcahyo
Original Author URI: http://priyadi.net/
*/

/* configuration */

### $smilies_style let you choose yahoo or msn style smiley
### valid values are 'yahoo' or 'msn'
### deprecated in Reloaded
# $smilies_style = 'yahoo';

### enable javascript smiley processing?
### change this to '1' if you need javascript smiley processor
### e.g. for use with comment preview
$smilies_javascript = '1';

### Allow user to show additional (hidden) smileys? (true/false)
### NOTE: it could be very slow to load all the smileys when this is enabled.
$smilies_allow_hidden = true;

### Javascript reloader, specify a Javascript command that will refresh
### Javascript based comment preview
#$js_reloader = "ReloadTextDiv();";

/* end configuration */

if (!function_exists('get_settings')) {
$smilies_blog_url = $_SERVER['SCRIPT_URI'];
$smilies_blog_url = preg_replace("/wp-content/plugins/im_smiley.php$/", "", $smilies_blog_url);
} else {
$smilies_blog_url = get_settings('siteurl');
}

/* the following are taken from gaim */

$smiliestrans = array (
'#:-s' => ‘yahoo_sweating.gif’,
‘#:-S’ => ‘yahoo_sweating.gif’,
‘#-o’ => ‘yahoo_doh.gif’,
‘#-O’ => ‘yahoo_doh.gif’,
‘$-)’ => ‘yahoo_moneyeyes.gif’,
‘%%-’ => ‘yahoo_shamrock.gif’,
‘(#)’ => ‘msn_sun.png’,
‘(%)’ => ‘msn_handcuffs.png’,
‘(%)’ => ‘yahoo_yingyang.gif’,
‘(&)’ => ‘msn_dog.png’,
‘(*)’ => ‘msn_star.png’,
‘(*)’ => ‘yahoo_star.gif’,
‘(:’ => ‘yahoo_smiley.gif’,
‘(-:’ => ‘yahoo_smiley.gif’,
‘(:|’ => ‘yahoo_tired.gif’,
‘(?)’ => ‘msn_question.png’,
‘(@)’ => ‘msn_cat.png’,
‘(^)’ => ‘msn_cake.gif’,
‘({)’ => ‘msn_run.png’,
‘(||)’ => ‘msn_bowl.png’,
‘(})’ => ‘msn_runback.png’,
‘(~)’ => ‘msn_film.png’,
‘(~~)’ => ‘yahoo_pumpkin.gif’,
‘(6)’ => ‘msn_devil.png’,
‘(8)’ => ‘msn_note.png’,
‘(a)’ => ‘msn_angel.png’,
‘(A)’ => ‘msn_angel.png’,
‘(ap)’ => ‘msn_plane.png’,
‘(au)’ => ‘msn_car.png’,
‘(b)’ => ‘msn_beer.png’,
‘(B)’ => ‘msn_beer.png’,
‘(bah)’ => ‘msn_sheep.png’,
‘(brb)’ => ‘msn_brb.png’,
‘(c)’ => ‘msn_coffee.png’,
‘(C)’ => ‘msn_coffee.png’,
‘(ci)’ => ‘msn_cigarette.gif’,
‘(co)’ => ‘msn_computer.png’,
‘(d)’ => ‘msn_drink.png’,
‘(D)’ => ‘msn_drink.png’,
‘(e)’ => ‘msn_email.png’,
‘(E)’ => ‘msn_email.png’,
‘(f)’ => ‘msn_flower.png’,
‘(F)’ => ‘msn_flower.png’,
‘(g)’ => ‘msn_gift.png’,
‘(G)’ => ‘msn_gift.png’,
‘(h)’ => ‘msn_hot.png’,
‘(H)’ => ‘msn_hot.png’,
‘(h5)’ => ‘msn_highfive.png’,
‘(i)’ => ‘msn_idea.png’,
‘(I)’ => ‘msn_idea.png’,
‘(ip)’ => ‘msn_island.png’,
‘(k)’ => ‘msn_kiss.png’,
‘(K)’ => ‘msn_kiss.png’,
‘(l)’ => ‘msn_heart.png’,
‘(L)’ => ‘msn_heart.png’,
‘(li)’ => ‘msn_lightning.gif’,
‘(m)’ => ‘msn_icon.png’,
‘(M)’ => ‘msn_icon.png’,
‘(mo)’ => ‘msn_coins.png’,
‘(mp)’ => ‘msn_cellphone.png’,
‘(n)’ => ‘msn_thumbdown.png’,
‘(N)’ => ‘msn_thumbdown.png’,
‘(o)’ => ‘msn_clock.png’,
‘(O)’ => ‘msn_clock.png’,
‘(p)’ => ‘msn_photo.png’,
‘(P)’ => ‘msn_photo.png’,
‘(pi)’ => ‘msn_pizza.png’,
‘(pl)’ => ‘msn_plate.png’,
‘(r)’ => ‘msn_rainbow.png’,
‘(R)’ => ‘msn_rainbow.png’,
‘(S)’ => ‘msn_sleep.png’,
‘(sn)’ => ‘msn_snail.png’,
‘(so)’ => ‘msn_soccer.png’,
‘(st)’ => ‘msn_stormy.png’,
‘(t)’ => ‘msn_phone.png’,
‘(T)’ => ‘msn_phone.png’,
‘(tu)’ => ‘msn_turtle.png’,
‘(u)’ => ‘msn_brheart.png’,
‘(U)’ => ‘msn_brheart.png’,
‘(um)’ => ‘msn_umbrella.png’,
‘(w)’ => ‘msn_deadflower.png’,
‘(W)’ => ‘msn_deadflower.png’,
‘(x)’ => ‘msn_girl.png’,
‘(X)’ => ‘msn_girl.png’,
‘(xx)’ => ‘msn_xbox.png’,
‘(y)’ => ‘msn_thumbup.png’,
‘(Y)’ => ‘msn_thumbup.png’,
‘(yn)’ => ‘msn_fingerscrossed.png’,
‘(z)’ => ‘msn_boy.png’,
‘(Z)’ => ‘msn_boy.png’,
‘*-)’ => ‘msn_think.gif’,
‘**==’ => ‘yahoo_flag.gif’,
‘*-:)’ => ‘yahoo_idea.gif’,
‘/:)’ => ‘yahoo_eyebrow.gif’,
‘/:-)’ => ‘yahoo_eyebrow.gif’,
‘:-”‘ => ‘yahoo_whistling.gif’,
‘:”>’ => ‘yahoo_blush.gif’,
‘:-#’ => ‘msn_donttell.png’,
‘:$’ => ‘msn_embarrassed.png’,
‘(:-$)’ => ‘msn_embarrassed.png’,
‘:-$’ => ‘yahoo_shhhh.gif’,
‘:-&’ => ‘yahoo_sick.gif’,
‘m:(’ => ‘msn_sad.png’,
‘m:-(’ => ‘msn_sad.png’,
‘:(’ => ‘yahoo_sad.gif’,
‘:-(’ => ‘yahoo_sad.gif’,
‘:((’ => ‘yahoo_cry.gif’,
‘:-((’ => ‘yahoo_cry.gif’,
‘:(|)’ => ‘yahoo_monkey.gif’,
‘m:)’ => ‘msn_smiley.png’,
‘m:-)’ => ‘msn_smiley.png’,
‘:)’ => ‘yahoo_smiley.gif’,
‘:-)’ => ‘yahoo_smiley.gif’,
‘:))’ => ‘yahoo_laughloud.gif’,
‘:-))’ => ‘yahoo_laughloud.gif’,
‘:)>-’ => ‘yahoo_peace.gif’,
‘m:-*’ => ‘msn_secret.png’,
‘:*’ => ‘yahoo_kiss.gif’,
‘:-*’ => ‘yahoo_kiss.gif’,
‘:-/’ => ‘yahoo_question.gif’,
‘:-?’ => ‘yahoo_think.gif’,
‘m:@’ => ‘msn_angry.png’,
‘m:-@’ => ‘msn_angry.png’,
‘:-@’ => ‘yahoo_talktohand.gif’,
‘:@)’ => ‘yahoo_pig.gif’,
‘:[' => 'msn_bat.gif',
':-[' => 'msn_bat.gif',
':'(' => 'msn_cry.gif',
':-' => 'yahoo_question.gif',
':^)' => 'msn_dontknow.gif',
':^o' => 'yahoo_liar.gif',
':^O' => 'yahoo_liar.gif',
'm:|' => 'msn_neutral.png',
'm:-|' => 'msn_neutral.png',
':|' => 'yahoo_neutral.gif',
':-|' => 'yahoo_neutral.gif',
'm:-<' => 'msn_sad.png',
':-<' => 'yahoo_sighing.gif',
'm:>' => 'msn_laugh.png',
'm:->' => 'msn_laugh.png',
':>' => 'yahoo_mean.gif',
':->' => 'yahoo_mean.gif',
':0)' => 'yahoo_clown.gif',
':-b' => 'yahoo_glasses.gif',
':-B' => 'yahoo_glasses.gif',
'm:d' => 'msn_laugh.png',
'm:-d' => 'msn_laugh.png',
'm:D' => 'msn_laugh.png',
'm:-D' => 'msn_laugh.png',
':d' => 'yahoo_bigsmile.gif',
':-d' => 'yahoo_bigsmile.gif',
':D' => 'yahoo_bigsmile.gif',
':-D' => 'yahoo_bigsmile.gif',
':-j' => 'yahoo_youkiddingme.gif',
':-J' => 'yahoo_youkiddingme.gif',
':-l' => 'yahoo_frustrated.gif',
':-L' => 'yahoo_frustrated.gif',
'm:o' => 'msn_ooooh.png',
'm:-o' => 'msn_ooooh.png',
'm:O' => 'msn_ooooh.png',
'm:-O' => 'msn_ooooh.png',
':o' => 'yahoo_ooooh.gif',
':-o' => 'yahoo_ooooh.gif',
':O' => 'yahoo_ooooh.gif',
':-O' => 'yahoo_ooooh.gif',
':o)' => 'yahoo_clown.gif',
':O)' => 'yahoo_clown.gif',
'm:p' => 'msn_tongue.png',
'm:-p' => 'msn_tongue.png',
'm:P' => 'msn_tongue.png',
'm:-P' => 'msn_tongue.png',
':p' => 'yahoo_tongue.gif',
':-p' => 'yahoo_tongue.gif',
':P' => 'yahoo_tongue.gif',
':-P' => 'yahoo_tongue.gif',
':s' => 'msn_weird.png',
'm:-s' => 'msn_weird.png',
':S' => 'msn_weird.png',
':-S' => 'msn_weird.png',
':-s' => 'yahoo_worried.gif',
':-S' => 'yahoo_worried.gif',
':-ss' => 'yahoo_nailbiting.gif',
':-sS' => 'yahoo_nailbiting.gif',
':-Ss' => 'yahoo_nailbiting.gif',
':-SS' => 'yahoo_nailbiting.gif',
':-w' => 'yahoo_waiting.gif',
':-W' => 'yahoo_waiting.gif',
':x' => 'yahoo_love.gif',
':-x' => 'yahoo_love.gif',
':X' => 'yahoo_love.gif',
':-X' => 'yahoo_love.gif',
'm;)' => 'msn_wink.gif',
'm;-)' => 'msn_wink.gif',
';)' => 'yahoo_wink.gif',
';-)' => 'yahoo_wink.gif',
';))' => 'yahoo_giggle.gif',
';;)' => 'yahoo_batting.gif',
'@-)' => 'yahoo_hypnotized.gif',
'@};-' => 'yahoo_flower.gif',
'[-(' => 'yahoo_silent.gif',
'[-o<' => 'yahoo_pray.gif',
'[-O<' => 'yahoo_pray.gif',
'[-x' => 'yahoo_shame.gif',
'[-X' => 'yahoo_shame.gif',
':d/' => 'yahoo_dance.gif',
':D/' => 'yahoo_dance.gif',
'^:)^' => 'yahoo_worship.gif',
'^o)' => 'msn_sarcastic.png',
'm|-)' => 'msn_sleepy.gif',
'|-)' => 'yahoo_sleep.gif',
'~:>' => 'yahoo_chicken.gif',
'~o)' => 'yahoo_coffee.gif',
'~O)' => 'yahoo_coffee.gif',
'+o(' => 'msn_sick.png',
'<):)' => 'yahoo_cowboy.gif',
'<:o)' => 'msn_party.gif',
'<:-p' => 'yahoo_party.gif',
'<:-P' => 'yahoo_party.gif',
'=((' => 'yahoo_brokenheart.gif',
'=))' => 'yahoo_rotfl.gif',
'=:)' => 'yahoo_alien.gif',
'=:-)' => 'yahoo_alien.gif',
'=;' => 'yahoo_bye.gif',
'=d>' => 'yahoo_clap.gif',
'=D>' => 'yahoo_clap.gif',
'=p~' => 'yahoo_drool.gif',
'=P~' => 'yahoo_drool.gif',
'>-)' => 'yahoo_alien2.gif',
'>:)' => 'yahoo_devil.gif',
'>:/' => 'yahoo_waving.gif',
'>:D<' => 'yahoo_huggs.gif',
'>:d<' => 'yahoo_huggs.gif',
'>:p' => 'yahoo_madtongue.gif',
'>:P' => 'yahoo_madtongue.gif',
'0:-)' => 'yahoo_angel.gif',
'3:-o' => 'yahoo_cow.gif',
'3:-O' => 'yahoo_cow.gif',
'8-)' => 'msn_eyeroll.gif',
'm8-|' => 'msn_nerd.png',
'8-|' => 'yahoo_eyeroll.gif',
'8-}' => 'yahoo_silly.gif',
'8o|' => 'msn_teeth.png',
'8-x' => 'yahoo_ghost.gif',
'8-X' => 'yahoo_ghost.gif',
'b-(' => 'yahoo_beatup.gif',
'B-(' => 'yahoo_beatup.gif',
'b-)' => 'yahoo_sunglas.gif',
'B-)' => 'yahoo_sunglas.gif',
'I-)' => 'yahoo_sleep.gif',
'l-)' => 'yahoo_loser.gif',
'L-)' => 'yahoo_loser.gif',
'o:-)' => 'yahoo_angel.gif',
'O:-)' => 'yahoo_angel.gif',
'o-+' => 'yahoo_femalefighter.gif',
'O-+' => 'yahoo_femalefighter.gif',
'o=>' => 'yahoo_malefighter2.gif',
'O=>' => 'yahoo_malefighter2.gif',
'o->' => 'yahoo_malefighter1.gif',
'O->' => 'yahoo_malefighter1.gif',
'x(' => 'yahoo_angry.gif',
'x-(' => 'yahoo_angry.gif',
'X(' => 'yahoo_angry.gif',
'X-(' => 'yahoo_angry.gif',
);

$imagesize = array (
'yahoo_giggle.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_dance.gif' =>
array (
0 => 26,
1 => 18,
),
'yahoo_clown.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_sunglas.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_huggs.gif' =>
array (
0 => 42,
1 => 18,
),
'yahoo_neutral.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_malefighter2.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_cry.gif' =>
array (
0 => 22,
1 => 18,
),
'yahoo_monkey.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_think.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_angry.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_pumpkin.gif' =>
array (
0 => 17,
1 => 18,
),
'yahoo_party.gif' =>
array (
0 => 38,
1 => 18,
),
'yahoo_beatup.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_blush.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_worried.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_brokenheart.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_liar.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_youkiddingme.gif' =>
array (
0 => 26,
1 => 18,
),
'yahoo_sleep.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_question.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_yingyang.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_loser.gif' =>
array (
0 => 24,
1 => 18,
),
'yahoo_mean.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_tongue.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_pig.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_eyebrow.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_madtongue.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_sweating.gif' =>
array (
0 => 34,
1 => 18,
),
'yahoo_talktohand.gif' =>
array (
0 => 31,
1 => 16,
),
'yahoo_nailbiting.gif' =>
array (
0 => 33,
1 => 18,
),
'yahoo_sad.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_moneyeyes.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_glasses.gif' =>
array (
0 => 24,
1 => 18,
),
'yahoo_smiley.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_femalefighter.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_eyeroll.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_pray.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_tired.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_malefighter1.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_ooooh.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_sick.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_cow.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_rotfl.gif' =>
array (
0 => 30,
1 => 18,
),
'yahoo_clap.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_frustrated.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_flag.gif' =>
array (
0 => 25,
1 => 18,
),
'yahoo_kiss.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_angel.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_silent.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_doh.gif' =>
array (
0 => 24,
1 => 18,
),
'yahoo_sighing.gif' =>
array (
0 => 24,
1 => 18,
),
'yahoo_silly.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_laughloud.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_drool.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_love.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_cowboy.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_chicken.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_bigsmile.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_hypnotized.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_shhhh.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_star.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_waiting.gif' =>
array (
0 => 23,
1 => 18,
),
'yahoo_coffee.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_worship.gif' =>
array (
0 => 32,
1 => 18,
),
'yahoo_shame.gif' =>
array (
0 => 22,
1 => 18,
),
'yahoo_alien2.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_bye.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_whistling.gif' =>
array (
0 => 22,
1 => 18,
),
'yahoo_wink.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_shamrock.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_waving.gif' =>
array (
0 => 23,
1 => 17,
),
'yahoo_flower.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_peace.gif' =>
array (
0 => 22,
1 => 18,
),
'yahoo_devil.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_idea.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_alien.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_batting.gif' =>
array (
0 => 18,
1 => 18,
),
'yahoo_ghost.gif' =>
array (
0 => 18,
1 => 18,
),
'msn_stormy.png' =>
array (
0 => 20,
1 => 19,
),
'msn_run.png' =>
array (
0 => 21,
1 => 21,
),
'msn_smiley.png' =>
array (
0 => 21,
1 => 21,
),
'msn_plane.png' =>
array (
0 => 21,
1 => 21,
),
'msn_cellphone.png' =>
array (
0 => 21,
1 => 21,
),
'msn_cake.gif' =>
array (
0 => 17,
1 => 19,
),
'msn_angry.png' =>
array (
0 => 21,
1 => 21,
),
'msn_cat.png' =>
array (
0 => 21,
1 => 21,
),
'msn_car.png' =>
array (
0 => 21,
1 => 21,
),
'msn_ooooh.png' =>
array (
0 => 21,
1 => 21,
),
'msn_kiss.png' =>
array (
0 => 21,
1 => 21,
),
'msn_cry.gif' =>
array (
0 => 19,
1 => 19,
),
'msn_thumbdown.png' =>
array (
0 => 21,
1 => 21,
),
'msn_donttell.png' =>
array (
0 => 21,
1 => 21,
),
'msn_xbox.png' =>
array (
0 => 19,
1 => 19,
),
'msn_party.gif' =>
array (
0 => 19,
1 => 19,
),
'msn_drink.png' =>
array (
0 => 21,
1 => 21,
),
'msn_teeth.png' =>
array (
0 => 21,
1 => 21,
),
'msn_girl.png' =>
array (
0 => 21,
1 => 21,
),
'msn_laugh.png' =>
array (
0 => 21,
1 => 21,
),
'msn_handcuffs.png' =>
array (
0 => 21,
1 => 21,
),
'msn_sarcastic.png' =>
array (
0 => 21,
1 => 21,
),
'msn_sick.png' =>
array (
0 => 21,
1 => 21,
),
'msn_coffee.png' =>
array (
0 => 21,
1 => 21,
),
'msn_umbrella.png' =>
array (
0 => 21,
1 => 21,
),
'msn_star.png' =>
array (
0 => 21,
1 => 20,
),
'msn_computer.png' =>
array (
0 => 21,
1 => 21,
),
'msn_clock.png' =>
array (
0 => 21,
1 => 21,
),
'msn_boy.png' =>
array (
0 => 21,
1 => 21,
),
'msn_dog.png' =>
array (
0 => 21,
1 => 21,
),
'msn_gift.png' =>
array (
0 => 21,
1 => 21,
),
'msn_turtle.png' =>
array (
0 => 19,
1 => 19,
),
'msn_highfive.png' =>
array (
0 => 19,
1 => 19,
),
'msn_eyeroll.gif' =>
array (
0 => 19,
1 => 19,
),
'msn_neutral.png' =>
array (
0 => 21,
1 => 21,
),
'msn_runback.png' =>
array (
0 => 21,
1 => 21,
),
'msn_flower.png' =>
array (
0 => 21,
1 => 21,
),
'msn_soccer.png' =>
array (
0 => 21,
1 => 21,
),
'msn_brheart.png' =>
array (
0 => 21,
1 => 21,
),
'msn_note.png' =>
array (
0 => 21,
1 => 21,
),
'msn_coins.png' =>
array (
0 => 21,
1 => 21,
),
'msn_bat.gif' =>
array (
0 => 19,
1 => 19,
),
'msn_sleepy.gif' =>
array (
0 => 19,
1 => 19,
),
'msn_tongue.png' =>
array (
0 => 21,
1 => 21,
),
'msn_cigarette.gif' =>
array (
0 => 19,
1 => 19,
),
'msn_secret.png' =>
array (
0 => 21,
1 => 21,
),
'msn_beer.png' =>
array (
0 => 21,
1 => 21,
),
'msn_heart.png' =>
array (
0 => 21,
1 => 21,
),
'msn_question.png' =>
array (
0 => 21,
1 => 21,
),
'msn_lightning.gif' =>
array (
0 => 19,
1 => 19,
),
'msn_icon.png' =>
array (
0 => 21,
1 => 21,
),
'msn_sun.png' =>
array (
0 => 21,
1 => 21,
),
'msn_sad.png' =>
array (
0 => 21,
1 => 21,
),
'msn_email.png' =>
array (
0 => 21,
1 => 21,
),
'msn_photo.png' =>
array (
0 => 22,
1 => 19,
),
'msn_deadflower.png' =>
array (
0 => 21,
1 => 21,
),
'msn_idea.png' =>
array (
0 => 21,
1 => 21,
),
'msn_rainbow.png' =>
array (
0 => 22,
1 => 16,
),
'msn_fingerscrossed.png' =>
array (
0 => 19,
1 => 19,
),
'msn_pizza.png' =>
array (
0 => 21,
1 => 21,
),
'msn_nerd.png' =>
array (
0 => 21,
1 => 21,
),
'msn_devil.png' =>
array (
0 => 21,
1 => 21,
),
'msn_sleep.png' =>
array (
0 => 21,
1 => 21,
),
'msn_sheep.png' =>
array (
0 => 21,
1 => 21,
),
'msn_bowl.png' =>
array (
0 => 19,
1 => 19,
),
'msn_snail.png' =>
array (
0 => 21,
1 => 21,
),
'msn_wink.gif' =>
array (
0 => 19,
1 => 19,
),
'msn_brb.png' =>
array (
0 => 19,
1 => 19,
),
'msn_angel.png' =>
array (
0 => 21,
1 => 21,
),
'msn_dontknow.gif' =>
array (
0 => 19,
1 => 19,
),
'msn_film.png' =>
array (
0 => 21,
1 => 21,
),
'msn_think.gif' =>
array (
0 => 19,
1 => 19,
),
'msn_weird.png' =>
array (
0 => 21,
1 => 21,
),
'msn_island.png' =>
array (
0 => 21,
1 => 21,
),
'msn_thumbup.png' =>
array (
0 => 21,
1 => 21,
),
'msn_phone.png' =>
array (
0 => 21,
1 => 20,
),
'msn_plate.png' =>
array (
0 => 19,
1 => 19,
),
'msn_embarrassed.png' =>
array (
0 => 21,
1 => 21,
),
'msn_hot.png' =>
array (
0 => 21,
1 => 21,
),
);

$smiliesshown = array(
'yahoo_smiley.gif',
'yahoo_bigsmile.gif',
'yahoo_laughloud.gif',
'yahoo_rotfl.gif',
'yahoo_wink.gif',
'yahoo_tongue.gif',
'yahoo_sad.gif',
'yahoo_cry.gif',
'yahoo_angry.gif',
'yahoo_doh.gif',
'yahoo_eyeroll.gif',
'yahoo_frustrated.gif',
'yahoo_ooooh.gif',
'yahoo_question.gif',
'yahoo_sighing.gif',
'yahoo_think.gif',
'yahoo_worried.gif',
'msn_dontknow.gif',
'msn_hot.gif',
'msn_sleepy.gif',
'msn_neutral.png',
'msn_weird.png',
'msn_embarrassed.png',
'msn_thumbup.png',
'msn_thumbdown.png'
);

/* begin real code */

/*if ($smilies_style == 'msn') {
$smiliestrans = $msnsmiliestrans;
$imagesize = $msnimagesize;
$smiliesshown = $smilies_msn_always_shown;
} elseif ($smilies_style == 'yahoo') {
$smiliestrans = $yahoosmiliestrans;
$imagesize = $yahooimagesize;
$smiliesshown = $smilies_yahoo_always_shown;
} else {
$smiliestrans = array();
$imagesize = array();
}*/

/* outputs javascript when called directly */

/* the following are taken and modified from wordpress internal smiley converter */

if (!function_exists('smiliescmp')) {
function smiliescmp ($a, $b) {
if (strlen($a) == strlen($b)) {
return strcmp($a, $b);
}
return (strlen($a) > strlen($b)) ? -1 : 1;
}
}

function smileyencode ($smiley) {
$arr = preg_split('//', $smiley, -1, PREG_SPLIT_NO_EMPTY);
$out = '';
foreach ($arr as $char) {
$out .= "&#" . ord($char) . ";" ;
}
return $out;
}

uksort($smiliestrans, 'smiliescmp');

// generates smilies' search & replace arrays
foreach($smiliestrans as $smiley => $img) {
$smiley_masked = smileyencode($smiley);
$width = $imagesize[$img][0];
$height = $imagesize[$img][1];

#$smiliessearch[] = $smiley_masked;
#$smiliesreplace[] = ” $smiley_masked “;

#$s2search = $smiley;
#$s2search = htmlspecialchars($s2search, ENT_NOQUOTES);
#$s2search = str_replace(’”‘, “”", $s2search);

$tosearch = $smiley;
$pre = ”;
$post = ”;
#if (preg_match(”/^w/”, $tosearch)) {
# $pre = “(?=W)”;
#}
#if (preg_match(”/w$/”, $tosearch)) {
# $post = “(?=W)”;
#}
$tosearch = ‘/’ . $pre . preg_quote($tosearch, ‘/’) . $post . ‘/s’;
#$tosearch = ‘/’ . preg_quote($tosearch, ‘/’) . ‘/’;

$smiliessearch[] = $tosearch;
$smiliesreplace[] = “$smiley_masked“;

$escsearch[] = $smiley;
$escreplace[] = $smiley_masked;

$imagetosmilies[$img] = htmlspecialchars($smiley);
#$imagetosmilies[$img] = $smiley_masked;
}

if ( ereg(”im_smiley.php$”, $_SERVER['SCRIPT_URI']) ) {
header(”Content-type: text/javascript”);
echo “var smiley_smiley2image_s = new Array();n”;
echo “var smiley_smiley2image_r = new Array();n”;
foreach($smiliessearch as $i) {
$i = preg_replace(”/^//”, “”, $i);
$i = preg_replace(”//s$/”, “”, $i);
$i = addslashes($i);
echo “smiley_smiley2image_s.push(’$i’);n”;
}
foreach($smiliesreplace as $i) {
$i = addslashes($i);
echo “smiley_smiley2image_r.push(’$i’);n”;
}
?>
function smiley_convert_text(text) {
var i;
var smiley;
var replacement;
var re = new RegExp(”", “i”);
for (i=0; i < smiley_smiley2image_s.length; i++) {
smiley = smiley_smiley2image_s[i];
replacement = smiley_smiley2image_r[i];
// smiley = smiley.replace(/([^a-zA-Z0-9])/gi, "$1"); // escape everything
re.compile(smiley, "gi");
text = text.replace(re, replacement);
}
return text;
}

function toggleMoreIcons(e) {
var moreIconsDiv = document.getElementById('moreIcons');
var isVisible = (moreIconsDiv.style.display == 'inline');
if (isVisible) {
moreIconsDiv.style.display = 'none';
e.innerHTML = 'more »';
} else {
moreIconsDiv.style.display = 'inline';
e.innerHTML = '« less';
}
}

function appendTextToComment(text) {
var commentArea = document.getElementById('comment');
commentArea.value = commentArea.value + text;

}
< ?php
exit;
}

#print_r($yahoo_smiliessearch);
#print_r($yahoo_smiliesreplace);
#exit;

/* mask smilies before going to balanceTags */

function convert_custom_smilies_pre($text) {
global $escsearch, $escreplace;
$textarr = preg_split("/()/U”, $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between
$stop = count($textarr);// loop stuff
for ($i = 0; $i < $stop; $i++) {
$content = $textarr[$i];
if ((strlen($content) > 0) && (’< ' != $content{0})) { // If it's not a tag
#$content = preg_replace($smiliessearch, $smiliesreplace, $content);
$content = str_replace($escsearch, $escreplace, $content);
}
$output .= $content;
}
return $output;
}

/* unmask smilies after balanceTags */

function convert_custom_smilies_post($text) {
global $escsearch, $escreplace;
$textarr = preg_split("/()/U”, $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between
$stop = count($textarr);// loop stuff
for ($i = 0; $i < $stop; $i++) {
$content = $textarr[$i];
if ((strlen($content) > 0) && (’< ' != $content{0})) { // If it's not a tag
#$content = preg_replace($smiliessearch, $smiliesreplace, $content);
$content = str_replace($escreplace, $escsearch, $content);
}
$output .= $content;
}
return $output;
}

/* convert smilies to images */

function convert_custom_smilies($text) {
global $smiliessearch, $smiliesreplace;
$textarr = preg_split("/()/U”, $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between
$stop = count($textarr);// loop stuff
for ($i = 0; $i < $stop; $i++) {
$content = $textarr[$i];
if ((strlen($content) > 0) && (’< ' != $content{0})) { // If it's not a tag
#$content = preg_replace($smiliessearch, $smiliesreplace, $content);
$content = preg_replace($smiliessearch, $smiliesreplace, $content);
}
$output .= $content;
}
return $output;
}

/* add javascript */
function smilies_javascript() {
global $smilies_blog_url;
?>

< ?php
}

function smilies_clickable() {
global $smilies_blog_url, $smiliesshown, $smilies_allow_hidden, $imagesize, $imagetosmilies;
$hidden_smileys = array_diff(array_keys($imagetosmilies), $smiliesshown);

?>
< ?php
foreach ($smiliesshown as $curr_smiley_img) {
?>

alt=”< ?php echo $imagetosmilies[$curr_smiley_img];?>”
title=”< ?php echo $imagetosmilies[$curr_smiley_img];?>”
width=”< ?php echo $imagesize[$curr_smiley_img][0];?>”
height=”< ?php echo $imagesize[$curr_smiley_img][1];?>”
class=”wp-smiley”
onclick=”appendTextToComment(’< ?php echo str_replace("", "", $imagetosmilies[$curr_smiley_img]);?> ‘)”
/>
< ?php
}

if ($smilies_allow_hidden) {
?>

onclick="toggleMoreIcons(this); return false;"
>more »

< ?php
}
?>
}

add_filter(’content_save_pre’, ‘convert_custom_smilies_pre’, 30);
add_filter(’excerpt_save_pre’, ‘convert_custom_smilies_pre’, 30);
add_filter(’comment_save_pre’, ‘convert_custom_smilies_pre’, 30);
add_filter(’pre_comment_content’, ‘convert_custom_smilies_pre’, 5);

add_filter(’content_save_pre’, ‘convert_custom_smilies_post’, 70);
add_filter(’excerpt_save_pre’, ‘convert_custom_smilies_post’, 70);
add_filter(’comment_save_pre’, ‘convert_custom_smilies_post’, 70);
add_filter(’pre_comment_content’, ‘convert_custom_smilies_post’, 35);

add_filter(’the_content’, ‘convert_custom_smilies’, 3);
add_filter(’the_excerpt’, ‘convert_custom_smilies’, 3);
add_filter(’comment_text’, ‘convert_custom_smilies’, 3);

if ($smilies_javascript) {
add_filter(’wp_head’, ’smilies_javascript’);
}[/php]

Pages: 1 2

Yahoo/MSN Style Smileys Reloaded Plugin Updated is written by cosa and posted under Programming, WordPress . If you like it, you might consider subscribing to our feed, follows us on Twitter, or receive our latest posts via email. Or else, you could also or store it to your favourite social bookmark sites. Further information about this article can be found.
And while you're here, why don't you check out our other articles:

No Comments »

No comments yet.

Leave a comment