RPS WordPress Plugin

I’ve completely rewritten the plugin after 8 years, because the code was targeting PHP4 platforms and now it should work with all PHP5+ versions.

Still does the same thing: Its a widget plugin which collects data from Audioscrobbler web services and gets your last listened tracks and their album images.

Download : You can get the latest release here :

Then just activate the plugin, go to Design-Widgets, add the widget where you want, write the username and widget title in the settings and save. That’s all.

Current Version : 2.0.0

Demo : You can see a working example in the right sidebar.

Fix WordPress UTF-8 corrupt characters

When deploying or moving wordpress sites between hosts, there might be issues with SQL dumps or server charset algorithms that corrupt the utf8 characters to two byte equivalents. To solve this in comments, run this command in phpmyadmin or other tool on your server:

For comments:

alter table wp_comments modify comment_content tinytext character set latin1;
alter table wp_comments modify comment_content blob;
alter table wp_comments modify comment_content tinytext character set utf8;
alter table wp_comments modify comment_author tinytext character set latin1;
alter table wp_comments modify comment_author blob;
alter table wp_comments modify comment_author tinytext character set utf8;

For posts:

alter table wp_posts modify post_author tinytext character set latin1;
alter table wp_posts modify post_author blob;
alter table wp_posts modify post_author tinytext character set utf8;
alter table wp_posts modify post_content tinytext character set latin1;
alter table wp_posts modify post_content blob;
alter table wp_posts modify post_content tinytext character set utf8;

Refresh wp_editor instance after cloning

While I was working on an extension within Redux Framework, I needed to initialize uninitialized copies of wp_editor instances to apply lazy loading. First I loaded uninitialized types of jQuery fields on the page, then I cloned them and and initialized them to have multiple forms in jQuery accordions. Everything was easy until I came to initialize wp_editor instance, because it was already initialized by wordpress, and you needed to give that field new parents, new id, and make it all work again. So, I developed this code to initialize a already-initialized wp_editor instance in a different DOM parent:

        var ed_id = $(element).attr("id");
        //  find if an instance with the same id was created before, and remove it.
        // -------------------------------------------------------------------------
        // it's a critical point when the users adds a group item, and then removes it, and then re-adds the group,
        // then this item would have an already-created editor instance on the memory. To work things correctly, we
        // must remove it first completely from the memory, and then recreate it.
        for(var ed_instance_idx = tinymce.editors.length-1; ed_instance_idx >= 0; ed_instance_idx--){
            if(tinymce.editors[ed_instance_idx].editorId === ed_id){
        // create editor settings with using the dummy editor settings as reference
        tinyMCEPreInit.mceInit[ed_id] = JSON.parse(JSON.stringify(tinyMCEPreInit.mceInit[$(element).data("old-id")]));
        tinyMCEPreInit.mceInit[ed_id].body_class = ed_id;
        tinyMCEPreInit.mceInit[ed_id].elements = ed_id;
        tinyMCEPreInit.mceInit[ed_id].id = ed_id;
        tinyMCEPreInit.mceInit[ed_id].mode = "tmce";
        // initialize wp_editor tinymce instance

        // create quicktags instance with using the dummy editor instance settings
        tinyMCEPreInit.qtInit[ed_id] =JSON.parse(JSON.stringify(tinyMCEPreInit.qtInit[$(element).data("old-id")]));
        tinyMCEPreInit.qtInit[ed_id].id = ed_id;
        // make the editor area visible
        // initialize quicktags
        new QTags(ed_id);
        // force the editor to start at its defined mode.
        switchEditors.go(ed_id, tinyMCEPreInit.mceInit[ed_id].mode);

It copies it’s data from the dummy field (the clone source), so when cloning, don’t forget to retrieve it’s ID from somewhere (I used [highlight]$(element).data(“old-id”)[/highlight] inside the element to pass to the clone). Another option here is choosing the default editor to show:

tinyMCEPreInit.mceInit[ed_id].mode = "tmce";

line of this script shows that all the clones would return to “TinyMCE” editor as default visible edior on cloning. You may change that to “html” if you want to make the code/text editor as default after cloning.

Fit Cufon texts to its container

Well, I ran into a situation that my design messed up when the cufon title width passed it’s container width, so I needed to lower the font-size automatically to make it fit into it’s container staying still an one-line title. And I wanted to share here. Here’s the function I wrote:

function Cufon_Fit_Title(element){
    var TotalWidth = 0;
        TotalWidth += $(this).width();
    if(TotalWidth > element.width()){
        return true;

And here’s the important part of it, because jQuery’s $(document).ready() function won’t work well with Cufon texts (insert it anywhere in your document body – and don’t forget to change the selector):


jQuery Scrolite Plugin

This plugin appends a vertical scrollbar to any element which you need to limit its dimensions like an image, a div or an ul list etc. This is the initial release of this plugin, so feel free to test it and give me some feedback so I can update this plugin with new improvements or with bug free versions. (horizontal scrollbar will be added later.)

It uses Brandon Aaron’s beautiful mousewheel plugin for mouse wheel scrolling support.

It can be configured with many ways as scrollbar width, color, edge radius, scrollbar bed width, color, edge radius, scroll panel width, scroll panel height, mouse scroll sensitivity.

File sizes are 7.36 kBytes for the development version, 4.08 kBytes for the minified version (as for alpha stage), and 206 bytes for the CSS file. (The zip file is big because of the included jQuery library and png image.)


You can see a working example here


You can download the package here (Demo page included):


Include these lines into your script’s <head> declaration:

<script src="lib/jquery.min.js" type="text/javascript"></script><script src="lib/jquery.scrolite.min.js" type="text/javascript"></script><script src="lib/jquery.mousewheel.js" type="text/javascript"></script>


Then use this script with :


It will create something like this:


The plugin options are:

'barColor' : The color of the scrollbar handle
'bedColor' : The color of the scrollbar bed
'bedWidth' : Width of the scrollbar bed
'bedCornerRadius' : CSS3 border-radius of scrollbar bed
'barWidth' : Scrollbar handle width
'barCornerRadius' : CSS3 border-radius of scrollbar handle
'width' : scrollable area width
'height' : scrollable area height
'scrollSensitivity' : pixel scrolling value of one tick of the mousewheel
'bedMarginTop' : pixel margin for top of the scroller bed
'bedMarginBottom' : pixel margin for bottom of the scroller bed
'bedMarginLeft' : pixel margin for left of the scroller bed
'bedMarginRight' : pixel margin for right of the scroller bed

CSS Elements

You can change other CSS values by referring to these classes in your styles file:

'.scrolite' : refers to container of all the elements below
'.scrolite-bed' : refers to scrollbar bed element
'.scrolite-bar' : refers to scrollbar handle element
'.scrolite-container' : refers to the scrollable area wrapper

Public Functions

If you are using an AJAX script to load it’s contents from somewhere, you can refresh the scrollbar’s calculations by this function (included in the demo file):


The “.scrollable” refers to your initial element which you’ve added the scrollbar.


Yine yarışmadayım!’a eklediğim PHP Animated Gif Resizer class’ım Şubat 2012 innovasyon ödülü için yarışıyor. Desteğinizi esirgemeyin. Sayfaya girip oy vermek için önce üye olmanız gerekiyor. Üyelik işleminizi yaptıktan sonra oylama sayfasına giderek oyunuzu verebilirsiniz. Linkler burada :

GIF Animation Resizer

Oylama Sayfası

İnovasyon Ödülleri Hakkında Bilgi

Hepinize desteğiniz için şimdiden çok çok teşekkür ediyorum.


Edit : 17.07% oyla 3. olduk. Neyse önemli olan katılmak 😛 RPS

Follow me on Twitter

GiottoPress by Enrique Chavez