I have a client that is international but they did not want/need to offer multuple lanugage content for the user, they would just write it accordingly.
But, they have various content writers from several countries so to ease use of WordPress, they should have it in their preferred language. I found Kau-Boy’s Backend Localization Plugin.
I installed it and got an undefined error on line 175. Did some research and found out that one, the host the client is on is old! Two, the plugin used PHP 5 functions which due to the host, obviously doesn’t work. Same thing with the latest WP designed for MySQL 5+… Did I mention the host is old!!!
Anyways, on to the code.
Original:
$files = scandir(WP_LANG_DIR);
foreach($files as $file){
$fileParts = pathinfo($file);
if($fileParts['extension'] == 'mo' && (strlen($fileParts['filename']) <= 5)){
$backend_locale_array[] = $fileParts['filename'];
}
}
This is the trouble area using PHP 5 functions such as scandir and get file property ‘extension’.
Replace above with the PHP 4 fix. You may be able to remove $fileParts['extension'] as it may actually not be doing anything in this usage.
Updated:
* php 4 fix */
$dir = WP_LANG_DIR;
$dh = opendir($dir);
while (false !== ($filename = readdir($dh))) {
$files[] = $filename;
}
/* read the array */
foreach($files as $file){
$fileParts = pathinfo($file);
if(!isset($fileParts['filename']) && $fileParts['extension'] == 'mo' && (strlen($fileParts['filename']) <= 5)){
$fileParts['filename'] = substr($fileParts['basename'], 0,strpos($fileParts['basename'],'.'));
$backend_locale_array[] = $fileParts['filename'];
}
}
Fixed the mark-up since WP was changing my single quote to left and right single quotes.
Was contacted by Mr. Kau, the author of the plug-in, just asking for permission to distribute the update. Of course it was not a problem and that is just an example of the way an open-source community should be.
Thanks for the shout-out Mr. Kau!
Your welcome!
I am always happy when some of my users report their issues or their ideas of how to improve one of my plugins. As a developer for a community as big as the wordpress community it is alwaya difficult to know what the users want.
So thanks again for your help.