Version Description
- new javascript-debug option to force the aggregated javascript file in the head-section of the HTML instead of at the bottom
- YUI compression & CDN are now deprecated functionality that will be removed in 1.7.0
Download this release
Release Info
Developer | futtta |
Plugin | Autoptimize |
Version | 1.6.5 |
Comparing to | |
See all releases |
Code changes from version 1.6.4 to 1.6.5
- autoptimize.php +3 -2
- classes/autoptimizeConfig.php +10 -3
- classes/autoptimizeScripts.php +14 -3
- readme.txt +9 -2
autoptimize.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Autoptimize
|
4 |
Plugin URI: http://blog.futtta.be/category/autoptimize/
|
5 |
Description: Optimizes your website, concatenating the CSS and JavaScript code, and compressing it.
|
6 |
-
Version: 1.6.
|
7 |
Author: Frank Goossens (futtta)
|
8 |
Author URI: http://blog.futtta.be/
|
9 |
Released under the GNU General Public License (GPL)
|
@@ -27,7 +27,7 @@ $conf = autoptimizeConfig::instance();
|
|
27 |
/* Check if we're updating, in which case we need to flush the cache
|
28 |
to avoid old versions of aggregated files lingering around */
|
29 |
|
30 |
-
$autoptimize_version="1.6.
|
31 |
$autoptimize_db_version=get_option('autoptimize_version','none');
|
32 |
|
33 |
if ($autoptimize_db_version !== $autoptimize_version) {
|
@@ -113,6 +113,7 @@ function autoptimize_end_buffering($content)
|
|
113 |
$classoptions = array(
|
114 |
'autoptimizeScripts' => array(
|
115 |
'justhead' => $conf->get('autoptimize_js_justhead'),
|
|
|
116 |
'trycatch' => $conf->get('autoptimize_js_trycatch'),
|
117 |
'yui' => $conf->get('autoptimize_js_yui'),
|
118 |
'exclude' => $conf->get('autoptimize_js_exclude')
|
3 |
Plugin Name: Autoptimize
|
4 |
Plugin URI: http://blog.futtta.be/category/autoptimize/
|
5 |
Description: Optimizes your website, concatenating the CSS and JavaScript code, and compressing it.
|
6 |
+
Version: 1.6.5
|
7 |
Author: Frank Goossens (futtta)
|
8 |
Author URI: http://blog.futtta.be/
|
9 |
Released under the GNU General Public License (GPL)
|
27 |
/* Check if we're updating, in which case we need to flush the cache
|
28 |
to avoid old versions of aggregated files lingering around */
|
29 |
|
30 |
+
$autoptimize_version="1.6.5";
|
31 |
$autoptimize_db_version=get_option('autoptimize_version','none');
|
32 |
|
33 |
if ($autoptimize_db_version !== $autoptimize_version) {
|
113 |
$classoptions = array(
|
114 |
'autoptimizeScripts' => array(
|
115 |
'justhead' => $conf->get('autoptimize_js_justhead'),
|
116 |
+
'forcehead' => $conf->get('autoptimize_js_forcehead'),
|
117 |
'trycatch' => $conf->get('autoptimize_js_trycatch'),
|
118 |
'yui' => $conf->get('autoptimize_js_yui'),
|
119 |
'exclude' => $conf->get('autoptimize_js_exclude')
|
classes/autoptimizeConfig.php
CHANGED
@@ -85,6 +85,11 @@ class autoptimizeConfig
|
|
85 |
<?php _e('Disabled by default. If the cache gets big, you might want to enable this.','autoptimize'); ?></label></td>
|
86 |
</tr>
|
87 |
<tr valign="top">
|
|
|
|
|
|
|
|
|
|
|
88 |
<th scope="row"><?php _e('Add try-catch wrapping?','autoptimize'); ?></th>
|
89 |
<td><label for="autoptimize_js_trycatch"><input type="checkbox" name="autoptimize_js_trycatch" <?php echo get_option('autoptimize_js_trycatch')?'checked="checked" ':''; ?>/>
|
90 |
<?php _e('Disabled by default. If your scripts break because of an script error, you might want to try this.','autoptimize'); ?></label></td>
|
@@ -92,7 +97,7 @@ class autoptimizeConfig
|
|
92 |
<tr valign="top">
|
93 |
<th scope="row"><?php _e('Use YUI compression?','autoptimize'); ?></th>
|
94 |
<td><label for="autoptimize_js_yui"><input type="checkbox" name="autoptimize_js_yui" <?php echo get_option('autoptimize_js_yui')?'checked="checked" ':''; ?>/>
|
95 |
-
<?php _e('Disabled by default. Read [autoptimize]/yui/README.txt for more information.','autoptimize'); ?></label></td>
|
96 |
</tr>
|
97 |
</table>
|
98 |
|
@@ -115,11 +120,11 @@ class autoptimizeConfig
|
|
115 |
<tr valign="top">
|
116 |
<th scope="row"><?php _e('Use YUI compression?','autoptimize'); ?></th>
|
117 |
<td><label for="autoptimize_css_yui"><input type="checkbox" name="autoptimize_css_yui" <?php echo get_option('autoptimize_css_yui')?'checked="checked" ':''; ?>/>
|
118 |
-
<?php _e('Disabled by default. Read [autoptimize]/yui/README.txt for more information.','autoptimize'); ?></label></td>
|
119 |
</tr>
|
120 |
</table>
|
121 |
|
122 |
-
<h3><?php _e('CDN Options','autoptimize');
|
123 |
<table class="form-table">
|
124 |
<tr valign="top">
|
125 |
<th scope="row"><?php _e('Rewrite JavaScript URLs?','autoptimize'); ?></th>
|
@@ -254,6 +259,7 @@ class autoptimizeConfig
|
|
254 |
register_setting('autoptimize','autoptimize_js_exclude');
|
255 |
register_setting('autoptimize','autoptimize_js_trycatch');
|
256 |
register_setting('autoptimize','autoptimize_js_justhead');
|
|
|
257 |
register_setting('autoptimize','autoptimize_js_yui');
|
258 |
register_setting('autoptimize','autoptimize_css');
|
259 |
register_setting('autoptimize','autoptimize_css_justhead');
|
@@ -307,6 +313,7 @@ class autoptimizeConfig
|
|
307 |
'autoptimize_js_exclude' => "s_sid, smowtion_size, sc_project, WAU_, wau_add, comment-form-quicktags, edToolbar, ch_client",
|
308 |
'autoptimize_js_trycatch' => 0,
|
309 |
'autoptimize_js_justhead' => 0,
|
|
|
310 |
'autoptimize_js_yui' => 0,
|
311 |
'autoptimize_css' => 0,
|
312 |
'autoptimize_css_justhead' => 0,
|
85 |
<?php _e('Disabled by default. If the cache gets big, you might want to enable this.','autoptimize'); ?></label></td>
|
86 |
</tr>
|
87 |
<tr valign="top">
|
88 |
+
<th scope="row"><?php _e('Force JavaScript in <head>?','autoptimize'); ?></th>
|
89 |
+
<td><label for="autoptimize_js_forcehead"><input type="checkbox" name="autoptimize_js_forcehead" <?php echo get_option('autoptimize_js_forcehead')?'checked="checked" ':''; ?>/>
|
90 |
+
<?php _e('Disabled by default. For performance reasons JavaScript is best put at the end of the HTML, but in some circumstances this breaks things. You can in that case check this option to add JavaScript to the <head> section.','autoptimize'); ?></label></td>
|
91 |
+
</tr>
|
92 |
+
<tr valign="top">
|
93 |
<th scope="row"><?php _e('Add try-catch wrapping?','autoptimize'); ?></th>
|
94 |
<td><label for="autoptimize_js_trycatch"><input type="checkbox" name="autoptimize_js_trycatch" <?php echo get_option('autoptimize_js_trycatch')?'checked="checked" ':''; ?>/>
|
95 |
<?php _e('Disabled by default. If your scripts break because of an script error, you might want to try this.','autoptimize'); ?></label></td>
|
97 |
<tr valign="top">
|
98 |
<th scope="row"><?php _e('Use YUI compression?','autoptimize'); ?></th>
|
99 |
<td><label for="autoptimize_js_yui"><input type="checkbox" name="autoptimize_js_yui" <?php echo get_option('autoptimize_js_yui')?'checked="checked" ':''; ?>/>
|
100 |
+
<?php _e('<b>Deprecated!</b> Disabled by default. Read [autoptimize]/yui/README.txt for more information.','autoptimize'); ?></label></td>
|
101 |
</tr>
|
102 |
</table>
|
103 |
|
120 |
<tr valign="top">
|
121 |
<th scope="row"><?php _e('Use YUI compression?','autoptimize'); ?></th>
|
122 |
<td><label for="autoptimize_css_yui"><input type="checkbox" name="autoptimize_css_yui" <?php echo get_option('autoptimize_css_yui')?'checked="checked" ':''; ?>/>
|
123 |
+
<?php _e('<b>Deprecated!</b> Disabled by default. Read [autoptimize]/yui/README.txt for more information.','autoptimize'); ?></label></td>
|
124 |
</tr>
|
125 |
</table>
|
126 |
|
127 |
+
<h3><?php _e('CDN Options','autoptimize'); ?> (Deprecated!)</h3>
|
128 |
<table class="form-table">
|
129 |
<tr valign="top">
|
130 |
<th scope="row"><?php _e('Rewrite JavaScript URLs?','autoptimize'); ?></th>
|
259 |
register_setting('autoptimize','autoptimize_js_exclude');
|
260 |
register_setting('autoptimize','autoptimize_js_trycatch');
|
261 |
register_setting('autoptimize','autoptimize_js_justhead');
|
262 |
+
register_setting('autoptimize','autoptimize_js_forcehead');
|
263 |
register_setting('autoptimize','autoptimize_js_yui');
|
264 |
register_setting('autoptimize','autoptimize_css');
|
265 |
register_setting('autoptimize','autoptimize_css_justhead');
|
313 |
'autoptimize_js_exclude' => "s_sid, smowtion_size, sc_project, WAU_, wau_add, comment-form-quicktags, edToolbar, ch_client",
|
314 |
'autoptimize_js_trycatch' => 0,
|
315 |
'autoptimize_js_justhead' => 0,
|
316 |
+
'autoptimize_js_forcehead' => 0,
|
317 |
'autoptimize_js_yui' => 0,
|
318 |
'autoptimize_css' => 0,
|
319 |
'autoptimize_css_justhead' => 0,
|
classes/autoptimizeScripts.php
CHANGED
@@ -7,6 +7,7 @@ class autoptimizeScripts extends autoptimizeBase
|
|
7 |
private $domove = array('gaJsHost','load_cmc','jd.gallery.transitions.js','swfobject.embedSWF(','tiny_mce.js','tinyMCEPreInit.go');
|
8 |
private $domovelast = array('addthis.com','/afsonline/show_afs_search.js','disqus.js','networkedblogs.com/getnetworkwidget','infolinks.com/js/','jd.gallery.js.php','jd.gallery.transitions.js','swfobject.embedSWF(','linkwithin.com/widget.js','tiny_mce.js','tinyMCEPreInit.go');
|
9 |
private $trycatch = false;
|
|
|
10 |
private $yui = false;
|
11 |
private $jscode = '';
|
12 |
private $url = '';
|
@@ -34,7 +35,11 @@ class autoptimizeScripts extends autoptimizeBase
|
|
34 |
//Should we add try-catch?
|
35 |
if($options['trycatch'] == true)
|
36 |
$this->trycatch = true;
|
37 |
-
|
|
|
|
|
|
|
|
|
38 |
//Do we use yui?
|
39 |
$this->yui = $options['yui'];
|
40 |
|
@@ -200,10 +205,16 @@ class autoptimizeScripts extends autoptimizeBase
|
|
200 |
}
|
201 |
|
202 |
//Add the scripts
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
$bodyreplacement = implode('',$this->move['first']);
|
204 |
$bodyreplacement .= '<script type="text/javascript" src="'.$this->url.'"></script>';
|
205 |
-
$bodyreplacement .= implode('',$this->move['last'])
|
206 |
-
$this->content = str_replace(
|
207 |
|
208 |
//Restore IE hacks
|
209 |
$this->content = preg_replace('#%%IEHACK%%(.*)%%IEHACK%%#Usie','stripslashes(base64_decode("$1"))',$this->content);
|
7 |
private $domove = array('gaJsHost','load_cmc','jd.gallery.transitions.js','swfobject.embedSWF(','tiny_mce.js','tinyMCEPreInit.go');
|
8 |
private $domovelast = array('addthis.com','/afsonline/show_afs_search.js','disqus.js','networkedblogs.com/getnetworkwidget','infolinks.com/js/','jd.gallery.js.php','jd.gallery.transitions.js','swfobject.embedSWF(','linkwithin.com/widget.js','tiny_mce.js','tinyMCEPreInit.go');
|
9 |
private $trycatch = false;
|
10 |
+
private $forcehead = false;
|
11 |
private $yui = false;
|
12 |
private $jscode = '';
|
13 |
private $url = '';
|
35 |
//Should we add try-catch?
|
36 |
if($options['trycatch'] == true)
|
37 |
$this->trycatch = true;
|
38 |
+
|
39 |
+
// force js in head?
|
40 |
+
if($options['forcehead'] == true)
|
41 |
+
$this->forcehead = true;
|
42 |
+
|
43 |
//Do we use yui?
|
44 |
$this->yui = $options['yui'];
|
45 |
|
205 |
}
|
206 |
|
207 |
//Add the scripts
|
208 |
+
if($this->forcehead == true) {
|
209 |
+
$replaceTag="</head>";
|
210 |
+
} else {
|
211 |
+
$replaceTag="</body>";
|
212 |
+
}
|
213 |
+
|
214 |
$bodyreplacement = implode('',$this->move['first']);
|
215 |
$bodyreplacement .= '<script type="text/javascript" src="'.$this->url.'"></script>';
|
216 |
+
$bodyreplacement .= implode('',$this->move['last']).$replaceTag;
|
217 |
+
$this->content = str_replace($replaceTag,$bodyreplacement,$this->content);
|
218 |
|
219 |
//Restore IE hacks
|
220 |
$this->content = preg_replace('#%%IEHACK%%(.*)%%IEHACK%%#Usie','stripslashes(base64_decode("$1"))',$this->content);
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: futtta, turl
|
|
3 |
Tags: css, html, javascript, js, optimize, speed, cache, data-uri, aggregate, minimize, performance, pagespeed, booster, multisite
|
4 |
Requires at least: 2.7
|
5 |
Tested up to: 3.6
|
6 |
-
Stable tag: 1.6.
|
7 |
|
8 |
Autoptimize speeds up your website and helps you save bandwidth by aggregating and minimizing JS and CSS.
|
9 |
|
@@ -38,13 +38,16 @@ Based on feedback received from BuddyPress users, CSS and JS-Autoptimization do
|
|
38 |
|
39 |
There have been reports of sightings of javascript errors when using Autoptimize together with WP SlimStat. Both [Camu (WP SlimStat developer)](http://profiles.wordpress.org/coolmann/) and I have installed both plugins on test-environments and [found no proof of such incompatibility](http://wordpress.org/support/topic/dropdown-menus-dont-work-when-slimstat-is-enabled?replies=14#post-4086894). Our common conclusion is that there are rare cases in which yet another theme or plugin's JavaScript are triggering these errors. If you do encounter JavaScript-errors when you have both WP SlimStat and Autoptimize installed, add "SlimStatParams, wp-slimstat.js" in the "Exclude scripts from autoptimize:" option on the admin-page and all should be well.
|
40 |
|
|
|
|
|
|
|
41 |
= Configuring & Troubleshooting Autoptimize =
|
42 |
|
43 |
After having installed and activated the plugin, you'll have access to an admin page where you can to enable HTML, CSS and JavaScript optimization. According to your liking, you can start of just enabling all of them, or if you're more cautious one at a time.
|
44 |
|
45 |
If your blog doens't function normally after having turned on Autoptimize, here are some pointers to identify & solve such issues:
|
46 |
* In case your blog looks weird, i.e. when the layout gets messed up, there is problem with CSS optimization. In this case you can turn on the option "Look for styles on just head?" and see if that solves the problem.
|
47 |
-
* In case some functionality on your site stops working (a carroussel, a menu, the search input, ...) you're likely hitting JavaScript optimization trouble. Enable the option "Look for scripts only in head?" and try again. Alternatively -for the technically savvy- you can exclude specific scripts from being treated (moved and/ or aggregated) by Autoptimize by adding a string that will match the offending Javascript. Identifying the offending JavaScript and choosing the correct exclusion-string can be trial and error, but in the majority of cases JavaScript optimization issues can be solved this way.
|
48 |
* If you can't get either CSS or JS optimization working, you can off course always continue using the other two optimization-techniques.
|
49 |
* If you tried the troubleshooting tips above and you still can't get CSS and JS working at all, you can ask for support on the [WordPress Autoptimize support forum](http://wordpress.org/support/plugin/autoptimize). See below for a description of what information you should provide in your "trouble ticket"
|
50 |
|
@@ -62,6 +65,10 @@ You can report problems on the [wordpress.org support forum](http://wordpress.or
|
|
62 |
|
63 |
== Changelog ==
|
64 |
|
|
|
|
|
|
|
|
|
65 |
= 1.6.4 =
|
66 |
* fix for PHP notice about mfunc_functions
|
67 |
* fix for strpos warnings due to empty values from the "Exclude scripts from autoptimize" configuration as [reported by CandleFOREX](http://wordpress.org/support/topic/empty-needle-warning)
|
3 |
Tags: css, html, javascript, js, optimize, speed, cache, data-uri, aggregate, minimize, performance, pagespeed, booster, multisite
|
4 |
Requires at least: 2.7
|
5 |
Tested up to: 3.6
|
6 |
+
Stable tag: 1.6.5
|
7 |
|
8 |
Autoptimize speeds up your website and helps you save bandwidth by aggregating and minimizing JS and CSS.
|
9 |
|
38 |
|
39 |
There have been reports of sightings of javascript errors when using Autoptimize together with WP SlimStat. Both [Camu (WP SlimStat developer)](http://profiles.wordpress.org/coolmann/) and I have installed both plugins on test-environments and [found no proof of such incompatibility](http://wordpress.org/support/topic/dropdown-menus-dont-work-when-slimstat-is-enabled?replies=14#post-4086894). Our common conclusion is that there are rare cases in which yet another theme or plugin's JavaScript are triggering these errors. If you do encounter JavaScript-errors when you have both WP SlimStat and Autoptimize installed, add "SlimStatParams, wp-slimstat.js" in the "Exclude scripts from autoptimize:" option on the admin-page and all should be well.
|
40 |
|
41 |
+
= Why are some options marked as Deprecated? =
|
42 |
+
YUI compression and the CDN options are marked as deprecated to indicate that this functionality will be removed for the next major version (probably 1.7.0). YUI compression was pretty exotic and required one to install JAVA and the YUI compression software. CDN options are deprecated as well; CDN isn't core functionality and can better be accomplished using e.g. [WP Super Cache](http://wordpress.org/extend/plugins/wp-super-cache/) (which is a must-have companion of Autoptimize anyhow).
|
43 |
+
|
44 |
= Configuring & Troubleshooting Autoptimize =
|
45 |
|
46 |
After having installed and activated the plugin, you'll have access to an admin page where you can to enable HTML, CSS and JavaScript optimization. According to your liking, you can start of just enabling all of them, or if you're more cautious one at a time.
|
47 |
|
48 |
If your blog doens't function normally after having turned on Autoptimize, here are some pointers to identify & solve such issues:
|
49 |
* In case your blog looks weird, i.e. when the layout gets messed up, there is problem with CSS optimization. In this case you can turn on the option "Look for styles on just head?" and see if that solves the problem.
|
50 |
+
* In case some functionality on your site stops working (a carroussel, a menu, the search input, ...) you're likely hitting JavaScript optimization trouble. Enable the option "Look for scripts only in head?" and/or "Force JavaScript in <head>?" and try again. Alternatively -for the technically savvy- you can exclude specific scripts from being treated (moved and/ or aggregated) by Autoptimize by adding a string that will match the offending Javascript. Identifying the offending JavaScript and choosing the correct exclusion-string can be trial and error, but in the majority of cases JavaScript optimization issues can be solved this way.
|
51 |
* If you can't get either CSS or JS optimization working, you can off course always continue using the other two optimization-techniques.
|
52 |
* If you tried the troubleshooting tips above and you still can't get CSS and JS working at all, you can ask for support on the [WordPress Autoptimize support forum](http://wordpress.org/support/plugin/autoptimize). See below for a description of what information you should provide in your "trouble ticket"
|
53 |
|
65 |
|
66 |
== Changelog ==
|
67 |
|
68 |
+
= 1.6.5 =
|
69 |
+
* new javascript-debug option to force the aggregated javascript file in the head-section of the HTML instead of at the bottom
|
70 |
+
* YUI compression & CDN are now deprecated functionality that will be removed in 1.7.0
|
71 |
+
|
72 |
= 1.6.4 =
|
73 |
* fix for PHP notice about mfunc_functions
|
74 |
* fix for strpos warnings due to empty values from the "Exclude scripts from autoptimize" configuration as [reported by CandleFOREX](http://wordpress.org/support/topic/empty-needle-warning)
|