Windows Live Writer Image Upload and WordPress (WPMU)
My previous post http://emad.blogstogo.com/2007/07/19/window-live-writer-and-pictures/ didn’t work right away. When I tried to post it, I received the error message
Luckily, I found the fix. The problem was in the wp-includes/class-IXR.php. At line 138 in function parse, I replaced:
$this->message = preg_replace(‘/<\?xml(.*)?\?’.'>/’, ”, $this->message);
if (trim($this->message) == ”) {
return false;
}
with:
$rx = ‘/<?xml.*encoding=[\'"](.*?)[\'"].*?>/m’;
if (preg_match($rx, $this->message, $m)) {
$encoding = strtoupper($m[1]);
} else {
$encoding = “UTF-8″;
}
The first few lines of my function looked like this:
//begin WLW fix for image upload
//commented for WLW
/*
$this->message = preg_replace(‘/<\?xml(.*)?\?’.'>/’, ”, $this->message);
if (trim($this->message) == ”) {
return false;
}
*/
//replaced with WLW
$rx = ‘/<?xml.*encoding=[\'"](.*?)[\'"].*?>/m’;
if (preg_match($rx, $this->message, $m)) {
$encoding = strtoupper($m[1]);
} else {
$encoding = “UTF-8″;
}
//end WLW fix
Tags: Random








Thu, Jul 19, 2007
Random