render_blocking = array(); $speedycache->render_blocking['except'] = ''; $speedycache->render_blocking['tags'] = array(); $speedycache->render_blocking['header_start_index'] = 0; $speedycache->render_blocking['js_tags_text'] = ''; $speedycache->render_blocking['html'] = $html; self::set_header_start_index(); self::set_tags(); $speedycache->render_blocking['tags'] = self::reorder_tags($speedycache->render_blocking['tags']); } static function set_tags(){ self::set_comments(); self::set_js(); self::set_css(); } static function set_comments(){ global $speedycache; $comment_tags = self::find_tags(''); self::set_except($comment_tags); foreach($comment_tags as $key => $value){ if(preg_match("/\<\!--\s*\[if/i", $value['text'])){ if(preg_match("/data-speedycache-render\=[\"\']false[\"\']/i", $value['text'])){ continue; } array_push($speedycache->render_blocking['tags'], $value); } } } static function set_css(){ global $speedycache; $style_tags = self::find_tags(''); foreach($style_tags as $key => $value){ // if(!preg_match("/<\/script>/i", $value['text'])){ array_push($speedycache->render_blocking['tags'], $value); } } $link_tags = self::find_tags(''); foreach($link_tags as $key => $value){ if(preg_match("/href\s*\=/i", $value['text'])){ if(preg_match("/rel\s*\=\s*[\'\"]\s*stylesheet\s*[\'\"]/i", $value['text'])){ array_push($speedycache->render_blocking['tags'], $value); } } } } static function set_js(){ global $speedycache; // Creating regex to exclude js from RenderBlocking if(!empty($speedycache->options['render_blocking_excludes'])){ $exclude_script_list = array_map('preg_quote', $speedycache->options['render_blocking_excludes'], array_fill(0, count($speedycache->options['render_blocking_excludes']), '/')); $exclude_user_script = '/\b(?:' . implode('|', $exclude_script_list) . ')\b/'; } $script_tag = self::find_tags(''); foreach($script_tag as $key => $value){ if(self::exclude_scripts($value['text'])){ continue; } // Excludes the user specified scripts if(!empty($exclude_user_script) && preg_match($exclude_user_script, $value['text'])){ continue; } // Import map should always load at the same place as it is meant to be loaded before other scripts. if(preg_match("/importmap/i", $value['text'])){ continue; } // if(preg_match("/partner\.googleadservices\.com\/gampad\/google_service\.js/i", $value['text'])){ continue; } // if(preg_match("/]*>\s*GS_googleAddAdSenseService\([\"\'][^\"\']+[\"\']\)\;\s*GS_googleEnableAllServices\(\)\;\s*<\/script>/i", $value['text'])){ continue; } // if(preg_match("/]*>\s*GA_googleAddSlot\([^\)]+\)\;\s*<\/script>/i", $value['text'])){ continue; } // if(preg_match("/]*>\s*GA_googleFetchAds\(\)\;\s*<\/script>/i", $value['text'])){ continue; } // if(preg_match("/]*>\s*\(function\(i,s,o,g,r,a,m\)\{i\[\'GoogleAnalyticsObject\'\]/i", $value['text'])){ if(preg_match("/ga\(\'send\',\s*\'pageview\'\)\;\s*<\/script>/i", $value['text'])){ continue; } } // // // if(preg_match("/]+googletagmanager\.com\/gtag\/js[^\>]+>/i", $value['text'])){ continue; } if(preg_match("/^ */ if(preg_match("/data-skip-moving\=[\"\']true[\"\']/i", $value['text'])){ continue; } if(preg_match('/amzn_assoc_placement/i', $value['text'])){ // continue; } // if(preg_match("/^]*>\s*document.write\([\"\']\s*
[\"\']\)\s*<\/script>$/i", $value['text'])){ if(preg_match("/amazonjs/i", $value['text'])){ continue; } } } if(preg_match('/reklamstore/i', $value['text'])){ if(preg_match("/reklamstore_region_id/i", $value['text'])){ continue; }else if(preg_match("/reklamstore\.com\/reklamstore\.js/i", $value['text'])){ continue; } } // if(preg_match("/document\.write\s*\(/i", $value['text'])){ if(preg_match("/