',$this->content,2); $this->content = $content[0].''; $this->restofcontent = $content[1]; } //Store data: URIs setting for later use $this->datauris = $options['datauris']; //Do we use yui? $this->yui = $options['yui']; //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) { //Get the media if(strpos($tag,'media=')!==false) { preg_match('#media=(?:"|\')([^>]*)(?:"|\')#Ui',$tag,$medias); $medias = explode(',',$medias[1]); $media = array(); foreach($medias as $elem) { $media[] = current(explode(' ',trim($elem),2)); } }else{ //No media specified - applies to all $media = array('all'); } if(preg_match('# $url = current(explode('?',$source[2],2)); $path = $this->getpath($url); if($path !==false && preg_match('#\.css$#',$path)) { //Good link $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($media,'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)) { //