@@ -1,5 +1,8 @@ discard block |
||
| 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 | |
@@ -25,7 +28,9 @@ discard block |
||
| 25 | 28 | //Reads the page and collects style tags |
| 26 | 29 | public function read($options) {
|
| 27 | 30 | $noptimizeCSS = apply_filters( 'autoptimize_filter_css_noptimize', false, $this->content ); |
| 28 | - if ($noptimizeCSS) return false; |
|
| 31 | + if ($noptimizeCSS) { |
|
| 32 | + return false; |
|
| 33 | + } |
|
| 29 | 34 | |
| 30 | 35 | $whitelistCSS = apply_filters( 'autoptimize_filter_css_whitelist', '' ); |
| 31 | 36 | if (!empty($whitelistCSS)) {
|
@@ -139,7 +144,7 @@ discard block |
||
| 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 | } |
@@ -202,8 +207,9 @@ discard block |
||
| 202 | 207 | } |
| 203 | 208 | |
| 204 | 209 | foreach($media as $elem) {
|
| 205 | - if(!isset($this->csscode[$elem])) |
|
| 206 | - $this->csscode[$elem] = ''; |
|
| 210 | + if(!isset($this->csscode[$elem])) { |
|
| 211 | + $this->csscode[$elem] = ''; |
|
| 212 | + } |
|
| 207 | 213 | $this->csscode[$elem] .= "\n/*FILESTART*/".$css; |
| 208 | 214 | } |
| 209 | 215 | } |
@@ -1,5 +1,8 @@ |
||
| 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 | class autoptimizeToolbar |
| 4 | 7 | { |
| 5 | 8 | public function __construct() |
@@ -1,5 +1,8 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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); |