Completed
Push — master ( 378079...9c48f6 )
by frank
02:31
created
classes/autoptimizeBase.php 1 patch
Braces   +10 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
 abstract class autoptimizeBase {
5 8
     protected $content = '';
@@ -122,7 +125,9 @@  discard block
 block discarded – undo
122 125
         $out = parse_url($in,PHP_URL_HOST);
123 126
         
124 127
         // fallback if parse_url does not understand the url is in fact a url
125
-        if (empty($out)) $out=$in;
128
+        if (empty($out)) {
129
+            $out=$in;
130
+        }
126 131
         
127 132
         return $out;
128 133
     }
@@ -359,7 +364,9 @@  discard block
 block discarded – undo
359 364
 		
360 365
 		// read file, return false if empty
361 366
 		$_toMinify = file_get_contents($pathIn);
362
-		if ( empty($_toMinify) ) return false;
367
+		if ( empty($_toMinify) ) {
368
+		    return false;
369
+		}
363 370
 		
364 371
 		// check cache
365 372
 		$_md5hash = "single_".md5($_toMinify);
Please login to merge, or discard this patch.
classes/autoptimizeScripts.php 1 patch
Braces   +10 added lines, -4 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 autoptimizeScripts extends autoptimizeBase {
5 8
     private $scripts = array();
@@ -22,7 +25,9 @@  discard block
 block discarded – undo
22 25
     //Reads the page and collects script tags
23 26
     public function read($options) {
24 27
         $noptimizeJS = apply_filters( 'autoptimize_filter_js_noptimize', false, $this->content );
25
-        if ($noptimizeJS) return false;
28
+        if ($noptimizeJS) {
29
+            return false;
30
+        }
26 31
 
27 32
         // only optimize known good JS?
28 33
         $whitelistJS = apply_filters( 'autoptimize_filter_js_whitelist', '', $this->content );
@@ -75,8 +80,9 @@  discard block
 block discarded – undo
75 80
         }
76 81
 
77 82
         //Should we add try-catch?
78
-        if($options['trycatch'] == true)
79
-            $this->trycatch = true;
83
+        if($options['trycatch'] == true) {
84
+                    $this->trycatch = true;
85
+        }
80 86
 
81 87
         // force js in head?    
82 88
         if($options['forcehead'] == true) {
Please login to merge, or discard this patch.
classes/autoptimizeStyles.php 1 patch
Braces   +11 added lines, -5 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 autoptimizeStyles extends autoptimizeBase {
5 8
 
@@ -24,7 +27,9 @@  discard block
 block discarded – undo
24 27
     //Reads the page and collects style tags
25 28
     public function read($options) {
26 29
         $noptimizeCSS = apply_filters( 'autoptimize_filter_css_noptimize', false, $this->content );
27
-        if ($noptimizeCSS) return false;
30
+        if ($noptimizeCSS) {
31
+            return false;
32
+        }
28 33
 
29 34
         $whitelistCSS = apply_filters( 'autoptimize_filter_css_whitelist', '', $this->content );
30 35
         if (!empty($whitelistCSS)) {
@@ -139,7 +144,7 @@  discard block
 block discarded – undo
139 144
                         if($path!==false && preg_match('#\.css$#',$path)) {
140 145
                             // Good link
141 146
                             $this->css[] = array($media,$path);
142
-                        }else{
147
+                        } else{
143 148
                             // Link is dynamic (.php etc)
144 149
                             $tag = '';
145 150
                         }
@@ -228,8 +233,9 @@  discard block
 block discarded – undo
228 233
             }
229 234
             
230 235
             foreach($media as $elem) {
231
-                if(!isset($this->csscode[$elem]))
232
-                    $this->csscode[$elem] = '';
236
+                if(!isset($this->csscode[$elem])) {
237
+                                    $this->csscode[$elem] = '';
238
+                }
233 239
                 $this->csscode[$elem] .= "\n/*FILESTART*/".$css;
234 240
             }
235 241
         }
Please login to merge, or discard this patch.
classlesses/autoptimizeSpeedupper.php 1 patch
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@
 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
 /*
5 8
 * Autoptimize SpeedUp; minify & cache each JS/ CSS separately
Please login to merge, or discard this patch.