Completed
Push — master ( 733aa4...6c69cc )
by frank
02:38
created
classlesses/autoptimizeSpeedupper.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -88,13 +88,13 @@
 block discarded – undo
88 88
 }
89 89
 
90 90
 function ao_css_speedup_cleanup($cssin) {
91
-	// speedupper results in aggregated CSS not being minified, so the filestart-marker AO adds when aggregating need to be removed
92
-	return trim(str_replace(array('/*FILESTART*/','/*FILESTART2*/'),'',$cssin));
91
+    // speedupper results in aggregated CSS not being minified, so the filestart-marker AO adds when aggregating need to be removed
92
+    return trim(str_replace(array('/*FILESTART*/','/*FILESTART2*/'),'',$cssin));
93 93
 }
94 94
 
95 95
 function ao_js_speedup_cleanup($jsin) {
96
-	// cleanup
97
-	return trim($jsin);
96
+    // cleanup
97
+    return trim($jsin);
98 98
 }
99 99
 
100 100
 add_filter('autoptimize_css_individual_style','ao_css_snippetcache',10,2);
Please login to merge, or discard this patch.
classes/autoptimizeScripts.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -128,27 +128,27 @@  discard block
 block discarded – undo
128 128
                             // should we add flags?
129 129
                             foreach ($excludeJS as $exclTag => $exclFlags) {
130 130
                                 if ( strpos($origTag,$exclTag)!==false && in_array($exclFlags,array("async","defer")) ) {
131
-                                   $newTag = str_replace('<script ','<script '.$exclFlags.' ',$newTag);
131
+                                    $newTag = str_replace('<script ','<script '.$exclFlags.' ',$newTag);
132 132
                                 }
133 133
                             }
134 134
                         }
135 135
                         
136
-   						// should we minify the non-aggregated script?
137
-						if ($path && apply_filters('autoptimize_filter_js_minify_excluded',false)) {
138
-							$_CachedMinifiedUrl = $this->minify_single($path);
136
+                            // should we minify the non-aggregated script?
137
+                        if ($path && apply_filters('autoptimize_filter_js_minify_excluded',false)) {
138
+                            $_CachedMinifiedUrl = $this->minify_single($path);
139 139
 
140
-							// replace orig URL with minified URL from cache if so
141
-							if (!empty($_CachedMinifiedUrl)) {
142
-								$newTag = str_replace($url, $_CachedMinifiedUrl, $newTag);
143
-							}
140
+                            // replace orig URL with minified URL from cache if so
141
+                            if (!empty($_CachedMinifiedUrl)) {
142
+                                $newTag = str_replace($url, $_CachedMinifiedUrl, $newTag);
143
+                            }
144 144
 							
145
-							// remove querystring from URL in newTag
146
-							if ( !empty($explUrl[1]) ) {
147
-								$newTag = str_replace("?".$explUrl[1],"",$newTag);
148
-							}
149
-						}
145
+                            // remove querystring from URL in newTag
146
+                            if ( !empty($explUrl[1]) ) {
147
+                                $newTag = str_replace("?".$explUrl[1],"",$newTag);
148
+                            }
149
+                        }
150 150
 
151
-						// should we move the non-aggregated script?
151
+                        // should we move the non-aggregated script?
152 152
                         if( $this->ismovable($newTag) ) {
153 153
                             // can be moved, flags and all
154 154
                             if( $this->movetolast($newTag) )    {
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         
262 262
         //$this->jscode has all the uncompressed code now.
263 263
         if ($this->alreadyminified!==true) {
264
-          if (class_exists('JSMin') && apply_filters( 'autoptimize_js_do_minify' , true)) {
264
+            if (class_exists('JSMin') && apply_filters( 'autoptimize_js_do_minify' , true)) {
265 265
             if (@is_callable(array("JSMin","minify"))) {
266 266
                 $tmp_jscode = trim(JSMin::minify($this->jscode));
267 267
                 if (!empty($tmp_jscode)) {
@@ -275,10 +275,10 @@  discard block
 block discarded – undo
275 275
                 $this->jscode = $this->inject_minified($this->jscode);
276 276
                 return false;
277 277
             }
278
-          } else {
279
-              $this->jscode = $this->inject_minified($this->jscode);
280
-              return false;
281
-          }
278
+            } else {
279
+                $this->jscode = $this->inject_minified($this->jscode);
280
+                return false;
281
+            }
282 282
         }
283 283
         $this->jscode = apply_filters( 'autoptimize_js_after_minify', $this->jscode );
284 284
         return true;
@@ -341,8 +341,8 @@  discard block
 block discarded – undo
341 341
     
342 342
     // Checks against the white- and blacklists
343 343
     private function ismergeable($tag) {
344
-		if (apply_filters('autoptimize_filter_js_dontaggregate',false)) {
345
-			return false;
344
+        if (apply_filters('autoptimize_filter_js_dontaggregate',false)) {
345
+            return false;
346 346
         } else if (!empty($this->whitelist)) {
347 347
             foreach ($this->whitelist as $match) {
348 348
                 if(strpos($tag,$match)!==false) {
@@ -450,15 +450,15 @@  discard block
 block discarded – undo
450 450
      * 
451 451
      * @param string $jsPath
452 452
      * @return bool
453
-	 */
454
-	private function can_inject_late($jsPath) {
455
-		$consider_minified_array = apply_filters('autoptimize_filter_js_consider_minified',false);
453
+     */
454
+    private function can_inject_late($jsPath) {
455
+        $consider_minified_array = apply_filters('autoptimize_filter_js_consider_minified',false);
456 456
         if ( $this->inject_min_late !== true ) {
457 457
             // late-inject turned off
458 458
             return false;
459 459
         } else if ( (strpos($jsPath,"min.js") === false) && ( strpos($jsPath,"wp-includes/js/jquery/jquery.js") === false ) && ( str_replace($consider_minified_array, '', $jsPath) === $jsPath ) ) {
460
-			// file not minified based on filename & filter
461
-			return false;
460
+            // file not minified based on filename & filter
461
+            return false;
462 462
         } else {
463 463
             // phew, all is safe, we can late-inject
464 464
             return true;
Please login to merge, or discard this patch.
autoptimize.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -132,21 +132,21 @@
 block discarded – undo
132 132
         $ao_noptimize = true;
133 133
     }
134 134
 
135
-	// if setting says not to optimize logged in user and user is logged in
136
-	if ( get_option('autoptimize_optimize_logged','on') !== 'on' && is_user_logged_in() && current_user_can('edit_posts') ) {
137
-		$ao_noptimize = true;
138
-	}
139
-
140
-	// if setting says not to optimize cart/ checkout
141
-	if ( get_option('autoptimize_optimize_checkout','on') !== 'on' ) {
142
-		// checking for woocommerce, easy digital downloads and wp ecommerce
143
-		foreach ( array("is_checkout","is_cart","edd_is_checkout","wpsc_is_cart","wpsc_is_checkout") as $shopCond ) {
144
-			if ( function_exists($shopCond) && $shopCond() ) {
145
-				$ao_noptimize = true;
146
-				break;
147
-			}
148
-		}
149
-	}
135
+    // if setting says not to optimize logged in user and user is logged in
136
+    if ( get_option('autoptimize_optimize_logged','on') !== 'on' && is_user_logged_in() && current_user_can('edit_posts') ) {
137
+        $ao_noptimize = true;
138
+    }
139
+
140
+    // if setting says not to optimize cart/ checkout
141
+    if ( get_option('autoptimize_optimize_checkout','on') !== 'on' ) {
142
+        // checking for woocommerce, easy digital downloads and wp ecommerce
143
+        foreach ( array("is_checkout","is_cart","edd_is_checkout","wpsc_is_cart","wpsc_is_checkout") as $shopCond ) {
144
+            if ( function_exists($shopCond) && $shopCond() ) {
145
+                $ao_noptimize = true;
146
+                break;
147
+            }
148
+        }
149
+    }
150 150
 
151 151
     // filter you can use to block autoptimization on your own terms
152 152
     $ao_noptimize = (bool) apply_filters( 'autoptimize_filter_noptimize', $ao_noptimize );
Please login to merge, or discard this patch.
classes/autoptimizeConfig.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -345,8 +345,8 @@  discard block
 block discarded – undo
345 345
 		</td>
346 346
 	</tr>
347 347
 	<?php
348
-		if ( function_exists("is_checkout") || function_exists("is_cart") || function_exists("edd_is_checkout") || function_exists("wpsc_is_cart") || function_exists("wpsc_is_checkout") ) {
349
-			?>
348
+        if ( function_exists("is_checkout") || function_exists("is_cart") || function_exists("edd_is_checkout") || function_exists("wpsc_is_cart") || function_exists("wpsc_is_checkout") ) {
349
+            ?>
350 350
 				<tr valign="top" class="<?php echo $hiddenClass;?>ao_adv">
351 351
 					<th scope="row"><?php _e('Also optimize shop cart/ checkout?','autoptimize'); ?></th>
352 352
 					<td><label class="cb_label"><input type="checkbox" name="autoptimize_optimize_checkout" <?php echo get_option('autoptimize_optimize_checkout','1')?'checked="checked" ':''; ?>/>
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
 					</td>
355 355
 				</tr>
356 356
 			<?php
357
-		}
358
-	?>
357
+        }
358
+    ?>
359 359
 </table>
360 360
 </li>
361 361
 
Please login to merge, or discard this patch.