Emoticons plugin not working
  • Hi. 
    I has installed emoticons plugin from this wiki page http://wiki.flatpress.org/res:plugins:nowhereman:emoticons. Has put it code to ./fp-plugins/emoticons/plugin.emoticons.php, copied my smiles to ./fp-content/emoticons, enabled plugin in admin area. But when I post news or comments, text smiles on that not replacing by images. What I did wrong?(

    FlatPress 0.1010.2, Server: Abyss Web Serve X1 2.7 + PHP 5.3.8
  • sorry if I ask, but did you customize the plugin with the filenames of your images?
  • yes, I did :)
    function plugin_emoticons_filter($string) {
        static $EMOTICONS = array(
        'O:-)' => 'angel.gif',
        ':D' => 'biggrin.gif',
        ':-D' => 'biggrin.gif',
        ':hand:' => 'bye.gif',
        '8)' => 'cool.gif',
        '8-)' => 'cool.gif',
        '%)' => 'crazy.gif',
        //':\'(' => 'cry.gif',
        ':wall:' => 'dash2.gif',
        '>:-)' => 'diablo.gif',
        ':rose:' => 'give_rose.gif',
        '<3' => 'heart.gif',
        ':-*' => 'kiss3.gif',
            ':*' => 'kiss3.gif',
        ':inlove:' => 'man_in_love.gif',
        ':no:' => 'no.gif',
        ':ky:' => 'patsak.gif',
        ':(' => 'sad.gif',
        ':((' => 'sad.gif',
        ':(((' => 'sad.gif',
        ':-(' => 'sad.gif',
        ':-((' => 'sad.gif',
        ':-(((' => 'sad.gif',
        'O_O' => 'shok.gif',
        ':)' => 'smile.gif',
        ':))' => 'smile.gif',
        ':)))' => 'smile.gif',
        ':-)' => 'smile.gif',
        ':-))' => 'smile.gif',
        ':-)))' => 'smile.gif',
        ':-P' => 'tease.gif',
        ':P' => 'tease.gif',
        '$(' => 'wacko2.gif',
        ';)' => 'wink.gif',
        ';-)' => 'wink.gif',
        ':yes:' => 'yes.gif',
        'xD' => 'rofl.gif',
        ':rofl:' => 'rofl.gif',
        // etc etc
        );

    p.s. Sorry, don't know what a tag there for code paste
  • Please, how did you insert your textsymbol for the emoticon? 

    The emoticons plugin use following syntax (.. = 2 spaces):

    text text ..:).. text text ..:D.. text text

    What mean, that your have to use 2 spaces before your textsymbol an 2 spaces behind your textsymbol. It works fine with the current version of Flatpress.
  • No ned space :P try this:

    <?php
    /*
    Plugin Name: emoticons
    Plugin URI: http://www.flatpress.org/
    Description: Adds emoticons to FlatPress
    Author: NoWhereMan
    Version: 1.0
    Author URI: http://www.nowhereland.it/
    */

    /*
    put your imgs in FP_CONTENT/emoticons/
    (tipically FP_CONTENT is fp-content/ )
    */

    define('EMOTICONS_DIR', BLOG_BASEURL . FP_CONTENT . 'emoticons/');

    /* now please notice how I follow this naming convention: */
    function plugin_emoticons_filter($string) {
    static $EMOTICONS = array(
    ':)' => 'smile.gif', // of course format can be whatever; I use PNGs
    ':(' => 'sad.gif', // these are the images you have in fp-content/emoticons/


    // etc etc
    );

    $ed = EMOTICONS_DIR;

    foreach ($EMOTICONS as $emo => $img) {
    $string = str_replace(
    "$emo", /* replace one of the codes defined above,
      when *sourrounded by spaces* :P */
    "<img src=\"{$ed}{$img}\" alt=\"{$emo}\" width=\"30\" height=\"30\"/>", /* with the <img> tag
      .emoticon class can be styled as you prefer in your css (no necessary)*/
    $string
    );
    }
    return $string;

    }

    /* and now, don't forget to register to the hook */
    add_filter( 'the_content', 'plugin_emoticons_filter' );
    /* if you want it in comments too */
    add_filter( 'comment_text', 'plugin_emoticons_filter' );

    ?>

In this Discussion