Breeze – WordPress Cache Plugin - Version 1.0.12

Version Description

  • Fix: Deprecated create_function
Download this release

Release Info

Developer adeelkhan
Plugin Icon 128x128 Breeze – WordPress Cache Plugin
Version 1.0.12
Comparing to
See all releases

Code changes from version 1.0.11 to 1.0.12

breeze.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Breeze
4
  * Description: Breeze is a WordPress cache plugin with extensive options to speed up your website. All the options including Varnish Cache are compatible with Cloudways hosting.
5
- * Version: 1.0.11
6
  * Text Domain: breeze
7
  * Domain Path: /languages
8
  * Author: Cloudways
2
  /**
3
  * Plugin Name: Breeze
4
  * Description: Breeze is a WordPress cache plugin with extensive options to speed up your website. All the options including Varnish Cache are compatible with Cloudways hosting.
5
+ * Version: 1.0.12
6
  * Text Domain: breeze
7
  * Domain Path: /languages
8
  * Author: Cloudways
inc/minification/breeze-minification-base.php CHANGED
@@ -123,10 +123,10 @@ abstract class Breeze_MinificationBase {
123
  if ( preg_match( '/<!--\s?noptimize\s?-->/', $noptimize_in ) ) {
124
  $noptimize_out = preg_replace_callback(
125
  '#<!--\s?noptimize\s?-->.*?<!--\s?/\s?noptimize\s?-->#is',
126
- create_function(
127
- '$matches',
128
- 'return "%%NOPTIMIZE".breeze_HASH."%%".base64_encode($matches[0])."%%NOPTIMIZE%%";'
129
- ),
130
  $noptimize_in
131
  );
132
  } else {
@@ -140,10 +140,10 @@ abstract class Breeze_MinificationBase {
140
  if ( strpos( $noptimize_in, '%%NOPTIMIZE%%' ) !== false ) {
141
  $noptimize_out = preg_replace_callback(
142
  '#%%NOPTIMIZE'.breeze_HASH.'%%(.*?)%%NOPTIMIZE%%#is',
143
- create_function(
144
- '$matches',
145
- 'return base64_decode($matches[1]);'
146
- ),
147
  $noptimize_in
148
  );
149
  } else {
@@ -156,10 +156,11 @@ abstract class Breeze_MinificationBase {
156
  if ( strpos( $iehacks_in, '<!--[if' ) !== false ) {
157
  $iehacks_out = preg_replace_callback(
158
  '#<!--\[if.*?\[endif\]-->#is',
159
- create_function(
160
- '$matches',
161
- 'return "%%IEHACK".breeze_HASH."%%".base64_encode($matches[0])."%%IEHACK%%";'
162
- ),
 
163
  $iehacks_in
164
  );
165
  } else {
@@ -172,10 +173,10 @@ abstract class Breeze_MinificationBase {
172
  if ( strpos( $iehacks_in, '%%IEHACK%%' ) !== false ) {
173
  $iehacks_out = preg_replace_callback(
174
  '#%%IEHACK'.breeze_HASH.'%%(.*?)%%IEHACK%%#is',
175
- create_function(
176
- '$matches',
177
- 'return base64_decode($matches[1]);'
178
- ),
179
  $iehacks_in
180
  );
181
  } else {
@@ -188,10 +189,10 @@ abstract class Breeze_MinificationBase {
188
  if ( strpos( $comments_in, '<!--' ) !== false ) {
189
  $comments_out = preg_replace_callback(
190
  '#<!--.*?-->#is',
191
- create_function(
192
- '$matches',
193
- 'return "%%COMMENTS".breeze_HASH."%%".base64_encode($matches[0])."%%COMMENTS%%";'
194
- ),
195
  $comments_in
196
  );
197
  } else {
@@ -204,10 +205,10 @@ abstract class Breeze_MinificationBase {
204
  if ( strpos( $comments_in, '%%COMMENTS%%' ) !== false ) {
205
  $comments_out = preg_replace_callback(
206
  '#%%COMMENTS'.breeze_HASH.'%%(.*?)%%COMMENTS%%#is',
207
- create_function(
208
- '$matches',
209
- 'return base64_decode($matches[1]);'
210
- ),
211
  $comments_in
212
  );
213
  } else {
@@ -278,9 +279,9 @@ abstract class Breeze_MinificationBase {
278
  if ( strpos( $in, '%%INJECTLATER%%' ) !== false ) {
279
  $out = preg_replace_callback(
280
  '#%%INJECTLATER'.breeze_HASH.'%%(.*?)%%INJECTLATER%%#is',
281
- create_function(
282
- '$matches',
283
- '$filepath=base64_decode(strtok($matches[1],"|"));
284
  $filecontent=file_get_contents($filepath);
285
 
286
  // remove BOM
@@ -307,9 +308,9 @@ abstract class Breeze_MinificationBase {
307
  $filecontent=Breeze_MinificationStyles::fixurls($filepath,$filecontent);
308
  }
309
 
310
- // return
311
- return "\n".$filecontent;'
312
- ),
313
  $in
314
  );
315
  } else {
123
  if ( preg_match( '/<!--\s?noptimize\s?-->/', $noptimize_in ) ) {
124
  $noptimize_out = preg_replace_callback(
125
  '#<!--\s?noptimize\s?-->.*?<!--\s?/\s?noptimize\s?-->#is',
126
+
127
+ function($matches){
128
+ return "%%NOPTIMIZE".breeze_HASH."%%".base64_encode($matches[0])."%%NOPTIMIZE%%";
129
+ },
130
  $noptimize_in
131
  );
132
  } else {
140
  if ( strpos( $noptimize_in, '%%NOPTIMIZE%%' ) !== false ) {
141
  $noptimize_out = preg_replace_callback(
142
  '#%%NOPTIMIZE'.breeze_HASH.'%%(.*?)%%NOPTIMIZE%%#is',
143
+
144
+ function($matches){
145
+ return base64_decode($matches[1]);
146
+ },
147
  $noptimize_in
148
  );
149
  } else {
156
  if ( strpos( $iehacks_in, '<!--[if' ) !== false ) {
157
  $iehacks_out = preg_replace_callback(
158
  '#<!--\[if.*?\[endif\]-->#is',
159
+
160
+ function($matches){
161
+ return "%%IEHACK".breeze_HASH."%%".base64_encode($matches[0])."%%IEHACK%%";
162
+ },
163
+
164
  $iehacks_in
165
  );
166
  } else {
173
  if ( strpos( $iehacks_in, '%%IEHACK%%' ) !== false ) {
174
  $iehacks_out = preg_replace_callback(
175
  '#%%IEHACK'.breeze_HASH.'%%(.*?)%%IEHACK%%#is',
176
+
177
+ function($matches){
178
+ return base64_decode($matches[1]);
179
+ },
180
  $iehacks_in
181
  );
182
  } else {
189
  if ( strpos( $comments_in, '<!--' ) !== false ) {
190
  $comments_out = preg_replace_callback(
191
  '#<!--.*?-->#is',
192
+
193
+ function($matches){
194
+ return "%%COMMENTS".breeze_HASH."%%".base64_encode($matches[0])."%%COMMENTS%%";
195
+ },
196
  $comments_in
197
  );
198
  } else {
205
  if ( strpos( $comments_in, '%%COMMENTS%%' ) !== false ) {
206
  $comments_out = preg_replace_callback(
207
  '#%%COMMENTS'.breeze_HASH.'%%(.*?)%%COMMENTS%%#is',
208
+
209
+ function($matches){
210
+ return base64_decode($matches[1]);
211
+ },
212
  $comments_in
213
  );
214
  } else {
279
  if ( strpos( $in, '%%INJECTLATER%%' ) !== false ) {
280
  $out = preg_replace_callback(
281
  '#%%INJECTLATER'.breeze_HASH.'%%(.*?)%%INJECTLATER%%#is',
282
+
283
+ function($matches){
284
+ $filepath=base64_decode(strtok($matches[1],"|"));
285
  $filecontent=file_get_contents($filepath);
286
 
287
  // remove BOM
308
  $filecontent=Breeze_MinificationStyles::fixurls($filepath,$filecontent);
309
  }
310
 
311
+ // return
312
+ return "\n".$filecontent;
313
+ },
314
  $in
315
  );
316
  } else {
inc/minification/breeze-minification-styles.php CHANGED
@@ -3,7 +3,6 @@
3
  * Based on some work of autoptimize plugin
4
  */
5
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
6
-
7
  class Breeze_MinificationStyles extends Breeze_MinificationBase {
8
  private $css = array();
9
  private $csscode = array();
@@ -27,17 +26,14 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
27
  private $css_min_arr = array();
28
  private $issetminfile = false;
29
  private $url_group_arr = array();
30
-
31
  //Reads the page and collects style tags
32
  public function read($options) {
33
  $noptimizeCSS = apply_filters( 'breeze_filter_css_noptimize', false, $this->content );
34
  if ($noptimizeCSS) return false;
35
-
36
  $whitelistCSS = apply_filters( 'breeze_filter_css_whitelist', '' );
37
  if (!empty($whitelistCSS)) {
38
  $this->whitelist = array_filter(array_map('trim',explode(",",$whitelistCSS)));
39
  }
40
-
41
  if ($options['nogooglefont'] == true) {
42
  $removableCSS = "fonts.googleapis.com";
43
  } else {
@@ -47,24 +43,19 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
47
  if (!empty($removableCSS)) {
48
  $this->cssremovables = array_filter(array_map('trim',explode(",",$removableCSS)));
49
  }
50
-
51
  $this->cssinlinesize = apply_filters('breeze_filter_css_inlinesize',256);
52
-
53
  // filter to "late inject minified CSS", default to true for now (it is faster)
54
  $this->inject_min_late = apply_filters('breeze_filter_css_inject_min_late',true);
55
-
56
  // Remove everything that's not the header
57
  if ( apply_filters('breeze_filter_css_justhead',$options['justhead']) == true ) {
58
  $content = explode('</head>',$this->content,2);
59
  $this->content = $content[0].'</head>';
60
  $this->restofcontent = $content[1];
61
  }
62
-
63
  // include inline?
64
  if( apply_filters('breeze_css_include_inline',$options['include_inline']) == true ) {
65
  $this->include_inline = true;
66
  }
67
-
68
  // group css?
69
  if( apply_filters('breeze_css_include_inline',$options['groupcss']) == true ) {
70
  $this->group_css = true;
@@ -81,48 +72,37 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
81
  } else {
82
  $this->dontmove = "";
83
  }
84
-
85
  // should we defer css?
86
  // value: true/ false
87
  $this->defer = $options['defer'];
88
  $this->defer = apply_filters( 'breeze_filter_css_defer', $this->defer );
89
-
90
  // should we inline while deferring?
91
  // value: inlined CSS
92
  $this->defer_inline = $options['defer_inline'];
93
-
94
  // should we inline?
95
  // value: true/ false
96
  $this->inline = $options['inline'];
97
  $this->inline = apply_filters( 'breeze_filter_css_inline', $this->inline );
98
-
99
  // get cdn url
100
  $this->cdn_url = $options['cdn_url'];
101
-
102
  // Store data: URIs setting for later use
103
  $this->datauris = $options['datauris'];
104
-
105
  // noptimize me
106
  $this->content = $this->hide_noptimize($this->content);
107
-
108
  // exclude (no)script, as those may contain CSS which should be left as is
109
  if ( strpos( $this->content, '<script' ) !== false ) {
110
  $this->content = preg_replace_callback(
111
  '#<(?:no)?script.*?<\/(?:no)?script>#is',
112
- create_function(
113
- '$matches',
114
- 'return "%%SCRIPT".breeze_HASH."%%".base64_encode($matches[0])."%%SCRIPT%%";'
115
- ),
116
  $this->content
117
  );
118
  }
119
-
120
  // Save IE hacks
121
  $this->content = $this->hide_iehacks($this->content);
122
-
123
  // hide comments
124
  $this->content = $this->hide_comments($this->content);
125
-
126
  // Get <style> and <link>
127
  if(preg_match_all('#(<style[^>]*>.*</style>)|(<link[^>]*stylesheet[^>]*>)#Usmi',$this->content,$matches)) {
128
  foreach($matches[0] as $tag) {
@@ -143,7 +123,6 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
143
  $media = array('all');
144
  }
145
  $media = apply_filters( 'breeze_filter_css_tagmedia',$media,$tag );
146
-
147
  if(preg_match('#<link.*href=("|\')(.*)("|\')#Usmi',$tag,$source)) {
148
  // <link>
149
  $url = current(explode('?',$source[2],2));
@@ -151,9 +130,7 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
151
  if(in_array($url,$this->custom_css_exclude)){
152
  continue;
153
  }
154
-
155
  $path = $this->getpath($url);
156
-
157
  if($path!==false && preg_match('#\.css$#',$path)) {
158
  // Good link
159
  $this->css[] = array($media,$path);
@@ -165,10 +142,8 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
165
  // inline css in style tags can be wrapped in comment tags, so restore comments
166
  $tag = $this->restore_comments($tag);
167
  preg_match('#<style.*>(.*)</style>#Usmi',$tag,$code);
168
-
169
  // and re-hide them to be able to to the removal based on tag
170
  $tag = $this->hide_comments($tag);
171
-
172
  if ( $this->include_inline ) {
173
  $code = preg_replace('#^.*<!\[CDATA\[(?:\s*\*/)?(.*)(?://|/\*)\s*?\]\]>.*$#sm','$1',$code[1]);
174
  $this->css[] = array($media,'INLINE;'.$code);
@@ -185,7 +160,6 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
185
  // Really, no styles?
186
  return false;
187
  }
188
-
189
  // Joins and optimizes CSS
190
  public function minify() {
191
  foreach($this->css as $group) {
@@ -228,8 +202,6 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
228
  $this->css_group_val[] = $elem."_breezecssgroup_".$css;
229
  }
230
  }
231
-
232
-
233
  }
234
  if($this->group_css == true){
235
  // Check for duplicate code
@@ -252,13 +224,11 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
252
  $md5list[$medianame] = $md5sum;
253
  }
254
  unset($tmpcss);
255
-
256
  // Manage @imports, while is for recursive import management
257
  foreach ($this->csscode as &$thiscss) {
258
  // Flag to trigger import reconstitution and var to hold external imports
259
  $fiximports = false;
260
  $external_imports = "";
261
-
262
  while(preg_match_all('#^(/*\s?)@import.*(?:;|$)#Um',$thiscss,$matches)) {
263
  foreach($matches[0] as $import) {
264
  if ($this->isremovable($import,$this->cssremovables)) {
@@ -278,7 +248,6 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
278
  } else if ($this->can_inject_late($path,$code)) {
279
  $code="%%INJECTLATER".breeze_HASH."%%".base64_encode($path)."|".md5($code)."%%INJECTLATER%%";
280
  }
281
-
282
  if(!empty($code)) {
283
  $tmp_thiscss = preg_replace('#(/\*FILESTART\*/.*)'.preg_quote($import,'#').'#Us','/*FILESTART2*/'.$code.'$1',$thiscss);
284
  if (!empty($tmp_thiscss)) {
@@ -290,7 +259,6 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
290
  }
291
  }
292
  }
293
-
294
  if (!$import_ok) {
295
  // external imports and general fall-back
296
  $external_imports .= $import;
@@ -301,14 +269,12 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
301
  $thiscss = preg_replace('#/\*FILESTART\*/#','',$thiscss);
302
  $thiscss = preg_replace('#/\*FILESTART2\*/#','/*FILESTART*/',$thiscss);
303
  }
304
-
305
  // add external imports to top of aggregated CSS
306
  if($fiximports) {
307
  $thiscss=$external_imports.$thiscss;
308
  }
309
  }
310
  unset($thiscss);
311
-
312
  // $this->csscode has all the uncompressed code now.
313
  $mhtmlcount = 0;
314
  foreach($this->csscode as &$code) {
@@ -321,20 +287,15 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
321
  continue;
322
  }
323
  unset($ccheck);
324
-
325
  // Do the imaging!
326
  $imgreplace = array();
327
  preg_match_all('#(background[^;}]*url\((?!\s?"?\s?data)(.*)\)[^;}]*)(?:;|$|})#Usm',$code,$matches);
328
-
329
  if(($this->datauris == true) && (function_exists('base64_encode')) && (is_array($matches))) {
330
  foreach($matches[2] as $count => $quotedurl) {
331
  $iurl = trim($quotedurl," \t\n\r\0\x0B\"'");
332
-
333
  // if querystring, remove it from url
334
  if (strpos($iurl,'?') !== false) { $iurl = strtok($iurl,'?'); }
335
-
336
  $ipath = $this->getpath($iurl);
337
-
338
  $datauri_max_size = 4096;
339
  $datauri_max_size = (int) apply_filters( 'breeze_filter_css_datauri_maxsize', $datauri_max_size );
340
  $datauri_exclude = apply_filters( 'breeze_filter_css_datauri_exclude', "");
@@ -347,7 +308,6 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
347
  }
348
  }
349
  }
350
-
351
  if($ipath != false && preg_match('#\.(jpe?g|png|gif|bmp)$#i',$ipath) && file_exists($ipath) && is_readable($ipath) && filesize($ipath) <= $datauri_max_size) {
352
  $ihash=md5($ipath);
353
  $icheck = new Breeze_MinificationCache($ihash,'img');
@@ -360,7 +320,6 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
360
  // It's an image and we don't have it in cache, get the type
361
  $explA=explode('.',$ipath);
362
  $type=end($explA);
363
-
364
  switch($type) {
365
  case 'jpeg':
366
  $dataurihead = 'data:image/jpeg;base64,';
@@ -380,19 +339,15 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
380
  default:
381
  $dataurihead = 'data:application/octet-stream;base64,';
382
  }
383
-
384
  // Encode the data
385
  $base64data = base64_encode(file_get_contents($ipath));
386
  $headAndData=$dataurihead.$base64data;
387
-
388
  // Save in cache
389
  $icheck->cache($headAndData,"text/plain");
390
  }
391
  unset($icheck);
392
-
393
  // Add it to the list for replacement
394
  $imgreplace[$matches[1][$count]] = str_replace($quotedurl,$headAndData,$matches[1][$count]).";\n*".str_replace($quotedurl,'mhtml:%%MHTML%%!'.$mhtmlcount,$matches[1][$count]).";\n_".$matches[1][$count].';';
395
-
396
  // Store image on the mhtml document
397
  $this->mhtml .= "--_\r\nContent-Location:{$mhtmlcount}\r\nContent-Transfer-Encoding:base64\r\n\r\n{$base64data}\r\n";
398
  $mhtmlcount++;
@@ -413,16 +368,13 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
413
  $imgreplace[$matches[1][$count]] = str_replace($quotedurl,$cdn_url,$matches[1][$count]);
414
  }
415
  }
416
-
417
  if(!empty($imgreplace)) {
418
  $code = str_replace(array_keys($imgreplace),array_values($imgreplace),$code);
419
  }
420
-
421
  // CDN the fonts!
422
  if ( (!empty($this->cdn_url)) && (apply_filters('breeze_filter_css_fonts_cdn',false)) && (version_compare(PHP_VERSION, '5.3.0') >= 0) ) {
423
  $fontreplace = array();
424
  include_once(BREEZE_PLUGIN_DIR.'inc/minification/config/minificationFontRegex.php');
425
-
426
  preg_match_all($fonturl_regex,$code,$matches);
427
  if (is_array($matches)) {
428
  foreach($matches[8] as $count => $quotedurl) {
@@ -435,7 +387,6 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
435
  }
436
  }
437
  }
438
-
439
  // Minify
440
  if (($this->alreadyminified!==true) && (apply_filters( "breeze_css_do_minify", true))) {
441
  if (class_exists('Minify_CSS_Compressor')) {
@@ -453,15 +404,12 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
453
  unset($tmp_code);
454
  }
455
  }
456
-
457
  $code = $this->inject_minified($code);
458
-
459
  $tmp_code = apply_filters( 'breeze_css_after_minify',$code );
460
  if (!empty($tmp_code)) {
461
  $code = $tmp_code;
462
  unset($tmp_code);
463
  }
464
-
465
  $this->hashmap[md5($code)] = $hash;
466
  }
467
  unset($code);
@@ -469,7 +417,6 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
469
  foreach ($this->css_group_val as $value){
470
  $media = substr($value, 0 , strpos($value,'_breezecssgroup_'));
471
  $css = substr($value,strpos($value,'_breezecssgroup_')+strlen('_breezecssgroup_'));
472
-
473
  $hash = md5($css);
474
  $ccheck = new Breeze_MinificationCache($hash,'css');
475
  if($ccheck->check()) {
@@ -478,9 +425,7 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
478
  continue;
479
  }
480
  unset($ccheck);
481
-
482
  // Minify
483
-
484
  if (class_exists('Minify_CSS_Compressor')) {
485
  $tmp_code = trim(Minify_CSS_Compressor::process($css));
486
  } else if(class_exists('CSSmin')) {
@@ -490,23 +435,19 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
490
  } elseif (@is_callable(array($cssmin,"minify"))) {
491
  $tmp_code = trim(CssMin::minify($css));
492
  }
493
-
494
  }
495
  if (!empty($tmp_code)) {
496
  $css = $tmp_code;
497
  unset($tmp_code);
498
  }
499
-
500
  $css = $this->inject_minified($css);
501
  $css = apply_filters( 'breeze_css_after_minify',$css );
502
  $this->css_min_arr[] = $media."_breezemedia_".$hash."_breezekey_".$css;
503
  }
504
  unset($css);
505
-
506
  }
507
  return true;
508
  }
509
-
510
  //Caches the CSS in uncompressed, deflated and gzipped form.
511
  public function cache() {
512
  if($this->datauris) {
@@ -524,12 +465,10 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
524
  // CSS cache
525
  foreach($this->csscode as $media => $code) {
526
  $md5 = $this->hashmap[md5($code)];
527
-
528
  if($this->datauris) {
529
  // Images for ie! Get the right url
530
  $code = str_replace('%%MHTML%%',$mhtml,$code);
531
  }
532
-
533
  $cache = new Breeze_MinificationCache($md5,'css');
534
  if(!$cache->check()) {
535
  // Cache our code
@@ -543,7 +482,6 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
543
  $code = substr($value,strpos($value,'_breezemedia_')+strlen('_breezemedia_'));
544
  $hash = substr($code,0,strpos($code,'_breezekey_'));
545
  $css = substr($code,strpos($code,'_breezekey_')+strlen('_breezekey_'));
546
-
547
  $cache = new Breeze_MinificationCache($hash,'css');
548
  if(!$cache->check()) {
549
  // Cache our code
@@ -553,36 +491,30 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
553
  }
554
  }
555
  }
556
-
557
  //Returns the content
558
  public function getcontent() {
559
  // restore IE hacks
560
  $this->content = $this->restore_iehacks($this->content);
561
-
562
  // restore comments
563
  $this->content = $this->restore_comments($this->content);
564
-
565
  // restore (no)script
566
  if ( strpos( $this->content, '%%SCRIPT%%' ) !== false ) {
567
  $this->content = preg_replace_callback(
568
  '#%%SCRIPT'.breeze_HASH.'%%(.*?)%%SCRIPT%%#is',
569
- create_function(
570
- '$matches',
571
- 'return base64_decode($matches[1]);'
572
- ),
573
  $this->content
574
  );
575
  }
576
-
577
  // restore noptimize
578
  $this->content = $this->restore_noptimize($this->content);
579
-
580
  //Restore the full content
581
  if(!empty($this->restofcontent)) {
582
  $this->content .= $this->restofcontent;
583
  $this->restofcontent = '';
584
  }
585
-
586
  // Inject the new stylesheets
587
  $replaceTag = array("<title","before");
588
  $replaceTag = apply_filters( 'breeze_filter_css_replacetag', $replaceTag );
@@ -598,7 +530,6 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
598
  $defer_inline_code=$this->defer_inline;
599
  $defer_inline_code=apply_filters( 'breeze_filter_css_defer_inline', $defer_inline_code );
600
  if(!empty($defer_inline_code)){
601
-
602
  $iCssHash=md5($defer_inline_code);
603
  $iCssCache = new Breeze_MinificationCache($iCssHash,'css');
604
  if($iCssCache->check()) {
@@ -611,7 +542,6 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
611
  $cssmin = new CSSmin();
612
  $tmp_code = trim($cssmin->run($defer_inline_code));
613
  }
614
-
615
  if (!empty($tmp_code)) {
616
  $defer_inline_code = $tmp_code;
617
  $iCssCache->cache($defer_inline_code,"text/css");
@@ -622,10 +552,8 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
622
  $this->inject_in_html($code_out,$replaceTag);
623
  }
624
  }
625
-
626
  foreach($this->url as $media => $url) {
627
  $url = $this->url_replace_cdn($url);
628
-
629
  //Add the stylesheet either deferred (import at bottom) or normal links in head
630
  if($this->defer == true) {
631
  $deferredCssBlock .= "lCss('".$url."','".$media."');";
@@ -638,7 +566,6 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
638
  }
639
  }
640
  }
641
-
642
  if($this->defer == true) {
643
  $deferredCssBlock .= "}if(window.addEventListener){window.addEventListener('DOMContentLoaded',deferredCSS,false);}else{window.onload = deferredCSS;}</script>";
644
  $noScriptCssBlock .= "</noscript>";
@@ -647,7 +574,6 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
647
  }
648
  }
649
  }else{
650
-
651
  if ($this->inline == true) {
652
  foreach($this->csscode as $media => $code) {
653
  $this->inject_in_html('<style type="text/css" media="'.$media.'">'.$code.'</style>',$replaceTag);
@@ -659,7 +585,6 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
659
  $defer_inline_code=$this->defer_inline;
660
  $defer_inline_code=apply_filters( 'breeze_filter_css_defer_inline', $defer_inline_code );
661
  if(!empty($defer_inline_code)){
662
-
663
  $iCssHash=md5($defer_inline_code);
664
  $iCssCache = new Breeze_MinificationCache($iCssHash,'css');
665
  if($iCssCache->check()) {
@@ -672,7 +597,6 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
672
  $cssmin = new CSSmin();
673
  $tmp_code = trim($cssmin->run($defer_inline_code));
674
  }
675
-
676
  if (!empty($tmp_code)) {
677
  $defer_inline_code = $tmp_code;
678
  $iCssCache->cache($defer_inline_code,"text/css");
@@ -683,13 +607,11 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
683
  $this->inject_in_html($code_out,$replaceTag);
684
  }
685
  }
686
-
687
  foreach ($this->url_group_arr as $value){
688
  $media = substr($value,0,strpos($value,'_breezemedia_'));
689
  $code = substr($value,strpos($value,'_breezemedia_')+strlen('_breezemedia_'));
690
  $hash = substr($code,0,strpos($code,'_breezekey_'));
691
  $url = substr($code,strpos($code,'_breezekey_')+strlen('_breezekey_'));
692
-
693
  $cache = new Breeze_MinificationCache($hash,'css');
694
  if($cache->check()) {
695
  $csscode = $cache->retrieve();
@@ -707,7 +629,6 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
707
  }
708
  }
709
  }
710
-
711
  if($this->defer == true) {
712
  $deferredCssBlock .= "}if(window.addEventListener){window.addEventListener('DOMContentLoaded',deferredCSS,false);}else{window.onload = deferredCSS;}</script>";
713
  $noScriptCssBlock .= "</noscript>";
@@ -716,19 +637,14 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
716
  }
717
  }
718
  }
719
-
720
-
721
  //Return the modified stylesheet
722
  return $this->content;
723
  }
724
-
725
  static function fixurls($file,$code) {
726
  $file = str_replace(BREEZE_ROOT_DIR,'/',$file);
727
  $dir = dirname($file); //Like /wp-content
728
-
729
  // quick fix for import-troubles in e.g. arras theme
730
  $code=preg_replace('#@import ("|\')(.+?)\.css("|\')#','@import url("${2}.css")',$code);
731
-
732
  if(preg_match_all('#url\((?!data)(?!\#)(?!"\#)(.*)\)#Usi',$code,$matches)) {
733
  $replace = array();
734
  foreach($matches[1] as $k => $url) {
@@ -747,10 +663,8 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
747
  } else {
748
  // relative URL
749
  $newurl = preg_replace('/https?:/','',str_replace(" ","%20",breeze_WP_ROOT_URL.str_replace('//','/',$dir.'/'.$url)));
750
-
751
  $hash = md5($url);
752
  $code = str_replace($matches[0][$k],$hash,$code);
753
-
754
  if (!empty($removedQuotes)) {
755
  $replace[$hash] = 'url(\''.$newurl.'\')';
756
  } else {
@@ -763,7 +677,6 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
763
  }
764
  return $code;
765
  }
766
-
767
  private function ismovable($tag) {
768
  if (!empty($this->whitelist)) {
769
  foreach ($this->whitelist as $match) {
@@ -782,12 +695,10 @@ class Breeze_MinificationStyles extends Breeze_MinificationBase {
782
  }
783
  }
784
  }
785
-
786
  //If we're here it's safe to move
787
  return true;
788
  }
789
  }
790
-
791
  private function can_inject_late($cssPath,$css) {
792
  if ((strpos($cssPath,"min.css")===false) || ($this->inject_min_late!==true)) {
793
  // late-inject turned off or file not minified based on filename
3
  * Based on some work of autoptimize plugin
4
  */
5
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
 
6
  class Breeze_MinificationStyles extends Breeze_MinificationBase {
7
  private $css = array();
8
  private $csscode = array();
26
  private $css_min_arr = array();
27
  private $issetminfile = false;
28
  private $url_group_arr = array();
 
29
  //Reads the page and collects style tags
30
  public function read($options) {
31
  $noptimizeCSS = apply_filters( 'breeze_filter_css_noptimize', false, $this->content );
32
  if ($noptimizeCSS) return false;
 
33
  $whitelistCSS = apply_filters( 'breeze_filter_css_whitelist', '' );
34
  if (!empty($whitelistCSS)) {
35
  $this->whitelist = array_filter(array_map('trim',explode(",",$whitelistCSS)));
36
  }
 
37
  if ($options['nogooglefont'] == true) {
38
  $removableCSS = "fonts.googleapis.com";
39
  } else {
43
  if (!empty($removableCSS)) {
44
  $this->cssremovables = array_filter(array_map('trim',explode(",",$removableCSS)));
45
  }
 
46
  $this->cssinlinesize = apply_filters('breeze_filter_css_inlinesize',256);
 
47
  // filter to "late inject minified CSS", default to true for now (it is faster)
48
  $this->inject_min_late = apply_filters('breeze_filter_css_inject_min_late',true);
 
49
  // Remove everything that's not the header
50
  if ( apply_filters('breeze_filter_css_justhead',$options['justhead']) == true ) {
51
  $content = explode('</head>',$this->content,2);
52
  $this->content = $content[0].'</head>';
53
  $this->restofcontent = $content[1];
54
  }
 
55
  // include inline?
56
  if( apply_filters('breeze_css_include_inline',$options['include_inline']) == true ) {
57
  $this->include_inline = true;
58
  }
 
59
  // group css?
60
  if( apply_filters('breeze_css_include_inline',$options['groupcss']) == true ) {
61
  $this->group_css = true;
72
  } else {
73
  $this->dontmove = "";
74
  }
 
75
  // should we defer css?
76
  // value: true/ false
77
  $this->defer = $options['defer'];
78
  $this->defer = apply_filters( 'breeze_filter_css_defer', $this->defer );
 
79
  // should we inline while deferring?
80
  // value: inlined CSS
81
  $this->defer_inline = $options['defer_inline'];
 
82
  // should we inline?
83
  // value: true/ false
84
  $this->inline = $options['inline'];
85
  $this->inline = apply_filters( 'breeze_filter_css_inline', $this->inline );
 
86
  // get cdn url
87
  $this->cdn_url = $options['cdn_url'];
 
88
  // Store data: URIs setting for later use
89
  $this->datauris = $options['datauris'];
 
90
  // noptimize me
91
  $this->content = $this->hide_noptimize($this->content);
 
92
  // exclude (no)script, as those may contain CSS which should be left as is
93
  if ( strpos( $this->content, '<script' ) !== false ) {
94
  $this->content = preg_replace_callback(
95
  '#<(?:no)?script.*?<\/(?:no)?script>#is',
96
+ function($matches){
97
+ return "%%SCRIPT".breeze_HASH."%%".base64_encode($matches[0])."%%SCRIPT%%";
98
+ },
 
99
  $this->content
100
  );
101
  }
 
102
  // Save IE hacks
103
  $this->content = $this->hide_iehacks($this->content);
 
104
  // hide comments
105
  $this->content = $this->hide_comments($this->content);
 
106
  // Get <style> and <link>
107
  if(preg_match_all('#(<style[^>]*>.*</style>)|(<link[^>]*stylesheet[^>]*>)#Usmi',$this->content,$matches)) {
108
  foreach($matches[0] as $tag) {
123
  $media = array('all');
124
  }
125
  $media = apply_filters( 'breeze_filter_css_tagmedia',$media,$tag );
 
126
  if(preg_match('#<link.*href=("|\')(.*)("|\')#Usmi',$tag,$source)) {
127
  // <link>
128
  $url = current(explode('?',$source[2],2));
130
  if(in_array($url,$this->custom_css_exclude)){
131
  continue;
132
  }
 
133
  $path = $this->getpath($url);
 
134
  if($path!==false && preg_match('#\.css$#',$path)) {
135
  // Good link
136
  $this->css[] = array($media,$path);
142
  // inline css in style tags can be wrapped in comment tags, so restore comments
143
  $tag = $this->restore_comments($tag);
144
  preg_match('#<style.*>(.*)</style>#Usmi',$tag,$code);
 
145
  // and re-hide them to be able to to the removal based on tag
146
  $tag = $this->hide_comments($tag);
 
147
  if ( $this->include_inline ) {
148
  $code = preg_replace('#^.*<!\[CDATA\[(?:\s*\*/)?(.*)(?://|/\*)\s*?\]\]>.*$#sm','$1',$code[1]);
149
  $this->css[] = array($media,'INLINE;'.$code);
160
  // Really, no styles?
161
  return false;
162
  }
 
163
  // Joins and optimizes CSS
164
  public function minify() {
165
  foreach($this->css as $group) {
202
  $this->css_group_val[] = $elem."_breezecssgroup_".$css;
203
  }
204
  }
 
 
205
  }
206
  if($this->group_css == true){
207
  // Check for duplicate code
224
  $md5list[$medianame] = $md5sum;
225
  }
226
  unset($tmpcss);
 
227
  // Manage @imports, while is for recursive import management
228
  foreach ($this->csscode as &$thiscss) {
229
  // Flag to trigger import reconstitution and var to hold external imports
230
  $fiximports = false;
231
  $external_imports = "";
 
232
  while(preg_match_all('#^(/*\s?)@import.*(?:;|$)#Um',$thiscss,$matches)) {
233
  foreach($matches[0] as $import) {
234
  if ($this->isremovable($import,$this->cssremovables)) {
248
  } else if ($this->can_inject_late($path,$code)) {
249
  $code="%%INJECTLATER".breeze_HASH."%%".base64_encode($path)."|".md5($code)."%%INJECTLATER%%";
250
  }
 
251
  if(!empty($code)) {
252
  $tmp_thiscss = preg_replace('#(/\*FILESTART\*/.*)'.preg_quote($import,'#').'#Us','/*FILESTART2*/'.$code.'$1',$thiscss);
253
  if (!empty($tmp_thiscss)) {
259
  }
260
  }
261
  }
 
262
  if (!$import_ok) {
263
  // external imports and general fall-back
264
  $external_imports .= $import;
269
  $thiscss = preg_replace('#/\*FILESTART\*/#','',$thiscss);
270
  $thiscss = preg_replace('#/\*FILESTART2\*/#','/*FILESTART*/',$thiscss);
271
  }
 
272
  // add external imports to top of aggregated CSS
273
  if($fiximports) {
274
  $thiscss=$external_imports.$thiscss;
275
  }
276
  }
277
  unset($thiscss);
 
278
  // $this->csscode has all the uncompressed code now.
279
  $mhtmlcount = 0;
280
  foreach($this->csscode as &$code) {
287
  continue;
288
  }
289
  unset($ccheck);
 
290
  // Do the imaging!
291
  $imgreplace = array();
292
  preg_match_all('#(background[^;}]*url\((?!\s?"?\s?data)(.*)\)[^;}]*)(?:;|$|})#Usm',$code,$matches);
 
293
  if(($this->datauris == true) && (function_exists('base64_encode')) && (is_array($matches))) {
294
  foreach($matches[2] as $count => $quotedurl) {
295
  $iurl = trim($quotedurl," \t\n\r\0\x0B\"'");
 
296
  // if querystring, remove it from url
297
  if (strpos($iurl,'?') !== false) { $iurl = strtok($iurl,'?'); }
 
298
  $ipath = $this->getpath($iurl);
 
299
  $datauri_max_size = 4096;
300
  $datauri_max_size = (int) apply_filters( 'breeze_filter_css_datauri_maxsize', $datauri_max_size );
301
  $datauri_exclude = apply_filters( 'breeze_filter_css_datauri_exclude', "");
308
  }
309
  }
310
  }
 
311
  if($ipath != false && preg_match('#\.(jpe?g|png|gif|bmp)$#i',$ipath) && file_exists($ipath) && is_readable($ipath) && filesize($ipath) <= $datauri_max_size) {
312
  $ihash=md5($ipath);
313
  $icheck = new Breeze_MinificationCache($ihash,'img');
320
  // It's an image and we don't have it in cache, get the type
321
  $explA=explode('.',$ipath);
322
  $type=end($explA);
 
323
  switch($type) {
324
  case 'jpeg':
325
  $dataurihead = 'data:image/jpeg;base64,';
339
  default:
340
  $dataurihead = 'data:application/octet-stream;base64,';
341
  }
 
342
  // Encode the data
343
  $base64data = base64_encode(file_get_contents($ipath));
344
  $headAndData=$dataurihead.$base64data;
 
345
  // Save in cache
346
  $icheck->cache($headAndData,"text/plain");
347
  }
348
  unset($icheck);
 
349
  // Add it to the list for replacement
350
  $imgreplace[$matches[1][$count]] = str_replace($quotedurl,$headAndData,$matches[1][$count]).";\n*".str_replace($quotedurl,'mhtml:%%MHTML%%!'.$mhtmlcount,$matches[1][$count]).";\n_".$matches[1][$count].';';
 
351
  // Store image on the mhtml document
352
  $this->mhtml .= "--_\r\nContent-Location:{$mhtmlcount}\r\nContent-Transfer-Encoding:base64\r\n\r\n{$base64data}\r\n";
353
  $mhtmlcount++;
368
  $imgreplace[$matches[1][$count]] = str_replace($quotedurl,$cdn_url,$matches[1][$count]);
369
  }
370
  }
 
371
  if(!empty($imgreplace)) {
372
  $code = str_replace(array_keys($imgreplace),array_values($imgreplace),$code);
373
  }
 
374
  // CDN the fonts!
375
  if ( (!empty($this->cdn_url)) && (apply_filters('breeze_filter_css_fonts_cdn',false)) && (version_compare(PHP_VERSION, '5.3.0') >= 0) ) {
376
  $fontreplace = array();
377
  include_once(BREEZE_PLUGIN_DIR.'inc/minification/config/minificationFontRegex.php');
 
378
  preg_match_all($fonturl_regex,$code,$matches);
379
  if (is_array($matches)) {
380
  foreach($matches[8] as $count => $quotedurl) {
387
  }
388
  }
389
  }
 
390
  // Minify
391
  if (($this->alreadyminified!==true) && (apply_filters( "breeze_css_do_minify", true))) {
392
  if (class_exists('Minify_CSS_Compressor')) {
404
  unset($tmp_code);
405
  }
406
  }
 
407
  $code = $this->inject_minified($code);
 
408
  $tmp_code = apply_filters( 'breeze_css_after_minify',$code );
409
  if (!empty($tmp_code)) {
410
  $code = $tmp_code;
411
  unset($tmp_code);
412
  }
 
413
  $this->hashmap[md5($code)] = $hash;
414
  }
415
  unset($code);
417
  foreach ($this->css_group_val as $value){
418
  $media = substr($value, 0 , strpos($value,'_breezecssgroup_'));
419
  $css = substr($value,strpos($value,'_breezecssgroup_')+strlen('_breezecssgroup_'));
 
420
  $hash = md5($css);
421
  $ccheck = new Breeze_MinificationCache($hash,'css');
422
  if($ccheck->check()) {
425
  continue;
426
  }
427
  unset($ccheck);
 
428
  // Minify
 
429
  if (class_exists('Minify_CSS_Compressor')) {
430
  $tmp_code = trim(Minify_CSS_Compressor::process($css));
431
  } else if(class_exists('CSSmin')) {
435
  } elseif (@is_callable(array($cssmin,"minify"))) {
436
  $tmp_code = trim(CssMin::minify($css));
437
  }
 
438
  }
439
  if (!empty($tmp_code)) {
440
  $css = $tmp_code;
441
  unset($tmp_code);
442
  }
 
443
  $css = $this->inject_minified($css);
444
  $css = apply_filters( 'breeze_css_after_minify',$css );
445
  $this->css_min_arr[] = $media."_breezemedia_".$hash."_breezekey_".$css;
446
  }
447
  unset($css);
 
448
  }
449
  return true;
450
  }
 
451
  //Caches the CSS in uncompressed, deflated and gzipped form.
452
  public function cache() {
453
  if($this->datauris) {
465
  // CSS cache
466
  foreach($this->csscode as $media => $code) {
467
  $md5 = $this->hashmap[md5($code)];
 
468
  if($this->datauris) {
469
  // Images for ie! Get the right url
470
  $code = str_replace('%%MHTML%%',$mhtml,$code);
471
  }
 
472
  $cache = new Breeze_MinificationCache($md5,'css');
473
  if(!$cache->check()) {
474
  // Cache our code
482
  $code = substr($value,strpos($value,'_breezemedia_')+strlen('_breezemedia_'));
483
  $hash = substr($code,0,strpos($code,'_breezekey_'));
484
  $css = substr($code,strpos($code,'_breezekey_')+strlen('_breezekey_'));
 
485
  $cache = new Breeze_MinificationCache($hash,'css');
486
  if(!$cache->check()) {
487
  // Cache our code
491
  }
492
  }
493
  }
 
494
  //Returns the content
495
  public function getcontent() {
496
  // restore IE hacks
497
  $this->content = $this->restore_iehacks($this->content);
 
498
  // restore comments
499
  $this->content = $this->restore_comments($this->content);
 
500
  // restore (no)script
501
  if ( strpos( $this->content, '%%SCRIPT%%' ) !== false ) {
502
  $this->content = preg_replace_callback(
503
  '#%%SCRIPT'.breeze_HASH.'%%(.*?)%%SCRIPT%%#is',
504
+
505
+ function ($matches){
506
+ return base64_decode($matches[1]);
507
+ },
508
  $this->content
509
  );
510
  }
 
511
  // restore noptimize
512
  $this->content = $this->restore_noptimize($this->content);
 
513
  //Restore the full content
514
  if(!empty($this->restofcontent)) {
515
  $this->content .= $this->restofcontent;
516
  $this->restofcontent = '';
517
  }
 
518
  // Inject the new stylesheets
519
  $replaceTag = array("<title","before");
520
  $replaceTag = apply_filters( 'breeze_filter_css_replacetag', $replaceTag );
530
  $defer_inline_code=$this->defer_inline;
531
  $defer_inline_code=apply_filters( 'breeze_filter_css_defer_inline', $defer_inline_code );
532
  if(!empty($defer_inline_code)){
 
533
  $iCssHash=md5($defer_inline_code);
534
  $iCssCache = new Breeze_MinificationCache($iCssHash,'css');
535
  if($iCssCache->check()) {
542
  $cssmin = new CSSmin();
543
  $tmp_code = trim($cssmin->run($defer_inline_code));
544
  }
 
545
  if (!empty($tmp_code)) {
546
  $defer_inline_code = $tmp_code;
547
  $iCssCache->cache($defer_inline_code,"text/css");
552
  $this->inject_in_html($code_out,$replaceTag);
553
  }
554
  }
 
555
  foreach($this->url as $media => $url) {
556
  $url = $this->url_replace_cdn($url);
 
557
  //Add the stylesheet either deferred (import at bottom) or normal links in head
558
  if($this->defer == true) {
559
  $deferredCssBlock .= "lCss('".$url."','".$media."');";
566
  }
567
  }
568
  }
 
569
  if($this->defer == true) {
570
  $deferredCssBlock .= "}if(window.addEventListener){window.addEventListener('DOMContentLoaded',deferredCSS,false);}else{window.onload = deferredCSS;}</script>";
571
  $noScriptCssBlock .= "</noscript>";
574
  }
575
  }
576
  }else{
 
577
  if ($this->inline == true) {
578
  foreach($this->csscode as $media => $code) {
579
  $this->inject_in_html('<style type="text/css" media="'.$media.'">'.$code.'</style>',$replaceTag);
585
  $defer_inline_code=$this->defer_inline;
586
  $defer_inline_code=apply_filters( 'breeze_filter_css_defer_inline', $defer_inline_code );
587
  if(!empty($defer_inline_code)){
 
588
  $iCssHash=md5($defer_inline_code);
589
  $iCssCache = new Breeze_MinificationCache($iCssHash,'css');
590
  if($iCssCache->check()) {
597
  $cssmin = new CSSmin();
598
  $tmp_code = trim($cssmin->run($defer_inline_code));
599
  }
 
600
  if (!empty($tmp_code)) {
601
  $defer_inline_code = $tmp_code;
602
  $iCssCache->cache($defer_inline_code,"text/css");
607
  $this->inject_in_html($code_out,$replaceTag);
608
  }
609
  }
 
610
  foreach ($this->url_group_arr as $value){
611
  $media = substr($value,0,strpos($value,'_breezemedia_'));
612
  $code = substr($value,strpos($value,'_breezemedia_')+strlen('_breezemedia_'));
613
  $hash = substr($code,0,strpos($code,'_breezekey_'));
614
  $url = substr($code,strpos($code,'_breezekey_')+strlen('_breezekey_'));
 
615
  $cache = new Breeze_MinificationCache($hash,'css');
616
  if($cache->check()) {
617
  $csscode = $cache->retrieve();
629
  }
630
  }
631
  }
 
632
  if($this->defer == true) {
633
  $deferredCssBlock .= "}if(window.addEventListener){window.addEventListener('DOMContentLoaded',deferredCSS,false);}else{window.onload = deferredCSS;}</script>";
634
  $noScriptCssBlock .= "</noscript>";
637
  }
638
  }
639
  }
 
 
640
  //Return the modified stylesheet
641
  return $this->content;
642
  }
 
643
  static function fixurls($file,$code) {
644
  $file = str_replace(BREEZE_ROOT_DIR,'/',$file);
645
  $dir = dirname($file); //Like /wp-content
 
646
  // quick fix for import-troubles in e.g. arras theme
647
  $code=preg_replace('#@import ("|\')(.+?)\.css("|\')#','@import url("${2}.css")',$code);
 
648
  if(preg_match_all('#url\((?!data)(?!\#)(?!"\#)(.*)\)#Usi',$code,$matches)) {
649
  $replace = array();
650
  foreach($matches[1] as $k => $url) {
663
  } else {
664
  // relative URL
665
  $newurl = preg_replace('/https?:/','',str_replace(" ","%20",breeze_WP_ROOT_URL.str_replace('//','/',$dir.'/'.$url)));
 
666
  $hash = md5($url);
667
  $code = str_replace($matches[0][$k],$hash,$code);
 
668
  if (!empty($removedQuotes)) {
669
  $replace[$hash] = 'url(\''.$newurl.'\')';
670
  } else {
677
  }
678
  return $code;
679
  }
 
680
  private function ismovable($tag) {
681
  if (!empty($this->whitelist)) {
682
  foreach ($this->whitelist as $match) {
695
  }
696
  }
697
  }
 
698
  //If we're here it's safe to move
699
  return true;
700
  }
701
  }
 
702
  private function can_inject_late($cssPath,$css) {
703
  if ((strpos($cssPath,"min.css")===false) || ($this->inject_min_late!==true)) {
704
  // late-inject turned off or file not minified based on filename
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Cloudways
3
  Tags: cache,caching, performance, wp-cache, cdn, combine, compress, speed plugin, database cache,gzip, http compression, js cache, minify, optimize, page cache, performance, speed, expire headers
4
  Requires at least: 4.5
5
  Tested up to: 5.2.1
6
- Stable tag: 1.0.11
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -145,6 +145,9 @@ Using Gzip, Breeze compresses the request files, further reducing the size of th
145
 
146
  == Changelog ==
147
 
 
 
 
148
  = 1.0.11 =
149
  * Fix: Change wp_redirect to wp_safe_redirect to fix redirect vulnerability of URL
150
 
3
  Tags: cache,caching, performance, wp-cache, cdn, combine, compress, speed plugin, database cache,gzip, http compression, js cache, minify, optimize, page cache, performance, speed, expire headers
4
  Requires at least: 4.5
5
  Tested up to: 5.2.1
6
+ Stable tag: 1.0.12
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
145
 
146
  == Changelog ==
147
 
148
+ = 1.0.12 =
149
+ * Fix: Deprecated create_function
150
+
151
  = 1.0.11 =
152
  * Fix: Change wp_redirect to wp_safe_redirect to fix redirect vulnerability of URL
153