@@ -4,8 +4,8 @@ discard block  | 
                                                    ||
| 4 | 4 | */  | 
                                                        
| 5 | 5 | |
| 6 | 6 |  function ao_js_snippetcache($jsin,$scriptname) { | 
                                                        
| 7 | - // load speedupper conditionally (true by default?)  | 
                                                        |
| 8 | -	if ( apply_filters('autoptimize_filter_speedupper', true) ) { | 
                                                        |
| 7 | + // load speedupper conditionally (true by default?)  | 
                                                        |
| 8 | +    if ( apply_filters('autoptimize_filter_speedupper', true) ) { | 
                                                        |
| 9 | 9 |          if (strpos($scriptname,"min.js")===false) { | 
                                                        
| 10 | 10 | $md5hash = "snippet_".md5($jsin);  | 
                                                        
| 11 | 11 | $ccheck = new autoptimizeCache($md5hash,'js');  | 
                                                        
@@ -30,71 +30,71 @@ discard block  | 
                                                    ||
| 30 | 30 | // do some housekeeping here to remove comments & linebreaks and stuff  | 
                                                        
| 31 | 31 |              $scriptsrc=preg_replace("#^\s*\/\/.*$#Um","",$jsin); | 
                                                        
| 32 | 32 |              $scriptsrc=preg_replace("#^\s*\/\*[^!].*\*\/\s?#Us","",$scriptsrc); | 
                                                        
| 33 | -			$scriptsrc=preg_replace("#(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+#", "\n", $scriptsrc); | 
                                                        |
| 33 | +            $scriptsrc=preg_replace("#(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+#", "\n", $scriptsrc); | 
                                                        |
| 34 | 34 | |
| 35 | -			if ((substr($scriptsrc,-1,1)!==";")&&(substr($scriptsrc,-1,1)!=="}")) { | 
                                                        |
| 36 | - $scriptsrc.=";";  | 
                                                        |
| 37 | - }  | 
                                                        |
| 35 | +            if ((substr($scriptsrc,-1,1)!==";")&&(substr($scriptsrc,-1,1)!=="}")) { | 
                                                        |
| 36 | + $scriptsrc.=";";  | 
                                                        |
| 37 | + }  | 
                                                        |
| 38 | 38 | |
| 39 | -			if (get_option("autoptimize_js_trycatch")==="on") { | 
                                                        |
| 40 | -				$scriptsrc="try{".$scriptsrc."}catch(e){}"; | 
                                                        |
| 41 | - }  | 
                                                        |
| 39 | +            if (get_option("autoptimize_js_trycatch")==="on") { | 
                                                        |
| 40 | +                $scriptsrc="try{".$scriptsrc."}catch(e){}"; | 
                                                        |
| 41 | + }  | 
                                                        |
| 42 | 42 | }  | 
                                                        
| 43 | 43 | return $scriptsrc;  | 
                                                        
| 44 | - }  | 
                                                        |
| 44 | + }  | 
                                                        |
| 45 | 45 | }  | 
                                                        
| 46 | 46 | |
| 47 | 47 |  function ao_css_snippetcache($cssin,$filename) { | 
                                                        
| 48 | - // load speedupper conditionally (true by default?)  | 
                                                        |
| 49 | -	if ( apply_filters('autoptimize_filter_speedupper', true) ) { | 
                                                        |
| 50 | - $md5hash = "snippet_".md5($cssin);  | 
                                                        |
| 51 | - $ccheck = new autoptimizeCache($md5hash,'css');  | 
                                                        |
| 52 | -		if($ccheck->check()) { | 
                                                        |
| 53 | - $stylesrc = $ccheck->retrieve();  | 
                                                        |
| 54 | -		} else { | 
                                                        |
| 55 | -			if (strpos($filename,"min.css")===false) { | 
                                                        |
| 56 | -				if (class_exists('Minify_CSS_Compressor')) { | 
                                                        |
| 57 | - $tmp_code = trim(Minify_CSS_Compressor::process($cssin));  | 
                                                        |
| 58 | -				} else if(class_exists('CSSmin')) { | 
                                                        |
| 59 | - $cssmin = new CSSmin();  | 
                                                        |
| 60 | -					if (method_exists($cssmin,"run")) { | 
                                                        |
| 61 | - $tmp_code = trim($cssmin->run($cssin));  | 
                                                        |
| 62 | -					} elseif (@is_callable(array($cssmin,"minify"))) { | 
                                                        |
| 63 | - $tmp_code = trim(CssMin::minify($cssin));  | 
                                                        |
| 64 | - }  | 
                                                        |
| 65 | - }  | 
                                                        |
| 48 | + // load speedupper conditionally (true by default?)  | 
                                                        |
| 49 | +    if ( apply_filters('autoptimize_filter_speedupper', true) ) { | 
                                                        |
| 50 | + $md5hash = "snippet_".md5($cssin);  | 
                                                        |
| 51 | + $ccheck = new autoptimizeCache($md5hash,'css');  | 
                                                        |
| 52 | +        if($ccheck->check()) { | 
                                                        |
| 53 | + $stylesrc = $ccheck->retrieve();  | 
                                                        |
| 54 | +        } else { | 
                                                        |
| 55 | +            if (strpos($filename,"min.css")===false) { | 
                                                        |
| 56 | +                if (class_exists('Minify_CSS_Compressor')) { | 
                                                        |
| 57 | + $tmp_code = trim(Minify_CSS_Compressor::process($cssin));  | 
                                                        |
| 58 | +                } else if(class_exists('CSSmin')) { | 
                                                        |
| 59 | + $cssmin = new CSSmin();  | 
                                                        |
| 60 | +                    if (method_exists($cssmin,"run")) { | 
                                                        |
| 61 | + $tmp_code = trim($cssmin->run($cssin));  | 
                                                        |
| 62 | +                    } elseif (@is_callable(array($cssmin,"minify"))) { | 
                                                        |
| 63 | + $tmp_code = trim(CssMin::minify($cssin));  | 
                                                        |
| 64 | + }  | 
                                                        |
| 65 | + }  | 
                                                        |
| 66 | 66 | |
| 67 | -				if (!empty($tmp_code)) { | 
                                                        |
| 68 | - $stylesrc = $tmp_code;  | 
                                                        |
| 69 | - unset($tmp_code);  | 
                                                        |
| 70 | -				} else { | 
                                                        |
| 71 | - $stylesrc = $cssin;  | 
                                                        |
| 72 | - }  | 
                                                        |
| 73 | -			} else { | 
                                                        |
| 74 | - // .min.css -> no heavy-lifting, just some cleanup  | 
                                                        |
| 75 | -				$stylesrc=preg_replace("#^\s*\/\*[^!].*\*\/\s?#Us","",$cssin); | 
                                                        |
| 76 | -				$stylesrc=preg_replace("#(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+#", "\n", $stylesrc); | 
                                                        |
| 77 | - $stylesrc=autoptimizeStyles::fixurls($filename,$stylesrc);  | 
                                                        |
| 78 | - }  | 
                                                        |
| 79 | -			if (!empty($filename)) { | 
                                                        |
| 80 | - // don't cache inline CSS to avoid risk of cache-explosion  | 
                                                        |
| 81 | - $ccheck->cache($stylesrc,'text/css');  | 
                                                        |
| 82 | - }  | 
                                                        |
| 83 | - unset($ccheck);  | 
                                                        |
| 84 | - }  | 
                                                        |
| 85 | - return $stylesrc;  | 
                                                        |
| 86 | - }  | 
                                                        |
| 67 | +                if (!empty($tmp_code)) { | 
                                                        |
| 68 | + $stylesrc = $tmp_code;  | 
                                                        |
| 69 | + unset($tmp_code);  | 
                                                        |
| 70 | +                } else { | 
                                                        |
| 71 | + $stylesrc = $cssin;  | 
                                                        |
| 72 | + }  | 
                                                        |
| 73 | +            } else { | 
                                                        |
| 74 | + // .min.css -> no heavy-lifting, just some cleanup  | 
                                                        |
| 75 | +                $stylesrc=preg_replace("#^\s*\/\*[^!].*\*\/\s?#Us","",$cssin); | 
                                                        |
| 76 | +                $stylesrc=preg_replace("#(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+#", "\n", $stylesrc); | 
                                                        |
| 77 | + $stylesrc=autoptimizeStyles::fixurls($filename,$stylesrc);  | 
                                                        |
| 78 | + }  | 
                                                        |
| 79 | +            if (!empty($filename)) { | 
                                                        |
| 80 | + // don't cache inline CSS to avoid risk of cache-explosion  | 
                                                        |
| 81 | + $ccheck->cache($stylesrc,'text/css');  | 
                                                        |
| 82 | + }  | 
                                                        |
| 83 | + unset($ccheck);  | 
                                                        |
| 84 | + }  | 
                                                        |
| 85 | + return $stylesrc;  | 
                                                        |
| 86 | + }  | 
                                                        |
| 87 | 87 | }  | 
                                                        
| 88 | 88 | |
| 89 | 89 | // try to warm (snippet) cache when AO cache is cleared  | 
                                                        
| 90 | 90 |  function ao_speedup_warmcache() { | 
                                                        
| 91 | - // load speedupper conditionally (true by default?)  | 
                                                        |
| 92 | -	if ( apply_filters('autoptimize_filter_speedupper', true) ) { | 
                                                        |
| 93 | -		error_log("speedupper triggered"); | 
                                                        |
| 94 | - $warmCacheUrl = site_url()."/?ao_speedup_cachebuster=".rand(1,100000);  | 
                                                        |
| 95 | - $warmCache = @wp_remote_get($warmCacheUrl);  | 
                                                        |
| 96 | - unset($warmCache);  | 
                                                        |
| 97 | - }  | 
                                                        |
| 91 | + // load speedupper conditionally (true by default?)  | 
                                                        |
| 92 | +    if ( apply_filters('autoptimize_filter_speedupper', true) ) { | 
                                                        |
| 93 | +        error_log("speedupper triggered"); | 
                                                        |
| 94 | + $warmCacheUrl = site_url()."/?ao_speedup_cachebuster=".rand(1,100000);  | 
                                                        |
| 95 | + $warmCache = @wp_remote_get($warmCacheUrl);  | 
                                                        |
| 96 | + unset($warmCache);  | 
                                                        |
| 97 | + }  | 
                                                        |
| 98 | 98 | }  | 
                                                        
| 99 | 99 | |
| 100 | 100 |  add_filter('autoptimize_css_individual_style','ao_css_snippetcache',10,2); | 
                                                        
@@ -3,63 +3,63 @@ discard block  | 
                                                    ||
| 3 | 3 | Autoptimize SpeedUp; minify & cache each JS/ CSS separately + warm the cache  | 
                                                        
| 4 | 4 | */  | 
                                                        
| 5 | 5 | |
| 6 | -function ao_js_snippetcache($jsin,$scriptname) { | 
                                                        |
| 6 | +function ao_js_snippetcache($jsin, $scriptname) { | 
                                                        |
| 7 | 7 | // load speedupper conditionally (true by default?)  | 
                                                        
| 8 | -	if ( apply_filters('autoptimize_filter_speedupper', true) ) { | 
                                                        |
| 9 | -        if (strpos($scriptname,"min.js")===false) { | 
                                                        |
| 8 | +	if (apply_filters('autoptimize_filter_speedupper', true)) { | 
                                                        |
| 9 | +        if (strpos($scriptname, "min.js") === false) { | 
                                                        |
| 10 | 10 | $md5hash = "snippet_".md5($jsin);  | 
                                                        
| 11 | - $ccheck = new autoptimizeCache($md5hash,'js');  | 
                                                        |
| 12 | -                if($ccheck->check()) { | 
                                                        |
| 11 | + $ccheck = new autoptimizeCache($md5hash, 'js');  | 
                                                        |
| 12 | +                if ($ccheck->check()) { | 
                                                        |
| 13 | 13 | $scriptsrc = $ccheck->retrieve();  | 
                                                        
| 14 | 14 |                  } else { | 
                                                        
| 15 | -                        if(class_exists('JSMin')) { | 
                                                        |
| 15 | +                        if (class_exists('JSMin')) { | 
                                                        |
| 16 | 16 | $tmp_jscode = trim(JSMin::minify($jsin));  | 
                                                        
| 17 | 17 |                                  if (!empty($tmp_jscode)) { | 
                                                        
| 18 | 18 | $scriptsrc = $tmp_jscode;  | 
                                                        
| 19 | 19 | unset($tmp_jscode);  | 
                                                        
| 20 | - $ccheck->cache($scriptsrc,'text/javascript');  | 
                                                        |
| 20 | + $ccheck->cache($scriptsrc, 'text/javascript');  | 
                                                        |
| 21 | 21 |                                  } else { | 
                                                        
| 22 | - $scriptsrc=$jsin;  | 
                                                        |
| 22 | + $scriptsrc = $jsin;  | 
                                                        |
| 23 | 23 | }  | 
                                                        
| 24 | 24 |                          } else { | 
                                                        
| 25 | - $scriptsrc=$jsin;  | 
                                                        |
| 25 | + $scriptsrc = $jsin;  | 
                                                        |
| 26 | 26 | }  | 
                                                        
| 27 | 27 | }  | 
                                                        
| 28 | 28 | unset($ccheck);  | 
                                                        
| 29 | 29 |          } else { | 
                                                        
| 30 | 30 | // do some housekeeping here to remove comments & linebreaks and stuff  | 
                                                        
| 31 | -            $scriptsrc=preg_replace("#^\s*\/\/.*$#Um","",$jsin); | 
                                                        |
| 32 | -            $scriptsrc=preg_replace("#^\s*\/\*[^!].*\*\/\s?#Us","",$scriptsrc); | 
                                                        |
| 33 | -			$scriptsrc=preg_replace("#(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+#", "\n", $scriptsrc); | 
                                                        |
| 31 | +            $scriptsrc = preg_replace("#^\s*\/\/.*$#Um", "", $jsin); | 
                                                        |
| 32 | +            $scriptsrc = preg_replace("#^\s*\/\*[^!].*\*\/\s?#Us", "", $scriptsrc); | 
                                                        |
| 33 | +			$scriptsrc = preg_replace("#(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+#", "\n", $scriptsrc); | 
                                                        |
| 34 | 34 | |
| 35 | -			if ((substr($scriptsrc,-1,1)!==";")&&(substr($scriptsrc,-1,1)!=="}")) { | 
                                                        |
| 36 | - $scriptsrc.=";";  | 
                                                        |
| 35 | +			if ((substr($scriptsrc, -1, 1) !== ";") && (substr($scriptsrc, -1, 1) !== "}")) { | 
                                                        |
| 36 | + $scriptsrc .= ";";  | 
                                                        |
| 37 | 37 | }  | 
                                                        
| 38 | 38 | |
| 39 | -			if (get_option("autoptimize_js_trycatch")==="on") { | 
                                                        |
| 40 | -				$scriptsrc="try{".$scriptsrc."}catch(e){}"; | 
                                                        |
| 39 | +			if (get_option("autoptimize_js_trycatch") === "on") { | 
                                                        |
| 40 | +				$scriptsrc = "try{".$scriptsrc."}catch(e){}"; | 
                                                        |
| 41 | 41 | }  | 
                                                        
| 42 | 42 | }  | 
                                                        
| 43 | 43 | return $scriptsrc;  | 
                                                        
| 44 | 44 | }  | 
                                                        
| 45 | 45 | }  | 
                                                        
| 46 | 46 | |
| 47 | -function ao_css_snippetcache($cssin,$filename) { | 
                                                        |
| 47 | +function ao_css_snippetcache($cssin, $filename) { | 
                                                        |
| 48 | 48 | // load speedupper conditionally (true by default?)  | 
                                                        
| 49 | -	if ( apply_filters('autoptimize_filter_speedupper', true) ) { | 
                                                        |
| 49 | +	if (apply_filters('autoptimize_filter_speedupper', true)) { | 
                                                        |
| 50 | 50 | $md5hash = "snippet_".md5($cssin);  | 
                                                        
| 51 | - $ccheck = new autoptimizeCache($md5hash,'css');  | 
                                                        |
| 52 | -		if($ccheck->check()) { | 
                                                        |
| 51 | + $ccheck = new autoptimizeCache($md5hash, 'css');  | 
                                                        |
| 52 | +		if ($ccheck->check()) { | 
                                                        |
| 53 | 53 | $stylesrc = $ccheck->retrieve();  | 
                                                        
| 54 | 54 |  		} else { | 
                                                        
| 55 | -			if (strpos($filename,"min.css")===false) { | 
                                                        |
| 55 | +			if (strpos($filename, "min.css") === false) { | 
                                                        |
| 56 | 56 |  				if (class_exists('Minify_CSS_Compressor')) { | 
                                                        
| 57 | 57 | $tmp_code = trim(Minify_CSS_Compressor::process($cssin));  | 
                                                        
| 58 | -				} else if(class_exists('CSSmin')) { | 
                                                        |
| 58 | +				} else if (class_exists('CSSmin')) { | 
                                                        |
| 59 | 59 | $cssmin = new CSSmin();  | 
                                                        
| 60 | -					if (method_exists($cssmin,"run")) { | 
                                                        |
| 60 | +					if (method_exists($cssmin, "run")) { | 
                                                        |
| 61 | 61 | $tmp_code = trim($cssmin->run($cssin));  | 
                                                        
| 62 | -					} elseif (@is_callable(array($cssmin,"minify"))) { | 
                                                        |
| 62 | +					} elseif (@is_callable(array($cssmin, "minify"))) { | 
                                                        |
| 63 | 63 | $tmp_code = trim(CssMin::minify($cssin));  | 
                                                        
| 64 | 64 | }  | 
                                                        
| 65 | 65 | }  | 
                                                        
@@ -72,13 +72,13 @@ discard block  | 
                                                    ||
| 72 | 72 | }  | 
                                                        
| 73 | 73 |  			} else { | 
                                                        
| 74 | 74 | // .min.css -> no heavy-lifting, just some cleanup  | 
                                                        
| 75 | -				$stylesrc=preg_replace("#^\s*\/\*[^!].*\*\/\s?#Us","",$cssin); | 
                                                        |
| 76 | -				$stylesrc=preg_replace("#(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+#", "\n", $stylesrc); | 
                                                        |
| 77 | - $stylesrc=autoptimizeStyles::fixurls($filename,$stylesrc);  | 
                                                        |
| 75 | +				$stylesrc = preg_replace("#^\s*\/\*[^!].*\*\/\s?#Us", "", $cssin); | 
                                                        |
| 76 | +				$stylesrc = preg_replace("#(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+#", "\n", $stylesrc); | 
                                                        |
| 77 | + $stylesrc = autoptimizeStyles::fixurls($filename, $stylesrc);  | 
                                                        |
| 78 | 78 | }  | 
                                                        
| 79 | 79 |  			if (!empty($filename)) { | 
                                                        
| 80 | 80 | // don't cache inline CSS to avoid risk of cache-explosion  | 
                                                        
| 81 | - $ccheck->cache($stylesrc,'text/css');  | 
                                                        |
| 81 | + $ccheck->cache($stylesrc, 'text/css');  | 
                                                        |
| 82 | 82 | }  | 
                                                        
| 83 | 83 | unset($ccheck);  | 
                                                        
| 84 | 84 | }  | 
                                                        
@@ -89,14 +89,14 @@ discard block  | 
                                                    ||
| 89 | 89 | // try to warm (snippet) cache when AO cache is cleared  | 
                                                        
| 90 | 90 |  function ao_speedup_warmcache() { | 
                                                        
| 91 | 91 | // load speedupper conditionally (true by default?)  | 
                                                        
| 92 | -	if ( apply_filters('autoptimize_filter_speedupper', true) ) { | 
                                                        |
| 92 | +	if (apply_filters('autoptimize_filter_speedupper', true)) { | 
                                                        |
| 93 | 93 |  		error_log("speedupper triggered"); | 
                                                        
| 94 | - $warmCacheUrl = site_url()."/?ao_speedup_cachebuster=".rand(1,100000);  | 
                                                        |
| 94 | + $warmCacheUrl = site_url()."/?ao_speedup_cachebuster=".rand(1, 100000);  | 
                                                        |
| 95 | 95 | $warmCache = @wp_remote_get($warmCacheUrl);  | 
                                                        
| 96 | 96 | unset($warmCache);  | 
                                                        
| 97 | 97 | }  | 
                                                        
| 98 | 98 | }  | 
                                                        
| 99 | 99 | |
| 100 | -add_filter('autoptimize_css_individual_style','ao_css_snippetcache',10,2); | 
                                                        |
| 101 | -add_filter('autoptimize_js_individual_script','ao_js_snippetcache',10,2); | 
                                                        |
| 102 | -add_action('autoptimize_action_cachepurged','ao_speedup_warmcache'); | 
                                                        |
| 100 | +add_filter('autoptimize_css_individual_style', 'ao_css_snippetcache', 10, 2); | 
                                                        |
| 101 | +add_filter('autoptimize_js_individual_script', 'ao_js_snippetcache', 10, 2); | 
                                                        |
| 102 | +add_action('autoptimize_action_cachepurged', 'ao_speedup_warmcache'); | 
                                                        |
@@ -12,15 +12,15 @@ discard block  | 
                                                    ||
| 12 | 12 | http://www.gnu.org/licenses/gpl.txt  | 
                                                        
| 13 | 13 | */  | 
                                                        
| 14 | 14 | |
| 15 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly  | 
                                                        |
| 15 | +if (!defined('ABSPATH')) exit; // Exit if accessed directly | 
                                                        |
| 16 | 16 | |
| 17 | -define('AUTOPTIMIZE_PLUGIN_DIR',plugin_dir_path(__FILE__)); | 
                                                        |
| 17 | +define('AUTOPTIMIZE_PLUGIN_DIR', plugin_dir_path(__FILE__)); | 
                                                        |
| 18 | 18 | |
| 19 | 19 | // Load config class  | 
                                                        
| 20 | 20 | include(AUTOPTIMIZE_PLUGIN_DIR.'classes/autoptimizeConfig.php');  | 
                                                        
| 21 | 21 | |
| 22 | 22 | // Load toolbar class  | 
                                                        
| 23 | -include( AUTOPTIMIZE_PLUGIN_DIR.'classes/autoptimizeToolbar.php' );  | 
                                                        |
| 23 | +include(AUTOPTIMIZE_PLUGIN_DIR.'classes/autoptimizeToolbar.php');  | 
                                                        |
| 24 | 24 | |
| 25 | 25 | // Load partners tab if admin  | 
                                                        
| 26 | 26 |  if (is_admin()) { | 
                                                        
@@ -31,25 +31,25 @@ discard block  | 
                                                    ||
| 31 | 31 | include(AUTOPTIMIZE_PLUGIN_DIR.'classlesses/autoptimizeSpeedupper.php');  | 
                                                        
| 32 | 32 | |
| 33 | 33 | // Do we gzip when caching (needed early to load autoptimizeCache.php)  | 
                                                        
| 34 | -define('AUTOPTIMIZE_CACHE_NOGZIP',(bool) get_option('autoptimize_cache_nogzip')); | 
                                                        |
| 34 | +define('AUTOPTIMIZE_CACHE_NOGZIP', (bool) get_option('autoptimize_cache_nogzip')); | 
                                                        |
| 35 | 35 | |
| 36 | 36 | // Load cache class  | 
                                                        
| 37 | 37 | include(AUTOPTIMIZE_PLUGIN_DIR.'classes/autoptimizeCache.php');  | 
                                                        
| 38 | 38 | |
| 39 | 39 | // wp-content dir name (automagically set, should not be needed), dirname of AO cache dir and AO-prefix can be overridden in wp-config.php  | 
                                                        
| 40 | -if (!defined('AUTOPTIMIZE_WP_CONTENT_NAME')) { define('AUTOPTIMIZE_WP_CONTENT_NAME','/'.wp_basename( WP_CONTENT_DIR )); } | 
                                                        |
| 41 | -if (!defined('AUTOPTIMIZE_CACHE_CHILD_DIR')) { define('AUTOPTIMIZE_CACHE_CHILD_DIR','/cache/autoptimize/'); } | 
                                                        |
| 40 | +if (!defined('AUTOPTIMIZE_WP_CONTENT_NAME')) { define('AUTOPTIMIZE_WP_CONTENT_NAME', '/'.wp_basename(WP_CONTENT_DIR)); } | 
                                                        |
| 41 | +if (!defined('AUTOPTIMIZE_CACHE_CHILD_DIR')) { define('AUTOPTIMIZE_CACHE_CHILD_DIR', '/cache/autoptimize/'); } | 
                                                        |
| 42 | 42 |  if (!defined('AUTOPTIMIZE_CACHEFILE_PREFIX')) { define('AUTOPTIMIZE_CACHEFILE_PREFIX', 'autoptimize_'); } | 
                                                        
| 43 | 43 | |
| 44 | 44 | // Plugin dir constants (plugin url's defined later to accomodate domain mapped sites)  | 
                                                        
| 45 | -if (is_multisite() && apply_filters( 'autoptimize_separate_blog_caches' , true )) { | 
                                                        |
| 45 | +if (is_multisite() && apply_filters('autoptimize_separate_blog_caches', true)) { | 
                                                        |
| 46 | 46 | $blog_id = get_current_blog_id();  | 
                                                        
| 47 | -    define('AUTOPTIMIZE_CACHE_DIR', WP_CONTENT_DIR.AUTOPTIMIZE_CACHE_CHILD_DIR.$blog_id.'/' ); | 
                                                        |
| 47 | +    define('AUTOPTIMIZE_CACHE_DIR', WP_CONTENT_DIR.AUTOPTIMIZE_CACHE_CHILD_DIR.$blog_id.'/'); | 
                                                        |
| 48 | 48 |  } else { | 
                                                        
| 49 | 49 |      define('AUTOPTIMIZE_CACHE_DIR', WP_CONTENT_DIR.AUTOPTIMIZE_CACHE_CHILD_DIR); | 
                                                        
| 50 | 50 | }  | 
                                                        
| 51 | -define('AUTOPTIMIZE_CACHE_DELAY',true); | 
                                                        |
| 52 | -define('WP_ROOT_DIR',str_replace(AUTOPTIMIZE_WP_CONTENT_NAME,'',WP_CONTENT_DIR)); | 
                                                        |
| 51 | +define('AUTOPTIMIZE_CACHE_DELAY', true); | 
                                                        |
| 52 | +define('WP_ROOT_DIR', str_replace(AUTOPTIMIZE_WP_CONTENT_NAME, '', WP_CONTENT_DIR)); | 
                                                        |
| 53 | 53 | |
| 54 | 54 | // Initialize the cache at least once  | 
                                                        
| 55 | 55 | $conf = autoptimizeConfig::instance();  | 
                                                        
@@ -57,65 +57,65 @@ discard block  | 
                                                    ||
| 57 | 57 | /* Check if we're updating, in which case we might need to do stuff and flush the cache  | 
                                                        
| 58 | 58 | to avoid old versions of aggregated files lingering around */  | 
                                                        
| 59 | 59 | |
| 60 | -$autoptimize_version="2.1.0";  | 
                                                        |
| 61 | -$autoptimize_db_version=get_option('autoptimize_version','none'); | 
                                                        |
| 60 | +$autoptimize_version = "2.1.0";  | 
                                                        |
| 61 | +$autoptimize_db_version = get_option('autoptimize_version', 'none'); | 
                                                        |
| 62 | 62 | |
| 63 | 63 |  if ($autoptimize_db_version !== $autoptimize_version) { | 
                                                        
| 64 | -    if ($autoptimize_db_version==="none") { | 
                                                        |
| 64 | +    if ($autoptimize_db_version === "none") { | 
                                                        |
| 65 | 65 |          add_action('admin_notices', 'autoptimize_install_config_notice'); | 
                                                        
| 66 | 66 |      } else { | 
                                                        
| 67 | 67 | // updating, include the update-code  | 
                                                        
| 68 | 68 | include(AUTOPTIMIZE_PLUGIN_DIR.'classlesses/autoptimizeUpdateCode.php');  | 
                                                        
| 69 | 69 | }  | 
                                                        
| 70 | 70 | |
| 71 | -    update_option('autoptimize_version',$autoptimize_version); | 
                                                        |
| 72 | - $autoptimize_db_version=$autoptimize_version;  | 
                                                        |
| 71 | +    update_option('autoptimize_version', $autoptimize_version); | 
                                                        |
| 72 | + $autoptimize_db_version = $autoptimize_version;  | 
                                                        |
| 73 | 73 | }  | 
                                                        
| 74 | 74 | |
| 75 | 75 | // Load translations  | 
                                                        
| 76 | 76 |  function autoptimize_load_plugin_textdomain() { | 
                                                        
| 77 | -    load_plugin_textdomain('autoptimize',false,plugin_basename(dirname( __FILE__ )).'/localization'); | 
                                                        |
| 77 | +    load_plugin_textdomain('autoptimize', false, plugin_basename(dirname(__FILE__)).'/localization'); | 
                                                        |
| 78 | 78 | }  | 
                                                        
| 79 | -add_action( 'init', 'autoptimize_load_plugin_textdomain' );  | 
                                                        |
| 79 | +add_action('init', 'autoptimize_load_plugin_textdomain'); | 
                                                        |
| 80 | 80 | |
| 81 | -function autoptimize_uninstall(){ | 
                                                        |
| 81 | +function autoptimize_uninstall() { | 
                                                        |
| 82 | 82 | autoptimizeCache::clearall();  | 
                                                        
| 83 | 83 | |
| 84 | -    $delete_options=array("autoptimize_cache_clean", "autoptimize_cache_nogzip", "autoptimize_css", "autoptimize_css_datauris", "autoptimize_css_justhead", "autoptimize_css_defer", "autoptimize_css_defer_inline", "autoptimize_css_inline", "autoptimize_css_exclude", "autoptimize_html", "autoptimize_html_keepcomments", "autoptimize_js", "autoptimize_js_exclude", "autoptimize_js_forcehead", "autoptimize_js_justhead", "autoptimize_js_trycatch", "autoptimize_version", "autoptimize_show_adv", "autoptimize_cdn_url", "autoptimize_cachesize_notice","autoptimize_css_include_inline","autoptimize_js_include_inline","autoptimize_css_nogooglefont","autoptimize_optimize_logged"); | 
                                                        |
| 84 | +    $delete_options = array("autoptimize_cache_clean", "autoptimize_cache_nogzip", "autoptimize_css", "autoptimize_css_datauris", "autoptimize_css_justhead", "autoptimize_css_defer", "autoptimize_css_defer_inline", "autoptimize_css_inline", "autoptimize_css_exclude", "autoptimize_html", "autoptimize_html_keepcomments", "autoptimize_js", "autoptimize_js_exclude", "autoptimize_js_forcehead", "autoptimize_js_justhead", "autoptimize_js_trycatch", "autoptimize_version", "autoptimize_show_adv", "autoptimize_cdn_url", "autoptimize_cachesize_notice", "autoptimize_css_include_inline", "autoptimize_js_include_inline", "autoptimize_css_nogooglefont", "autoptimize_optimize_logged"); | 
                                                        |
| 85 | 85 | |
| 86 | -    if ( !is_multisite() ) { | 
                                                        |
| 87 | -        foreach ($delete_options as $del_opt) {    delete_option( $del_opt ); } | 
                                                        |
| 86 | +    if (!is_multisite()) { | 
                                                        |
| 87 | +        foreach ($delete_options as $del_opt) {    delete_option($del_opt); } | 
                                                        |
| 88 | 88 |      } else { | 
                                                        
| 89 | 89 | global $wpdb;  | 
                                                        
| 90 | - $blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );  | 
                                                        |
| 90 | +        $blog_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs"); | 
                                                        |
| 91 | 91 | $original_blog_id = get_current_blog_id();  | 
                                                        
| 92 | -        foreach ( $blog_ids as $blog_id ) { | 
                                                        |
| 93 | - switch_to_blog( $blog_id );  | 
                                                        |
| 94 | -            foreach ($delete_options as $del_opt) {    delete_option( $del_opt ); } | 
                                                        |
| 92 | +        foreach ($blog_ids as $blog_id) { | 
                                                        |
| 93 | + switch_to_blog($blog_id);  | 
                                                        |
| 94 | +            foreach ($delete_options as $del_opt) {    delete_option($del_opt); } | 
                                                        |
| 95 | 95 | }  | 
                                                        
| 96 | - switch_to_blog( $original_blog_id );  | 
                                                        |
| 96 | + switch_to_blog($original_blog_id);  | 
                                                        |
| 97 | 97 | }  | 
                                                        
| 98 | 98 | |
| 99 | -    if ( wp_get_schedule( 'ao_cachechecker' ) ) { | 
                                                        |
| 100 | - wp_clear_scheduled_hook( 'ao_cachechecker' );  | 
                                                        |
| 99 | +    if (wp_get_schedule('ao_cachechecker')) { | 
                                                        |
| 100 | +        wp_clear_scheduled_hook('ao_cachechecker'); | 
                                                        |
| 101 | 101 | }  | 
                                                        
| 102 | 102 | }  | 
                                                        
| 103 | 103 | |
| 104 | 104 |  function autoptimize_install_config_notice() { | 
                                                        
| 105 | 105 | echo '<div class="updated"><p>';  | 
                                                        
| 106 | -    _e('Thank you for installing and activating Autoptimize. Please configure it under "Settings" -> "Autoptimize" to start improving your site\'s performance.', 'autoptimize' ); | 
                                                        |
| 106 | +    _e('Thank you for installing and activating Autoptimize. Please configure it under "Settings" -> "Autoptimize" to start improving your site\'s performance.', 'autoptimize'); | 
                                                        |
| 107 | 107 | echo '</p></div>';  | 
                                                        
| 108 | 108 | }  | 
                                                        
| 109 | 109 | |
| 110 | 110 |  function autoptimize_update_config_notice() { | 
                                                        
| 111 | 111 | echo '<div class="updated"><p>';  | 
                                                        
| 112 | -    _e('Autoptimize has just been updated. Please <strong>test your site now</strong> and adapt Autoptimize config if needed.', 'autoptimize' ); | 
                                                        |
| 112 | +    _e('Autoptimize has just been updated. Please <strong>test your site now</strong> and adapt Autoptimize config if needed.', 'autoptimize'); | 
                                                        |
| 113 | 113 | echo '</p></div>';  | 
                                                        
| 114 | 114 | }  | 
                                                        
| 115 | 115 | |
| 116 | 116 |  function autoptimize_cache_unavailable_notice() { | 
                                                        
| 117 | 117 | echo '<div class="error"><p>';  | 
                                                        
| 118 | - printf( __( 'Autoptimize cannot write to the cache directory (%s), please fix to enable CSS/ JS optimization!', 'autoptimize' ), AUTOPTIMIZE_CACHE_DIR );  | 
                                                        |
| 118 | +    printf(__('Autoptimize cannot write to the cache directory (%s), please fix to enable CSS/ JS optimization!', 'autoptimize'), AUTOPTIMIZE_CACHE_DIR); | 
                                                        |
| 119 | 119 | echo '</p></div>';  | 
                                                        
| 120 | 120 | }  | 
                                                        
| 121 | 121 | |
@@ -124,26 +124,26 @@ discard block  | 
                                                    ||
| 124 | 124 | $ao_noptimize = false;  | 
                                                        
| 125 | 125 | |
| 126 | 126 | // noptimize in qs to get non-optimized page for debugging  | 
                                                        
| 127 | -    if (array_key_exists("ao_noptimize",$_GET)) { | 
                                                        |
| 128 | -        if ( ($_GET["ao_noptimize"]==="1") && (apply_filters('autoptimize_filter_honor_qs_noptimize',true)) ) { | 
                                                        |
| 127 | +    if (array_key_exists("ao_noptimize", $_GET)) { | 
                                                        |
| 128 | +        if (($_GET["ao_noptimize"] === "1") && (apply_filters('autoptimize_filter_honor_qs_noptimize', true))) { | 
                                                        |
| 129 | 129 | $ao_noptimize = true;  | 
                                                        
| 130 | 130 | }  | 
                                                        
| 131 | 131 | }  | 
                                                        
| 132 | 132 | |
| 133 | 133 | // check for DONOTMINIFY constant as used by e.g. WooCommerce POS  | 
                                                        
| 134 | -    if (defined('DONOTMINIFY') && (constant('DONOTMINIFY')===true || constant('DONOTMINIFY')==="true")) { | 
                                                        |
| 134 | +    if (defined('DONOTMINIFY') && (constant('DONOTMINIFY') === true || constant('DONOTMINIFY') === "true")) { | 
                                                        |
| 135 | 135 | $ao_noptimize = true;  | 
                                                        
| 136 | 136 | }  | 
                                                        
| 137 | 137 | |
| 138 | 138 | // if setting says not to optimize logged in user and user is logged in  | 
                                                        
| 139 | -	if (get_option('autoptimize_optimize_logged','on') !== 'on' && is_user_logged_in()) { | 
                                                        |
| 139 | +	if (get_option('autoptimize_optimize_logged', 'on') !== 'on' && is_user_logged_in()) { | 
                                                        |
| 140 | 140 | $ao_noptimize = true;  | 
                                                        
| 141 | 141 | }  | 
                                                        
| 142 | 142 | |
| 143 | 143 | // filter you can use to block autoptimization on your own terms  | 
                                                        
| 144 | - $ao_noptimize = (bool) apply_filters( 'autoptimize_filter_noptimize', $ao_noptimize );  | 
                                                        |
| 144 | +    $ao_noptimize = (bool) apply_filters('autoptimize_filter_noptimize', $ao_noptimize); | 
                                                        |
| 145 | 145 | |
| 146 | -    if (!is_feed() && !$ao_noptimize && !is_admin() && ( !function_exists('is_customize_preview') || !is_customize_preview() ) ) { | 
                                                        |
| 146 | +    if (!is_feed() && !$ao_noptimize && !is_admin() && (!function_exists('is_customize_preview') || !is_customize_preview())) { | 
                                                        |
| 147 | 147 | // Config element  | 
                                                        
| 148 | 148 | $conf = autoptimizeConfig::instance();  | 
                                                        
| 149 | 149 | |
@@ -151,7 +151,7 @@ discard block  | 
                                                    ||
| 151 | 151 | include(AUTOPTIMIZE_PLUGIN_DIR.'classes/autoptimizeBase.php');  | 
                                                        
| 152 | 152 | |
| 153 | 153 | // Load extra classes and set some vars  | 
                                                        
| 154 | -        if($conf->get('autoptimize_html')) { | 
                                                        |
| 154 | +        if ($conf->get('autoptimize_html')) { | 
                                                        |
| 155 | 155 | include(AUTOPTIMIZE_PLUGIN_DIR.'classes/autoptimizeHTML.php');  | 
                                                        
| 156 | 156 | // BUG: new minify-html does not support keeping HTML comments, skipping for now  | 
                                                        
| 157 | 157 |              // if (defined('AUTOPTIMIZE_LEGACY_MINIFIERS')) { | 
                                                        
@@ -161,7 +161,7 @@ discard block  | 
                                                    ||
| 161 | 161 | // }  | 
                                                        
| 162 | 162 | }  | 
                                                        
| 163 | 163 | |
| 164 | -        if($conf->get('autoptimize_js')) { | 
                                                        |
| 164 | +        if ($conf->get('autoptimize_js')) { | 
                                                        |
| 165 | 165 | include(AUTOPTIMIZE_PLUGIN_DIR.'classes/autoptimizeScripts.php');  | 
                                                        
| 166 | 166 |              if (!class_exists('JSMin')) { | 
                                                        
| 167 | 167 |                  if (defined('AUTOPTIMIZE_LEGACY_MINIFIERS')) { | 
                                                        
@@ -170,15 +170,15 @@ discard block  | 
                                                    ||
| 170 | 170 | @include(AUTOPTIMIZE_PLUGIN_DIR.'classes/external/php/minify-2.3.1-jsmin.php');  | 
                                                        
| 171 | 171 | }  | 
                                                        
| 172 | 172 | }  | 
                                                        
| 173 | -            if ( ! defined( 'CONCATENATE_SCRIPTS' )) { | 
                                                        |
| 174 | -                define('CONCATENATE_SCRIPTS',false); | 
                                                        |
| 173 | +            if (!defined('CONCATENATE_SCRIPTS')) { | 
                                                        |
| 174 | +                define('CONCATENATE_SCRIPTS', false); | 
                                                        |
| 175 | 175 | }  | 
                                                        
| 176 | -            if ( ! defined( 'COMPRESS_SCRIPTS' )) { | 
                                                        |
| 177 | -                define('COMPRESS_SCRIPTS',false); | 
                                                        |
| 176 | +            if (!defined('COMPRESS_SCRIPTS')) { | 
                                                        |
| 177 | +                define('COMPRESS_SCRIPTS', false); | 
                                                        |
| 178 | 178 | }  | 
                                                        
| 179 | 179 | }  | 
                                                        
| 180 | 180 | |
| 181 | -        if($conf->get('autoptimize_css')) { | 
                                                        |
| 181 | +        if ($conf->get('autoptimize_css')) { | 
                                                        |
| 182 | 182 | include(AUTOPTIMIZE_PLUGIN_DIR.'classes/autoptimizeStyles.php');  | 
                                                        
| 183 | 183 |              if (defined('AUTOPTIMIZE_LEGACY_MINIFIERS')) { | 
                                                        
| 184 | 184 |                  if (!class_exists('Minify_CSS_Compressor')) { | 
                                                        
@@ -189,13 +189,13 @@ discard block  | 
                                                    ||
| 189 | 189 | @include(AUTOPTIMIZE_PLUGIN_DIR.'classes/external/php/yui-php-cssmin-2.4.8-p10/cssmin.php');  | 
                                                        
| 190 | 190 | }  | 
                                                        
| 191 | 191 | }  | 
                                                        
| 192 | -            if ( ! defined( 'COMPRESS_CSS' )) { | 
                                                        |
| 193 | -                define('COMPRESS_CSS',false); | 
                                                        |
| 192 | +            if (!defined('COMPRESS_CSS')) { | 
                                                        |
| 193 | +                define('COMPRESS_CSS', false); | 
                                                        |
| 194 | 194 | }  | 
                                                        
| 195 | 195 | }  | 
                                                        
| 196 | 196 | |
| 197 | 197 | // filter to be used with care, kills all output buffers when true. use with extreme caution. you have been warned!  | 
                                                        
| 198 | -        if (apply_filters('autoptimize_filter_obkiller',false)) { | 
                                                        |
| 198 | +        if (apply_filters('autoptimize_filter_obkiller', false)) { | 
                                                        |
| 199 | 199 |              while (ob_get_level() > 0) { | 
                                                        
| 200 | 200 | ob_end_clean();  | 
                                                        
| 201 | 201 | }  | 
                                                        
@@ -207,35 +207,35 @@ discard block  | 
                                                    ||
| 207 | 207 | |
| 208 | 208 | // Action on end, this is where the magic happens  | 
                                                        
| 209 | 209 |  function autoptimize_end_buffering($content) { | 
                                                        
| 210 | -    if ( ((stripos($content,"<html") === false) && (stripos($content,"<!DOCTYPE html") === false)) || preg_match('/<html[^>]*(?:amp|⚡)/',$content) === 1 || stripos($content,"<xsl:stylesheet") !== false ) { return $content; } | 
                                                        |
| 210 | +    if (((stripos($content, "<html") === false) && (stripos($content, "<!DOCTYPE html") === false)) || preg_match('/<html[^>]*(?:amp|⚡)/', $content) === 1 || stripos($content, "<xsl:stylesheet") !== false) { return $content; } | 
                                                        |
| 211 | 211 | |
| 212 | 212 | // load URL constants as late as possible to allow domain mapper to kick in  | 
                                                        
| 213 | 213 |      if (function_exists("domain_mapping_siteurl")) { | 
                                                        
| 214 | -        define('AUTOPTIMIZE_WP_SITE_URL',domain_mapping_siteurl(get_current_blog_id())); | 
                                                        |
| 215 | -        define('AUTOPTIMIZE_WP_CONTENT_URL',str_replace(get_original_url(AUTOPTIMIZE_WP_SITE_URL),AUTOPTIMIZE_WP_SITE_URL,content_url())); | 
                                                        |
| 214 | +        define('AUTOPTIMIZE_WP_SITE_URL', domain_mapping_siteurl(get_current_blog_id())); | 
                                                        |
| 215 | +        define('AUTOPTIMIZE_WP_CONTENT_URL', str_replace(get_original_url(AUTOPTIMIZE_WP_SITE_URL), AUTOPTIMIZE_WP_SITE_URL, content_url())); | 
                                                        |
| 216 | 216 |      } else { | 
                                                        
| 217 | -        define('AUTOPTIMIZE_WP_SITE_URL',site_url()); | 
                                                        |
| 218 | -        define('AUTOPTIMIZE_WP_CONTENT_URL',content_url()); | 
                                                        |
| 217 | +        define('AUTOPTIMIZE_WP_SITE_URL', site_url()); | 
                                                        |
| 218 | +        define('AUTOPTIMIZE_WP_CONTENT_URL', content_url()); | 
                                                        |
| 219 | 219 | }  | 
                                                        
| 220 | 220 | |
| 221 | -    if ( is_multisite() && apply_filters( 'autoptimize_separate_blog_caches' , true ) ) { | 
                                                        |
| 221 | +    if (is_multisite() && apply_filters('autoptimize_separate_blog_caches', true)) { | 
                                                        |
| 222 | 222 | $blog_id = get_current_blog_id();  | 
                                                        
| 223 | -        define('AUTOPTIMIZE_CACHE_URL',AUTOPTIMIZE_WP_CONTENT_URL.AUTOPTIMIZE_CACHE_CHILD_DIR.$blog_id.'/' ); | 
                                                        |
| 223 | +        define('AUTOPTIMIZE_CACHE_URL', AUTOPTIMIZE_WP_CONTENT_URL.AUTOPTIMIZE_CACHE_CHILD_DIR.$blog_id.'/'); | 
                                                        |
| 224 | 224 |      } else { | 
                                                        
| 225 | -        define('AUTOPTIMIZE_CACHE_URL',AUTOPTIMIZE_WP_CONTENT_URL.AUTOPTIMIZE_CACHE_CHILD_DIR); | 
                                                        |
| 225 | +        define('AUTOPTIMIZE_CACHE_URL', AUTOPTIMIZE_WP_CONTENT_URL.AUTOPTIMIZE_CACHE_CHILD_DIR); | 
                                                        |
| 226 | 226 | }  | 
                                                        
| 227 | -    define('AUTOPTIMIZE_WP_ROOT_URL',str_replace(AUTOPTIMIZE_WP_CONTENT_NAME,'',AUTOPTIMIZE_WP_CONTENT_URL)); | 
                                                        |
| 227 | +    define('AUTOPTIMIZE_WP_ROOT_URL', str_replace(AUTOPTIMIZE_WP_CONTENT_NAME, '', AUTOPTIMIZE_WP_CONTENT_URL)); | 
                                                        |
| 228 | 228 | |
| 229 | 229 | // Config element  | 
                                                        
| 230 | 230 | $conf = autoptimizeConfig::instance();  | 
                                                        
| 231 | 231 | |
| 232 | 232 | // Choose the classes  | 
                                                        
| 233 | 233 | $classes = array();  | 
                                                        
| 234 | -    if($conf->get('autoptimize_js')) | 
                                                        |
| 234 | +    if ($conf->get('autoptimize_js')) | 
                                                        |
| 235 | 235 | $classes[] = 'autoptimizeScripts';  | 
                                                        
| 236 | -    if($conf->get('autoptimize_css')) | 
                                                        |
| 236 | +    if ($conf->get('autoptimize_css')) | 
                                                        |
| 237 | 237 | $classes[] = 'autoptimizeStyles';  | 
                                                        
| 238 | -    if($conf->get('autoptimize_html')) | 
                                                        |
| 238 | +    if ($conf->get('autoptimize_html')) | 
                                                        |
| 239 | 239 | $classes[] = 'autoptimizeHTML';  | 
                                                        
| 240 | 240 | |
| 241 | 241 | // Set some options  | 
                                                        
@@ -264,12 +264,12 @@ discard block  | 
                                                    ||
| 264 | 264 | )  | 
                                                        
| 265 | 265 | );  | 
                                                        
| 266 | 266 | |
| 267 | - $content = apply_filters( 'autoptimize_filter_html_before_minify', $content );  | 
                                                        |
| 267 | +    $content = apply_filters('autoptimize_filter_html_before_minify', $content); | 
                                                        |
| 268 | 268 | |
| 269 | 269 | // Run the classes  | 
                                                        
| 270 | -    foreach($classes as $name) { | 
                                                        |
| 270 | +    foreach ($classes as $name) { | 
                                                        |
| 271 | 271 | $instance = new $name($content);  | 
                                                        
| 272 | -        if($instance->read($classoptions[$name])) { | 
                                                        |
| 272 | +        if ($instance->read($classoptions[$name])) { | 
                                                        |
| 273 | 273 | $instance->minify();  | 
                                                        
| 274 | 274 | $instance->cache();  | 
                                                        
| 275 | 275 | $content = $instance->getcontent();  | 
                                                        
@@ -277,19 +277,19 @@ discard block  | 
                                                    ||
| 277 | 277 | unset($instance);  | 
                                                        
| 278 | 278 | }  | 
                                                        
| 279 | 279 | |
| 280 | - $content = apply_filters( 'autoptimize_html_after_minify', $content );  | 
                                                        |
| 280 | +    $content = apply_filters('autoptimize_html_after_minify', $content); | 
                                                        |
| 281 | 281 | return $content;  | 
                                                        
| 282 | 282 | }  | 
                                                        
| 283 | 283 | |
| 284 | -if ( autoptimizeCache::cacheavail() ) { | 
                                                        |
| 284 | +if (autoptimizeCache::cacheavail()) { | 
                                                        |
| 285 | 285 | $conf = autoptimizeConfig::instance();  | 
                                                        
| 286 | -    if( $conf->get('autoptimize_html') || $conf->get('autoptimize_js') || $conf->get('autoptimize_css') ) { | 
                                                        |
| 286 | +    if ($conf->get('autoptimize_html') || $conf->get('autoptimize_js') || $conf->get('autoptimize_css')) { | 
                                                        |
| 287 | 287 | // Hook to wordpress  | 
                                                        
| 288 | 288 |          if (defined('AUTOPTIMIZE_INIT_EARLIER')) { | 
                                                        
| 289 | -            add_action('init','autoptimize_start_buffering',-1); | 
                                                        |
| 289 | +            add_action('init', 'autoptimize_start_buffering', -1); | 
                                                        |
| 290 | 290 |          } else { | 
                                                        
| 291 | 291 |              if (!defined('AUTOPTIMIZE_HOOK_INTO')) { define('AUTOPTIMIZE_HOOK_INTO', 'template_redirect'); } | 
                                                        
| 292 | -            add_action(constant("AUTOPTIMIZE_HOOK_INTO"),'autoptimize_start_buffering',2); | 
                                                        |
| 292 | +            add_action(constant("AUTOPTIMIZE_HOOK_INTO"), 'autoptimize_start_buffering', 2); | 
                                                        |
| 293 | 293 | }  | 
                                                        
| 294 | 294 | }  | 
                                                        
| 295 | 295 |  } else { | 
                                                        
@@ -297,9 +297,9 @@ discard block  | 
                                                    ||
| 297 | 297 | }  | 
                                                        
| 298 | 298 | |
| 299 | 299 |  function autoptimize_activate() { | 
                                                        
| 300 | - register_uninstall_hook( __FILE__, 'autoptimize_uninstall' );  | 
                                                        |
| 300 | + register_uninstall_hook(__FILE__, 'autoptimize_uninstall');  | 
                                                        |
| 301 | 301 | }  | 
                                                        
| 302 | -register_activation_hook( __FILE__, 'autoptimize_activate' );  | 
                                                        |
| 302 | +register_activation_hook(__FILE__, 'autoptimize_activate');  | 
                                                        |
| 303 | 303 | |
| 304 | 304 |  include_once('classlesses/autoptimizeCacheChecker.php'); | 
                                                        
| 305 | 305 | |