Completed
Pull Request — master (#254)
by
unknown
01:50
created
config/default.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php exit;
2 2
 
3 3
 //Check everything exists before using it
4
-if(!isset($_SERVER['HTTP_ACCEPT_ENCODING']))
4
+if (!isset($_SERVER['HTTP_ACCEPT_ENCODING']))
5 5
 	$_SERVER['HTTP_ACCEPT_ENCODING'] = '';
6
-if(!isset($_SERVER['HTTP_USER_AGENT']))
6
+if (!isset($_SERVER['HTTP_USER_AGENT']))
7 7
 	$_SERVER['HTTP_USER_AGENT'] = '';
8 8
 
9 9
 // Determine supported compression method
@@ -27,16 +27,16 @@  discard block
 block discarded – undo
27 27
 }
28 28
 
29 29
 //Some servers compress the output of PHP - Don't break in those cases
30
-if(ini_get('output_handler') == 'ob_gzhandler' || ini_get('zlib.output_compression') == 1)
30
+if (ini_get('output_handler') == 'ob_gzhandler' || ini_get('zlib.output_compression') == 1)
31 31
 	$encoding = 'none';
32 32
 
33 33
 $iscompressed = file_exists(__FILE__.'.'.$encoding);
34
-if($encoding != 'none' && $iscompressed == false)
34
+if ($encoding != 'none' && $iscompressed == false)
35 35
 {
36 36
 	$flag = ($encoding == 'gzip' ? FORCE_GZIP : FORCE_DEFLATE);
37 37
 	$code = file_get_contents(__FILE__.'.none');
38
-	$contents = gzencode($code,9,$flag);
39
-}else{
38
+	$contents = gzencode($code, 9, $flag);
39
+} else {
40 40
 	//Get data
41 41
 	$contents = file_get_contents(__FILE__.'.'.$encoding);
42 42
 }
@@ -44,19 +44,19 @@  discard block
 block discarded – undo
44 44
 // first check if we have to send 304
45 45
 // inspired by http://www.jonasjohn.de/snippets/php/caching.htm
46 46
 
47
-$eTag=md5($contents);
48
-$modTime=filemtime(__FILE__.'.none');
47
+$eTag = md5($contents);
48
+$modTime = filemtime(__FILE__.'.none');
49 49
 
50 50
 date_default_timezone_set("UTC");
51
-$eTagMatch = (isset($_SERVER['HTTP_IF_NONE_MATCH']) && strpos($_SERVER['HTTP_IF_NONE_MATCH'],$eTag));
51
+$eTagMatch = (isset($_SERVER['HTTP_IF_NONE_MATCH']) && strpos($_SERVER['HTTP_IF_NONE_MATCH'], $eTag));
52 52
 $modTimeMatch = (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) === $modTime);
53 53
 
54
-if (($modTimeMatch)||($eTagMatch)) {
54
+if (($modTimeMatch) || ($eTagMatch)) {
55 55
 	header('HTTP/1.1 304 Not Modified');
56 56
 	header('Connection: close');
57 57
 } else {
58 58
 	// send all sorts of headers
59
-	$expireTime=60*60*24*355; // 1y max according to RFC
59
+	$expireTime = 60*60*24*355; // 1y max according to RFC
60 60
 	if ($encoding != 'none') {
61 61
 		header('Content-Encoding: '.$encoding);
62 62
 	}
@@ -66,22 +66,22 @@  discard block
 block discarded – undo
66 66
 	header('Cache-Control: max-age='.$expireTime.', public, must-revalidate');
67 67
 	header('Cache-Control: max-age='.$expireTime.', public, immutable');
68 68
 	header('Expires: '.gmdate('D, d M Y H:i:s', time() + $expireTime).' GMT');
69
-	header('ETag: ' . $eTag);
69
+	header('ETag: '.$eTag);
70 70
 	header('Last-Modified: '.gmdate('D, d M Y H:i:s', $modTime).' GMT');
71 71
 
72 72
 	// send output
73 73
 	echo $contents;
74 74
 
75 75
 	//And write to filesystem cache if not done yet
76
-	if($encoding != 'none' && $iscompressed == false)
76
+	if ($encoding != 'none' && $iscompressed == false)
77 77
 	{
78 78
 		//Write the content we sent
79
-		file_put_contents(__FILE__.'.'.$encoding,$contents);
79
+		file_put_contents(__FILE__.'.'.$encoding, $contents);
80 80
 
81 81
 		//And write the new content
82 82
 		$flag = ($encoding == 'gzip' ? FORCE_DEFLATE : FORCE_GZIP);
83 83
 		$ext = ($encoding == 'gzip' ? 'deflate' : 'gzip');
84
-		$contents = gzencode($code,9,$flag);
85
-		file_put_contents(__FILE__.'.'.$ext,$contents);
84
+		$contents = gzencode($code, 9, $flag);
85
+		file_put_contents(__FILE__.'.'.$ext, $contents);
86 86
 	}
87 87
 }
Please login to merge, or discard this patch.
Braces   +14 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,10 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php exit;
2 2
 
3 3
 //Check everything exists before using it
4
-if(!isset($_SERVER['HTTP_ACCEPT_ENCODING']))
4
+if(!isset($_SERVER['HTTP_ACCEPT_ENCODING'])) {
5 5
 	$_SERVER['HTTP_ACCEPT_ENCODING'] = '';
6
-if(!isset($_SERVER['HTTP_USER_AGENT']))
6
+}
7
+if(!isset($_SERVER['HTTP_USER_AGENT'])) {
7 8
 	$_SERVER['HTTP_USER_AGENT'] = '';
9
+}
8 10
 
9 11
 // Determine supported compression method
10 12
 $gzip = strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip');
@@ -19,16 +21,19 @@  discard block
 block discarded – undo
19 21
 {
20 22
 	$version = floatval($matches[1]);
21 23
 
22
-	if ($version < 6)
23
-		$encoding = 'none';
24
+	if ($version < 6) {
25
+			$encoding = 'none';
26
+	}
24 27
 
25
-	if ($version == 6 && !strstr($_SERVER['HTTP_USER_AGENT'], 'EV1'))
26
-		$encoding = 'none';
27
-}
28
+	if ($version == 6 && !strstr($_SERVER['HTTP_USER_AGENT'], 'EV1')) {
29
+			$encoding = 'none';
30
+	}
31
+	}
28 32
 
29 33
 //Some servers compress the output of PHP - Don't break in those cases
30
-if(ini_get('output_handler') == 'ob_gzhandler' || ini_get('zlib.output_compression') == 1)
34
+if(ini_get('output_handler') == 'ob_gzhandler' || ini_get('zlib.output_compression') == 1) {
31 35
 	$encoding = 'none';
36
+}
32 37
 
33 38
 $iscompressed = file_exists(__FILE__.'.'.$encoding);
34 39
 if($encoding != 'none' && $iscompressed == false)
@@ -36,7 +41,7 @@  discard block
 block discarded – undo
36 41
 	$flag = ($encoding == 'gzip' ? FORCE_GZIP : FORCE_DEFLATE);
37 42
 	$code = file_get_contents(__FILE__.'.none');
38 43
 	$contents = gzencode($code,9,$flag);
39
-}else{
44
+} else{
40 45
 	//Get data
41 46
 	$contents = file_get_contents(__FILE__.'.'.$encoding);
42 47
 }
Please login to merge, or discard this patch.
classes/external/php/yui-php-cssmin-bundled/Utils.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -38,18 +38,18 @@  discard block
 block discarded – undo
38 38
         $l = floatval(str_replace('%', '', $hslValues[2]));
39 39
 
40 40
         // Wrap and clamp, then fraction!
41
-        $h = ((($h % 360) + 360) % 360) / 360;
42
-        $s = self::clampNumber($s, 0, 100) / 100;
43
-        $l = self::clampNumber($l, 0, 100) / 100;
41
+        $h = ((($h%360) + 360)%360)/360;
42
+        $s = self::clampNumber($s, 0, 100)/100;
43
+        $l = self::clampNumber($l, 0, 100)/100;
44 44
 
45 45
         if ($s == 0) {
46
-            $r = $g = $b = self::roundNumber(255 * $l);
46
+            $r = $g = $b = self::roundNumber(255*$l);
47 47
         } else {
48
-            $v2 = $l < 0.5 ? $l * (1 + $s) : ($l + $s) - ($s * $l);
49
-            $v1 = (2 * $l) - $v2;
50
-            $r = self::roundNumber(255 * self::hueToRgb($v1, $v2, $h + (1/3)));
51
-            $g = self::roundNumber(255 * self::hueToRgb($v1, $v2, $h));
52
-            $b = self::roundNumber(255 * self::hueToRgb($v1, $v2, $h - (1/3)));
48
+            $v2 = $l < 0.5 ? $l*(1 + $s) : ($l + $s) - ($s*$l);
49
+            $v1 = (2*$l) - $v2;
50
+            $r = self::roundNumber(255*self::hueToRgb($v1, $v2, $h + (1/3)));
51
+            $g = self::roundNumber(255*self::hueToRgb($v1, $v2, $h));
52
+            $b = self::roundNumber(255*self::hueToRgb($v1, $v2, $h - (1/3)));
53 53
         }
54 54
 
55 55
         return array($r, $g, $b);
@@ -66,16 +66,16 @@  discard block
 block discarded – undo
66 66
     {
67 67
         $vh = $vh < 0 ? $vh + 1 : ($vh > 1 ? $vh - 1 : $vh);
68 68
 
69
-        if ($vh * 6 < 1) {
70
-            return $v1 + ($v2 - $v1) * 6 * $vh;
69
+        if ($vh*6 < 1) {
70
+            return $v1 + ($v2 - $v1)*6*$vh;
71 71
         }
72 72
 
73
-        if ($vh * 2 < 1) {
73
+        if ($vh*2 < 1) {
74 74
             return $v2;
75 75
         }
76 76
 
77
-        if ($vh * 3 < 2) {
78
-            return $v1 + ($v2 - $v1) * ((2 / 3) - $vh) * 6;
77
+        if ($vh*3 < 2) {
78
+            return $v1 + ($v2 - $v1)*((2/3) - $vh)*6;
79 79
         }
80 80
 
81 81
         return $v1;
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
             switch ($letter) {
95 95
                 case 'M':
96 96
                 case 'm':
97
-                    return (int) $size * 1048576;
97
+                    return (int) $size*1048576;
98 98
                 case 'K':
99 99
                 case 'k':
100
-                    return (int) $size * 1024;
100
+                    return (int) $size*1024;
101 101
                 case 'G':
102 102
                 case 'g':
103
-                    return (int) $size * 1073741824;
103
+                    return (int) $size*1073741824;
104 104
             }
105 105
         }
106 106
         return (int) $size;
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     public static function rgbPercentageToRgbInteger($rgbPercentage)
115 115
     {
116 116
         if (strpos($rgbPercentage, '%') !== false) {
117
-            $rgbPercentage = self::roundNumber(floatval(str_replace('%', '', $rgbPercentage)) * 2.55);
117
+            $rgbPercentage = self::roundNumber(floatval(str_replace('%', '', $rgbPercentage))*2.55);
118 118
         }
119 119
 
120 120
         return intval($rgbPercentage, 10);
Please login to merge, or discard this patch.
classes/external/php/minify-html.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     {
71 71
         $this->_html = str_replace("\r\n", "\n", trim($html));
72 72
         if (isset($options['xhtml'])) {
73
-            $this->_isXhtml = (bool)$options['xhtml'];
73
+            $this->_isXhtml = (bool) $options['xhtml'];
74 74
         }
75 75
         if (isset($options['cssMinifier'])) {
76 76
             $this->_cssMinifier = $options['cssMinifier'];
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
             $this->_isXhtml = (false !== strpos($this->_html, '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML'));
96 96
         }
97 97
 
98
-        $this->_replacementHash = 'MINIFYHTML' . md5($_SERVER['REQUEST_TIME']);
98
+        $this->_replacementHash = 'MINIFYHTML'.md5($_SERVER['REQUEST_TIME']);
99 99
         $this->_placeholders = array();
100 100
 
101 101
         // replace SCRIPTs (and minify) with placeholders
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
             ,$this->_html);
112 112
 
113 113
         // remove HTML comments (not containing IE conditional comments).
114
-        if  ($this->_keepComments == false) {
114
+        if ($this->_keepComments == false) {
115 115
             $this->_html = preg_replace_callback(
116 116
                 '/<!--([\\s\\S]*?)-->/'
117 117
                 ,array($this, '_commentCB')
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 
174 174
     protected function _reservePlace($content)
175 175
     {
176
-        $placeholder = '%' . $this->_replacementHash . count($this->_placeholders) . '%';
176
+        $placeholder = '%'.$this->_replacementHash.count($this->_placeholders).'%';
177 177
         $this->_placeholders[$placeholder] = $content;
178 178
         return $placeholder;
179 179
     }
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 
188 188
     protected function _outsideTagCB($m)
189 189
     {
190
-        return '>' . preg_replace('/^\\s+|\\s+$/', ' ', $m[1]) . '<';
190
+        return '>'.preg_replace('/^\\s+|\\s+$/', ' ', $m[1]).'<';
191 191
     }
192 192
 
193 193
     protected function _removePreCB($m)
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
     protected function _removeCdata($str)
260 260
     {
261 261
         return (false !== strpos($str, '<![CDATA['))
262
-            ? str_replace(array('/* <![CDATA[ */','/* ]]> */','/*<![CDATA[*/','/*]]>*/','<![CDATA[', ']]>'), '', $str)
262
+            ? str_replace(array('/* <![CDATA[ */', '/* ]]> */', '/*<![CDATA[*/', '/*]]>*/', '<![CDATA[', ']]>'), '', $str)
263 263
             : $str;
264 264
     }
265 265
 
Please login to merge, or discard this patch.
classes/autoptimizeHTML.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Handles minifying HTML markup.
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if (!defined('ABSPATH')) {
7 7
     exit;
8 8
 }
9 9
 
@@ -27,19 +27,19 @@  discard block
 block discarded – undo
27 27
         '<!--/noindex-->',
28 28
     );
29 29
 
30
-    public function read( $options )
30
+    public function read($options)
31 31
     {
32 32
         // Remove the HTML comments?
33 33
         $this->keepcomments = (bool) $options['keepcomments'];
34 34
 
35 35
         // Filter to force xhtml.
36
-        $this->forcexhtml = (bool) apply_filters( 'autoptimize_filter_html_forcexhtml', false );
36
+        $this->forcexhtml = (bool) apply_filters('autoptimize_filter_html_forcexhtml', false);
37 37
 
38 38
         // Filterable strings to be excluded from HTML minification.
39
-        $exclude = apply_filters( 'autoptimize_filter_html_exclude', '' );
40
-        if ( '' !== $exclude ) {
41
-            $exclude_arr   = array_filter( array_map( 'trim', explode( ',', $exclude ) ) );
42
-            $this->exclude = array_merge( $exclude_arr, $this->exclude );
39
+        $exclude = apply_filters('autoptimize_filter_html_exclude', '');
40
+        if ('' !== $exclude) {
41
+            $exclude_arr   = array_filter(array_map('trim', explode(',', $exclude)));
42
+            $this->exclude = array_merge($exclude_arr, $this->exclude);
43 43
         }
44 44
 
45 45
         // Nothing else for HTML!
@@ -53,49 +53,49 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function minify()
55 55
     {
56
-        $noptimize = apply_filters( 'autoptimize_filter_html_noptimize', false, $this->content );
57
-        if ( $noptimize ) {
56
+        $noptimize = apply_filters('autoptimize_filter_html_noptimize', false, $this->content);
57
+        if ($noptimize) {
58 58
             return false;
59 59
         }
60 60
 
61 61
         // Wrap the to-be-excluded strings in noptimize tags.
62
-        foreach ( $this->exclude as $str ) {
63
-            if ( false !== strpos( $this->content, $str ) ) {
64
-                $replacement   = '<!--noptimize-->' . $str . '<!--/noptimize-->';
65
-                $this->content = str_replace( $str, $replacement, $this->content );
62
+        foreach ($this->exclude as $str) {
63
+            if (false !== strpos($this->content, $str)) {
64
+                $replacement   = '<!--noptimize-->'.$str.'<!--/noptimize-->';
65
+                $this->content = str_replace($str, $replacement, $this->content);
66 66
             }
67 67
         }
68 68
 
69 69
         // Noptimize.
70
-        $this->content = $this->hide_noptimize( $this->content );
70
+        $this->content = $this->hide_noptimize($this->content);
71 71
 
72 72
         // Preparing options for Minify_HTML.
73
-        $options = array( 'keepComments' => $this->keepcomments );
74
-        if ( $this->forcexhtml ) {
73
+        $options = array('keepComments' => $this->keepcomments);
74
+        if ($this->forcexhtml) {
75 75
             $options['xhtml'] = true;
76 76
         }
77 77
 
78
-        $tmp_content = Minify_HTML::minify( $this->content, $options );
79
-        if ( ! empty( $tmp_content ) ) {
78
+        $tmp_content = Minify_HTML::minify($this->content, $options);
79
+        if (!empty($tmp_content)) {
80 80
             $this->content = $tmp_content;
81
-            unset( $tmp_content );
81
+            unset($tmp_content);
82 82
         }
83 83
 
84 84
         // Restore noptimize.
85
-        $this->content = $this->restore_noptimize( $this->content );
85
+        $this->content = $this->restore_noptimize($this->content);
86 86
 
87 87
         // Remove the noptimize-wrapper from around the excluded strings.
88
-        foreach ( $this->exclude as $str ) {
89
-            $replacement = '<!--noptimize-->' . $str . '<!--/noptimize-->';
90
-            if ( false !== strpos( $this->content, $replacement ) ) {
91
-                $this->content = str_replace( $replacement, $str, $this->content );
88
+        foreach ($this->exclude as $str) {
89
+            $replacement = '<!--noptimize-->'.$str.'<!--/noptimize-->';
90
+            if (false !== strpos($this->content, $replacement)) {
91
+                $this->content = str_replace($replacement, $str, $this->content);
92 92
             }
93 93
         }
94 94
 
95 95
         // Revslider data attribs somehow suffer from HTML optimization, this fixes that!
96
-        if ( class_exists( 'RevSlider' ) && apply_filters( 'autoptimize_filter_html_dataattrib_cleanup', false ) ) {
97
-            $this->content = preg_replace( '#\n(data-.*$)\n#Um', ' $1 ', $this->content );
98
-            $this->content = preg_replace( '#<[^>]*(=\"[^"\'<>\s]*\")(\w)#', '$1 $2', $this->content );
96
+        if (class_exists('RevSlider') && apply_filters('autoptimize_filter_html_dataattrib_cleanup', false)) {
97
+            $this->content = preg_replace('#\n(data-.*$)\n#Um', ' $1 ', $this->content);
98
+            $this->content = preg_replace('#<[^>]*(=\"[^"\'<>\s]*\")(\w)#', '$1 $2', $this->content);
99 99
         }
100 100
 
101 101
         return true;
Please login to merge, or discard this patch.
classes/autoptimizeCLI.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@  discard block
 block discarded – undo
3 3
  * WP-CLI commands for Autoptimize.
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if (!defined('ABSPATH')) {
7 7
     exit;
8 8
 }
9 9
 
10 10
 // This is a WP-CLI command, so bail if it's not available.
11
-if ( ! defined( 'WP_CLI' ) ) {
11
+if (!defined('WP_CLI')) {
12 12
     return;
13 13
 }
14 14
 
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
      *
25 25
      * @return void
26 26
      */
27
-    public function clear( $args, $args_assoc ) {
28
-        WP_CLI::line( esc_html__( 'Flushing the cache...', 'autoptimize' ) );
27
+    public function clear($args, $args_assoc) {
28
+        WP_CLI::line(esc_html__('Flushing the cache...', 'autoptimize'));
29 29
         autoptimizeCache::clearall();
30
-        WP_CLI::success( esc_html__( 'Cache flushed.', 'autoptimize' ) );
30
+        WP_CLI::success(esc_html__('Cache flushed.', 'autoptimize'));
31 31
     }
32 32
 }
33 33
 
34
-WP_CLI::add_command( 'autoptimize', 'autoptimizeCLI' );
34
+WP_CLI::add_command('autoptimize', 'autoptimizeCLI');
Please login to merge, or discard this patch.
classes/autoptimizeCSSmin.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Thin wrapper around css minifiers to avoid rewriting a bunch of existing code.
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if (!defined('ABSPATH')) {
7 7
     exit;
8 8
 }
9 9
 
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
      *
22 22
      * @param bool $raise_limits Whether to raise memory limits or not. Default true.
23 23
      */
24
-    public function __construct( $raise_limits = true )
24
+    public function __construct($raise_limits = true)
25 25
     {
26
-        $this->minifier = new Autoptimize\tubalmartin\CssMin\Minifier( $raise_limits );
26
+        $this->minifier = new Autoptimize\tubalmartin\CssMin\Minifier($raise_limits);
27 27
     }
28 28
 
29 29
     /**
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
      *
35 35
      * @return string
36 36
      */
37
-    public function run( $css )
37
+    public function run($css)
38 38
     {
39
-        $result = $this->minifier->run( $css );
39
+        $result = $this->minifier->run($css);
40 40
 
41 41
         return $result;
42 42
     }
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
      *
49 49
      * @return string
50 50
      */
51
-    public static function minify( $css )
51
+    public static function minify($css)
52 52
     {
53 53
         $minifier = new self();
54 54
 
55
-        return $minifier->run( $css );
55
+        return $minifier->run($css);
56 56
     }
57 57
 }
Please login to merge, or discard this patch.
classes/autoptimizeSpeedupper.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  * new in Autoptimize 2.2
5 5
  */
6 6
 
7
-if ( ! defined( 'ABSPATH' ) ) {
7
+if (!defined('ABSPATH')) {
8 8
     exit;
9 9
 }
10 10
 
@@ -17,94 +17,94 @@  discard block
 block discarded – undo
17 17
 
18 18
     public function add_hooks()
19 19
     {
20
-        if ( apply_filters( 'autoptimize_js_do_minify', true ) ) {
21
-            add_filter( 'autoptimize_js_individual_script', array( $this, 'js_snippetcacher' ), 10, 2 );
22
-            add_filter( 'autoptimize_js_after_minify', array( $this, 'js_cleanup' ), 10, 1 );
20
+        if (apply_filters('autoptimize_js_do_minify', true)) {
21
+            add_filter('autoptimize_js_individual_script', array($this, 'js_snippetcacher'), 10, 2);
22
+            add_filter('autoptimize_js_after_minify', array($this, 'js_cleanup'), 10, 1);
23 23
         }
24
-        if ( apply_filters( 'autoptimize_css_do_minify', true ) ) {
25
-            add_filter( 'autoptimize_css_individual_style', array( $this, 'css_snippetcacher' ), 10, 2 );
26
-            add_filter( 'autoptimize_css_after_minify', array( $this, 'css_cleanup' ), 10, 1 );
24
+        if (apply_filters('autoptimize_css_do_minify', true)) {
25
+            add_filter('autoptimize_css_individual_style', array($this, 'css_snippetcacher'), 10, 2);
26
+            add_filter('autoptimize_css_after_minify', array($this, 'css_cleanup'), 10, 1);
27 27
         }
28 28
     }
29 29
 
30
-    public function js_snippetcacher( $jsin, $jsfilename )
30
+    public function js_snippetcacher($jsin, $jsfilename)
31 31
     {
32
-        $md5hash = 'snippet_' . md5( $jsin );
33
-        $ccheck  = new autoptimizeCache( $md5hash, 'js' );
34
-        if ( $ccheck->check() ) {
32
+        $md5hash = 'snippet_'.md5($jsin);
33
+        $ccheck  = new autoptimizeCache($md5hash, 'js');
34
+        if ($ccheck->check()) {
35 35
             $scriptsrc = $ccheck->retrieve();
36 36
         } else {
37
-            if ( false === ( strpos( $jsfilename, 'min.js' ) ) && ( false === strpos( $jsfilename, 'js/jquery/jquery.js' ) ) && ( str_replace( apply_filters( 'autoptimize_filter_js_consider_minified', false ), '', $jsfilename ) === $jsfilename ) ) {
38
-                $tmp_jscode = trim( JSMin::minify( $jsin ) );
39
-                if ( ! empty( $tmp_jscode ) ) {
37
+            if (false === (strpos($jsfilename, 'min.js')) && (false === strpos($jsfilename, 'js/jquery/jquery.js')) && (str_replace(apply_filters('autoptimize_filter_js_consider_minified', false), '', $jsfilename) === $jsfilename)) {
38
+                $tmp_jscode = trim(JSMin::minify($jsin));
39
+                if (!empty($tmp_jscode)) {
40 40
                     $scriptsrc = $tmp_jscode;
41
-                    unset( $tmp_jscode );
41
+                    unset($tmp_jscode);
42 42
                 } else {
43 43
                     $scriptsrc = $jsin;
44 44
                 }
45 45
             } else {
46 46
                 // Removing comments, linebreaks and stuff!
47
-                $scriptsrc = preg_replace( '#^\s*\/\/.*$#Um', '', $jsin );
48
-                $scriptsrc = preg_replace( '#^\s*\/\*[^!].*\*\/\s?#Us', '', $scriptsrc );
49
-                $scriptsrc = preg_replace( "#(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+#", "\n", $scriptsrc );
47
+                $scriptsrc = preg_replace('#^\s*\/\/.*$#Um', '', $jsin);
48
+                $scriptsrc = preg_replace('#^\s*\/\*[^!].*\*\/\s?#Us', '', $scriptsrc);
49
+                $scriptsrc = preg_replace("#(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+#", "\n", $scriptsrc);
50 50
             }
51 51
 
52
-            $last_char = substr( $scriptsrc, -1, 1 );
53
-            if ( ';' !== $last_char && '}' !== $last_char ) {
52
+            $last_char = substr($scriptsrc, -1, 1);
53
+            if (';' !== $last_char && '}' !== $last_char) {
54 54
                 $scriptsrc .= ';';
55 55
             }
56 56
 
57
-            if ( ! empty( $jsfilename ) && str_replace( apply_filters( 'autoptimize_filter_js_speedup_cache', false ), '', $jsfilename ) === $jsfilename ) {
57
+            if (!empty($jsfilename) && str_replace(apply_filters('autoptimize_filter_js_speedup_cache', false), '', $jsfilename) === $jsfilename) {
58 58
                 // Don't cache inline CSS or if filter says no!
59
-                $ccheck->cache( $scriptsrc, 'text/javascript' );
59
+                $ccheck->cache($scriptsrc, 'text/javascript');
60 60
             }
61 61
         }
62
-        unset( $ccheck );
62
+        unset($ccheck);
63 63
 
64 64
         return $scriptsrc;
65 65
     }
66 66
 
67
-    public function css_snippetcacher( $cssin, $cssfilename )
67
+    public function css_snippetcacher($cssin, $cssfilename)
68 68
     {
69
-        $md5hash = 'snippet_' . md5( $cssin );
70
-        $ccheck  = new autoptimizeCache( $md5hash, 'css' );
71
-        if ( $ccheck->check() ) {
69
+        $md5hash = 'snippet_'.md5($cssin);
70
+        $ccheck  = new autoptimizeCache($md5hash, 'css');
71
+        if ($ccheck->check()) {
72 72
             $stylesrc = $ccheck->retrieve();
73 73
         } else {
74
-            if ( ( false === strpos( $cssfilename, 'min.css' ) ) && ( str_replace( apply_filters( 'autoptimize_filter_css_consider_minified', false ), '', $cssfilename ) === $cssfilename ) ) {
74
+            if ((false === strpos($cssfilename, 'min.css')) && (str_replace(apply_filters('autoptimize_filter_css_consider_minified', false), '', $cssfilename) === $cssfilename)) {
75 75
                 $cssmin   = new autoptimizeCSSmin();
76
-                $tmp_code = trim( $cssmin->run( $cssin ) );
76
+                $tmp_code = trim($cssmin->run($cssin));
77 77
 
78
-                if ( ! empty( $tmp_code ) ) {
78
+                if (!empty($tmp_code)) {
79 79
                     $stylesrc = $tmp_code;
80
-                    unset( $tmp_code );
80
+                    unset($tmp_code);
81 81
                 } else {
82 82
                     $stylesrc = $cssin;
83 83
                 }
84 84
             } else {
85 85
                 // .min.css -> no heavy-lifting, just some cleanup!
86
-                $stylesrc = preg_replace( '#^\s*\/\*[^!].*\*\/\s?#Us', '', $cssin );
87
-                $stylesrc = preg_replace( "#(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+#", "\n", $stylesrc );
88
-                $stylesrc = autoptimizeStyles::fixurls( $cssfilename, $stylesrc );
86
+                $stylesrc = preg_replace('#^\s*\/\*[^!].*\*\/\s?#Us', '', $cssin);
87
+                $stylesrc = preg_replace("#(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+#", "\n", $stylesrc);
88
+                $stylesrc = autoptimizeStyles::fixurls($cssfilename, $stylesrc);
89 89
             }
90
-            if ( ! empty( $cssfilename ) && ( str_replace( apply_filters( 'autoptimize_filter_css_speedup_cache', false ), '', $cssfilename ) === $cssfilename ) ) {
90
+            if (!empty($cssfilename) && (str_replace(apply_filters('autoptimize_filter_css_speedup_cache', false), '', $cssfilename) === $cssfilename)) {
91 91
                 // Only caching CSS if it's not inline and is allowed by filter!
92
-                $ccheck->cache( $stylesrc, 'text/css' );
92
+                $ccheck->cache($stylesrc, 'text/css');
93 93
             }
94 94
         }
95
-        unset( $ccheck );
95
+        unset($ccheck);
96 96
 
97 97
         return $stylesrc;
98 98
     }
99 99
 
100
-    public function css_cleanup( $cssin )
100
+    public function css_cleanup($cssin)
101 101
     {
102 102
         // Speedupper results in aggregated CSS not being minified, so the filestart-marker AO adds when aggregating needs to be removed.
103
-        return trim( str_replace( array( '/*FILESTART*/', '/*FILESTART2*/' ), '', $cssin ) );
103
+        return trim(str_replace(array('/*FILESTART*/', '/*FILESTART2*/'), '', $cssin));
104 104
     }
105 105
 
106
-    public function js_cleanup( $jsin )
106
+    public function js_cleanup($jsin)
107 107
     {
108
-        return trim( $jsin );
108
+        return trim($jsin);
109 109
     }
110 110
 }
Please login to merge, or discard this patch.
classes/autoptimizeConfig.php 2 patches
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
2
+if ( ! defined( 'ABSPATH' ) ) {
3
+    exit;
4
+}
5
+// Exit if accessed directly.
3 6
 
4 7
 class autoptimizeConfig
5 8
 {
@@ -791,10 +794,13 @@  discard block
 block discarded – undo
791 794
             <ul>
792 795
                 <?php if ( $maxitems == 0 ) : ?>
793 796
                     <li><?php _e( 'No items', 'autoptimize' ); ?></li>
794
-                <?php else : ?>
797
+                <?php else {
798
+    : ?>
795 799
                     <?php foreach ( $rss_items as $item ) : ?>
796 800
                         <li>
797
-                            <a href="<?php echo esc_url( $item->get_permalink() ); ?>"
801
+                            <a href="<?php echo esc_url( $item->get_permalink() );
802
+}
803
+?>"
798 804
                                 title="<?php printf( __( 'Posted %s', 'autoptimize' ), $item->get_date('j F Y | g:i a') ); ?>">
799 805
                                 <?php echo esc_html( $item->get_title() ); ?>
800 806
                             </a>
Please login to merge, or discard this patch.
Spacing   +232 added lines, -232 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
2
+if (!defined('ABSPATH')) exit; // Exit if accessed directly.
3 3
 
4 4
 class autoptimizeConfig
5 5
 {
@@ -13,32 +13,32 @@  discard block
 block discarded – undo
13 13
      */
14 14
     private function __construct()
15 15
     {
16
-        if ( is_admin() ) {
16
+        if (is_admin()) {
17 17
             // Add the admin page and settings.
18
-			if ( is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) {
19
-				add_action( 'network_admin_menu', array( $this, 'addmenu' ) );
18
+			if (is_plugin_active_for_network('autoptimize/autoptimize.php')) {
19
+				add_action('network_admin_menu', array($this, 'addmenu'));
20 20
 			}
21 21
 
22
-			add_action( 'admin_menu', array( $this, 'addmenu' ) );
23
-            add_action( 'admin_init', array( $this, 'registersettings' ) );
22
+			add_action('admin_menu', array($this, 'addmenu'));
23
+            add_action('admin_init', array($this, 'registersettings'));
24 24
 
25 25
             // Set meta info.
26
-            if ( function_exists( 'plugin_row_meta' ) ) {
26
+            if (function_exists('plugin_row_meta')) {
27 27
                 // 2.8 and higher.
28
-                add_filter( 'plugin_row_meta', array( $this, 'setmeta' ), 10, 2 );
29
-            } elseif ( function_exists( 'post_class' ) ) {
28
+                add_filter('plugin_row_meta', array($this, 'setmeta'), 10, 2);
29
+            } elseif (function_exists('post_class')) {
30 30
                 // 2.7 and lower.
31
-                $plugin = plugin_basename( AUTOPTIMIZE_PLUGIN_DIR . 'autoptimize.php' );
32
-                add_filter( 'plugin_action_links_' . $plugin, array( $this, 'setmeta' ) );
31
+                $plugin = plugin_basename(AUTOPTIMIZE_PLUGIN_DIR.'autoptimize.php');
32
+                add_filter('plugin_action_links_'.$plugin, array($this, 'setmeta'));
33 33
             }
34 34
 
35 35
             // Clean cache?
36
-            if ( autoptimizeOption::get_option( 'autoptimize_cache_clean' ) ) {
36
+            if (autoptimizeOption::get_option('autoptimize_cache_clean')) {
37 37
                 autoptimizeCache::clearall();
38
-                autoptimizeOption::update_option( 'autoptimize_cache_clean', 0 );
38
+                autoptimizeOption::update_option('autoptimize_cache_clean', 0);
39 39
             }
40 40
 
41
-            $this->settings_screen_do_remote_http = apply_filters( 'autoptimize_settingsscreen_remotehttp', $this->settings_screen_do_remote_http );
41
+            $this->settings_screen_do_remote_http = apply_filters('autoptimize_settingsscreen_remotehttp', $this->settings_screen_do_remote_http);
42 42
         }
43 43
 
44 44
         // Adds the Autoptimize Toolbar to the Admin bar.
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     static public function instance()
53 53
     {
54 54
         // Only one instance.
55
-        if ( null === self::$instance ) {
55
+        if (null === self::$instance) {
56 56
             self::$instance = new autoptimizeConfig();
57 57
         }
58 58
 
@@ -185,28 +185,28 @@  discard block
 block discarded – undo
185 185
 
186 186
 <div class="wrap">
187 187
 
188
-<?php if ( version_compare( PHP_VERSION, '5.3.0' ) < 0 ) { ?>
189
-<div class="notice-error notice"><?php echo '<p>' . sprintf( __( '<strong>You are using a very old version of PHP</strong> (5.2.x or older) which has <a href=%s>serious security and performance issues</a>. Support for PHP 5.5 and below will be removed in one of the next AO released, please ask your hoster to provide you with an upgrade path to 7.x.', 'autoptimize' ), '"http://blog.futtta.be/2016/03/15/why-would-you-still-be-on-php-5-2/" target="_blank"' ) . '</p>'; ?></div>
188
+<?php if (version_compare(PHP_VERSION, '5.3.0') < 0) { ?>
189
+<div class="notice-error notice"><?php echo '<p>'.sprintf(__('<strong>You are using a very old version of PHP</strong> (5.2.x or older) which has <a href=%s>serious security and performance issues</a>. Support for PHP 5.5 and below will be removed in one of the next AO released, please ask your hoster to provide you with an upgrade path to 7.x.', 'autoptimize'), '"http://blog.futtta.be/2016/03/15/why-would-you-still-be-on-php-5-2/" target="_blank"').'</p>'; ?></div>
190 190
 <?php } ?>
191 191
 
192
-<?php if ( defined( 'AUTOPTIMIZE_LEGACY_MINIFIERS' ) ) { ?>
192
+<?php if (defined('AUTOPTIMIZE_LEGACY_MINIFIERS')) { ?>
193 193
     <div class="notice-error notice"><p>
194
-        <?php _e( "You are using the (no longer supported) AUTOPTIMIZE_LEGACY_MINIFIERS constant. Ensure your site is working properly and remove the constant, it doesn't do anything any more.", 'autoptimize' ); ?>
194
+        <?php _e("You are using the (no longer supported) AUTOPTIMIZE_LEGACY_MINIFIERS constant. Ensure your site is working properly and remove the constant, it doesn't do anything any more.", 'autoptimize'); ?>
195 195
     </p></div>
196 196
 <?php } ?>
197 197
 
198 198
 <div id="autoptimize_main">
199 199
     <div id="ao_title_and_button">
200
-        <h1 id="ao_title"><?php _e( 'Autoptimize Settings', 'autoptimize' ); ?>
200
+        <h1 id="ao_title"><?php _e('Autoptimize Settings', 'autoptimize'); ?>
201 201
         <span id="ao_adv_button">
202
-        <?php if ( autoptimizeOption::get_option( 'autoptimize_show_adv', '1' ) == '1' ) { ?>
203
-            <a href="javascript:void(0);" id="ao_show_adv" class="button" style="display:none;"><span><?php _e("Show advanced settings","autoptimize") ?></span></a>
204
-            <a href="javascript:void(0);" id="ao_hide_adv" class="button"><span><?php _e("Hide advanced settings","autoptimize") ?></span></a>
202
+        <?php if (autoptimizeOption::get_option('autoptimize_show_adv', '1') == '1') { ?>
203
+            <a href="javascript:void(0);" id="ao_show_adv" class="button" style="display:none;"><span><?php _e("Show advanced settings", "autoptimize") ?></span></a>
204
+            <a href="javascript:void(0);" id="ao_hide_adv" class="button"><span><?php _e("Hide advanced settings", "autoptimize") ?></span></a>
205 205
             <style>tr.ao_adv{display:table-row;} li.ao_adv{display:list-item;}</style>
206 206
             <?php $hiddenClass = ''; ?>
207 207
         <?php } else { ?>
208
-            <a href="javascript:void(0);" id="ao_show_adv" class="button"><span><?php _e("Show advanced settings","autoptimize") ?></span></a>
209
-            <a href="javascript:void(0);" id="ao_hide_adv" class="button" style="display:none;"><span><?php _e("Hide advanced settings","autoptimize") ?></span></a>
208
+            <a href="javascript:void(0);" id="ao_show_adv" class="button"><span><?php _e("Show advanced settings", "autoptimize") ?></span></a>
209
+            <a href="javascript:void(0);" id="ao_hide_adv" class="button" style="display:none;"><span><?php _e("Hide advanced settings", "autoptimize") ?></span></a>
210 210
             <?php $hiddenClass = 'hidden '; ?>
211 211
         <?php } ?>
212 212
         </span>
@@ -215,214 +215,214 @@  discard block
 block discarded – undo
215 215
 
216 216
     <?php echo $this->ao_admin_tabs(); ?>
217 217
 
218
-<form method="post" action="<?php echo admin_url( 'options.php' ); ?>">
219
-<?php settings_fields( 'autoptimize' ); ?>
218
+<form method="post" action="<?php echo admin_url('options.php'); ?>">
219
+<?php settings_fields('autoptimize'); ?>
220 220
 
221 221
 <ul>
222 222
 
223 223
 <?php
224 224
 // Only show enable site configuration in network site option.
225 225
 $blog_id = get_current_blog_id();
226
-if( is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) && 1 === $blog_id ) { 
226
+if (is_plugin_active_for_network('autoptimize/autoptimize.php') && 1 === $blog_id) { 
227 227
 ?>
228 228
 	<li class="itemDetail">
229
-	<h2 class="itemTitle"><?php _e('Multisite Options','autoptimize'); ?></h2>
229
+	<h2 class="itemTitle"><?php _e('Multisite Options', 'autoptimize'); ?></h2>
230 230
 	<table class="form-table">
231 231
 	<tr valign="top">
232
-	<th scope="row"><?php _e('Enable site configuration?','autoptimize'); ?></th>
233
-	<td><label class="cb_label"><input type="checkbox" id="autoptimize_enable_site_config" name="autoptimize_enable_site_config" <?php echo autoptimizeOption::get_option('autoptimize_enable_site_config')?'checked="checked" ':''; ?>/>
234
-	<?php _e('Enable Autoptimize configuration per site.','autoptimize'); ?></label></td>
232
+	<th scope="row"><?php _e('Enable site configuration?', 'autoptimize'); ?></th>
233
+	<td><label class="cb_label"><input type="checkbox" id="autoptimize_enable_site_config" name="autoptimize_enable_site_config" <?php echo autoptimizeOption::get_option('autoptimize_enable_site_config') ? 'checked="checked" ' : ''; ?>/>
234
+	<?php _e('Enable Autoptimize configuration per site.', 'autoptimize'); ?></label></td>
235 235
 	</tr>
236 236
 	</table>
237 237
 	</li>
238 238
 <?php } ?>
239 239
 
240 240
 <li class="itemDetail">
241
-<h2 class="itemTitle"><?php _e('JavaScript Options','autoptimize'); ?></h2>
241
+<h2 class="itemTitle"><?php _e('JavaScript Options', 'autoptimize'); ?></h2>
242 242
 <table class="form-table">
243 243
 <tr valign="top">
244
-<th scope="row"><?php _e('Optimize JavaScript Code?','autoptimize'); ?></th>
245
-<td><input type="checkbox" id="autoptimize_js" name="autoptimize_js" <?php echo autoptimizeOption::get_option('autoptimize_js')?'checked="checked" ':''; ?>/></td>
244
+<th scope="row"><?php _e('Optimize JavaScript Code?', 'autoptimize'); ?></th>
245
+<td><input type="checkbox" id="autoptimize_js" name="autoptimize_js" <?php echo autoptimizeOption::get_option('autoptimize_js') ? 'checked="checked" ' : ''; ?>/></td>
246 246
 </tr>
247
-<tr valign="top" class="<?php echo $hiddenClass;?>js_sub ao_adv">
248
-<th scope="row"><?php _e( 'Aggregate JS-files?', 'autoptimize' ); ?></th>
249
-<td><label class="cb_label"><input type="checkbox" id="autoptimize_js_aggregate" name="autoptimize_js_aggregate" <?php echo $conf->get( 'autoptimize_js_aggregate' ) ? 'checked="checked" ':''; ?>/>
250
-<?php _e( 'Aggregate all linked JS-files to have them loaded non-render blocking? If this option is off, the individual JS-files will remain in place but will be minified.', 'autoptimize' ); ?></label></td>
247
+<tr valign="top" class="<?php echo $hiddenClass; ?>js_sub ao_adv">
248
+<th scope="row"><?php _e('Aggregate JS-files?', 'autoptimize'); ?></th>
249
+<td><label class="cb_label"><input type="checkbox" id="autoptimize_js_aggregate" name="autoptimize_js_aggregate" <?php echo $conf->get('autoptimize_js_aggregate') ? 'checked="checked" ' : ''; ?>/>
250
+<?php _e('Aggregate all linked JS-files to have them loaded non-render blocking? If this option is off, the individual JS-files will remain in place but will be minified.', 'autoptimize'); ?></label></td>
251 251
 </tr>
252
-<tr valign="top" class="<?php echo $hiddenClass;?>js_sub ao_adv js_aggregate">
253
-<th scope="row"><?php _e('Also aggregate inline JS?','autoptimize'); ?></th>
254
-<td><label class="cb_label"><input type="checkbox" name="autoptimize_js_include_inline" <?php echo autoptimizeOption::get_option('autoptimize_js_include_inline')?'checked="checked" ':''; ?>/>
255
-<?php _e('Let Autoptimize also extract JS from the HTML. <strong>Warning</strong>: this can make Autoptimize\'s cache size grow quickly, so only enable this if you know what you\'re doing.','autoptimize'); ?></label></td>
252
+<tr valign="top" class="<?php echo $hiddenClass; ?>js_sub ao_adv js_aggregate">
253
+<th scope="row"><?php _e('Also aggregate inline JS?', 'autoptimize'); ?></th>
254
+<td><label class="cb_label"><input type="checkbox" name="autoptimize_js_include_inline" <?php echo autoptimizeOption::get_option('autoptimize_js_include_inline') ? 'checked="checked" ' : ''; ?>/>
255
+<?php _e('Let Autoptimize also extract JS from the HTML. <strong>Warning</strong>: this can make Autoptimize\'s cache size grow quickly, so only enable this if you know what you\'re doing.', 'autoptimize'); ?></label></td>
256 256
 </tr>
257
-<tr valign="top" class="<?php echo $hiddenClass;?>js_sub ao_adv js_aggregate">
258
-<th scope="row"><?php _e('Force JavaScript in &lt;head&gt;?','autoptimize'); ?></th>
259
-<td><label class="cb_label"><input type="checkbox" name="autoptimize_js_forcehead" <?php echo autoptimizeOption::get_option('autoptimize_js_forcehead')?'checked="checked" ':''; ?>/>
260
-<?php _e('Load JavaScript early, this can potentially fix some JS-errors, but makes the JS render blocking.','autoptimize'); ?></label></td>
257
+<tr valign="top" class="<?php echo $hiddenClass; ?>js_sub ao_adv js_aggregate">
258
+<th scope="row"><?php _e('Force JavaScript in &lt;head&gt;?', 'autoptimize'); ?></th>
259
+<td><label class="cb_label"><input type="checkbox" name="autoptimize_js_forcehead" <?php echo autoptimizeOption::get_option('autoptimize_js_forcehead') ? 'checked="checked" ' : ''; ?>/>
260
+<?php _e('Load JavaScript early, this can potentially fix some JS-errors, but makes the JS render blocking.', 'autoptimize'); ?></label></td>
261 261
 </tr>
262 262
 <?php if (autoptimizeOption::get_option('autoptimize_js_justhead')) { ?>
263
-<tr valign="top" class="<?php echo $hiddenClass;?>js_sub ao_adv js_aggregate">
264
-<th scope="row"><?php _e('Look for scripts only in &lt;head&gt;?','autoptimize'); echo ' <i>'. __('(deprecated)','autoptimize') . '</i>'; ?></th>
265
-<td><label class="cb_label"><input type="checkbox" name="autoptimize_js_justhead" <?php echo autoptimizeOption::get_option('autoptimize_js_justhead')?'checked="checked" ':''; ?>/>
266
-<?php _e('Mostly useful in combination with previous option when using jQuery-based templates, but might help keeping cache size under control.','autoptimize'); ?></label></td>
263
+<tr valign="top" class="<?php echo $hiddenClass; ?>js_sub ao_adv js_aggregate">
264
+<th scope="row"><?php _e('Look for scripts only in &lt;head&gt;?', 'autoptimize'); echo ' <i>'.__('(deprecated)', 'autoptimize').'</i>'; ?></th>
265
+<td><label class="cb_label"><input type="checkbox" name="autoptimize_js_justhead" <?php echo autoptimizeOption::get_option('autoptimize_js_justhead') ? 'checked="checked" ' : ''; ?>/>
266
+<?php _e('Mostly useful in combination with previous option when using jQuery-based templates, but might help keeping cache size under control.', 'autoptimize'); ?></label></td>
267 267
 </tr>
268 268
 <?php } ?>
269
-<tr valign="top" class="<?php echo $hiddenClass;?>js_sub ao_adv">
270
-<th scope="row"><?php _e('Exclude scripts from Autoptimize:','autoptimize'); ?></th>
271
-<td><label><input type="text" style="width:100%;" name="autoptimize_js_exclude" value="<?php echo autoptimizeOption::get_option('autoptimize_js_exclude',"wp-includes/js/dist/, wp-includes/js/tinymce/, js/jquery/jquery.js"); ?>"/><br />
272
-<?php _e('A comma-separated list of scripts you want to exclude from being optimized, for example \'whatever.js, another.js\' (without the quotes) to exclude those scripts from being aggregated by Autoptimize.','autoptimize'); ?></label></td>
269
+<tr valign="top" class="<?php echo $hiddenClass; ?>js_sub ao_adv">
270
+<th scope="row"><?php _e('Exclude scripts from Autoptimize:', 'autoptimize'); ?></th>
271
+<td><label><input type="text" style="width:100%;" name="autoptimize_js_exclude" value="<?php echo autoptimizeOption::get_option('autoptimize_js_exclude', "wp-includes/js/dist/, wp-includes/js/tinymce/, js/jquery/jquery.js"); ?>"/><br />
272
+<?php _e('A comma-separated list of scripts you want to exclude from being optimized, for example \'whatever.js, another.js\' (without the quotes) to exclude those scripts from being aggregated by Autoptimize.', 'autoptimize'); ?></label></td>
273 273
 </tr>
274
-<tr valign="top" class="<?php echo $hiddenClass;?>js_sub ao_adv js_aggregate">
275
-<th scope="row"><?php _e('Add try-catch wrapping?','autoptimize'); ?></th>
276
-<td><label class="cb_label"><input type="checkbox" name="autoptimize_js_trycatch" <?php echo autoptimizeOption::get_option('autoptimize_js_trycatch')?'checked="checked" ':''; ?>/>
277
-<?php _e('If your scripts break because of a JS-error, you might want to try this.','autoptimize'); ?></label></td>
274
+<tr valign="top" class="<?php echo $hiddenClass; ?>js_sub ao_adv js_aggregate">
275
+<th scope="row"><?php _e('Add try-catch wrapping?', 'autoptimize'); ?></th>
276
+<td><label class="cb_label"><input type="checkbox" name="autoptimize_js_trycatch" <?php echo autoptimizeOption::get_option('autoptimize_js_trycatch') ? 'checked="checked" ' : ''; ?>/>
277
+<?php _e('If your scripts break because of a JS-error, you might want to try this.', 'autoptimize'); ?></label></td>
278 278
 </tr>
279 279
 </table>
280 280
 </li>
281 281
 
282 282
 <li class="itemDetail">
283
-<h2 class="itemTitle"><?php _e('CSS Options','autoptimize'); ?></h2>
283
+<h2 class="itemTitle"><?php _e('CSS Options', 'autoptimize'); ?></h2>
284 284
 <table class="form-table">
285 285
 <tr valign="top">
286
-<th scope="row"><?php _e('Optimize CSS Code?','autoptimize'); ?></th>
287
-<td><input type="checkbox" id="autoptimize_css" name="autoptimize_css" <?php echo autoptimizeOption::get_option('autoptimize_css')?'checked="checked" ':''; ?>/></td>
286
+<th scope="row"><?php _e('Optimize CSS Code?', 'autoptimize'); ?></th>
287
+<td><input type="checkbox" id="autoptimize_css" name="autoptimize_css" <?php echo autoptimizeOption::get_option('autoptimize_css') ? 'checked="checked" ' : ''; ?>/></td>
288 288
 </tr>
289
-<tr class="<?php echo $hiddenClass;?>css_sub ao_adv" valign="top">
290
-<th scope="row"><?php _e( 'Aggregate CSS-files?', 'autoptimize' ); ?></th>
291
-<td><label class="cb_label"><input type="checkbox" id="autoptimize_css_aggregate" name="autoptimize_css_aggregate" <?php echo $conf->get( 'autoptimize_css_aggregate' ) ? 'checked="checked" ' : ''; ?>/>
292
-<?php _e('Aggregate all linked CSS-files? If this option is off, the individual CSS-files will remain in place but will be minified.', 'autoptimize' ); ?></label></td>
289
+<tr class="<?php echo $hiddenClass; ?>css_sub ao_adv" valign="top">
290
+<th scope="row"><?php _e('Aggregate CSS-files?', 'autoptimize'); ?></th>
291
+<td><label class="cb_label"><input type="checkbox" id="autoptimize_css_aggregate" name="autoptimize_css_aggregate" <?php echo $conf->get('autoptimize_css_aggregate') ? 'checked="checked" ' : ''; ?>/>
292
+<?php _e('Aggregate all linked CSS-files? If this option is off, the individual CSS-files will remain in place but will be minified.', 'autoptimize'); ?></label></td>
293 293
 </tr>
294
-<tr valign="top" class="<?php echo $hiddenClass;?>css_sub ao_adv css_aggregate">
295
-<th scope="row"><?php _e('Also aggregate inline CSS?','autoptimize'); ?></th>
296
-<td><label class="cb_label"><input type="checkbox" name="autoptimize_css_include_inline" <?php echo autoptimizeOption::get_option('autoptimize_css_include_inline','1')?'checked="checked" ':''; ?>/>
297
-<?php _e('Check this option for Autoptimize to also aggregate CSS in the HTML.','autoptimize'); ?></label></td>
294
+<tr valign="top" class="<?php echo $hiddenClass; ?>css_sub ao_adv css_aggregate">
295
+<th scope="row"><?php _e('Also aggregate inline CSS?', 'autoptimize'); ?></th>
296
+<td><label class="cb_label"><input type="checkbox" name="autoptimize_css_include_inline" <?php echo autoptimizeOption::get_option('autoptimize_css_include_inline', '1') ? 'checked="checked" ' : ''; ?>/>
297
+<?php _e('Check this option for Autoptimize to also aggregate CSS in the HTML.', 'autoptimize'); ?></label></td>
298 298
 </tr>
299
-<tr class="<?php echo $hiddenClass;?>css_sub ao_adv css_aggregate" valign="top">
300
-<th scope="row"><?php _e('Generate data: URIs for images?','autoptimize'); ?></th>
301
-<td><label class="cb_label"><input type="checkbox" name="autoptimize_css_datauris" <?php echo autoptimizeOption::get_option('autoptimize_css_datauris')?'checked="checked" ':''; ?>/>
302
-<?php _e('Enable this to include small background-images in the CSS itself instead of as separate downloads.','autoptimize'); ?></label></td>
299
+<tr class="<?php echo $hiddenClass; ?>css_sub ao_adv css_aggregate" valign="top">
300
+<th scope="row"><?php _e('Generate data: URIs for images?', 'autoptimize'); ?></th>
301
+<td><label class="cb_label"><input type="checkbox" name="autoptimize_css_datauris" <?php echo autoptimizeOption::get_option('autoptimize_css_datauris') ? 'checked="checked" ' : ''; ?>/>
302
+<?php _e('Enable this to include small background-images in the CSS itself instead of as separate downloads.', 'autoptimize'); ?></label></td>
303 303
 </tr>
304 304
 <?php if (autoptimizeOption::get_option('autoptimize_css_justhead')) { ?>
305
-<tr valign="top" class="<?php echo $hiddenClass;?>css_sub ao_adv css_aggregate">
306
-<th scope="row"><?php _e('Look for styles only in &lt;head&gt;?','autoptimize'); echo ' <i>'. __('(deprecated)','autoptimize') . '</i>'; ?></th>
307
-<td><label class="cb_label"><input type="checkbox" name="autoptimize_css_justhead" <?php echo autoptimizeOption::get_option('autoptimize_css_justhead')?'checked="checked" ':''; ?>/>
308
-<?php _e('Don\'t autoptimize CSS outside the head-section. If the cache gets big, you might want to enable this.','autoptimize'); ?></label></td>
305
+<tr valign="top" class="<?php echo $hiddenClass; ?>css_sub ao_adv css_aggregate">
306
+<th scope="row"><?php _e('Look for styles only in &lt;head&gt;?', 'autoptimize'); echo ' <i>'.__('(deprecated)', 'autoptimize').'</i>'; ?></th>
307
+<td><label class="cb_label"><input type="checkbox" name="autoptimize_css_justhead" <?php echo autoptimizeOption::get_option('autoptimize_css_justhead') ? 'checked="checked" ' : ''; ?>/>
308
+<?php _e('Don\'t autoptimize CSS outside the head-section. If the cache gets big, you might want to enable this.', 'autoptimize'); ?></label></td>
309 309
 </tr>
310 310
 <?php } ?>
311
-<tr valign="top" class="<?php echo $hiddenClass;?>css_sub ao_adv">
312
-<th scope="row"><?php _e('Inline and Defer CSS?','autoptimize'); ?></th>
313
-<td><label class="cb_label"><input type="checkbox" name="autoptimize_css_defer" id="autoptimize_css_defer" <?php echo autoptimizeOption::get_option('autoptimize_css_defer')?'checked="checked" ':''; ?>/>
311
+<tr valign="top" class="<?php echo $hiddenClass; ?>css_sub ao_adv">
312
+<th scope="row"><?php _e('Inline and Defer CSS?', 'autoptimize'); ?></th>
313
+<td><label class="cb_label"><input type="checkbox" name="autoptimize_css_defer" id="autoptimize_css_defer" <?php echo autoptimizeOption::get_option('autoptimize_css_defer') ? 'checked="checked" ' : ''; ?>/>
314 314
 <?php
315
-_e( 'Inline "above the fold CSS" while loading the main autoptimized CSS only after page load. <a href="http://wordpress.org/plugins/autoptimize/faq/" target="_blank">Check the FAQ</a> for more info.', 'autoptimize' );
316
-if ( function_exists( 'is_plugin_active' ) && ! is_plugin_active( 'autoptimize-criticalcss/ao_criticss_aas.php' ) ) {
315
+_e('Inline "above the fold CSS" while loading the main autoptimized CSS only after page load. <a href="http://wordpress.org/plugins/autoptimize/faq/" target="_blank">Check the FAQ</a> for more info.', 'autoptimize');
316
+if (function_exists('is_plugin_active') && !is_plugin_active('autoptimize-criticalcss/ao_criticss_aas.php')) {
317 317
     echo ' ';
318
-    $critcss_install_url = network_admin_url() . 'plugin-install.php?s=autoptimize+criticalcss&tab=search&type=term';
319
-    echo sprintf( __( 'This can be fully automated for different types of pages with the %s.', 'autoptimize' ), '<a href="'.$critcss_install_url.'">Autoptimize CriticalCSS Power-Up</a>' );
318
+    $critcss_install_url = network_admin_url().'plugin-install.php?s=autoptimize+criticalcss&tab=search&type=term';
319
+    echo sprintf(__('This can be fully automated for different types of pages with the %s.', 'autoptimize'), '<a href="'.$critcss_install_url.'">Autoptimize CriticalCSS Power-Up</a>');
320 320
 }
321 321
 ?>
322 322
 </label></td>
323 323
 </tr>
324
-<tr valign="top" class="<?php echo $hiddenClass;?>css_sub ao_adv" id="autoptimize_css_defer_inline">
324
+<tr valign="top" class="<?php echo $hiddenClass; ?>css_sub ao_adv" id="autoptimize_css_defer_inline">
325 325
 <th scope="row"></th>
326
-<td><label><textarea rows="10" cols="10" style="width:100%;" placeholder="<?php _e('Paste the above the fold CSS here.','autoptimize'); ?>" name="autoptimize_css_defer_inline"><?php echo autoptimizeOption::get_option('autoptimize_css_defer_inline'); ?></textarea></label></td>
326
+<td><label><textarea rows="10" cols="10" style="width:100%;" placeholder="<?php _e('Paste the above the fold CSS here.', 'autoptimize'); ?>" name="autoptimize_css_defer_inline"><?php echo autoptimizeOption::get_option('autoptimize_css_defer_inline'); ?></textarea></label></td>
327 327
 </tr>
328
-<tr valign="top" class="<?php echo $hiddenClass;?>ao_adv css_sub css_aggregate">
329
-<th scope="row"><?php _e('Inline all CSS?','autoptimize'); ?></th>
330
-<td><label class="cb_label"><input type="checkbox" id="autoptimize_css_inline" name="autoptimize_css_inline" <?php echo autoptimizeOption::get_option('autoptimize_css_inline')?'checked="checked" ':''; ?>/>
331
-<?php _e('Inlining all CSS can improve performance for sites with a low pageviews/ visitor-rate, but may slow down performance otherwise.','autoptimize'); ?></label></td>
328
+<tr valign="top" class="<?php echo $hiddenClass; ?>ao_adv css_sub css_aggregate">
329
+<th scope="row"><?php _e('Inline all CSS?', 'autoptimize'); ?></th>
330
+<td><label class="cb_label"><input type="checkbox" id="autoptimize_css_inline" name="autoptimize_css_inline" <?php echo autoptimizeOption::get_option('autoptimize_css_inline') ? 'checked="checked" ' : ''; ?>/>
331
+<?php _e('Inlining all CSS can improve performance for sites with a low pageviews/ visitor-rate, but may slow down performance otherwise.', 'autoptimize'); ?></label></td>
332 332
 </tr>
333
-<tr valign="top" class="<?php echo $hiddenClass;?>ao_adv css_sub">
334
-<th scope="row"><?php _e('Exclude CSS from Autoptimize:','autoptimize'); ?></th>
335
-<td><label><input type="text" style="width:100%;" name="autoptimize_css_exclude" value="<?php echo autoptimizeOption::get_option('autoptimize_css_exclude','wp-content/cache/, wp-content/uploads/, admin-bar.min.css, dashicons.min.css'); ?>"/><br />
336
-<?php _e('A comma-separated list of CSS you want to exclude from being optimized.','autoptimize'); ?></label></td>
333
+<tr valign="top" class="<?php echo $hiddenClass; ?>ao_adv css_sub">
334
+<th scope="row"><?php _e('Exclude CSS from Autoptimize:', 'autoptimize'); ?></th>
335
+<td><label><input type="text" style="width:100%;" name="autoptimize_css_exclude" value="<?php echo autoptimizeOption::get_option('autoptimize_css_exclude', 'wp-content/cache/, wp-content/uploads/, admin-bar.min.css, dashicons.min.css'); ?>"/><br />
336
+<?php _e('A comma-separated list of CSS you want to exclude from being optimized.', 'autoptimize'); ?></label></td>
337 337
 </tr>
338 338
 </table>
339 339
 </li>
340 340
 
341 341
 <li class="itemDetail">
342
-<h2 class="itemTitle"><?php _e('HTML Options','autoptimize'); ?></h2>
342
+<h2 class="itemTitle"><?php _e('HTML Options', 'autoptimize'); ?></h2>
343 343
 <table class="form-table">
344 344
 <tr valign="top">
345
-<th scope="row"><?php _e('Optimize HTML Code?','autoptimize'); ?></th>
346
-<td><input type="checkbox" id="autoptimize_html" name="autoptimize_html" <?php echo autoptimizeOption::get_option('autoptimize_html')?'checked="checked" ':''; ?>/></td>
345
+<th scope="row"><?php _e('Optimize HTML Code?', 'autoptimize'); ?></th>
346
+<td><input type="checkbox" id="autoptimize_html" name="autoptimize_html" <?php echo autoptimizeOption::get_option('autoptimize_html') ? 'checked="checked" ' : ''; ?>/></td>
347 347
 </tr>
348
-<tr class="<?php echo $hiddenClass;?>html_sub ao_adv" valign="top">
349
-<th scope="row"><?php _e('Keep HTML comments?','autoptimize'); ?></th>
350
-<td><label class="cb_label"><input type="checkbox" name="autoptimize_html_keepcomments" <?php echo autoptimizeOption::get_option('autoptimize_html_keepcomments')?'checked="checked" ':''; ?>/>
351
-<?php _e('Enable this if you want HTML comments to remain in the page.','autoptimize'); ?></label></td>
348
+<tr class="<?php echo $hiddenClass; ?>html_sub ao_adv" valign="top">
349
+<th scope="row"><?php _e('Keep HTML comments?', 'autoptimize'); ?></th>
350
+<td><label class="cb_label"><input type="checkbox" name="autoptimize_html_keepcomments" <?php echo autoptimizeOption::get_option('autoptimize_html_keepcomments') ? 'checked="checked" ' : ''; ?>/>
351
+<?php _e('Enable this if you want HTML comments to remain in the page.', 'autoptimize'); ?></label></td>
352 352
 </tr>
353 353
 </table>
354 354
 </li>
355 355
 
356 356
 <li class="itemDetail">
357
-<h2 class="itemTitle"><?php _e('CDN Options','autoptimize'); ?></h2>
357
+<h2 class="itemTitle"><?php _e('CDN Options', 'autoptimize'); ?></h2>
358 358
 <table class="form-table">
359 359
 <tr valign="top">
360
-<th scope="row"><?php _e('CDN Base URL','autoptimize'); ?></th>
361
-<td><label><input id="cdn_url" type="text" name="autoptimize_cdn_url" pattern="^(https?:)?\/\/([\da-z\.-]+)\.([\da-z\.]{2,6})([\/\w \.-]*)*(:\d{2,5})?\/?$" style="width:100%" value="<?php echo esc_url(autoptimizeOption::get_option('autoptimize_cdn_url',''),array("http","https")); ?>" /><br />
362
-<?php _e('Enter your CDN root URL to enable CDN for Autoptimized files. The URL can be http, https or protocol-relative (e.g. <code>//cdn.example.com/</code>). This is not needed for Cloudflare.','autoptimize'); ?></label></td>
360
+<th scope="row"><?php _e('CDN Base URL', 'autoptimize'); ?></th>
361
+<td><label><input id="cdn_url" type="text" name="autoptimize_cdn_url" pattern="^(https?:)?\/\/([\da-z\.-]+)\.([\da-z\.]{2,6})([\/\w \.-]*)*(:\d{2,5})?\/?$" style="width:100%" value="<?php echo esc_url(autoptimizeOption::get_option('autoptimize_cdn_url', ''), array("http", "https")); ?>" /><br />
362
+<?php _e('Enter your CDN root URL to enable CDN for Autoptimized files. The URL can be http, https or protocol-relative (e.g. <code>//cdn.example.com/</code>). This is not needed for Cloudflare.', 'autoptimize'); ?></label></td>
363 363
 </tr>
364 364
 </table>
365 365
 </li>
366 366
 
367
-<li class="<?php echo $hiddenClass;?>itemDetail ao_adv">
368
-<h2 class="itemTitle"><?php _e('Cache Info','autoptimize'); ?></h2>
367
+<li class="<?php echo $hiddenClass; ?>itemDetail ao_adv">
368
+<h2 class="itemTitle"><?php _e('Cache Info', 'autoptimize'); ?></h2>
369 369
 <table class="form-table" >
370
-<tr valign="top" class="<?php echo $hiddenClass;?>ao_adv">
371
-<th scope="row"><?php _e('Cache folder','autoptimize'); ?></th>
370
+<tr valign="top" class="<?php echo $hiddenClass; ?>ao_adv">
371
+<th scope="row"><?php _e('Cache folder', 'autoptimize'); ?></th>
372 372
 <td><?php echo htmlentities(AUTOPTIMIZE_CACHE_DIR); ?></td>
373 373
 </tr>
374
-<tr valign="top" class="<?php echo $hiddenClass;?>ao_adv">
375
-<th scope="row"><?php _e('Can we write?','autoptimize'); ?></th>
376
-<td><?php echo (autoptimizeCache::cacheavail() ? __('Yes','autoptimize') : __('No','autoptimize')); ?></td>
374
+<tr valign="top" class="<?php echo $hiddenClass; ?>ao_adv">
375
+<th scope="row"><?php _e('Can we write?', 'autoptimize'); ?></th>
376
+<td><?php echo (autoptimizeCache::cacheavail() ? __('Yes', 'autoptimize') : __('No', 'autoptimize')); ?></td>
377 377
 </tr>
378
-<tr valign="top" class="<?php echo $hiddenClass;?>ao_adv">
379
-<th scope="row"><?php _e('Cached styles and scripts','autoptimize'); ?></th>
378
+<tr valign="top" class="<?php echo $hiddenClass; ?>ao_adv">
379
+<th scope="row"><?php _e('Cached styles and scripts', 'autoptimize'); ?></th>
380 380
 <td><?php
381 381
     $AOstatArr = autoptimizeCache::stats();
382
-    if ( ! empty( $AOstatArr ) && is_array( $AOstatArr ) ) {
383
-        $AOcacheSize = size_format( $AOstatArr[1], 2 );
382
+    if (!empty($AOstatArr) && is_array($AOstatArr)) {
383
+        $AOcacheSize = size_format($AOstatArr[1], 2);
384 384
         $details = '';
385
-        if ( $AOcacheSize > 0 ) {
386
-            $details = ', ~' . $AOcacheSize . ' total';
385
+        if ($AOcacheSize > 0) {
386
+            $details = ', ~'.$AOcacheSize.' total';
387 387
         }
388
-        printf( __( '%1$s files, totalling %2$s Kbytes (calculated at %3$s)', 'autoptimize' ), $AOstatArr[0], $AOcacheSize, date( 'H:i e', $AOstatArr[2] ) );
388
+        printf(__('%1$s files, totalling %2$s Kbytes (calculated at %3$s)', 'autoptimize'), $AOstatArr[0], $AOcacheSize, date('H:i e', $AOstatArr[2]));
389 389
     }
390 390
 ?></td>
391 391
 </tr>
392 392
 </table>
393 393
 </li>
394 394
 
395
-<li class="<?php echo $hiddenClass;?>itemDetail ao_adv">
396
-<h2 class="itemTitle"><?php _e('Misc Options','autoptimize'); ?></h2>
395
+<li class="<?php echo $hiddenClass; ?>itemDetail ao_adv">
396
+<h2 class="itemTitle"><?php _e('Misc Options', 'autoptimize'); ?></h2>
397 397
 <table class="form-table">
398
-    <tr valign="top" class="<?php echo $hiddenClass;?>ao_adv">
399
-    <th scope="row"><?php _e('Save aggregated script/css as static files?','autoptimize'); ?></th>
400
-    <td><label class="cb_label"><input type="checkbox" name="autoptimize_cache_nogzip" <?php echo autoptimizeOption::get_option('autoptimize_cache_nogzip','1')?'checked="checked" ':''; ?>/>
401
-    <?php _e('By default files saved are static css/js, uncheck this option if your webserver doesn\'t properly handle the compression and expiry.','autoptimize'); ?></label></td>
398
+    <tr valign="top" class="<?php echo $hiddenClass; ?>ao_adv">
399
+    <th scope="row"><?php _e('Save aggregated script/css as static files?', 'autoptimize'); ?></th>
400
+    <td><label class="cb_label"><input type="checkbox" name="autoptimize_cache_nogzip" <?php echo autoptimizeOption::get_option('autoptimize_cache_nogzip', '1') ? 'checked="checked" ' : ''; ?>/>
401
+    <?php _e('By default files saved are static css/js, uncheck this option if your webserver doesn\'t properly handle the compression and expiry.', 'autoptimize'); ?></label></td>
402 402
     </tr>
403 403
     <?php
404 404
     $_min_excl_class = 'ao_adv';
405
-    if ( !$conf->get( 'autoptimize_css_aggregate' ) && !$conf->get( 'autoptimize_js_aggregate' ) ) {
405
+    if (!$conf->get('autoptimize_css_aggregate') && !$conf->get('autoptimize_js_aggregate')) {
406 406
         $_min_excl_class = ' hidden';
407 407
     }
408 408
     ?>
409 409
     <tr valign="top" id="min_excl_row" class="<?php echo $hiddenClass.$_min_excl_class; ?>">
410
-        <th scope="row"><?php _e('Minify excluded CSS and JS files?','autoptimize'); ?></th>
411
-        <td><label class="cb_label"><input type="checkbox" name="autoptimize_minify_excluded" <?php echo autoptimizeOption::get_option('autoptimize_minify_excluded','1')?'checked="checked" ':''; ?>/>
412
-        <?php _e('When aggregating JS or CSS, excluded files that are not minified (based on filename) are by default minified by Autoptimize despite being excluded. Uncheck this option if anything breaks despite excluding.','autoptimize'); ?></label></td>
410
+        <th scope="row"><?php _e('Minify excluded CSS and JS files?', 'autoptimize'); ?></th>
411
+        <td><label class="cb_label"><input type="checkbox" name="autoptimize_minify_excluded" <?php echo autoptimizeOption::get_option('autoptimize_minify_excluded', '1') ? 'checked="checked" ' : ''; ?>/>
412
+        <?php _e('When aggregating JS or CSS, excluded files that are not minified (based on filename) are by default minified by Autoptimize despite being excluded. Uncheck this option if anything breaks despite excluding.', 'autoptimize'); ?></label></td>
413 413
     </tr>
414
-    <tr valign="top" class="<?php echo $hiddenClass;?>ao_adv">
415
-    <th scope="row"><?php _e('Also optimize for logged in users?','autoptimize'); ?></th>
416
-    <td><label class="cb_label"><input type="checkbox" name="autoptimize_optimize_logged" <?php echo autoptimizeOption::get_option('autoptimize_optimize_logged','1')?'checked="checked" ':''; ?>/>
417
-    <?php _e('By default Autoptimize is also active for logged on users, uncheck not to optimize when logged in e.g. to use a pagebuilder.','autoptimize'); ?></label></td>
414
+    <tr valign="top" class="<?php echo $hiddenClass; ?>ao_adv">
415
+    <th scope="row"><?php _e('Also optimize for logged in users?', 'autoptimize'); ?></th>
416
+    <td><label class="cb_label"><input type="checkbox" name="autoptimize_optimize_logged" <?php echo autoptimizeOption::get_option('autoptimize_optimize_logged', '1') ? 'checked="checked" ' : ''; ?>/>
417
+    <?php _e('By default Autoptimize is also active for logged on users, uncheck not to optimize when logged in e.g. to use a pagebuilder.', 'autoptimize'); ?></label></td>
418 418
     </tr>
419 419
     <?php
420
-    if ( function_exists("is_checkout") || function_exists("is_cart") || function_exists("edd_is_checkout") || function_exists("wpsc_is_cart") || function_exists("wpsc_is_checkout") ) {
420
+    if (function_exists("is_checkout") || function_exists("is_cart") || function_exists("edd_is_checkout") || function_exists("wpsc_is_cart") || function_exists("wpsc_is_checkout")) {
421 421
     ?>
422
-    <tr valign="top" class="<?php echo $hiddenClass;?>ao_adv">
423
-        <th scope="row"><?php _e('Also optimize shop cart/ checkout?','autoptimize'); ?></th>
424
-        <td><label class="cb_label"><input type="checkbox" name="autoptimize_optimize_checkout" <?php echo autoptimizeOption::get_option('autoptimize_optimize_checkout','1')?'checked="checked" ':''; ?>/>
425
-            <?php _e('By default Autoptimize is also active on your shop\'s cart/ checkout, uncheck not to optimize those.','autoptimize'); ?></label>
422
+    <tr valign="top" class="<?php echo $hiddenClass; ?>ao_adv">
423
+        <th scope="row"><?php _e('Also optimize shop cart/ checkout?', 'autoptimize'); ?></th>
424
+        <td><label class="cb_label"><input type="checkbox" name="autoptimize_optimize_checkout" <?php echo autoptimizeOption::get_option('autoptimize_optimize_checkout', '1') ? 'checked="checked" ' : ''; ?>/>
425
+            <?php _e('By default Autoptimize is also active on your shop\'s cart/ checkout, uncheck not to optimize those.', 'autoptimize'); ?></label>
426 426
         </td>
427 427
     </tr>
428 428
     <?php } ?>
@@ -431,11 +431,11 @@  discard block
 block discarded – undo
431 431
 
432 432
 </ul>
433 433
 
434
-<input type="hidden" id="autoptimize_show_adv" name="autoptimize_show_adv" value="<?php echo autoptimizeOption::get_option('autoptimize_show_adv','1'); ?>">
434
+<input type="hidden" id="autoptimize_show_adv" name="autoptimize_show_adv" value="<?php echo autoptimizeOption::get_option('autoptimize_show_adv', '1'); ?>">
435 435
 
436 436
 <p class="submit">
437
-<input type="submit" class="button-secondary" value="<?php _e('Save Changes','autoptimize') ?>" />
438
-<input type="submit" class="button-primary" name="autoptimize_cache_clean" value="<?php _e('Save Changes and Empty Cache','autoptimize') ?>" />
437
+<input type="submit" class="button-secondary" value="<?php _e('Save Changes', 'autoptimize') ?>" />
438
+<input type="submit" class="button-primary" name="autoptimize_cache_clean" value="<?php _e('Save Changes and Empty Cache', 'autoptimize') ?>" />
439 439
 </p>
440 440
 
441 441
 </form>
@@ -444,13 +444,13 @@  discard block
 block discarded – undo
444 444
     <div class="autoptimize_banner hidden">
445 445
       <ul>
446 446
     <?php
447
-    if ( $this->settings_screen_do_remote_http ) {
448
-        $AO_banner = get_transient( 'autoptimize_banner' );
449
-        if ( empty( $AO_banner ) ) {
450
-            $banner_resp = wp_remote_get( 'https://misc.optimizingmatters.com/autoptimize_news.html?ao_ver='.AUTOPTIMIZE_PLUGIN_VERSION );
451
-            if ( ! is_wp_error( $banner_resp ) ) {
452
-                if ( '200' == wp_remote_retrieve_response_code( $banner_resp ) ) {
453
-                    $AO_banner = wp_kses_post( wp_remote_retrieve_body( $banner_resp ) );
447
+    if ($this->settings_screen_do_remote_http) {
448
+        $AO_banner = get_transient('autoptimize_banner');
449
+        if (empty($AO_banner)) {
450
+            $banner_resp = wp_remote_get('https://misc.optimizingmatters.com/autoptimize_news.html?ao_ver='.AUTOPTIMIZE_PLUGIN_VERSION);
451
+            if (!is_wp_error($banner_resp)) {
452
+                if ('200' == wp_remote_retrieve_response_code($banner_resp)) {
453
+                    $AO_banner = wp_kses_post(wp_remote_retrieve_body($banner_resp));
454 454
                     set_transient('autoptimize_banner', $AO_banner, DAY_IN_SECONDS);
455 455
                 }
456 456
             }
@@ -458,17 +458,17 @@  discard block
 block discarded – undo
458 458
         echo $AO_banner;
459 459
     }
460 460
     ?>
461
-        <li><?php _e("Need help? <a href='https://wordpress.org/plugins/autoptimize/faq/'>Check out the FAQ here</a>.","autoptimize"); ?></li>
462
-        <li><?php _e("Happy with Autoptimize?","autoptimize"); ?><br /><a href="<?php echo network_admin_url(); ?>plugin-install.php?tab=search&type=author&s=optimizingmatters"><?php _e("Try my other plugins!","autoptimize"); ?></a></li>
461
+        <li><?php _e("Need help? <a href='https://wordpress.org/plugins/autoptimize/faq/'>Check out the FAQ here</a>.", "autoptimize"); ?></li>
462
+        <li><?php _e("Happy with Autoptimize?", "autoptimize"); ?><br /><a href="<?php echo network_admin_url(); ?>plugin-install.php?tab=search&type=author&s=optimizingmatters"><?php _e("Try my other plugins!", "autoptimize"); ?></a></li>
463 463
     </ul>
464 464
     </div>
465 465
     <div style="margin-left:10px;margin-top:-5px;">
466 466
         <h2>
467
-            <?php _e("futtta about","autoptimize") ?>
467
+            <?php _e("futtta about", "autoptimize") ?>
468 468
             <select id="feed_dropdown" >
469
-                <option value="1"><?php _e("Autoptimize","autoptimize") ?></option>
470
-                <option value="2"><?php _e("WordPress","autoptimize") ?></option>
471
-                <option value="3"><?php _e("Web Technology","autoptimize") ?></option>
469
+                <option value="1"><?php _e("Autoptimize", "autoptimize") ?></option>
470
+                <option value="2"><?php _e("WordPress", "autoptimize") ?></option>
471
+                <option value="3"><?php _e("Web Technology", "autoptimize") ?></option>
472 472
             </select>
473 473
         </h2>
474 474
         <div id="futtta_feed">
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
             </div>
484 484
         </div>
485 485
     </div>
486
-    <div style="float:right;margin:50px 15px;"><a href="http://blog.futtta.be/2013/10/21/do-not-donate-to-me/" target="_blank"><img width="100px" height="85px" src="<?php echo plugins_url().'/'.plugin_basename(dirname(__FILE__)).'/external/do_not_donate_smallest.png'; ?>" title="<?php _e("Do not donate for this plugin!","autoptimize"); ?>"></a></div>
486
+    <div style="float:right;margin:50px 15px;"><a href="http://blog.futtta.be/2013/10/21/do-not-donate-to-me/" target="_blank"><img width="100px" height="85px" src="<?php echo plugins_url().'/'.plugin_basename(dirname(__FILE__)).'/external/do_not_donate_smallest.png'; ?>" title="<?php _e("Do not donate for this plugin!", "autoptimize"); ?>"></a></div>
487 487
 </div>
488 488
 
489 489
 <script type="text/javascript">
@@ -654,58 +654,58 @@  discard block
 block discarded – undo
654 654
 
655 655
     public function addmenu()
656 656
     {
657
-		if ( is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) {
658
-			$hook = add_submenu_page( 'settings.php',  __( 'Autoptimize Options', 'autoptimize' ), 'Autoptimize', 'manage_network_options', 'autoptimize', array( $this, 'show' ) );
657
+		if (is_plugin_active_for_network('autoptimize/autoptimize.php')) {
658
+			$hook = add_submenu_page('settings.php', __('Autoptimize Options', 'autoptimize'), 'Autoptimize', 'manage_network_options', 'autoptimize', array($this, 'show'));
659 659
 		}
660
-		if ( ! is_multisite() || 'on' === autoptimizeOption::get_option('autoptimize_enable_site_config') ) {
661
-			$hook = add_options_page( __( 'Autoptimize Options', 'autoptimize' ), 'Autoptimize', 'manage_options', 'autoptimize', array( $this, 'show' ) );
660
+		if (!is_multisite() || 'on' === autoptimizeOption::get_option('autoptimize_enable_site_config')) {
661
+			$hook = add_options_page(__('Autoptimize Options', 'autoptimize'), 'Autoptimize', 'manage_options', 'autoptimize', array($this, 'show'));
662 662
 		} else {
663
-			$hook = add_options_page( __( 'Autoptimize Options', 'autoptimize' ), 'Autoptimize', 'manage_options', 'autoptimize', array( $this, 'show_message' ) );
663
+			$hook = add_options_page(__('Autoptimize Options', 'autoptimize'), 'Autoptimize', 'manage_options', 'autoptimize', array($this, 'show_message'));
664 664
 		}
665 665
 
666
-        add_action( 'admin_print_scripts-' . $hook, array( $this, 'autoptimize_admin_scripts' ) );
667
-        add_action( 'admin_print_styles-' . $hook, array( $this, 'autoptimize_admin_styles' ) );
666
+        add_action('admin_print_scripts-'.$hook, array($this, 'autoptimize_admin_scripts'));
667
+        add_action('admin_print_styles-'.$hook, array($this, 'autoptimize_admin_styles'));
668 668
     }
669 669
 
670 670
     public function autoptimize_admin_scripts()
671 671
     {
672
-        wp_enqueue_script( 'jqcookie', plugins_url( '/external/js/jquery.cookie.min.js', __FILE__ ), array( 'jquery' ), null, true );
673
-        wp_enqueue_script( 'unslider', plugins_url( '/external/js/unslider-min.js', __FILE__ ), array( 'jquery' ), null, true );
672
+        wp_enqueue_script('jqcookie', plugins_url('/external/js/jquery.cookie.min.js', __FILE__), array('jquery'), null, true);
673
+        wp_enqueue_script('unslider', plugins_url('/external/js/unslider-min.js', __FILE__), array('jquery'), null, true);
674 674
     }
675 675
 
676 676
     public function autoptimize_admin_styles()
677 677
     {
678
-        wp_enqueue_style( 'unslider', plugins_url( '/external/js/unslider.css', __FILE__ ) );
679
-        wp_enqueue_style( 'unslider-dots', plugins_url( '/external/js/unslider-dots.css', __FILE__ ) );
678
+        wp_enqueue_style('unslider', plugins_url('/external/js/unslider.css', __FILE__));
679
+        wp_enqueue_style('unslider-dots', plugins_url('/external/js/unslider-dots.css', __FILE__));
680 680
     }
681 681
 
682 682
     public function registersettings() {
683
-        register_setting( 'autoptimize', 'autoptimize_html' );
684
-        register_setting( 'autoptimize', 'autoptimize_html_keepcomments' );
685
-		register_setting( 'autoptimize', 'autoptimize_enable_site_config' );
686
-        register_setting( 'autoptimize', 'autoptimize_js' );
687
-        register_setting( 'autoptimize', 'autoptimize_js_aggregate' );
688
-        register_setting( 'autoptimize', 'autoptimize_js_exclude' );
689
-        register_setting( 'autoptimize', 'autoptimize_js_trycatch' );
690
-        register_setting( 'autoptimize', 'autoptimize_js_justhead' );
691
-        register_setting( 'autoptimize', 'autoptimize_js_forcehead' );
692
-        register_setting( 'autoptimize', 'autoptimize_js_include_inline' );
693
-        register_setting( 'autoptimize', 'autoptimize_css' );
694
-        register_setting( 'autoptimize', 'autoptimize_css_aggregate' );
695
-        register_setting( 'autoptimize', 'autoptimize_css_exclude' );
696
-        register_setting( 'autoptimize', 'autoptimize_css_justhead' );
697
-        register_setting( 'autoptimize', 'autoptimize_css_datauris' );
698
-        register_setting( 'autoptimize', 'autoptimize_css_defer' );
699
-        register_setting( 'autoptimize', 'autoptimize_css_defer_inline' );
700
-        register_setting( 'autoptimize', 'autoptimize_css_inline' );
701
-        register_setting( 'autoptimize', 'autoptimize_css_include_inline' );
702
-        register_setting( 'autoptimize', 'autoptimize_cdn_url' );
703
-        register_setting( 'autoptimize', 'autoptimize_cache_clean' );
704
-        register_setting( 'autoptimize', 'autoptimize_cache_nogzip' );
705
-        register_setting( 'autoptimize', 'autoptimize_show_adv' );
706
-        register_setting( 'autoptimize', 'autoptimize_optimize_logged' );
707
-        register_setting( 'autoptimize', 'autoptimize_optimize_checkout' );
708
-        register_setting( 'autoptimize', 'autoptimize_minify_excluded' );
683
+        register_setting('autoptimize', 'autoptimize_html');
684
+        register_setting('autoptimize', 'autoptimize_html_keepcomments');
685
+		register_setting('autoptimize', 'autoptimize_enable_site_config');
686
+        register_setting('autoptimize', 'autoptimize_js');
687
+        register_setting('autoptimize', 'autoptimize_js_aggregate');
688
+        register_setting('autoptimize', 'autoptimize_js_exclude');
689
+        register_setting('autoptimize', 'autoptimize_js_trycatch');
690
+        register_setting('autoptimize', 'autoptimize_js_justhead');
691
+        register_setting('autoptimize', 'autoptimize_js_forcehead');
692
+        register_setting('autoptimize', 'autoptimize_js_include_inline');
693
+        register_setting('autoptimize', 'autoptimize_css');
694
+        register_setting('autoptimize', 'autoptimize_css_aggregate');
695
+        register_setting('autoptimize', 'autoptimize_css_exclude');
696
+        register_setting('autoptimize', 'autoptimize_css_justhead');
697
+        register_setting('autoptimize', 'autoptimize_css_datauris');
698
+        register_setting('autoptimize', 'autoptimize_css_defer');
699
+        register_setting('autoptimize', 'autoptimize_css_defer_inline');
700
+        register_setting('autoptimize', 'autoptimize_css_inline');
701
+        register_setting('autoptimize', 'autoptimize_css_include_inline');
702
+        register_setting('autoptimize', 'autoptimize_cdn_url');
703
+        register_setting('autoptimize', 'autoptimize_cache_clean');
704
+        register_setting('autoptimize', 'autoptimize_cache_nogzip');
705
+        register_setting('autoptimize', 'autoptimize_show_adv');
706
+        register_setting('autoptimize', 'autoptimize_optimize_logged');
707
+        register_setting('autoptimize', 'autoptimize_optimize_checkout');
708
+        register_setting('autoptimize', 'autoptimize_minify_excluded');
709 709
     }
710 710
 
711 711
     public function setmeta($links, $file = null)
@@ -713,20 +713,20 @@  discard block
 block discarded – undo
713 713
         // Inspired on http://wpengineer.com/meta-links-for-wordpress-plugins/.
714 714
         // Do it only once - saves time.
715 715
         static $plugin;
716
-        if ( empty( $plugin ) ) {
717
-            $plugin = plugin_basename( AUTOPTIMIZE_PLUGIN_DIR . 'autoptimize.php' );
716
+        if (empty($plugin)) {
717
+            $plugin = plugin_basename(AUTOPTIMIZE_PLUGIN_DIR.'autoptimize.php');
718 718
         }
719 719
 
720
-        if ( null === $file ) {
720
+        if (null === $file) {
721 721
             // 2.7 and lower.
722
-            $settings_link = sprintf( '<a href="options-general.php?page=autoptimize">%s</a>', __( 'Settings' ) );
723
-            array_unshift( $links, $settings_link );
722
+            $settings_link = sprintf('<a href="options-general.php?page=autoptimize">%s</a>', __('Settings'));
723
+            array_unshift($links, $settings_link);
724 724
         } else {
725 725
             // 2.8 and higher.
726 726
             // If it's us, add the link.
727
-            if ( $file === $plugin ) {
728
-                $newlink = array( sprintf( '<a href="options-general.php?page=autoptimize">%s</a>', __( 'Settings' ) ) );
729
-                $links = array_merge( $links, $newlink );
727
+            if ($file === $plugin) {
728
+                $newlink = array(sprintf('<a href="options-general.php?page=autoptimize">%s</a>', __('Settings')));
729
+                $links = array_merge($links, $newlink);
730 730
             }
731 731
         }
732 732
 
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
             'autoptimize_imgopt_select_field_2'   => '2', // quality glossy.
800 800
             'autoptimize_imgopt_checkbox_field_3' => '0', // lazy load off.
801 801
             'autoptimize_imgopt_checkbox_field_4' => '0', // webp off (might be removed).
802
-            'autoptimize_imgopt_text_field_5'     => '',  // lazy load exclusions empty.
802
+            'autoptimize_imgopt_text_field_5'     => '', // lazy load exclusions empty.
803 803
         );
804 804
         return $defaults;
805 805
     }
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
      */
812 812
     public static function get_ao_css_preload_polyfill()
813 813
     {
814
-        $preload_poly = apply_filters('autoptimize_css_preload_polyfill','<script data-cfasync=\'false\'>!function(t){"use strict";t.loadCSS||(t.loadCSS=function(){});var e=loadCSS.relpreload={};if(e.support=function(){var e;try{e=t.document.createElement("link").relList.supports("preload")}catch(t){e=!1}return function(){return e}}(),e.bindMediaToggle=function(t){function e(){t.media=a}var a=t.media||"all";t.addEventListener?t.addEventListener("load",e):t.attachEvent&&t.attachEvent("onload",e),setTimeout(function(){t.rel="stylesheet",t.media="only x"}),setTimeout(e,3e3)},e.poly=function(){if(!e.support())for(var a=t.document.getElementsByTagName("link"),n=0;n<a.length;n++){var o=a[n];"preload"!==o.rel||"style"!==o.getAttribute("as")||o.getAttribute("data-loadcss")||(o.setAttribute("data-loadcss",!0),e.bindMediaToggle(o))}},!e.support()){e.poly();var a=t.setInterval(e.poly,500);t.addEventListener?t.addEventListener("load",function(){e.poly(),t.clearInterval(a)}):t.attachEvent&&t.attachEvent("onload",function(){e.poly(),t.clearInterval(a)})}"undefined"!=typeof exports?exports.loadCSS=loadCSS:t.loadCSS=loadCSS}("undefined"!=typeof global?global:this);</script>');
814
+        $preload_poly = apply_filters('autoptimize_css_preload_polyfill', '<script data-cfasync=\'false\'>!function(t){"use strict";t.loadCSS||(t.loadCSS=function(){});var e=loadCSS.relpreload={};if(e.support=function(){var e;try{e=t.document.createElement("link").relList.supports("preload")}catch(t){e=!1}return function(){return e}}(),e.bindMediaToggle=function(t){function e(){t.media=a}var a=t.media||"all";t.addEventListener?t.addEventListener("load",e):t.attachEvent&&t.attachEvent("onload",e),setTimeout(function(){t.rel="stylesheet",t.media="only x"}),setTimeout(e,3e3)},e.poly=function(){if(!e.support())for(var a=t.document.getElementsByTagName("link"),n=0;n<a.length;n++){var o=a[n];"preload"!==o.rel||"style"!==o.getAttribute("as")||o.getAttribute("data-loadcss")||(o.setAttribute("data-loadcss",!0),e.bindMediaToggle(o))}},!e.support()){e.poly();var a=t.setInterval(e.poly,500);t.addEventListener?t.addEventListener("load",function(){e.poly(),t.clearInterval(a)}):t.attachEvent&&t.attachEvent("onload",function(){e.poly(),t.clearInterval(a)})}"undefined"!=typeof exports?exports.loadCSS=loadCSS:t.loadCSS=loadCSS}("undefined"!=typeof global?global:this);</script>');
815 815
         return $preload_poly;
816 816
     }
817 817
 
@@ -822,55 +822,55 @@  discard block
 block discarded – undo
822 822
      */
823 823
     public static function get_ao_css_preload_onload()
824 824
     {
825
-        $preload_onload = apply_filters('autoptimize_filter_css_preload_onload',"this.onload=null;this.rel='stylesheet'");
825
+        $preload_onload = apply_filters('autoptimize_filter_css_preload_onload', "this.onload=null;this.rel='stylesheet'");
826 826
         return $preload_onload;
827 827
     }
828 828
 
829 829
     public function get($key)
830 830
     {
831
-        if ( ! is_array( $this->config ) ) {
831
+        if (!is_array($this->config)) {
832 832
             // Default config.
833 833
             $config = self::get_defaults();
834 834
 
835 835
             // Override with user settings.
836
-            foreach ( array_keys( $config ) as $name ) {
837
-                $conf = autoptimizeOption::get_option( $name );
838
-                if ( false !== $conf ) {
836
+            foreach (array_keys($config) as $name) {
837
+                $conf = autoptimizeOption::get_option($name);
838
+                if (false !== $conf) {
839 839
                     // It was set before!
840
-                    $config[ $name ] = $conf;
840
+                    $config[$name] = $conf;
841 841
                 }
842 842
             }
843 843
 
844 844
             // Save for next call.
845
-            $this->config = apply_filters( 'autoptimize_filter_get_config', $config );
845
+            $this->config = apply_filters('autoptimize_filter_get_config', $config);
846 846
         }
847 847
 
848
-        if ( isset( $this->config[ $key ] ) ) {
849
-            return $this->config[ $key ];
848
+        if (isset($this->config[$key])) {
849
+            return $this->config[$key];
850 850
         }
851 851
 
852 852
         return false;
853 853
     }
854 854
 
855 855
     private function getFutttaFeeds($url) {
856
-        if ( $this->settings_screen_do_remote_http ) {
857
-            $rss = fetch_feed( $url );
856
+        if ($this->settings_screen_do_remote_http) {
857
+            $rss = fetch_feed($url);
858 858
             $maxitems = 0;
859 859
 
860
-            if ( ! is_wp_error( $rss ) ) {
861
-                $maxitems = $rss->get_item_quantity( 7 );
862
-                $rss_items = $rss->get_items( 0, $maxitems );
860
+            if (!is_wp_error($rss)) {
861
+                $maxitems = $rss->get_item_quantity(7);
862
+                $rss_items = $rss->get_items(0, $maxitems);
863 863
             }
864 864
             ?>
865 865
             <ul>
866
-                <?php if ( $maxitems == 0 ) : ?>
867
-                    <li><?php _e( 'No items', 'autoptimize' ); ?></li>
866
+                <?php if ($maxitems == 0) : ?>
867
+                    <li><?php _e('No items', 'autoptimize'); ?></li>
868 868
                 <?php else : ?>
869
-                    <?php foreach ( $rss_items as $item ) : ?>
869
+                    <?php foreach ($rss_items as $item) : ?>
870 870
                         <li>
871
-                            <a href="<?php echo esc_url( $item->get_permalink() ); ?>"
872
-                                title="<?php printf( __( 'Posted %s', 'autoptimize' ), $item->get_date('j F Y | g:i a') ); ?>">
873
-                                <?php echo esc_html( $item->get_title() ); ?>
871
+                            <a href="<?php echo esc_url($item->get_permalink()); ?>"
872
+                                title="<?php printf(__('Posted %s', 'autoptimize'), $item->get_date('j F Y | g:i a')); ?>">
873
+                                <?php echo esc_html($item->get_title()); ?>
874 874
                             </a>
875 875
                         </li>
876 876
                     <?php endforeach; ?>
@@ -883,23 +883,23 @@  discard block
 block discarded – undo
883 883
     // based on http://wordpress.stackexchange.com/a/58826
884 884
     static function ao_admin_tabs()
885 885
     {
886
-        $tabs = apply_filters( 'autoptimize_filter_settingsscreen_tabs' ,array( 'autoptimize' => __( 'JS, CSS  &amp; HTML', 'autoptimize' ) ) );
886
+        $tabs = apply_filters('autoptimize_filter_settingsscreen_tabs', array('autoptimize' => __('JS, CSS  &amp; HTML', 'autoptimize')));
887 887
         $tabContent = '';
888 888
         $tabs_count = count($tabs);
889
-        if ( $tabs_count > 1 ) {
890
-            if ( isset( $_GET['page'] ) ) {
889
+        if ($tabs_count > 1) {
890
+            if (isset($_GET['page'])) {
891 891
                 $currentId = $_GET['page'];
892 892
             } else {
893 893
                 $currentId = "autoptimize";
894 894
             }
895 895
             $tabContent .= '<h2 class="nav-tab-wrapper">';
896 896
             foreach ($tabs as $tabId => $tabName) {
897
-                if ( $currentId == $tabId ) {
897
+                if ($currentId == $tabId) {
898 898
                     $class = ' nav-tab-active';
899
-                } else{
899
+                } else {
900 900
                     $class = '';
901 901
                 }
902
-                $tabContent .= '<a class="nav-tab' . $class . '" href="?page=' . $tabId . '">' . $tabName . '</a>';
902
+                $tabContent .= '<a class="nav-tab'.$class.'" href="?page='.$tabId.'">'.$tabName.'</a>';
903 903
             }
904 904
             $tabContent .= '</h2>';
905 905
         } else {
@@ -916,7 +916,7 @@  discard block
 block discarded – undo
916 916
      */
917 917
     public static function is_admin_and_not_ajax()
918 918
     {
919
-        return ( is_admin() && ! self::doing_ajax() );
919
+        return (is_admin() && !self::doing_ajax());
920 920
     }
921 921
 
922 922
     /**
@@ -926,9 +926,9 @@  discard block
 block discarded – undo
926 926
      */
927 927
     protected static function doing_ajax()
928 928
     {
929
-        if ( function_exists( 'wp_doing_ajax' ) ) {
929
+        if (function_exists('wp_doing_ajax')) {
930 930
             return wp_doing_ajax();
931 931
         }
932
-        return ( defined( 'DOING_AJAX' ) && DOING_AJAX );
932
+        return (defined('DOING_AJAX') && DOING_AJAX);
933 933
     }
934 934
 }
Please login to merge, or discard this patch.
classes/external/php/yui-php-cssmin-bundled/Minifier.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
     public function __construct($raisePhpLimits = true)
73 73
     {
74 74
         $this->raisePhpLimits = (bool) $raisePhpLimits;
75
-        $this->memoryLimit = 128 * 1048576; // 128MB in bytes
76
-        $this->pcreBacktrackLimit = 1000 * 1000;
77
-        $this->pcreRecursionLimit = 500 * 1000;
75
+        $this->memoryLimit = 128*1048576; // 128MB in bytes
76
+        $this->pcreBacktrackLimit = 1000*1000;
77
+        $this->pcreRecursionLimit = 500*1000;
78 78
         $this->hexToNamedColorsMap = Colors::getHexToNamedMap();
79 79
         $this->namedToHexColorsMap = Colors::getNamedToHexMap();
80 80
         $this->namedToHexColorsRegex = sprintf(
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
      */
177 177
     private function setShortenZeroValuesRegexes()
178 178
     {
179
-        $zeroRegex = '0'. $this->unitsGroupRegex;
180
-        $numOrPosRegex = '('. $this->numRegex .'|top|left|bottom|right|center) ';
179
+        $zeroRegex = '0'.$this->unitsGroupRegex;
180
+        $numOrPosRegex = '('.$this->numRegex.'|top|left|bottom|right|center) ';
181 181
         $oneZeroSafeProperties = array(
182 182
             '(?:line-)?height',
183 183
             '(?:(?:min|max)-)?width',
@@ -195,14 +195,14 @@  discard block
 block discarded – undo
195 195
         );
196 196
 
197 197
         // First zero regex
198
-        $regex = '/(^|;)('. implode('|', $oneZeroSafeProperties) .'):%s/Si';
198
+        $regex = '/(^|;)('.implode('|', $oneZeroSafeProperties).'):%s/Si';
199 199
         $this->shortenOneZeroesRegex = sprintf($regex, $zeroRegex);
200 200
 
201 201
         // Multiple zeroes regexes
202 202
         $regex = '/(^|;)(margin|padding|border-(?:width|radius)|background-position):%s/Si';
203
-        $this->shortenTwoZeroesRegex = sprintf($regex, $numOrPosRegex . $zeroRegex);
204
-        $this->shortenThreeZeroesRegex = sprintf($regex, $numOrPosRegex . $numOrPosRegex . $zeroRegex);
205
-        $this->shortenFourZeroesRegex = sprintf($regex, $numOrPosRegex . $numOrPosRegex . $numOrPosRegex . $zeroRegex);
203
+        $this->shortenTwoZeroesRegex = sprintf($regex, $numOrPosRegex.$zeroRegex);
204
+        $this->shortenThreeZeroesRegex = sprintf($regex, $numOrPosRegex.$numOrPosRegex.$zeroRegex);
205
+        $this->shortenFourZeroesRegex = sprintf($regex, $numOrPosRegex.$numOrPosRegex.$numOrPosRegex.$zeroRegex);
206 206
     }
207 207
 
208 208
     /**
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
             $dataStartIndex = $matchStartIndex + 4; // url( length
390 390
             $searchOffset = $matchStartIndex + strlen($m[0][0]);
391 391
             $terminator = $m[1][0]; // ', " or empty (not quoted)
392
-            $terminatorRegex = '/(?<!\\\\)'. (strlen($terminator) === 0 ? '' : $terminator.'\s*') .'(\))/S';
392
+            $terminatorRegex = '/(?<!\\\\)'.(strlen($terminator) === 0 ? '' : $terminator.'\s*').'(\))/S';
393 393
 
394 394
             $ret .= substr($css, $substrOffset, $matchStartIndex - $substrOffset);
395 395
 
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
                     $token = preg_replace('/\s+/S', '', $token);
405 405
                 }
406 406
 
407
-                $ret .= 'url('. $this->registerPreservedToken(trim($token)) .')';
407
+                $ret .= 'url('.$this->registerPreservedToken(trim($token)).')';
408 408
             // No end terminator found, re-add the whole match. Should we throw/warn here?
409 409
             } else {
410 410
                 $ret .= substr($css, $matchStartIndex, $searchOffset - $matchStartIndex);
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
      */
426 426
     private function processCommentsCallback($matches)
427 427
     {
428
-        return '/*'. $this->registerCommentToken($matches[1]) .'*/';
428
+        return '/*'.$this->registerCommentToken($matches[1]).'*/';
429 429
     }
430 430
 
431 431
     /**
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
      */
436 436
     private function processOldIeSpecificMatrixDefinitionCallback($matches)
437 437
     {
438
-        return 'filter:progid:DXImageTransform.Microsoft.Matrix('. $this->registerPreservedToken($matches[1]) .')';
438
+        return 'filter:progid:DXImageTransform.Microsoft.Matrix('.$this->registerPreservedToken($matches[1]).')';
439 439
     }
440 440
 
441 441
     /**
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
         // minify alpha opacity in filter strings
459 459
         $match = str_ireplace('progid:DXImageTransform.Microsoft.Alpha(Opacity=', 'alpha(opacity=', $match);
460 460
 
461
-        return $quote . $this->registerPreservedToken($match) . $quote;
461
+        return $quote.$this->registerPreservedToken($match).$quote;
462 462
     }
463 463
 
464 464
     /**
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
      */
470 470
     private function processImportUnquotedUrlAtRulesCallback($matches)
471 471
     {
472
-        return '@import url('. $this->registerPreservedToken($matches[1]) .')'. $matches[2];
472
+        return '@import url('.$this->registerPreservedToken($matches[1]).')'.$matches[2];
473 473
     }
474 474
 
475 475
     /**
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
     private function processComments($css)
481 481
     {
482 482
         foreach ($this->comments as $commentId => $comment) {
483
-            $commentIdString = '/*'. $commentId .'*/';
483
+            $commentIdString = '/*'.$commentId.'*/';
484 484
 
485 485
             // ! in the first position of the comment means preserve
486 486
             // so push to the preserved tokens keeping the !
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
             $blockEndPos = strpos($css, '}', $blockStartPos);
532 532
             // When ending curly brace is missing, let's
533 533
             // behave like there was one at the end of the block...
534
-            if ( false === $blockEndPos ) {
534
+            if (false === $blockEndPos) {
535 535
                 $blockEndPos = strlen($css) - 1;
536 536
             }
537 537
             $nextBlockStartPos = strpos($css, '{', $blockStartPos + 1);
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
             } else {
544 544
                 $ruleBody = substr($css, $blockStartPos + 1, $blockEndPos - $blockStartPos - 1);
545 545
                 $ruleBodyToken = $this->registerRuleBodyToken($this->processRuleBody($ruleBody));
546
-                $ret .= '{'. $ruleBodyToken .'}';
546
+                $ret .= '{'.$ruleBodyToken.'}';
547 547
                 $searchOffset = $blockEndPos + 1;
548 548
             }
549 549
 
@@ -643,8 +643,8 @@  discard block
 block discarded – undo
643 643
         $body = preg_replace('/([ :,(])\+(\.?\d+)/S', '$1$2', $body);
644 644
 
645 645
         // shorten ms to s
646
-        $body = preg_replace_callback('/([ :,(])(-?)(\d{3,})ms/Si', function ($matches) {
647
-            return $matches[1] . $matches[2] . ((int) $matches[3] / 1000) .'s';
646
+        $body = preg_replace_callback('/([ :,(])(-?)(\d{3,})ms/Si', function($matches) {
647
+            return $matches[1].$matches[2].((int) $matches[3]/1000).'s';
648 648
         }, $body);
649 649
 
650 650
         // Remove leading zeros from integer and float numbers.
@@ -756,13 +756,13 @@  discard block
 block discarded – undo
756 756
         $css = preg_replace('/::(before|after|first-(?:line|letter))(\{|,)/Si', ':$1$2', $css);
757 757
 
758 758
         // Retain space for special IE6 cases
759
-        $css = preg_replace_callback('/:first-(line|letter)(\{|,)/Si', function ($matches) {
760
-            return ':first-'. strtolower($matches[1]) .' '. $matches[2];
759
+        $css = preg_replace_callback('/:first-(line|letter)(\{|,)/Si', function($matches) {
760
+            return ':first-'.strtolower($matches[1]).' '.$matches[2];
761 761
         }, $css);
762 762
 
763 763
         // Find a fraction that may used in some @media queries such as: (min-aspect-ratio: 1/1)
764 764
         // Add token to add the "/" back in later
765
-        $css = preg_replace('/\(([a-z-]+):([0-9]+)\/([0-9]+)\)/Si', '($1:$2'. self::QUERY_FRACTION .'$3)', $css);
765
+        $css = preg_replace('/\(([a-z-]+):([0-9]+)\/([0-9]+)\)/Si', '($1:$2'.self::QUERY_FRACTION.'$3)', $css);
766 766
 
767 767
         // Remove empty rule blocks up to 2 levels deep.
768 768
         $css = preg_replace(array_fill(0, 2, '/(\{)[^{};\/\n]+\{\}/S'), '$1', $css);
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
         }
811 811
 
812 812
         // @import handling
813
-        $css = preg_replace_callback($this->importRegex, function ($matches) use (&$imports) {
813
+        $css = preg_replace_callback($this->importRegex, function($matches) use (&$imports) {
814 814
             // Keep all @import at-rules found for later
815 815
             $imports .= $matches[0];
816 816
             // Delete all @import at-rules
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
         }, $css);
819 819
 
820 820
         // @namespace handling
821
-        $css = preg_replace_callback($this->namespaceRegex, function ($matches) use (&$namespaces) {
821
+        $css = preg_replace_callback($this->namespaceRegex, function($matches) use (&$namespaces) {
822 822
             // Keep all @namespace at-rules found for later
823 823
             $namespaces .= $matches[0];
824 824
             // Delete all @namespace at-rules
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
         // 1. @charset first
830 830
         // 2. @imports below @charset
831 831
         // 3. @namespaces below @imports
832
-        $css = $charset . $imports . $namespaces . $css;
832
+        $css = $charset.$imports.$namespaces.$css;
833 833
 
834 834
         return $css;
835 835
     }
@@ -883,10 +883,10 @@  discard block
 block discarded – undo
883 883
         // Restore space after rgb() or hsl() function in some cases such as:
884 884
         // background-image: linear-gradient(to bottom, rgb(210,180,140) 10%, rgb(255,0,0) 90%);
885 885
         if (!empty($terminator) && !preg_match('/[ ,);]/S', $terminator)) {
886
-            $terminator = ' '. $terminator;
886
+            $terminator = ' '.$terminator;
887 887
         }
888 888
 
889
-        return '#'. implode('', $hexColors) . $terminator;
889
+        return '#'.implode('', $hexColors).$terminator;
890 890
     }
891 891
 
892 892
     /**
@@ -900,16 +900,16 @@  discard block
 block discarded – undo
900 900
 
901 901
         // Shorten suitable 6 chars HEX colors
902 902
         if (strlen($hex) === 6 && preg_match('/^([0-9a-f])\1([0-9a-f])\2([0-9a-f])\3$/Si', $hex, $m)) {
903
-            $hex = $m[1] . $m[2] . $m[3];
903
+            $hex = $m[1].$m[2].$m[3];
904 904
         }
905 905
 
906 906
         // Lowercase
907
-        $hex = '#'. strtolower($hex);
907
+        $hex = '#'.strtolower($hex);
908 908
 
909 909
         // Replace Hex colors with shorter color names
910 910
         $color = array_key_exists($hex, $this->hexToNamedColorsMap) ? $this->hexToNamedColorsMap[$hex] : $hex;
911 911
 
912
-        return $color . $matches[2];
912
+        return $color.$matches[2];
913 913
     }
914 914
 
915 915
     /**
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
      */
921 921
     private function shortenNamedColorsCallback($matches)
922 922
     {
923
-        return $matches[1] . $this->namedToHexColorsMap[strtolower($matches[2])] . $matches[3];
923
+        return $matches[1].$this->namedToHexColorsMap[strtolower($matches[2])].$matches[3];
924 924
     }
925 925
 
926 926
     /**
Please login to merge, or discard this patch.