',$this->content,2);
$this->content = $content[0].'';
$this->restofcontent = $content[1];
}
//Save IE hacks
$this->content = preg_replace('#(<\!--\[if.*\]>.*<\!\[endif\]-->)#Usie',
'\'%%IEHACK%%\'.base64_encode("$1").\'%%IEHACK%%\'',$this->content);
//Get )|(]*text/css[^>]*>)#Usmi',$this->content,$matches))
{
foreach($matches[0] as $tag)
{
if(preg_match('#
$url = current(explode('?',$source[2],2));
$path = $this->getpath($url);
$media = array('all');
if($path !==false && preg_match('#\.css$#',$path))
{
//Good link
//Get the media
if(strpos($tag,'media=')!==false)
{
$medias = preg_replace('#^.*media=(?:"|\')(.*)(?:"|\').*$#U','$1',$tag);
$medias = explode(',',$medias);
$media = array();
foreach($medias as $elem)
{
$media[] = current(explode(' ',trim($elem),2));
}
}
$this->css[] = array($media,$path);
}else{
//Link is dynamic (.php etc)
$tag = '';
}
}else{
//#Usmi',$tag,$code);
$code = preg_replace('#^.*.*$#sm','$1',$code[1]);
$this->css[] = array('all','INLINE;'.$code);
}
//Remove the original style tag
$this->content = str_replace($tag,'',$this->content);
}
return true;
}
//No styles :(
return false;
}
//Joins and optimizes CSS
public function minify()
{
foreach($this->css as $group)
{
list($media,$css) = $group;
if(preg_match('#^INLINE;#',$css))
{
//