Autoptimize - Version 1.8.4

Version Description

  • Bugfix: code in inline JS (or CSS) can be wrapped inside HTML-comments, but these got removed since 1.8.2 as part of a bugfix.
Download this release

Release Info

Developer futtta
Plugin Icon 128x128 Autoptimize
Version 1.8.4
Comparing to
See all releases

Code changes from version 1.8.3 to 1.8.4

autoptimize.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Autoptimize
4
  Plugin URI: http://blog.futtta.be/autoptimize
5
  Description: Optimizes your website, concatenating the CSS and JavaScript code, and compressing it.
6
- Version: 1.8.3
7
  Author: Frank Goossens (futtta)
8
  Author URI: http://blog.futtta.be/
9
  Domain Path: localization/
@@ -34,7 +34,7 @@ $conf = autoptimizeConfig::instance();
34
  /* Check if we're updating, in which case we might need to do stuff and flush the cache
35
  to avoid old versions of aggregated files lingering around */
36
 
37
- $autoptimize_version="1.8.2";
38
  $autoptimize_db_version=get_option('autoptimize_version','none');
39
 
40
  if ($autoptimize_db_version !== $autoptimize_version) {
3
  Plugin Name: Autoptimize
4
  Plugin URI: http://blog.futtta.be/autoptimize
5
  Description: Optimizes your website, concatenating the CSS and JavaScript code, and compressing it.
6
+ Version: 1.8.4
7
  Author: Frank Goossens (futtta)
8
  Author URI: http://blog.futtta.be/
9
  Domain Path: localization/
34
  /* Check if we're updating, in which case we might need to do stuff and flush the cache
35
  to avoid old versions of aggregated files lingering around */
36
 
37
+ $autoptimize_version="1.8.4";
38
  $autoptimize_db_version=get_option('autoptimize_version','none');
39
 
40
  if ($autoptimize_db_version !== $autoptimize_version) {
classes/autoptimizeScripts.php CHANGED
@@ -97,7 +97,9 @@ class autoptimizeScripts extends autoptimizeBase
97
  }
98
  }
99
  } else {
100
- //Inline script
 
 
101
  if($this->ismergeable($tag)) {
102
  preg_match('#<script.*>(.*)</script>#Usmi',$tag,$code);
103
  $code = preg_replace('#.*<!\[CDATA\[(?:\s*\*/)?(.*)(?://|/\*)\s*?\]\]>.*#sm','$1',$code[1]);
@@ -116,6 +118,8 @@ class autoptimizeScripts extends autoptimizeBase
116
  $tag = '';
117
  }
118
  }
 
 
119
  }
120
 
121
  //Remove the original script tag
@@ -155,7 +159,7 @@ class autoptimizeScripts extends autoptimizeBase
155
  }*/
156
  }
157
  }
158
-
159
  //Check for already-minified code
160
  $this->md5hash = md5($this->jscode);
161
  $ccheck = new autoptimizeCache($this->md5hash,'js');
97
  }
98
  }
99
  } else {
100
+ // Inline script
101
+ // unhide comments, as javascript may be wrapped in comment-tags for old times' sake
102
+ $tag = $this->restore_comments($tag);
103
  if($this->ismergeable($tag)) {
104
  preg_match('#<script.*>(.*)</script>#Usmi',$tag,$code);
105
  $code = preg_replace('#.*<!\[CDATA\[(?:\s*\*/)?(.*)(?://|/\*)\s*?\]\]>.*#sm','$1',$code[1]);
118
  $tag = '';
119
  }
120
  }
121
+ // re-hide comments to be able to do the removal based on tag from $this->content
122
+ $tag = $this->hide_comments($tag);
123
  }
124
 
125
  //Remove the original script tag
159
  }*/
160
  }
161
  }
162
+
163
  //Check for already-minified code
164
  $this->md5hash = md5($this->jscode);
165
  $ccheck = new autoptimizeCache($this->md5hash,'js');
classes/autoptimizeStyles.php CHANGED
@@ -90,8 +90,13 @@ class autoptimizeStyles extends autoptimizeBase {
90
  $tag = '';
91
  }
92
  } else {
93
- //<style>
 
94
  preg_match('#<style.*>(.*)</style>#Usmi',$tag,$code);
 
 
 
 
95
  $code = preg_replace('#^.*<!\[CDATA\[(?:\s*\*/)?(.*)(?://|/\*)\s*?\]\]>.*$#sm','$1',$code[1]);
96
  $this->css[] = array($media,'INLINE;'.$code);
97
  }
90
  $tag = '';
91
  }
92
  } else {
93
+ // inline css in style tags can be wrapped in comment tags, so restore comments
94
+ $tag = $this->restore_comments($tag);
95
  preg_match('#<style.*>(.*)</style>#Usmi',$tag,$code);
96
+
97
+ // and re-hide them to be able to to the removal based on tag
98
+ $tag = $this->hide_comments($tag);
99
+
100
  $code = preg_replace('#^.*<!\[CDATA\[(?:\s*\*/)?(.*)(?://|/\*)\s*?\]\]>.*$#sm','$1',$code[1]);
101
  $this->css[] = array($media,'INLINE;'.$code);
102
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: css, html, javascript, js, optimize, speed, cache, data-uri, aggregate, mi
4
  Donate link: http://blog.futtta.be/2013/10/21/do-not-donate-to-me/
5
  Requires at least: 2.7
6
  Tested up to: 3.9
7
- Stable tag: 1.8.3
8
 
9
  Autoptimize speeds up your website and helps you save bandwidth by aggregating and minimizing JS, CSS and HTML.
10
 
@@ -125,6 +125,9 @@ You can report problems on the [wordpress.org support forum](http://wordpress.or
125
 
126
  == Changelog ==
127
 
 
 
 
128
  = 1.8.3 =
129
  * Bugfix: avoid useless warnings on is_callable to flood php error log as [reported by Praveen Kumar](http://wordpress.org/support/topic/182-breaks-css-and-js?replies=14#post-5377604)
130
 
@@ -132,7 +135,7 @@ You can report problems on the [wordpress.org support forum](http://wordpress.or
132
  * Improvement: more graceful failure when minifier classes exist but method does not, based on [bug-report by Franck160](http://wordpress.org/support/topic/confict-with-dynamic-to-top)
133
  * Improvement: deferred CSS is also outputted in noscript-tags
134
  * Improvement: differentiate between Apache version in .htaccess file as suggested by [iMadalin](http://www.imadalin.ro/)
135
- * Improvement: also aggregate protocol-less CSS/JS URI's (as [suggested by Ross](http://wordpress.org/support/topic/protocol-less-url-support)
136
  * Improvement: disable autoptimization based on parameter in querystring (for debugging)
137
  * Bugfix: some CSS-imports were not being aggregated/ minified
138
  * Bugfix: add CSS before <title instead of <title> to avoid breakage when title includes other attributes (e.g. itemscope)
4
  Donate link: http://blog.futtta.be/2013/10/21/do-not-donate-to-me/
5
  Requires at least: 2.7
6
  Tested up to: 3.9
7
+ Stable tag: 1.8.4
8
 
9
  Autoptimize speeds up your website and helps you save bandwidth by aggregating and minimizing JS, CSS and HTML.
10
 
125
 
126
  == Changelog ==
127
 
128
+ = 1.8.4 =
129
+ * Bugfix: code in inline JS (or CSS) can be wrapped inside HTML-comments, but these got removed since 1.8.2 as part of a bugfix.
130
+
131
  = 1.8.3 =
132
  * Bugfix: avoid useless warnings on is_callable to flood php error log as [reported by Praveen Kumar](http://wordpress.org/support/topic/182-breaks-css-and-js?replies=14#post-5377604)
133
 
135
  * Improvement: more graceful failure when minifier classes exist but method does not, based on [bug-report by Franck160](http://wordpress.org/support/topic/confict-with-dynamic-to-top)
136
  * Improvement: deferred CSS is also outputted in noscript-tags
137
  * Improvement: differentiate between Apache version in .htaccess file as suggested by [iMadalin](http://www.imadalin.ro/)
138
+ * Improvement: also aggregate protocol-less CSS/JS URI's (as [suggested by Ross](http://wordpress.org/support/topic/protocol-less-url-support))
139
  * Improvement: disable autoptimization based on parameter in querystring (for debugging)
140
  * Bugfix: some CSS-imports were not being aggregated/ minified
141
  * Bugfix: add CSS before <title instead of <title> to avoid breakage when title includes other attributes (e.g. itemscope)