芝麻web文件管理V1.00
编辑当前文件:/home/soundframestudio/smith.soundframestudios.net/wp-content/plugins/speedycache/main/js.php
]+[\s"\'])?src\s*=\s*[\'"]\s*?(?
[^\'"]+\.js(?:\?[^\'"]*)?)\s*?[\'"]([^>]+)?\/?><\/script>/is', $content, $tags, PREG_SET_ORDER); if(empty($tags)){ return; } if(empty($_SERVER['HTTP_HOST'])){ return; } $site_host = str_replace('www.', '', sanitize_text_field(wp_unslash($_SERVER['HTTP_HOST']))); $site_url = site_url(); foreach($tags as $tag){ if(empty($tag['url'])){ continue; } $url = $tag['url']; if(self::is_excluded($url)) continue; // We don't want to minify already minified js if(strpos($url, '.min.js') !== FALSE){ continue; } // We wont process any css that is not present on this WordPress install if(strpos($url, $site_host) === FALSE){ continue; } $file_path = Util::url_to_path($url); if(!file_exists($file_path)){ continue; } $file_name = self::file_name($file_path); if(empty($speedycache->enhanced)){ \SpeedyCache\Enhanced::init(); } $js = file_get_contents($file_path); $js = \SpeedyCache\Enhanced::minify_js($js); $asset_path = Util::cache_path('assets'); if(!is_dir($asset_path)){ mkdir($asset_path, 0755, true); touch($asset_path . 'index.html'); } $minified_path = $asset_path.$file_name; file_put_contents($minified_path, $js); $minified_url = Util::path_to_url($minified_path); $content = str_replace($tag['url'], $minified_url, $content); // TODO: check if there is a preload. } } static function combine_head(&$content){ global $speedycache; if (preg_match('/
(.*?)<\/head>/is', $content, $head_section)) { $head = preg_replace( '//Uis', '', $head_section[1]); // Regex pattern to match script tags with src attribute in the head section preg_match_all('/