Alex (SirShurf) Frenkel's Blog

A web log of a PHP professional

Another Week another beta – WordPress 3.4 Beta 2

with one comment

Well the second beta is out, and about 60 bug fixes were commited …


We will see how it works 🙂

Written by Alex (Shurf) Frenkel

April 13, 2012 at 11:26 am

Posted in Wordpress

Tagged with , ,

WordPress 3.4 Beta 1 – Developer preview

leave a comment »

WordPress developer team have released Beta 1 of the next version of WordPress.

This is not a production release, only install it on test servers to check on your themes and plugins!

If all goes well, WordPress 3.4 will be released  in May. If you want to be a beta tester, you should check out the Codex article on how to report bugs.

Here’s some of what’s new:

  • Theme Customizer with Previewer
  • Flexible Custom Header Sizes
  • Selecting Custom Header and Background Images from Media Library
  • Better experience searching for and choosing a theme

And some of the under-the-hood changes:

  • New XML-RPC API for external and mobile applications
  • New API for registering theme support for custom headers and backgrounds
  • Performance improvements to WP_Query by splitting the query (Please test!)
  • Internationalization improvements (improved performance and locale support)
  • Performance and API improvements when working with lists of installed themes
  • Support for installing child themes from the WordPress Themes Directory

Remember, if you find something you think is a bug, report it! You can bring it up in the alpha/beta forum, you can email it to the wp-testers list, or if you’ve confirmed that other people are experiencing the same bug, you can report it on the WordPress Core Trac. (We recommend starting in the forum or on the mailing list.)

Written by Alex (Shurf) Frenkel

April 10, 2012 at 2:07 pm

WPMU Ultimate Facebook Addon plugin Upgraded to version 0.3

with 2 comments

Well as stated in the topic, I have updated the WPMU Ultimate Facebook plugin Fix to version 0.3.

This is a maintenance only version since it’s only fixing posting description with a quotes (single quote to be exact).

You can download the plugin from:

And you can get the plugin from:


Written by Alex (Shurf) Frenkel

March 12, 2012 at 7:05 pm

PHP 5.4 is out, and here is the list you should be watching

leave a comment »

As of today PHP team has released PHP 5.4.

Since this is a major version here is the list of things you should look at:

    • The break and continue keywords don’t accept variable argument anymore. Consider using a static constant argument.
    • Safe mode is no longer supported. Any application that rely on safe mode may need adjustements in term of security.
    • Salsa10 and Salsa20 hash algorithms have been removed.
    • In Date extension, setting the timezone with the TZ environment variable is no longer supported. The extension will no longer guess the default timezone if none is set, instead it will always fall back to “UTC”.
    • get_magic_quotes_gpc() and get_magic_quotes_runtime() now always return false. set_magic_quotes_runtime() raises an E_CORE_ERROR
    • Non-numeric string offsets – e.g. $a[‘foo’] where $a is a string – now return false on isset() and true on empty(), and produce warning if trying to use them. Offsets of types double, bool and null produce notice. Numeric strings ($a[‘2’]) still work as before. Note that offsets like ‘12.3’ and ‘5 and a half’ are considered non-numeric and produce warning, but are converted to 12 and 5 respectively for BC reasons.
    • Turning null, false or empty string into an object by adding a property will now emit a warning instead of an E_STRICT error.
    • Converting array to string now will cause E_NOTICE warning.
    • Shadowing names of superglobals for parameter names now causes a fatal error.
    • array_combine() now returns array() instead of FALSE when two empty arrays are provided as parameters.
    • call_user_func_array() no longer allows call-time pass by reference.
    • htmlentities() now emits an E_STRICT warning when used with asian characters, as in that case htmlentities() has (and already had before this version) the same functionality as htmlspecialchars().

The following keyword(s) are now reserved and may not be used in function, class, etc. names.

  • trait
  • callable
  • insteadof

The following functions have been removed from PHP :

  • define_syslog_variables()
  • import_request_variables()
  • session_is_registered(), session_register() and session_unregister()
  • mysqli_bind_param(), mysqli_bind_result(), mysqli_client_encoding(), mysqli_fetch(), mysqli_param_count(), mysqli_get_metadata(), mysqli_send_long_data(), mysqli::client_encoding() and mysqli_stmt::stmt()

Have fun coding!

Written by Alex (Shurf) Frenkel

March 2, 2012 at 8:53 am

WPMU Infinite SEO plugin fix

with 7 comments

As you where able to see from my previous post’s I was quite made at some of the development decisions of WPMU stuff and I was stuck with a problem that was not possible (at least I did not know how) to fix.

Well I fixed it and here is the result.
My new plugin was approved by and can be downloaded here:

This plugin fix multibite problems with the description and fixes usage of caption.

Comments are welcomed.

Written by Alex (Shurf) Frenkel

February 22, 2012 at 10:41 pm

WPMU Ultimate Facebook plugin Fix

with one comment

In addition to this post:Problem with UTF, Excepts — AND GOOD CODING PRACTICES!

I have created a fix to Ultimate Facebook:
This fix address next things:
* Facebook OpenGraph fails if the text in description is incorrect – especially in Hebrew
* Current version of the plugin sends in wall post description blog tag line. In my fix I am sending Excerpts.

The plugin can be downloaded at

Written by Alex (Shurf) Frenkel

February 20, 2012 at 9:42 pm

Problem with UTF, Excepts — AND GOOD CODING PRACTICES!

with 2 comments

I am sorry if what I am going to write will offend anybody but after more then 2 days of debugging… I am getting frustrated with this.

I have no problems with plugins not working with Hebrew, since this language is not that common, but for crying out loud, PLEASE pretty PLEASE use common sense when programming!

I will show here simple example of what I mean and this is only an example, unfortunaly the same problem exist in other plugins (I have seen the same general programming problems in Ultimate Facebook too).

This plugin create a description text for the “META-Description” tag.
Now the problem in the current version I faces is that it’s not stripping out “Caption” tags and it’s splitting multi-byte strings in the middle of the letter (usage of strlen which is not multibyte safe).
I am not asking here WHY the programmer not used a built in function to get excerpt of a set length, or added ANY hooks in his plugins!!!

Here is the code used:

First lets go to: wds_onepage.php that is responsible for printing the meta to the client, in it we see next code:

if (is_singular()) {
$metadesc = wds_get_value('metadesc');
if ($metadesc == '' || !$metadesc) {
$metadesc = wds_replace_vars($wds_options['metadesc-'.$post->post_type], (array) $post );

You can see here that first we try to get metadesc value and if it’s empty we are requesting metadesc value from the option.
Lets trace “wds_replace_vars” to the source, and we find it in wds_core.php
I will not put the full function here to save some space but here is the interesting part:
'%%excerpt%%' => !empty($r['post_excerpt']) ? apply_filters('get_the_excerpt', $r['post_excerpt']) : substr(wp_trim_excerpt($r['post_content']), 0, 155),

We are checking IF excerpt exists if not we will create one using “wp_trim_excerpt” and we will substr (not MB safe!!!).
The first part of the problem is easily fixed here all I need to do is to sit in the “wp_trim_excerpt” hook of WP:

add_filter( 'wp_trim_excerpt', array($objClass,'seo'));
function seo($strText){

$strText = strip_shortcodes( $strText );
$strText = strip_tags ( $strText );

return $strText;

That way we are getting text only and not all of the HTML junk the plugin is giving GOOGLE.

But now I am getting blank description, so lets trace it further, we have striped the text, and cutted it not MB safe to 155 characters. next things we have is this:

echo "\t".''."\n";

OUCH, now, we are stripping tags and using esc_attr on our cutted text. the first is stupid since the HTML we had was cutted to 155 in the middle so the strip_tags would not work, but that I have fixed using the hook above (I am stripping tags on the original text before the substr call).

But the biggest problem is the esc_attr call, since it’s checking for the CORRECT UTF text, and since we cutted the text in the middle of a letter it is not a VALID UTF!

to fix that lets change the hook above:

add_filter( 'wp_trim_excerpt', array($objClass,'seo'));
function seo($strText){

$strText = strip_shortcodes( $strText );
$strText = strip_tags ( $strText );
$strText = apply_filters('the_content', $strText);
$strText = str_replace(']]>', ']]>', $strText);
$excerpt_length = apply_filters('excerpt_length', 55);
$excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
$strText = wp_trim_words( $strText, $excerpt_length, $excerpt_more );

return $strText;

This time I am responsible for the shortening of the text (I am making it only 55 characters to fit in 155 that will be cutted later), and using wp_trim_words in order to have only full words in the description (Google dont like paritial words).

This has taken ceare of the first part the client part, but what about the Admin part?

Well this is the one that got me to write this post, in the admin part for some reason the creation of the text does not uses the same function at all!!!!

The parameter here is $desc in wds-core-metabox.php and is acheaved by this code:

$desc = wds_get_value('metadesc');
if (empty($desc))
$desc = substr(strip_tags($post->post_content), 0, 130).' ...';
if (empty($desc))
$desc = 'temp description';

Now here there is NO hooks and no methods for me to catch.
Currently as of writing this post, I have not yet found an answere of how to bypass this and ANY ideas will be welcomed.

In any way, my fix for this plugin will be availible at this location as soon as approve it:

Written by Alex (Shurf) Frenkel

February 20, 2012 at 5:22 pm