wpfc = $wpfc;
$this->html = $html;
$this->set_except_tags();
$this->set_tags();
$this->tags_reorder();
}
public function check_exclude($css_url = false){
if($css_url){
// to exclude the css source of elementor which is /elementor/css/post-[number].css to avoid increasing the size of minified sources
if(preg_match("/\/elementor\/css\/post-\d+\.css/i", $css_url)){
return true;
}
foreach((array)$this->wpfc->exclude_rules as $key => $value){
if(isset($value->prefix) && $value->prefix && $value->type == "css"){
if($value->prefix == "contain"){
$preg_match_rule = preg_quote($value->content, "/");
}
if(preg_match("/".$preg_match_rule."/i", $css_url)){
return true;
}
}
}
}
}
public function combineCss(){
$all = array();
$group = array();
foreach ($this->tags as $key => $value) {
if(preg_match("/except){
if(strpos($this->except, $value["text"]) !== false){
array_push($all, $group);
$group = array();
continue;
}
}
if(!$this->checkInternal($value["text"])){
array_push($all, $group);
$group = array();
continue;
}
if($this->check_exclude($value["text"])){
array_push($all, $group);
$group = array();
continue;
}
if(count($group) > 0){
if($group[0]["media"] == $value["media"]){
array_push($group, $value);
}else{
array_push($all, $group);
$group = array();
array_push($group, $value);
}
}else{
array_push($group, $value);
}
if($value === end($this->tags)){
array_push($all, $group);
}
}
if(preg_match("/";
return $link;
}
public function tags_reorder(){
$sorter = array();
$ret = array();
foreach ($this->tags as $ii => $va) {
$sorter[$ii] = $va['start'];
}
asort($sorter);
foreach ($sorter as $ii => $va) {
$ret[$ii] = $this->tags[$ii];
}
$this->tags = $ret;
}
public function set_except_tags(){
$comment_tags = $this->find_tags("");
foreach ($comment_tags as $key => $value) {
$this->except = $value["text"].$this->except;
}
// to execute if html contains