I have sent you a mail with the results 🙂
Did you get my latest mail Josef? I’d like to have a look at the resulting HTML source when CSS optimization is activated, can you mail that to me?
Hey, sorry for the late response. I answered you via e-mail (including the html source code) a few minutes ago 🙂
OK, we’re on to something; the problem is related to the fact that the imports in themes/iblog/style.css are relative.
Now this in handled in wp-content/plugins/autoptimize/classes/autoptimizeStyles.php in the fixurls function at the bottom.
So … can you replace the code there with this and see if that fixes things:
private function fixurls($file,$code)
{
$file = str_replace(WP_CONTENT_DIR,'/',$file);
$dir = dirname($file); //Like /wp-content
if(preg_match_all('#url\((.*)\)#Usi',$code,$matches))
{
$replace = array();
foreach($matches[1] as $k => $url)
{
//Remove quotes
$url = trim($url," \t\n\r\x0B\"'");
if(substr($url,0,1)=='/' || preg_match('#^(https?|ftp)://#i',$url))
{
continue;
}else{
$newurl = WP_CONTENT_URL.str_replace('//','/',$dir.'/'.$url);
$hash = md5($url);
$code = str_replace($matches[0][$k],$hash,$code);
$replace[$hash] = 'url('.$newurl.')';
}
}
$code = str_replace(array_keys($replace),array_values($replace),$code);
}
return $code;
}
(crossing my fingers now)
Awesome! It works great again 🙂 Thanks a lot for your help.
You’re welcome Josef, thanks for you patience & continuous feedback. I’ll make sure to mention you in the release notes of the next version (which I’m working on now).
Hi Josef;
I’m finalizing 1.6.0 and ran into a problem with the getpath-function I posted above. Can you replace with this one and report if that works for you as well?
protected function getpath($url)
{
$path = str_replace(site_url(),'',$url);
if(preg_match('#^(https?|ftp)://#i',$path))
{
/**
External script/css (adsense, etc)
*/
return false;
}
$path = str_replace('//','/',ABSPATH.$path);
return $path;
}
thanks!
Nah, that won’t work, as $path will start with /bits/ and ABSPATH will end with that same string. I’ll have to think some more.