12.29.06

Get Recent Comments 1.5

Posted in wordpress at 6:06 pm

Get Recent Comments is a very popular wordpress plug-in, to allow you show recent comments and trackbacks in you sidebar.

In recent update, it adds cache function so it will reduce db access and processing a lot.

However for utf-8 users, we’re running into two problems, first is the php wordwrap function is not utf-8 aware, and will be cut incorrectly. Second is that in wordpress, update_option() will not save serialized broken utf8 values correctly, so the cache function will not work at all without utf8_wordwrap() on a CJK blog.

I’ve done quick fixes on these problem:

  1. using utf8_wordwrap() from php.net, to replace wordwrap().
  2. do base64_encode() before saving the cache to avoid escaping problem.

Here is the fixed file, you can grab if you need to use it in utf8 environment.

Updated: Sorry the conclusion is too quick, the cache problem is also cause by wordwrap(), with broken characters, the option will not be correctly saved into database. So with utf8_wordwrap() we don’t need base64_encode(). You just need one of them to allow cache to work in Chinese environment. The file is updated to latest version 1.5.1 with utf8_wordwrap()

RSS feed for comments on this post · TrackBack URL

Leave a Comment