Completed
Push — master ( f13c3a...0e2b84 )
by frank
02:45
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/autoptimizeUpdateCode.php 1 patch
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,10 @@
 block discarded – undo
3 3
 * below code handles updates and is only included by autoptimize.php if/ when needed
4 4
 */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
6
+if ( ! defined( 'ABSPATH' ) ) {
7
+    exit;
8
+}
9
+// Exit if accessed directly
7 10
 
8 11
 $majorUp = false;        
9 12
 $autoptimize_major_version=substr($autoptimize_db_version,0,3);
Please login to merge, or discard this patch.
classlesses/autoptimizePartners.php 1 patch
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,10 @@
 block discarded – undo
3 3
 Classlessly add a "more tools" tab to promote (future) AO addons and/ or affiliate services
4 4
 */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
6
+if ( ! defined( 'ABSPATH' ) ) {
7
+    exit;
8
+}
9
+// Exit if accessed directly
7 10
 
8 11
 add_action('admin_init', 'ao_partner_tabs_preinit');
9 12
 function ao_partner_tabs_preinit() {
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
@@ -4,7 +4,10 @@
 block discarded – undo
4 4
 * new in Autoptimize 2.2
5 5
 */
6 6
 
7
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
7
+if ( ! defined( 'ABSPATH' ) ) {
8
+    exit;
9
+}
10
+// Exit if accessed directly
8 11
 
9 12
 function ao_js_snippetcache($jsin,$jsfilename) {
10 13
     $md5hash = "snippet_".md5($jsin);
Please login to merge, or discard this patch.
classlesses/autoptimizePageCacheFlush.php 1 patch
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,10 @@
 block discarded – undo
2 2
 // flush as many page cache plugin's caches as possible
3 3
 // hyper cache and gator cache hook into AO, so we don't need to :-)
4 4
 
5
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
5
+if ( ! defined( 'ABSPATH' ) ) {
6
+    exit;
7
+}
8
+// Exit if accessed directly
6 9
 
7 10
 function autoptimize_flush_pagecache() {
8 11
     if(function_exists('wp_cache_clear_cache')) {
Please login to merge, or discard this patch.