@@ -162,32 +162,32 @@ discard block |
||
| 162 | 162 | // Remove the original style tag |
| 163 | 163 | $this->content = str_replace($tag,'',$this->content); |
| 164 | 164 | } else {
|
| 165 | - // excluded CSS, minify if getpath |
|
| 166 | - if (preg_match('#<link.*href=("|\')(.*)("|\')#Usmi',$tag,$source)) {
|
|
| 167 | - $explUrl = explode('?',$source[2],2);
|
|
| 165 | + // excluded CSS, minify if getpath |
|
| 166 | + if (preg_match('#<link.*href=("|\')(.*)("|\')#Usmi',$tag,$source)) {
|
|
| 167 | + $explUrl = explode('?',$source[2],2);
|
|
| 168 | 168 | $url = $explUrl[0]; |
| 169 | 169 | $path = $this->getpath($url); |
| 170 | 170 | |
| 171 | - if ($path && apply_filters('autoptimize_filter_css_minify_excluded',false)) {
|
|
| 172 | - $_CachedMinifiedUrl = $this->minify_single($path); |
|
| 173 | - |
|
| 174 | - if (!empty($_CachedMinifiedUrl)) {
|
|
| 175 | - // replace orig URL with URL to cache |
|
| 176 | - $newTag = str_replace($url, $_CachedMinifiedUrl, $tag); |
|
| 177 | - } else {
|
|
| 178 | - $newTag = $tag; |
|
| 179 | - } |
|
| 171 | + if ($path && apply_filters('autoptimize_filter_css_minify_excluded',false)) {
|
|
| 172 | + $_CachedMinifiedUrl = $this->minify_single($path); |
|
| 173 | + |
|
| 174 | + if (!empty($_CachedMinifiedUrl)) {
|
|
| 175 | + // replace orig URL with URL to cache |
|
| 176 | + $newTag = str_replace($url, $_CachedMinifiedUrl, $tag); |
|
| 177 | + } else {
|
|
| 178 | + $newTag = $tag; |
|
| 179 | + } |
|
| 180 | 180 | |
| 181 | - // remove querystring from URL |
|
| 182 | - if ( !empty($explUrl[1]) ) {
|
|
| 183 | - $newTag = str_replace("?".$explUrl[1],"",$newTag);
|
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - // and replace |
|
| 187 | - $this->content = str_replace($tag,$newTag,$this->content); |
|
| 188 | - } |
|
| 189 | - } |
|
| 190 | - } |
|
| 181 | + // remove querystring from URL |
|
| 182 | + if ( !empty($explUrl[1]) ) {
|
|
| 183 | + $newTag = str_replace("?".$explUrl[1],"",$newTag);
|
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + // and replace |
|
| 187 | + $this->content = str_replace($tag,$newTag,$this->content); |
|
| 188 | + } |
|
| 189 | + } |
|
| 190 | + } |
|
| 191 | 191 | } |
| 192 | 192 | return true; |
| 193 | 193 | } |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | // just cdn the URL if applicable |
| 405 | 405 | if (!empty($this->cdn_url)) {
|
| 406 | 406 | $imgreplace[$matches[0][$count]] = str_replace($quotedurl,$this->maybe_cdn_urls($quotedurl),$matches[0][$count]); |
| 407 | - } |
|
| 407 | + } |
|
| 408 | 408 | } |
| 409 | 409 | } |
| 410 | 410 | } else if ((is_array($matches)) && (!empty($this->cdn_url))) {
|
@@ -611,8 +611,8 @@ discard block |
||
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | private function ismovable($tag) {
|
| 614 | - if (apply_filters('autoptimize_filter_css_dontaggregate',false)) {
|
|
| 615 | - return false; |
|
| 614 | + if (apply_filters('autoptimize_filter_css_dontaggregate',false)) {
|
|
| 615 | + return false; |
|
| 616 | 616 | } else if (!empty($this->whitelist)) {
|
| 617 | 617 | foreach ($this->whitelist as $match) {
|
| 618 | 618 | if(strpos($tag,$match)!==false) {
|
@@ -284,8 +284,8 @@ discard block |
||
| 284 | 284 | // Normalize all whitespace strings to single spaces. Easier to work with that way. |
| 285 | 285 | $css = preg_replace('/\s+/', ' ', $css); |
| 286 | 286 | |
| 287 | - // Fix IE7 issue on matrix filters which browser accept whitespaces between Matrix parameters |
|
| 288 | - $css = preg_replace_callback('/\s*filter\:\s*progid:DXImageTransform\.Microsoft\.Matrix\(([^\)]+)\)/', array($this, 'preserve_old_IE_specific_matrix_definition'), $css); |
|
| 287 | + // Fix IE7 issue on matrix filters which browser accept whitespaces between Matrix parameters |
|
| 288 | + $css = preg_replace_callback('/\s*filter\:\s*progid:DXImageTransform\.Microsoft\.Matrix\(([^\)]+)\)/', array($this, 'preserve_old_IE_specific_matrix_definition'), $css); |
|
| 289 | 289 | |
| 290 | 290 | // Shorten & preserve calculations calc(...) since spaces are important |
| 291 | 291 | $css = preg_replace_callback('/calc(\(((?:[^\(\)]+|(?1))*)\))/i', array($this, 'replace_calc'), $css); |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | // Add "/" back to fix Opera -o-device-pixel-ratio query |
| 389 | 389 | $css = preg_replace('/'. self::QUERY_FRACTION .'/', '/', $css); |
| 390 | 390 | |
| 391 | - // Replace multiple semi-colons in a row by a single one |
|
| 391 | + // Replace multiple semi-colons in a row by a single one |
|
| 392 | 392 | // See SF bug #1980989 |
| 393 | 393 | $css = preg_replace('/;;+/', ';', $css); |
| 394 | 394 | |
@@ -603,10 +603,10 @@ discard block |
||
| 603 | 603 | return 'calc('. self::TOKEN . (count($this->preserved_tokens) - 1) . '___' . ')'; |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | - private function preserve_old_IE_specific_matrix_definition($matches) |
|
| 607 | - { |
|
| 608 | - $this->preserved_tokens[] = $matches[1]; |
|
| 609 | - return 'filter:progid:DXImageTransform.Microsoft.Matrix(' . self::TOKEN . (count($this->preserved_tokens) - 1) . '___' . ')'; |
|
| 606 | + private function preserve_old_IE_specific_matrix_definition($matches) |
|
| 607 | + { |
|
| 608 | + $this->preserved_tokens[] = $matches[1]; |
|
| 609 | + return 'filter:progid:DXImageTransform.Microsoft.Matrix(' . self::TOKEN . (count($this->preserved_tokens) - 1) . '___' . ')'; |
|
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | private function rgb_to_hex($matches) |