Daily J Your Daily Dose of Vitamin Japan!



« Working on a new face for Nipponster. Any ideas? Chinese anyone? »

When your smiling… (a list of smileys for wordpress)

On August 31, 2008 in Uncategorized

Warning: Nerdy content to follow

uh oh.
This is like a toddler finding the secret stash of sweets!

Today I was file diving in wordpress (the software that powers this blog) looking for a way to fix something and I made a little discovery.

A list of smileys!

As anyone who follows this blog knows, I have a weakness for smileys. So, of course, I have to post them all now to get the excitement out of my system :) <– see what I mean?

Here they are (from the file wp-inludes/funtions.php):

:mrgreen: :neutral: :twisted: :arrow: :shock: :smile: :???: :cool: :evil: :grin: :idea: :oops: :razz: :roll: :wink: :cry: :eek: :lol: :mad: :sad: 8-) 8-O :-( :-) :-? :-D :-P :-o :-x :-| ;-) 8) 8O :( :) :? :D :P :o :x :| ;) :!: :?:
:mrgreen:’ => ‘icon_mrgreen’,
‘:neutral:’ => ‘icon_neutral’,
‘:twisted:’ => ‘icon_twisted’,
‘:arrow:’ => ‘icon_arrow’,
‘:shock:’ => ‘icon_eek’,
‘:smile:’ => ‘icon_smile’,
‘:???:’ => ‘icon_confused’,
‘:cool:’ => ‘icon_cool’,
‘:evil:’ => ‘icon_evil’,
‘:grin:’ => ‘icon_biggrin’,
‘:idea:’ => ‘icon_idea’,
‘:oops:’ => ‘icon_redface’,
‘:razz:’ => ‘icon_razz’,
‘:roll:’ => ‘icon_rolleyes’,
‘:wink:’ => ‘icon_wink’,
‘:cry:’ => ‘icon_cry’,
‘:eek:’ => ‘icon_surprised’,
‘:lol:’ => ‘icon_lol’,
‘:mad:’ => ‘icon_mad’,
‘:sad:’ => ‘icon_sad’,
‘8-)’ => ‘icon_cool’,
‘8-O’ => ‘icon_eek’,
‘:-(’ => ‘icon_sad’,
‘:-)’ => ‘icon_smile’,
‘:-?’ => ‘icon_confused’,
‘:-D’ => ‘icon_biggrin’,
‘:-P’ => ‘icon_razz’,
‘:-o’ => ‘icon_surprised’,
‘:-x’ => ‘icon_mad’,
‘:-|’ => ‘icon_neutral’,
‘;-)’ => ‘icon_wink’,
‘8)’ => ‘icon_cool’,
‘8O’ => ‘icon_eek’,
‘:(’ => ‘icon_sad’,
‘:)’ => ‘icon_smile’,
‘:?’ => ‘icon_confused’,
‘:D’ => ‘icon_biggrin’,
‘:P’ => ‘icon_razz’,
‘:o’ => ‘icon_surprised’,
‘:x’ => ‘icon_mad’,
‘:|’ => ‘icon_neutral’,
‘;)’ => ‘icon_wink’,
‘:!:’ => ‘icon_exclaim’,
‘:?:’ => ‘icon_question’,
  1. Nick Ramsay Said,

    What a coincidence! Last week I was working on a plugin for JapanSoc so that text automatically converts into smilies. Unfortunately, I only got so far before I hit a brick wall, but on the way there I found the smiley list in functions.php, too! :)

  2. The Chemist Said,

    :)
    wow. that is a coincidence!
    so you were looking for a way to make : ) (for example) turn into :) on Jsoc.
    That sounds like it might be tricky.
    What was the brick wall you hit?

  3. Nick Ramsay Said,

    Pligg/SWCMS use Smarty templates. Once the comment has been assigned to a Smarty variable, there’s not much you can do with it. So, I tried to catch it before it was assigned to a Smarty, but HTML (i.e. IMG tag for smiley) is stripped from the comment at the moment it becomes a Smarty:

    $smarty->assign(’comment_content’, save_text_to_html($this->content));

    I tried every possible workaround, but couldn’t get anything to work. :(

  4. The Chemist Said,

    Hmmm.
    That would be a brick wall.
    I don’t know much about Smarty but I was reading smarty.php.net and see that it is for completely separating template from function, so I understand what you are saying (probably).

    Comment content is assigned to the $smarty variable in that code you posted. And you are saying that smarty strips anything that isn’t text.
    I’m not sure how smileys work in wordpress either and I don’t know enough about how pligg works so really I am no help.
    But when you say IMG tag you are talking about <img src=>, right? That confuses me. In a comment, users don’t enter an img tag to post smileys, they just type like this : )

    I don’t know how smileys work in wordpress but I would imagine (pure ignorant imagination) that it processes the text, : ) , somehow, matches it to the array of smileys in functions.php, and displays (instead of the text) the image file associated with that : ) in the array.
    But probably I am just missing point because I have little idea what I am talking about anyway :)

  5. Nick Ramsay Said,

    You’re exactly right, and I’ll keep trying until I find a way to do this.

  6. Nick Ramsay Said,

    Quick update. I got it to work and finished the module. SWCMS users can get it here.

    It’s working on my development site, but JapanSoc’ers won’t see it until I upgrade the live site. That won’t happen until the new “confirm email on registration” module is finished, which hopefully won’t be much longer.

  7. The Chemist Said,

    Nice work!

Add A Comment