• Home
  • Investigasi Domain
  • Tools
  • Sitemap
  • Blogroll
  • Cek Pagerank
  • About

  • Error Plugin Emoticons

    February 21st, 2011 Under blog, Wordpress | 54 Comments

    Setelah update ke versi wordpress terbaru rupanya plugin emoticons yang saya gunakan di blog ini mengalami error. Masalahnya semua kode untuk memunculkan emotion ketika disubmit semuanya berubah menjadi kode karakter html [ Ref : html character entities ] sehingga harus diedit secara manual baru emotion bisa muncul. 

    Berhubung ilmu php saya masih seumur jagung, ya tulunglah buat yang merasa jago web programming khususnya php coba dilihat, diraba dan diterawang kode-kode php pada plugin berikut ini.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    <?php
    $smilies_javascript = '1';
    $smilies_allow_hidden = true;
    if (!function_exists('get_settings')) {
        $smilies_blog_url = $_SERVER['SCRIPT_URI'];
        $smilies_blog_url = preg_replace("/wp-content\\/plugins\\/blog-emoticons\\/smiley\\.php$/", "", $smilies_blog_url);
    } else {
        $smilies_blog_url = get_settings('siteurl');
    }
    $smiliestrans = array(
        ':bom:' => 'bom.gif',
        ':clinguk:' => 'clinguk.gif',
        ':hehe:' => 'hehe.gif',
        ':hore:' => 'hore.gif',
        ':jedug:' => 'jedug.gif',
        ':love:' => 'love.gif',
        ':matabelo:' => 'matabelo.gif',
        ':mikir:' => 'mikir.gif',
        ':nangis:' => 'nangis.gif',
        ':ngacir:' => 'ngacir.gif',
        ':ngakak:' => 'ngakak.gif',
        ':nyerah:' => 'nyerah.gif',
        ':plis:' => 'plis.gif',
        ':puyeng:' => 'puyeng.gif',
        ':sikut:' => 'sikut.gif',
        ':sip:' => 'sip.gif',
        ':baca:' => 'baca.gif',
        ':bisik:' => 'bisik.gif',
        ':cool:' => 'cool.gif',
        ':detektif:' => 'detektif.gif',
        ':hiks:' => 'hiks.gif',
        ':hotlove:' => 'hotlove.gif',
        ':jewer:' => 'jewer.gif',
        ':keren:' => 'keren.gif',
        ':licik:' => 'licik.gif',
        ':lirik:' => 'lirik.gif',
        ':loveu:' => 'loveu.gif',
        ':mataduitan:' => 'mataduitan.gif',
        ':me:' => 'me.gif',
        ':melet:' => 'melet.gif',
        ':ngojek:' => 'ngojek.gif',
        ':no:' => 'no.gif',
        ':phew:' => 'phew.gif',
        ':sliweran:' => 'sliweran.gif',
        ':takut:' => 'takut.gif',
        ':udut:' => 'udut.gif',
        ':waaa:' => 'waaa.gif',
        ':wooo:' => 'wooo.gif',
        ':yaya:' => 'yaya.gif',
        ':yeye:' => 'yeye.gif',
        ':yoyo:' => 'yoyo.gif',    
        ':1:' => '1.gif',  
        ':2:' => '2.gif',    
        ':3:' => '3.gif',  
        ':4:' => '4.gif',  
        ':5:' => '5.gif',  
        ':6:' => '6.gif',    
        ':7:' => '7.gif',  
        ':8:' => '8.gif',  
        ':9:' => '9.gif',  
        ':10:' => '10.gif',
        ':11:' => '11.gif',
        ':12:' => '12.gif',    
        ':13:' => '13.gif',    
        ':14:' => '14.gif',    
        ':15:' => '15.gif',
        ':16:' => '16.gif',
        ':17:' => '17.gif',
        ':18:' => '18.gif',
        ':19:' => '19.gif',
        ':20:' => '20.gif',    
        ':21:' => '21.gif',    
        ':22:' => '22.gif',    
        ':23:' => '23.gif',    
        ':beer:' => 'beer.gif',
        ':belajar:' => 'belajar.gif',  
        ':bonyok:' => 'bonyok.gif',
        ':boong:' => 'boong.gif',  
        ':capede:' => 'capede.gif',    
        ':censored:' => 'censored.gif',    
        ':cinta:' => 'cinta.gif',  
        ':demam:' => 'demam.gif',  
        ':dingin:' => 'dingin.gif',
        ':doa:' => 'doa.gif',  
        ':fd:' => 'fd.gif',
        ':gakdenger:' => 'gakdenger.gif',  
        ':gembel:' => 'gembel.gif',    
        ':gila:' => 'gila.gif',    
        ':gun:' => 'gun.gif',  
        ':haha:' => 'haha.gif',    
        ':hammer:' => 'hammer.gif',    
        ':harakiri:' => 'harakiri.gif',
        ':hb:' => 'hb.gif',
        ':help:' => 'help.gif',
        ':jiraiya:' => 'jiraiya.gif',  
        ':kl:' => 'kl.gif',
        ':kuda:' => 'kuda.gif',    
        ':lulus:' => 'lulus.gif',  
        ':maaf:' => 'maaf.gif',        
        ':makacih:' => 'makacih.gif',  
        ':minta:' => 'minta.gif',  
        ':muntah:' => 'muntah.gif',
        ':nari:' => 'nari.gif',
        ':ngamen:' => 'ngamen.gif',
        ':ngantuk:' => 'ngantuk.gif',  
        ':ngeselin:' => 'ngeselin.gif',    
        ':ngupi:' => 'ngupi.gif',  
        ':niceinfo:' => 'niceinfo.gif',        
        ':ompong:' => 'ompong.gif',    
        ':oops:' => 'oops.gif',
        ':piss:' => 'piss.gif',
        ':salam:' => 'salam.gif',  
        ':sedih:' => 'sedih.gif',  
        ':siul:' => 'siul.gif',
        ':stress:' => 'stress.gif',    
        ':swt:' => 'swt.gif',  
        ':tank:' => 'tank.gif',        
        ':thx:' => 'thx.gif',  
        ':tidur:' => 'tidur.gif',  
        ':voodoo:' => 'voodoo.gif',
        ':xiexie:' => 'xiexie.gif',
        ':zzzz:' => 'zzzz.gif'
    );
    $smiliesshown = array(
        'hehe.gif',
        'hore.gif',
        'jedug.gif',
        'love.gif',
        'matabelo.gif',
        'mikir.gif',
        'hiks.gif',
        'ngacir.gif',
        'ngakak.gif',
        'nyerah.gif',
        'plis.gif',
        'puyeng.gif',
        'sikut.gif',
        'sip.gif'
    );
    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');
    foreach($smiliestrans as $smiley => $img) {
        $smiley_masked = smileyencode($smiley);
        $tosearch = $smiley;
        $pre = '';
        $post = '';
        $tosearch = '/' . $pre . preg_quote($tosearch, '/') . $post . '/s';
        $smiliessearch[] = $tosearch;
        $smiliesreplace[] = "<img src='$smilies_blog_url/wp-content/plugins/blog-emoticons/$img' alt='$smiley_masked' class='wp-smiley' width='$width' height='$height' title='$smiley_masked' />";
        $escsearch[] = $smiley;
        $escreplace[] = $smiley_masked;
        $imagetosmilies[$img] = htmlspecialchars($smiley);
    }
    if ( !function_exists('add_filter') ) {
        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");
                    re.compile(smiley, "gi");
                    text = text.replace(re, replacement);
                }
                return text;
            }
           
            function appendTextToComment(text) {
                var commentArea = document.getElementById('comment');
                commentArea.value = commentArea.value + text;
                <?php echo $js_reloader ?>
            }
        <?php
        exit;
    }
    function convert_custom_smilies_pre($text) {
        global $escsearch, $escreplace;
        $textarr = preg_split("/(<\\/?[a-z!].*>)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE);
        $stop = count($textarr);
        for ($i = 0; $i < $stop; $i++) {
            $content = $textarr[$i];
            if ((strlen($content) > 0) && ('<' != $content{0})) {  
                #$content = preg_replace($smiliessearch, $smiliesreplace, $content);
                $content = str_replace($escsearch, $escreplace, $content);
            }
            $output .= $content;
        }
        return $output;
    }
    function convert_custom_smilies_post($text) {
        global $escsearch, $escreplace;
        $textarr = preg_split("/(<\\/?[a-z!].*>)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE);
        $stop = count($textarr);
        for ($i = 0; $i < $stop; $i++) {
            $content = $textarr[$i];
            if ((strlen($content) > 0) && ('<' != $content{0})) {
                #$content = preg_replace($smiliessearch, $smiliesreplace, $content);
                $content = str_replace($escreplace, $escsearch, $content);
            }
            $output .= $content;
        }
        return $output;
    }
    function convert_custom_smilies($text) {
        global $smiliessearch, $smiliesreplace;
        $textarr = preg_split("/(<\\/?[a-z!].*>)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE);
        $stop = count($textarr);
        for ($i = 0; $i < $stop; $i++) {
            $content = $textarr[$i];
            if ((strlen($content) > 0) && ('<' != $content{0})) {  
                #$content = preg_replace($smiliessearch, $smiliesreplace, $content);
                $content = preg_replace($smiliessearch, $smiliesreplace, $content);
            }
            $output .= $content;
        }
        return $output;
    }
    function smilies_javascript() {
        global $smilies_blog_url;
        ?>
        <script type="text/javascript"
            src="<?php echo $smilies_blog_url?>/wp-content/plugins/blog-emoticons/smiley.php">
        </script>
        <?php
    }
    function smilies_clickable() {
        global $smilies_blog_url, $smiliesshown, $smilies_allow_hidden, $imagetosmilies;
        $hidden_smileys = array_diff(array_keys($imagetosmilies), $smiliesshown);
       
        ?>
        <?php
        foreach ($smiliesshown as $curr_smiley_img) {
            ?>
            <img src="<?php echo $smilies_blog_url."/wp-content/plugins/blog-emoticons/$curr_smiley_img"?>"
                alt="<?php echo $imagetosmilies[$curr_smiley_img];?>"
                title="<?php echo $imagetosmilies[$curr_smiley_img];?>"
                width="<?php echo 30;?>"
                height="<?php echo 30;?>"
                class="wp-smiley"
                onclick="appendTextToComment('<?php echo str_replace("\\", "\\\\", $imagetosmilies[$curr_smiley_img]);?>')"
            />
            <?php
        }

        if ($smilies_allow_hidden) {
            ?>
            <span id="moreIcons" style="display: none">
            <?php

            foreach ($hidden_smileys as $curr_smiley_img) {
                ?>
                <img src="<?php echo $smilies_blog_url."/wp-content/plugins/blog-emoticons/$curr_smiley_img";?>"
                    alt="<?php echo $imagetosmilies[$curr_smiley_img];?>"
                    title="<?php echo $imagetosmilies[$curr_smiley_img];?>"
                    width="<?php echo 30;?>"
                    height="<?php echo 30;?>"
                    class="wp-smiley"
                    onclick="appendTextToComment('<?php echo str_replace("\\", "\\\\", $imagetosmilies[$curr_smiley_img]);?>')"
                />
                <?php
            }
            ?>
            </span>

        <?php
        }
        ?>
        <?php
    }
    if (function_exists('add_filter')) {
        @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('comment_form', 'smilies_javascript');
        }
    }

    Untuk lengkapnya bisa download disini.

    Sebenarnya banyak sekali pilihan plugin emotion yang lain kalo saya mau ganti, tapi sayangnya saya udah terlanjur suka dengan plugin ini karena tidak terlalu banyak script php nya. selain itu juga kalo saya ganti dengan plugin lain akan sedikit repot mengarahkan image ke emotion pada plugin sebelumnya.

    Any help appreciated.

    Bookmark and Share


    You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

    54 Responses to 'Error Plugin Emoticons'

    1. avatar September 10, 2011 at 1:49 pm
      nopha kartika
    2. avatar October 16, 2011 at 9:29 pm
      die
    3. avatar November 3, 2011 at 5:36 am
      Seputar Jakarta
    4. avatar November 5, 2011 at 8:36 am
      toko baju muslim
    5. avatar December 1, 2011 at 12:13 pm
      Kuliner
    6. avatar January 24, 2012 at 10:39 am
      ANEKA HOT
    7. avatar January 24, 2012 at 10:41 am
      Wandi Sukoharjo
    8. avatar April 9, 2012 at 4:07 pm
      EO Kids Party

    Leave a Reply