Version Description
- Critical CSS: cache settings in the PHP process instead of re-fetching them
- Critical CSS: shorter intervals between calls to criticalcss.com (shortening the asynchronous job queue processing time)
- inline & defer CSS: fix for some excluded files not being preloaded
- 404 fallback: only create fallback files for CSS/ JS, not for (background-)images
- copy changes as suggested by Cyrille (@css31), un grand merci!
- misc. other minor fixes, see the GitHub commit log.
Download this release
Release Info
Developer | futtta |
Plugin | Autoptimize |
Version | 2.7.3 |
Comparing to | |
See all releases |
Code changes from version 2.7.2 to 2.7.3
- autoptimize.php +2 -2
- autoptimize_helper.php_example +4 -4
- classes/autoptimizeCache.php +1 -1
- classes/autoptimizeConfig.php +3 -3
- classes/autoptimizeCriticalCSSBase.php +46 -41
- classes/autoptimizeCriticalCSSCron.php +6 -6
- classes/autoptimizeExtra.php +1 -1
- classes/autoptimizeScripts.php +3 -2
- classes/autoptimizeStyles.php +3 -2
- classes/critcss-inc/admin_settings_explain.php +5 -2
- classes/critcss-inc/admin_settings_queue.php +1 -1
- readme.txt +10 -135
autoptimize.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Autoptimize
|
4 |
* Plugin URI: https://autoptimize.com/
|
5 |
* Description: Makes your site faster by optimizing CSS, JS, Images, Google fonts and more.
|
6 |
-
* Version: 2.7.
|
7 |
* Author: Frank Goossens (futtta)
|
8 |
* Author URI: https://autoptimize.com/
|
9 |
* Text Domain: autoptimize
|
@@ -20,7 +20,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
20 |
exit;
|
21 |
}
|
22 |
|
23 |
-
define( 'AUTOPTIMIZE_PLUGIN_VERSION', '2.7.
|
24 |
|
25 |
// plugin_dir_path() returns the trailing slash!
|
26 |
define( 'AUTOPTIMIZE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
3 |
* Plugin Name: Autoptimize
|
4 |
* Plugin URI: https://autoptimize.com/
|
5 |
* Description: Makes your site faster by optimizing CSS, JS, Images, Google fonts and more.
|
6 |
+
* Version: 2.7.3
|
7 |
* Author: Frank Goossens (futtta)
|
8 |
* Author URI: https://autoptimize.com/
|
9 |
* Text Domain: autoptimize
|
20 |
exit;
|
21 |
}
|
22 |
|
23 |
+
define( 'AUTOPTIMIZE_PLUGIN_VERSION', '2.7.3' );
|
24 |
|
25 |
// plugin_dir_path() returns the trailing slash!
|
26 |
define( 'AUTOPTIMIZE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
autoptimize_helper.php_example
CHANGED
@@ -23,7 +23,7 @@ function my_ao_override_dataursize($urisizeIn) {
|
|
23 |
@return: comma-seperated list of images to exclude */
|
24 |
// add_filter('autoptimize_filter_css_datauri_exclude','my_ao_exclude_image',10,1);
|
25 |
function my_ao_exclude_image($imageexcl) {
|
26 |
-
return "adfreebutton.jpg, otherimage.png";
|
27 |
}
|
28 |
|
29 |
/* autoptimize_filter_js_defer: change flag added to javascript
|
@@ -38,12 +38,12 @@ function my_ao_override_defer($defer) {
|
|
38 |
/* autoptimize_filter_noptimize: stop autoptimize from optimizing, e.g. based on URL as in example
|
39 |
|
40 |
@return: boolean, true or false */
|
41 |
-
// add_filter('autoptimize_filter_noptimize','my_ao_noptimize',10,
|
42 |
-
function my_ao_noptimize() {
|
43 |
if (strpos($_SERVER['REQUEST_URI'],'no-autoptimize-now')!==false) {
|
44 |
return true;
|
45 |
} else {
|
46 |
-
return
|
47 |
}
|
48 |
}
|
49 |
|
23 |
@return: comma-seperated list of images to exclude */
|
24 |
// add_filter('autoptimize_filter_css_datauri_exclude','my_ao_exclude_image',10,1);
|
25 |
function my_ao_exclude_image($imageexcl) {
|
26 |
+
return $imageexcl . ", adfreebutton.jpg, otherimage.png";
|
27 |
}
|
28 |
|
29 |
/* autoptimize_filter_js_defer: change flag added to javascript
|
38 |
/* autoptimize_filter_noptimize: stop autoptimize from optimizing, e.g. based on URL as in example
|
39 |
|
40 |
@return: boolean, true or false */
|
41 |
+
// add_filter('autoptimize_filter_noptimize','my_ao_noptimize',10,1);
|
42 |
+
function my_ao_noptimize( $flag_in ) {
|
43 |
if (strpos($_SERVER['REQUEST_URI'],'no-autoptimize-now')!==false) {
|
44 |
return true;
|
45 |
} else {
|
46 |
+
return $flag_in;
|
47 |
}
|
48 |
}
|
49 |
|
classes/autoptimizeCache.php
CHANGED
@@ -119,7 +119,7 @@ class autoptimizeCache
|
|
119 |
if ( self::do_fallback() && strpos( $this->filename, '_snippet_' ) === false && strpos( $this->filename, '_single_' ) === false ) {
|
120 |
$_extension = pathinfo( $this->filename, PATHINFO_EXTENSION );
|
121 |
$_fallback_file = AUTOPTIMIZE_CACHEFILE_PREFIX . 'fallback.' . $_extension;
|
122 |
-
if ( ! file_exists( $this->cachedir . $_extension . '/' . $_fallback_file ) ) {
|
123 |
file_put_contents( $this->cachedir . $_extension . '/' . $_fallback_file, $data );
|
124 |
}
|
125 |
}
|
119 |
if ( self::do_fallback() && strpos( $this->filename, '_snippet_' ) === false && strpos( $this->filename, '_single_' ) === false ) {
|
120 |
$_extension = pathinfo( $this->filename, PATHINFO_EXTENSION );
|
121 |
$_fallback_file = AUTOPTIMIZE_CACHEFILE_PREFIX . 'fallback.' . $_extension;
|
122 |
+
if ( ( 'css' === $_extension || 'js' === $_extension ) && ! file_exists( $this->cachedir . $_extension . '/' . $_fallback_file ) ) {
|
123 |
file_put_contents( $this->cachedir . $_extension . '/' . $_fallback_file, $data );
|
124 |
}
|
125 |
}
|
classes/autoptimizeConfig.php
CHANGED
@@ -302,7 +302,7 @@ echo ' <i>' . __( '(deprecated)', 'autoptimize' ) . '</i>';
|
|
302 |
<th scope="row"><?php _e( 'Inline and Defer CSS?', 'autoptimize' ); ?></th>
|
303 |
<td><label class="cb_label"><input type="checkbox" name="autoptimize_css_defer" id="autoptimize_css_defer" <?php echo autoptimizeOptionWrapper::get_option( 'autoptimize_css_defer' ) ? 'checked="checked" ' : ''; ?>/>
|
304 |
<?php
|
305 |
-
_e( 'Inline "above the fold CSS" while loading the main autoptimized CSS only after page load. <a href="
|
306 |
echo ' ';
|
307 |
$critcss_settings_url = get_admin_url( null, 'options-general.php?page=ao_critcss' );
|
308 |
// translators: links "autoptimize critical CSS" tab.
|
@@ -379,7 +379,7 @@ echo __( 'A comma-separated list of CSS you want to exclude from being optimized
|
|
379 |
$details = ', ~' . $ao_cache_size . ' total';
|
380 |
}
|
381 |
// translators: Kilobytes + timestamp shown.
|
382 |
-
printf( __( '%1$s files, totalling %2$s
|
383 |
}
|
384 |
?>
|
385 |
</td>
|
@@ -481,7 +481,7 @@ echo __( 'A comma-separated list of CSS you want to exclude from being optimized
|
|
481 |
</div>
|
482 |
</div>
|
483 |
</div>
|
484 |
-
<div style="float:right;margin:50px 15px;"><a href="
|
485 |
</div>
|
486 |
|
487 |
<script type="text/javascript">
|
302 |
<th scope="row"><?php _e( 'Inline and Defer CSS?', 'autoptimize' ); ?></th>
|
303 |
<td><label class="cb_label"><input type="checkbox" name="autoptimize_css_defer" id="autoptimize_css_defer" <?php echo autoptimizeOptionWrapper::get_option( 'autoptimize_css_defer' ) ? 'checked="checked" ' : ''; ?>/>
|
304 |
<?php
|
305 |
+
_e( 'Inline "above the fold CSS" while loading the main autoptimized CSS only after page load. <a href="https://wordpress.org/plugins/autoptimize/faq/" target="_blank">Check the FAQ</a> for more info.', 'autoptimize' );
|
306 |
echo ' ';
|
307 |
$critcss_settings_url = get_admin_url( null, 'options-general.php?page=ao_critcss' );
|
308 |
// translators: links "autoptimize critical CSS" tab.
|
379 |
$details = ', ~' . $ao_cache_size . ' total';
|
380 |
}
|
381 |
// translators: Kilobytes + timestamp shown.
|
382 |
+
printf( __( '%1$s files, totalling %2$s (calculated at %3$s)', 'autoptimize' ), $ao_stat_arr[0], $ao_cache_size, date( 'H:i e', $ao_stat_arr[2] ) );
|
383 |
}
|
384 |
?>
|
385 |
</td>
|
481 |
</div>
|
482 |
</div>
|
483 |
</div>
|
484 |
+
<div style="float:right;margin:50px 15px;"><a href="https://blog.futtta.be/2013/10/21/do-not-donate-to-me/" target="_blank"><img width="100px" height="85px" src="<?php echo plugins_url() . '/' . plugin_basename( dirname( __FILE__ ) ) . '/external/do_not_donate_smallest.png'; ?>" title="<?php _e( 'Do not donate for this plugin!', 'autoptimize' ); ?>"></a></div>
|
485 |
</div>
|
486 |
|
487 |
<script type="text/javascript">
|
classes/autoptimizeCriticalCSSBase.php
CHANGED
@@ -40,6 +40,7 @@ class autoptimizeCriticalCSSBase {
|
|
40 |
// fixme: AO_CCSS_URL should be read from the autoptimize availability json stored as option.
|
41 |
define( 'AO_CCSS_URL', 'https://criticalcss.com' );
|
42 |
define( 'AO_CCSS_API', AO_CCSS_URL . '/api/premium/' );
|
|
|
43 |
}
|
44 |
|
45 |
$this->filepath = __FILE__;
|
@@ -86,50 +87,54 @@ class autoptimizeCriticalCSSBase {
|
|
86 |
}
|
87 |
|
88 |
public static function fetch_options() {
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
$autoptimize_ccss_options['ao_ccss_domain']
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
|
|
|
|
|
|
114 |
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
|
130 |
-
|
131 |
-
|
132 |
-
|
|
|
133 |
}
|
134 |
|
135 |
return $autoptimize_ccss_options;
|
40 |
// fixme: AO_CCSS_URL should be read from the autoptimize availability json stored as option.
|
41 |
define( 'AO_CCSS_URL', 'https://criticalcss.com' );
|
42 |
define( 'AO_CCSS_API', AO_CCSS_URL . '/api/premium/' );
|
43 |
+
define( 'AO_CCSS_SLEEP', 10 );
|
44 |
}
|
45 |
|
46 |
$this->filepath = __FILE__;
|
87 |
}
|
88 |
|
89 |
public static function fetch_options() {
|
90 |
+
static $autoptimize_ccss_options = null;
|
91 |
+
|
92 |
+
if ( null === $autoptimize_ccss_options ) {
|
93 |
+
// not cached yet, fetching from WordPress options.
|
94 |
+
$autoptimize_ccss_options['ao_css_defer'] = autoptimizeOptionWrapper::get_option( 'autoptimize_css_defer' );
|
95 |
+
$autoptimize_ccss_options['ao_css_defer_inline'] = autoptimizeOptionWrapper::get_option( 'autoptimize_css_defer_inline' );
|
96 |
+
$autoptimize_ccss_options['ao_ccss_rules_raw'] = get_option( 'autoptimize_ccss_rules', false );
|
97 |
+
$autoptimize_ccss_options['ao_ccss_additional'] = get_option( 'autoptimize_ccss_additional' );
|
98 |
+
$autoptimize_ccss_options['ao_ccss_queue_raw'] = get_option( 'autoptimize_ccss_queue', false );
|
99 |
+
$autoptimize_ccss_options['ao_ccss_viewport'] = get_option( 'autoptimize_ccss_viewport', false );
|
100 |
+
$autoptimize_ccss_options['ao_ccss_finclude'] = get_option( 'autoptimize_ccss_finclude', false );
|
101 |
+
$autoptimize_ccss_options['ao_ccss_rlimit'] = get_option( 'autoptimize_ccss_rlimit', '5' );
|
102 |
+
$autoptimize_ccss_options['ao_ccss_noptimize'] = get_option( 'autoptimize_ccss_noptimize', false );
|
103 |
+
$autoptimize_ccss_options['ao_ccss_debug'] = get_option( 'autoptimize_ccss_debug', false );
|
104 |
+
$autoptimize_ccss_options['ao_ccss_key'] = get_option( 'autoptimize_ccss_key' );
|
105 |
+
$autoptimize_ccss_options['ao_ccss_keyst'] = get_option( 'autoptimize_ccss_keyst' );
|
106 |
+
$autoptimize_ccss_options['ao_ccss_loggedin'] = get_option( 'autoptimize_ccss_loggedin', '1' );
|
107 |
+
$autoptimize_ccss_options['ao_ccss_forcepath'] = get_option( 'autoptimize_ccss_forcepath', '1' );
|
108 |
+
$autoptimize_ccss_options['ao_ccss_servicestatus'] = get_option( 'autoptimize_service_availablity' );
|
109 |
+
$autoptimize_ccss_options['ao_ccss_deferjquery'] = get_option( 'autoptimize_ccss_deferjquery', false );
|
110 |
+
$autoptimize_ccss_options['ao_ccss_domain'] = get_option( 'autoptimize_ccss_domain' );
|
111 |
+
|
112 |
+
if ( strpos( $autoptimize_ccss_options['ao_ccss_domain'], 'http' ) === false && strpos( $autoptimize_ccss_options['ao_ccss_domain'], 'uggc' ) === 0 ) {
|
113 |
+
$autoptimize_ccss_options['ao_ccss_domain'] = str_rot13( $autoptimize_ccss_options['ao_ccss_domain'] );
|
114 |
+
} elseif ( strpos( $autoptimize_ccss_options['ao_ccss_domain'], 'http' ) !== false ) {
|
115 |
+
// not rot13'ed yet, do so now (goal; avoid migration plugins change the bound domain).
|
116 |
+
update_option( 'autoptimize_ccss_domain', str_rot13( $autoptimize_ccss_options['ao_ccss_domain'] ) );
|
117 |
+
}
|
118 |
|
119 |
+
// Setup the rules array.
|
120 |
+
if ( empty( $autoptimize_ccss_options['ao_ccss_rules_raw'] ) ) {
|
121 |
+
$autoptimize_ccss_options['ao_ccss_rules']['paths'] = array();
|
122 |
+
$autoptimize_ccss_options['ao_ccss_rules']['types'] = array();
|
123 |
+
} else {
|
124 |
+
$autoptimize_ccss_options['ao_ccss_rules'] = json_decode( $autoptimize_ccss_options['ao_ccss_rules_raw'], true );
|
125 |
+
}
|
126 |
|
127 |
+
// Setup the queue array.
|
128 |
+
if ( empty( $autoptimize_ccss_options['ao_ccss_queue_raw'] ) ) {
|
129 |
+
$autoptimize_ccss_options['ao_ccss_queue'] = array();
|
130 |
+
} else {
|
131 |
+
$autoptimize_ccss_options['ao_ccss_queue'] = json_decode( $autoptimize_ccss_options['ao_ccss_queue_raw'], true );
|
132 |
+
}
|
133 |
|
134 |
+
// Override API key if constant is defined.
|
135 |
+
if ( defined( 'AUTOPTIMIZE_CRITICALCSS_API_KEY' ) ) {
|
136 |
+
$autoptimize_ccss_options['ao_ccss_key'] = AUTOPTIMIZE_CRITICALCSS_API_KEY;
|
137 |
+
}
|
138 |
}
|
139 |
|
140 |
return $autoptimize_ccss_options;
|
classes/autoptimizeCriticalCSSCron.php
CHANGED
@@ -119,10 +119,10 @@ class autoptimizeCriticalCSSCron {
|
|
119 |
// Set job hash.
|
120 |
$jprops['hash'] = $hash;
|
121 |
|
122 |
-
// If this is not the first job, wait
|
123 |
if ( $jr > 1 ) {
|
124 |
-
autoptimizeCriticalCSSCore::ao_ccss_log( 'Waiting
|
125 |
-
sleep(
|
126 |
}
|
127 |
|
128 |
// Dispatch the job generate request and increment request count.
|
@@ -187,10 +187,10 @@ class autoptimizeCriticalCSSCron {
|
|
187 |
// Log the pending job.
|
188 |
autoptimizeCriticalCSSCore::ao_ccss_log( 'Found PENDING job with local ID <' . $jprops['ljid'] . '>, continuing its queue processing', 3 );
|
189 |
|
190 |
-
// If this is not the first job, wait
|
191 |
if ( $jr > 1 ) {
|
192 |
-
autoptimizeCriticalCSSCore::ao_ccss_log( 'Waiting
|
193 |
-
sleep(
|
194 |
}
|
195 |
|
196 |
// Dispatch the job result request and increment request count.
|
119 |
// Set job hash.
|
120 |
$jprops['hash'] = $hash;
|
121 |
|
122 |
+
// If this is not the first job, wait 10 seconds before process next job due criticalcss.com API limits.
|
123 |
if ( $jr > 1 ) {
|
124 |
+
autoptimizeCriticalCSSCore::ao_ccss_log( 'Waiting ' . AO_CCSS_SLEEP . ' seconds due to criticalcss.com API limits', 3 );
|
125 |
+
sleep( AO_CCSS_SLEEP );
|
126 |
}
|
127 |
|
128 |
// Dispatch the job generate request and increment request count.
|
187 |
// Log the pending job.
|
188 |
autoptimizeCriticalCSSCore::ao_ccss_log( 'Found PENDING job with local ID <' . $jprops['ljid'] . '>, continuing its queue processing', 3 );
|
189 |
|
190 |
+
// If this is not the first job, wait before process next job due criticalcss.com API limits.
|
191 |
if ( $jr > 1 ) {
|
192 |
+
autoptimizeCriticalCSSCore::ao_ccss_log( 'Waiting ' . AO_CCSS_SLEEP . ' seconds due to criticalcss.com API limits', 3 );
|
193 |
+
sleep( AO_CCSS_SLEEP );
|
194 |
}
|
195 |
|
196 |
// Dispatch the job result request and increment request count.
|
classes/autoptimizeExtra.php
CHANGED
@@ -184,7 +184,7 @@ class autoptimizeExtra
|
|
184 |
}
|
185 |
|
186 |
// Preload!
|
187 |
-
if ( ! empty( $options['autoptimize_extra_text_field_7'] ) ) {
|
188 |
add_filter( 'autoptimize_html_after_minify', array( $this, 'filter_preload' ), 10, 2 );
|
189 |
}
|
190 |
}
|
184 |
}
|
185 |
|
186 |
// Preload!
|
187 |
+
if ( ! empty( $options['autoptimize_extra_text_field_7'] ) || has_filter( 'autoptimize_filter_extra_tobepreloaded' ) ) {
|
188 |
add_filter( 'autoptimize_html_after_minify', array( $this, 'filter_preload' ), 10, 2 );
|
189 |
}
|
190 |
}
|
classes/autoptimizeScripts.php
CHANGED
@@ -345,8 +345,9 @@ class autoptimizeScripts extends autoptimizeBase
|
|
345 |
if ( ! empty( $minified_url ) ) {
|
346 |
// Replace original URL with minified URL from cache.
|
347 |
$new_tag = str_replace( $url, $minified_url, $new_tag );
|
348 |
-
}
|
349 |
-
// Remove the original script tag, because cache content is empty
|
|
|
350 |
$new_tag = '';
|
351 |
}
|
352 |
}
|
345 |
if ( ! empty( $minified_url ) ) {
|
346 |
// Replace original URL with minified URL from cache.
|
347 |
$new_tag = str_replace( $url, $minified_url, $new_tag );
|
348 |
+
} elseif ( apply_filters( 'autoptimize_filter_ccsjs_remove_empty_minified_url', false ) ) {
|
349 |
+
// Remove the original script tag, because cache content is empty but only if filter
|
350 |
+
// is trued because $minified_url is also false if original JS is minified already.
|
351 |
$new_tag = '';
|
352 |
}
|
353 |
}
|
classes/autoptimizeStyles.php
CHANGED
@@ -343,8 +343,9 @@ class autoptimizeStyles extends autoptimizeBase
|
|
343 |
if ( ! empty( $minified_url ) ) {
|
344 |
// Replace orig URL with cached minified URL.
|
345 |
$new_tag = str_replace( $url, $minified_url, $tag );
|
346 |
-
}
|
347 |
-
// Remove the original style tag, because cache content is empty
|
|
|
348 |
$new_tag = '';
|
349 |
}
|
350 |
}
|
343 |
if ( ! empty( $minified_url ) ) {
|
344 |
// Replace orig URL with cached minified URL.
|
345 |
$new_tag = str_replace( $url, $minified_url, $tag );
|
346 |
+
} elseif ( apply_filters( 'autoptimize_filter_ccsjs_remove_empty_minified_url', false ) ) {
|
347 |
+
// Remove the original style tag, because cache content is empty but only if
|
348 |
+
// filter is true-ed because $minified_url is also false if file is minified already.
|
349 |
$new_tag = '';
|
350 |
}
|
351 |
}
|
classes/critcss-inc/admin_settings_explain.php
CHANGED
@@ -22,7 +22,7 @@ function ao_ccss_render_explain() {
|
|
22 |
if ( apply_filters( 'autoptimize_settingsscreen_remotehttp', true ) ) {
|
23 |
$ccss_explanation = get_transient( 'ao_ccss_explain' );
|
24 |
if ( empty( $ccss_explanation ) ) {
|
25 |
-
$ccss_expl_resp = wp_remote_get( 'https://misc.optimizingmatters.com/
|
26 |
if ( ! is_wp_error( $ccss_expl_resp ) ) {
|
27 |
if ( '200' == wp_remote_retrieve_response_code( $ccss_expl_resp ) ) {
|
28 |
$ccss_explanation = wp_kses_post( wp_remote_retrieve_body( $ccss_expl_resp ) );
|
@@ -34,7 +34,10 @@ function ao_ccss_render_explain() {
|
|
34 |
|
35 |
// placeholder text in case HTML is empty.
|
36 |
if ( empty( $ccss_explanation ) ) {
|
37 |
-
$ccss_explanation = '<h2>Fix render-blocking CSS!</h2><p>Significantly improve your first-paint times by making CSS non-render-blocking.</p><p>The next step is to sign up at <a href="https://criticalcss.com/?aff=1" target="_blank">https://criticalcss.com</a> (this is a premium service, priced 2 GBP/month for membership and 5 GBP/month per domain) <strong>and get the API key, which you can copy from <a href="https://criticalcss.com/account/api-keys?aff=1" target="_blank">the API-keys page</a></strong> and paste below.</p><p>If you have any questions or need support, head on over to <a href="https://wordpress.org/support/plugin/autoptimize" target="_blank">our support forum</a> and we\'ll help you get up and running in no time!</p>';
|
|
|
|
|
|
|
38 |
}
|
39 |
|
40 |
// and echo it.
|
22 |
if ( apply_filters( 'autoptimize_settingsscreen_remotehttp', true ) ) {
|
23 |
$ccss_explanation = get_transient( 'ao_ccss_explain' );
|
24 |
if ( empty( $ccss_explanation ) ) {
|
25 |
+
$ccss_expl_resp = wp_remote_get( 'https://misc.optimizingmatters.com/autoptimize_ccss_explain_i18n.html?ao_ver=' . AUTOPTIMIZE_PLUGIN_VERSION );
|
26 |
if ( ! is_wp_error( $ccss_expl_resp ) ) {
|
27 |
if ( '200' == wp_remote_retrieve_response_code( $ccss_expl_resp ) ) {
|
28 |
$ccss_explanation = wp_kses_post( wp_remote_retrieve_body( $ccss_expl_resp ) );
|
34 |
|
35 |
// placeholder text in case HTML is empty.
|
36 |
if ( empty( $ccss_explanation ) ) {
|
37 |
+
$ccss_explanation = __( '<h2>Fix render-blocking CSS!</h2><p>Significantly improve your first-paint times by making CSS non-render-blocking.</p><p>The next step is to sign up at <a href="https://criticalcss.com/?aff=1" target="_blank">https://criticalcss.com</a> (this is a premium service, priced 2 GBP/month for membership and 5 GBP/month per domain) <strong>and get the API key, which you can copy from <a href="https://criticalcss.com/account/api-keys?aff=1" target="_blank">the API-keys page</a></strong> and paste below.</p><p>If you have any questions or need support, head on over to <a href="https://wordpress.org/support/plugin/autoptimize" target="_blank">our support forum</a> and we\'ll help you get up and running in no time!</p>', 'autoptimize' );
|
38 |
+
} else {
|
39 |
+
// we were able to fetch the explenation, so add the JS to show correct language.
|
40 |
+
$ccss_explanation .= "<script>jQuery('.ao_i18n').hide();d=document;lang=d.getElementsByTagName('html')[0].getAttribute('lang').substring(0,2);if(d.getElementById(lang)!= null){jQuery('#'+lang).show();}else{jQuery('#default').show();}</script>";
|
41 |
}
|
42 |
|
43 |
// and echo it.
|
classes/critcss-inc/admin_settings_queue.php
CHANGED
@@ -68,7 +68,7 @@ function ao_ccss_render_queue() {
|
|
68 |
<li><?php _e( 'When things go wrong, a job is marked as <span class="badge error">E</span>. You can retry faulty jobs, delete them or get in touch with <a href="https://criticalcss.com/?aff=1" target="_blank">criticalcss.com</a> for assistance.', 'autoptimize' ); ?></li>
|
69 |
<li><?php _e( 'Sometimes an unknown condition can happen. In this case, the job status becomes <span class="badge unknown">U</span> and you may want to ask <a href="https://criticalcss.com/?aff=1" target="_blank">criticalcss.com</a> for help or just delete it.', 'autoptimize' ); ?></li>
|
70 |
<li><?php _e( 'To get more information about jobs statuses, specially the ones with <span class="badge error">E</span> and <span class="badge unknown">U</span> status, hover your mouse in the status badge of that job. This information might be crucial when contacting <a href="https://criticalcss.com/?aff=1" target="_blank">criticalcss.com</a> for assistance.', 'autoptimize' ); ?></li>
|
71 |
-
<li><?php _e( '<strong>A word about WordPress cron:</strong> Autoptimize CriticalCSS Power-Up watch the queue by using WordPress Cron (or WP-Cron for short.) It <a href="https://www.smashingmagazine.com/2013/10/schedule-events-using-wordpress-cron/#limitations-of-wordpress-cron-and-solutions-to-fix-em" target="_blank">could be faulty</a> on very light or very heavy loads. If your site receives just a few or thousands visits a day, it might be a good idea to <a href="https://developer.wordpress.org/plugins/cron/hooking-into-the-system-task-scheduler/" target="_blank">turn WP-Cron off and use your system task scheduler</a> to fire it instead.', 'autoptimize' ); ?></li>
|
72 |
</ol>
|
73 |
</div>
|
74 |
</div>
|
68 |
<li><?php _e( 'When things go wrong, a job is marked as <span class="badge error">E</span>. You can retry faulty jobs, delete them or get in touch with <a href="https://criticalcss.com/?aff=1" target="_blank">criticalcss.com</a> for assistance.', 'autoptimize' ); ?></li>
|
69 |
<li><?php _e( 'Sometimes an unknown condition can happen. In this case, the job status becomes <span class="badge unknown">U</span> and you may want to ask <a href="https://criticalcss.com/?aff=1" target="_blank">criticalcss.com</a> for help or just delete it.', 'autoptimize' ); ?></li>
|
70 |
<li><?php _e( 'To get more information about jobs statuses, specially the ones with <span class="badge error">E</span> and <span class="badge unknown">U</span> status, hover your mouse in the status badge of that job. This information might be crucial when contacting <a href="https://criticalcss.com/?aff=1" target="_blank">criticalcss.com</a> for assistance.', 'autoptimize' ); ?></li>
|
71 |
+
<li><?php _e( '<strong>A word about WordPress cron:</strong> Autoptimize CriticalCSS Power-Up watch the queue by using WordPress Cron (or WP-Cron for short.) It <a href="https://www.smashingmagazine.com/2013/10/schedule-events-using-wordpress-cron/#limitations-of-wordpress-cron-and-solutions-to-fix-em" target="_blank">could be faulty</a> on very light or very heavy loads. If your site receives just a few or thousands visits a day, it might be a good idea to <a href="https://developer.wordpress.org/plugins/cron/hooking-wp-cron-into-the-system-task-scheduler/" target="_blank">turn WP-Cron off and use your system task scheduler</a> to fire it instead.', 'autoptimize' ); ?></li>
|
72 |
</ol>
|
73 |
</div>
|
74 |
</div>
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Donate link: http://blog.futtta.be/2013/10/21/do-not-donate-to-me/
|
|
5 |
Requires at least: 4.9
|
6 |
Tested up to: 5.4
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 2.7.
|
9 |
|
10 |
Autoptimize speeds up your website by optimizing JS, CSS, images (incl. lazy-load), HTML and Google Fonts, asyncing JS, removing emoji cruft and more.
|
11 |
|
@@ -295,6 +295,14 @@ Just [fork Autoptimize on Github](https://github.com/futtta/autoptimize) and cod
|
|
295 |
|
296 |
== Changelog ==
|
297 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
= 2.7.2 =
|
299 |
* Critical CSS: fix settings page issues with certain translation strings
|
300 |
* Critical CSS: fix "inline & defer" not being "seen" on multisite network settings
|
@@ -348,138 +356,5 @@ Just [fork Autoptimize on Github](https://github.com/futtta/autoptimize) and cod
|
|
348 |
* added option to enable/ disable the minification of excluded JS/ CSS files (on by default)
|
349 |
* misc. bugfixes and smaller improvements
|
350 |
|
351 |
-
= 2.4.4 =
|
352 |
-
* bugfix: safer way of removing extra cronjobs
|
353 |
-
|
354 |
-
= 2.4.3 =
|
355 |
-
* improved Google Fonts optimzation, praise to @nextendweb (of Smartslider3 fame)!
|
356 |
-
* improved deferring of non-aggregated CSS when "inline & defer" is active
|
357 |
-
* bugfix: extra ao_cachechecker scheduled jobs & improve scheduling logic
|
358 |
-
* bugfix: some extra checks on vars to avoid PHP notices
|
359 |
-
|
360 |
-
= 2.4.2 =
|
361 |
-
* misc. improvements to image optimization logic
|
362 |
-
* update PAnD framework to latest version to fix issues with notices not staying dismissed
|
363 |
-
* patched JS minifying component to not break template literals as reported by Alex Kozack
|
364 |
-
* bugfix for Google fonts subset concatenation by Rocco Aliberti, thanks!
|
365 |
-
* bugfix not to remove querystrings if that option is not on in "Extra", kudo's to Diego Versiani for pointing out the inconsistency
|
366 |
-
* tested and confirmed working with WordPress 5.0 (beta 5)
|
367 |
-
|
368 |
-
= 2.4.1 =
|
369 |
-
* bugfix for CSS minifier throwing a HTTP 500 error when a `}` is missing.
|
370 |
-
* bugfix for slowness when iconv was used for multibyte string replacements (ditched iconv).
|
371 |
-
* bugfix for occasional issues with broken/ missing </html> strings due to mbstring (also for multibyte string replacement) weirdness.
|
372 |
-
* bugfix for wrong sizes in image optimization.
|
373 |
-
* bugfix for Google Font subset getting lost in optimization.
|
374 |
-
|
375 |
-
= 2.4.0 =
|
376 |
-
* refactored significantly (no more "classlesses", all is OO), classes are autoloaded, tests added (travis-ci) by zytzagoo who deserves praise for his hard work!
|
377 |
-
* new: image optimization (see "Extra"-tab) using Shortpixel's smart image optimization proxy
|
378 |
-
* new: you can now disable JS/ CSS-files being aggregated, having them minified individually instead
|
379 |
-
* new: Google Fonts can now be "aggregated & preloaded", this uses CSS which is loaded non render-blocking
|
380 |
-
* new: Autoptimize "listens" to page caches being cleared, upon which it purges it's own cache as well. Support depends on known action hooks firing by the page cache, supported by Hyper Cache, WP Rocket, W3 Total Cache, KeyCDN Cache Enabler, Swift, WP Super Cache, WP Fastest Cache and Comet Cache.
|
381 |
-
* new: local JS/ CSS-files that are excluded from optimization are minified by default (can be overridden by filter)
|
382 |
-
* improvement: updated minifiers (with very significant improvements for YUI CSS compressor PHP port)
|
383 |
-
* improvement: "remove all Google Fonts" is now more careful (avoiding removing entire CSS blocks)
|
384 |
-
* misc. under the hood improvements (e.g. more robust cache clearing, better support for multibyte character sets, improved CDN rewrite logic, avoid PHP warnings when writing files to cache, ...)
|
385 |
-
|
386 |
-
= 2.3.4 =
|
387 |
-
* bugfix: is_plugin_active causing errors in some cases as [reported by @iluminancia and @lozula](https://wordpress.org/support/topic/fatal-error-after-update-to-2-3-3/)
|
388 |
-
* bugfix: added language domain to 4 __/_e functions, un grand merci à Guillaume Blet!
|
389 |
-
|
390 |
-
= 2.3.3 =
|
391 |
-
* improvement: updated to latest version of Filamentgroup's loadCSS
|
392 |
-
* improvement: by default exclude `wp-content/cache` and `wp-content/uploads` from CSS optimization (Divi, Avada & possibly others store page-specific CSS there)
|
393 |
-
* bugfix: stop double try/catch-blocks
|
394 |
-
* misc. bugfixes (see [GitHub commit log](https://github.com/futtta/autoptimize/commits/master))
|
395 |
-
* heads-up: this is (supposed to be) the last minor release of the 2.3 branch, [2.4 is a major change with some big under-the-hood and functional changes](https://blog.futtta.be/2018/02/18/introducing-zytzagoos-major-changes-for-autoptimize-2-4/)
|
396 |
-
|
397 |
-
= 2.3.2 =
|
398 |
-
* workaround for [stale options-data in external object cache such as Redis, Memcached (core bug)](https://core.trac.wordpress.org/ticket/31245) resulting in Autoptimize continuously executing the upgrade-procedure including clearing the cache and trying to preload it with HTTP-requests with "cachebuster" in the query string, thanks to [Haroon Q. Raja](https://hqraja.com/) and [Tomas Trkulja](https://twitter.com/zytzagoo) for their great assistance!
|
399 |
-
* fixes for "undefined index" notices on Extra settings page
|
400 |
-
* now removing respective dns-prefetch resource hints when "remove emojis" or when Google Fonts are optimized or removed.
|
401 |
-
* changed JS code to load webfont.js deferred instead of asynced to make sure the js-file or fonts are not consider render blocking.
|
402 |
-
|
403 |
-
= 2.3.1 =
|
404 |
-
* fix for issue with update-code in some circumstances, thanks to [Rajendra Zore](https://rajendrazore.com/) to report & help fix!
|
405 |
-
|
406 |
-
= 2.3.0 =
|
407 |
-
* new: optimize Google fonts with "combine & link" and "combine and load async" (with webload.js), intelligently preconnecting to Google's domains to limit performance impact even further
|
408 |
-
* new: Async JS, can be applied to local or 3rd party JS (if local it will be auto-excluded from autoptimization)
|
409 |
-
* new: support to tell browsers to preconnect (= dns lookup + tcp/ip connection + ssl negotiation) to 3rd party domains (depends on browser support, works in Chrome & Firefox)
|
410 |
-
* new: remove WordPress' core's emoji CSS & JS
|
411 |
-
* new: remove (version parameter from) Querystring
|
412 |
-
* new: support to clear cache through WP CLI thanks to [junaidbhura](https://junaidbhura.com)
|
413 |
-
* lots of [bugfixes and small improvements done by some seriously smart people via GitHub](https://github.com/futtta/autoptimize/commits/master) (thanks all!!), including [a fix for AO 2.2 which saw the HTML minifier go PacMan on spaces](https://github.com/futtta/autoptimize/commit/0f6ac683c35bc82d1ac2d496ae3b66bb53e49f88) in some circumstances.
|
414 |
-
|
415 |
-
= 2.2.2 =
|
416 |
-
* roll-back to previous battle-tested version of the CSS minifier
|
417 |
-
* tweaks to Autoptimize toolbar menu (visual + timeout of "delete cache" AJAX call)
|
418 |
-
* readme update
|
419 |
-
|
420 |
-
= 2.2.1 =
|
421 |
-
* fix for images being referenced in CSS not all being translated to correct path, leading to 404's as reported by Jeff Inho
|
422 |
-
* fix for "[] operator not supported for strings" error in PHP7.1 as reported by falk-wussow.de
|
423 |
-
* fix for security hash busting AO's cache in some cases (esp. in 2.1.1)
|
424 |
-
|
425 |
-
= 2.2.0 =
|
426 |
-
* new: Autoptimize minifies first (caching the individual snippets) and aggregrates the minified snippets, resulting in huge performance improvements for uncached JS/ CSS.
|
427 |
-
* new: option to enable/ disable AO for logged in users (on by default)
|
428 |
-
* new: option to enable/ disable AO on WooCommerce, Easy Digital Downloads or WP eCommerce cart/ checkout page (on by default)
|
429 |
-
* improvement: switched to [rel=preload + Filamentgroup's loadCSS for CSS deferring](http://blog.futtta.be/2017/02/24/autoptimize-css-defer-switching-to-loadcss-soon/)
|
430 |
-
* improvement: switched to YUI CSS minifier PHP-port 2.8.4-p10 (so not to the 3.x branch yet)
|
431 |
-
* improvements to the logic of which JS/ CSS can be optimized (getPath function) increasing reliability of the aggregation process
|
432 |
-
* security: made placeholder replacement less naive to protect against XSS and LFI vulnerability as reported by Matthew Barry and fixed with great help from Matthew and Tomas Trkulja. Thanks guys!!
|
433 |
-
* API: Lots of extra filters, making AO (even) more flexible.
|
434 |
-
* Lots of bugfixes and smaller improvements (see [GitHub commit log](https://github.com/futtta/autoptimize/commits/master))
|
435 |
-
* tested and confirmed working in WordPress 4.8
|
436 |
-
|
437 |
-
= 2.1.2 =
|
438 |
-
* fix for security hash busting AO's cache in some cases (esp. in 2.1.1)
|
439 |
-
* identical to 2.1.0 except for the security fix backported from 2.2.0
|
440 |
-
|
441 |
-
= 2.1.1 =
|
442 |
-
* identical to 2.1.0 except for the security fix backported from 2.2.0
|
443 |
-
|
444 |
-
= 2.1.0 =
|
445 |
-
* new: Autoptimize now appears in admin-toolbar with an easy view on cache size and the possibility to purge the cache (pass `false` to `autoptimize_filter_toolbar_show` filter to disable), a big thanks to [Pablo Custo](https://github.com/pablocusto) for his hard work on this nice feature!
|
446 |
-
* new: An extra "More Optimization"-tab is shown (can be hidden with ´autoptimize_filter_show_partner_tabs´-filter) with information about related optimization tools- and services.
|
447 |
-
* new: If cache size becomes too big, a mail will be sent to the site admin (pass `false` to `autoptimize_filter_cachecheck_sendmail` filter to disable or pass alternative email to the `autoptimize_filter_cachecheck_mailto` filter to change email-address)
|
448 |
-
* new: power-users can enable Autoptimize to pre-gzip the autoptimized files by passing `true` to `autoptimize_filter_cache_create_static_gzip`, kudo's to (Draikin)[https://github.com/Draikin] for this!
|
449 |
-
* improvement: admin GUI updated (again; thanks Pablo!) with some responsiveness added in the mix (not showing the right hand column on smaller screen-sizes)
|
450 |
-
* improvement: settings-screen now accepts protocol-relative URL for CDN base URL
|
451 |
-
* improvement: new (smarter) defaults for JS (don't force in head + exclude jquery.js) and CSS optimization (include inline CSS)
|
452 |
-
* Misc. bugfixes & small improvements (see [commit-log on GitHub](https://github.com/futtta/autoptimize/commits/master))
|
453 |
-
* Minimal version updated from 2.7 (!) to 4.0
|
454 |
-
* Tested and confirmed working on WordPress 4.6
|
455 |
-
|
456 |
-
= 2.0.2 =
|
457 |
-
* bugfix: disallow moving non-aggregated JS by default (can be re-enabled by passing false to the `autoptimize_filter_js_unmovable`)
|
458 |
-
* bugfix: hook autoptimize_action_cachepurged into init to avoid ugly error-message for ZenCache (Comet Cache) users
|
459 |
-
* bugfix to allow for Autoptimize to work with PHP 5.2 (although [you really should upgrade](http://blog.futtta.be/2016/03/15/why-would-you-still-be-on-php-5-2/))
|
460 |
-
|
461 |
-
= 2.0.1 =
|
462 |
-
* Improvement: Autoptimize now also tries to purge WP Engine cache when AO's cache is cleared
|
463 |
-
* Improvement: for AMP pages (which are pretty optimized anyway) Autoptimize will not optimize to avoid issues with e.g. "inline & defer" and with AO adding attributes to link-tags that are not allowed in the subset of HTML that AMP is
|
464 |
-
* Improvement: refactored the page cache purging mechanism (removing duplicate code, now nicely hooking into AO's own `autoptimize_action_cachepurged` action)
|
465 |
-
* Improvement: Re-enable functionality to move non-aggregated JS if "also aggregate inline JS" is active (can be disabled with `autoptimize_filter_js_unmovable` filter)
|
466 |
-
* Improvement: script tags with `data-noptimize` attribute will be excluded from optimization
|
467 |
-
* Bugfix: Better support for renamed wp-content directories
|
468 |
-
* Bugfix: Multiple fixes for late-injected CSS/ JS (changes in those files were not always picked up, fonts or background images were not being CDN'ed, ...)
|
469 |
-
* Misc. other fixes & improvements, go read [the commit-log on GitHub](https://github.com/futtta/autoptimize/commits/master) if you're that curious
|
470 |
-
* Tested & confirmed working with WordPress 4.5 (beta 3)
|
471 |
-
|
472 |
-
= 2.0.0 =
|
473 |
-
* On average 30% faster minification (more info [in this blogpost](http://blog.futtta.be/2015/12/22/making-autoptimize-faster/))!
|
474 |
-
* New: Option to (de-)activate aggregation of inline JS and CSS.
|
475 |
-
* New: Option to remove Google Fonts.
|
476 |
-
* New: Cache-size will be checked daily and a notice will be shown on wp-admin if cache size goes over 512 MB (can be changed by filter).
|
477 |
-
* New: Small autoptimized CSS (less then 256 characters, can be changed by filter) will be inlined instead of linked.
|
478 |
-
* New in API: filters to declare a JS and CSS whitelist, where only files in that whitelist are autoptimized and all others are left untouched.
|
479 |
-
* New in API: filters to declare removable CSS and JS, upon which Autoptimize will simply delete that code (emoji CSS/JS for example, if you prefer not to dequeue them).
|
480 |
-
* New in API: filter to move fonts to CDN as well.
|
481 |
-
* lots of small and bigger bugfixes, I won't bother you with a full list but have a look at [the commmit log on GitHub](https://github.com/futtta/autoptimize/commits/master).
|
482 |
-
* tested and confirmed working with PHP7
|
483 |
-
|
484 |
= older =
|
485 |
-
* see [https://plugins.svn.wordpress.org/autoptimize/tags/2.
|
5 |
Requires at least: 4.9
|
6 |
Tested up to: 5.4
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 2.7.3
|
9 |
|
10 |
Autoptimize speeds up your website by optimizing JS, CSS, images (incl. lazy-load), HTML and Google Fonts, asyncing JS, removing emoji cruft and more.
|
11 |
|
295 |
|
296 |
== Changelog ==
|
297 |
|
298 |
+
= 2.7.3 =
|
299 |
+
* Critical CSS: cache settings in the PHP process instead of re-fetching them
|
300 |
+
* Critical CSS: shorter intervals between calls to criticalcss.com (shortening the asynchronous job queue processing time)
|
301 |
+
* inline & defer CSS: fix for some excluded files not being preloaded
|
302 |
+
* 404 fallback: only create fallback files for CSS/ JS, not for (background-)images
|
303 |
+
* copy changes as suggested by Cyrille (@css31), un grand merci!
|
304 |
+
* misc. other minor fixes, see the [GitHub commit log](https://github.com/futtta/autoptimize/commits/beta).
|
305 |
+
|
306 |
= 2.7.2 =
|
307 |
* Critical CSS: fix settings page issues with certain translation strings
|
308 |
* Critical CSS: fix "inline & defer" not being "seen" on multisite network settings
|
356 |
* added option to enable/ disable the minification of excluded JS/ CSS files (on by default)
|
357 |
* misc. bugfixes and smaller improvements
|
358 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
359 |
= older =
|
360 |
+
* see [https://plugins.svn.wordpress.org/autoptimize/tags/2.7.2/readme.txt](https://plugins.svn.wordpress.org/autoptimize/tags/2.7.2/readme.txt)
|