Changeset 2978978
- Timestamp:
- 10/14/2023 08:25:20 AM (2 years ago)
- Location:
- autoptimize/trunk
- Files:
-
- 1 added
- 11 edited
-
autoptimize.php (modified) (2 diffs)
-
classes/autoptimizeCache.php (modified) (1 diff)
-
classes/autoptimizeConfig.php (modified) (3 diffs)
-
classes/autoptimizeCriticalCSSSettings.php (modified) (1 diff)
-
classes/autoptimizeImages.php (modified) (1 diff)
-
classes/autoptimizeMain.php (modified) (3 diffs)
-
classes/autoptimizeProTab.php (added)
-
classes/autoptimizeScripts.php (modified) (2 diffs)
-
classes/autoptimizeUtils.php (modified) (3 diffs)
-
classes/critcss-inc/admin_settings_explain.php (modified) (1 diff)
-
classes/critcss-inc/admin_settings_rules.js.php (modified) (4 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
autoptimize/trunk/autoptimize.php
r2929681 r2978978 4 4 * Plugin URI: https://autoptimize.com/pro/ 5 5 * Description: Makes your site faster by optimizing CSS, JS, Images, Google fonts and more. 6 * Version: 3.1. 8.16 * Version: 3.1.9 7 7 * Author: Frank Goossens (futtta) 8 8 * Author URI: https://autoptimize.com/pro/ … … 22 22 } 23 23 24 define( 'AUTOPTIMIZE_PLUGIN_VERSION', '3.1. 8.1' );24 define( 'AUTOPTIMIZE_PLUGIN_VERSION', '3.1.9' ); 25 25 26 26 // plugin_dir_path() returns the trailing slash! -
autoptimize/trunk/classes/autoptimizeCache.php
r2786932 r2978978 388 388 $caller = isset( $dbt[1]['function'] ) ? $dbt[1]['function'] : null; 389 389 if ( 'et_core_clear_wp_cache' === $caller ) { 390 _doing_it_wrong( 'autoptimizeCache::clearall', 'Divi devs: please don\'t clear Autoptimize\'s cache, it is unneeded and can break sites. You can contact me at [email protected] to discuss.', 'Autoptimize 2.9.6' ); 390 if ( apply_filters( 'autoptimize_filter_cache_divi_wrong_complain', true ) ) { 391 _doing_it_wrong( 'autoptimizeCache::clearall', 'Divi devs: please don\'t clear Autoptimize\'s cache, it is unneeded and can break sites. You can contact me at [email protected] to discuss.', 'Autoptimize 2.9.6' ); 392 } 391 393 return false; 392 394 } -
autoptimize/trunk/classes/autoptimizeConfig.php
r2903008 r2978978 336 336 <tr valign="top" class="css_sub" id="autoptimize_css_defer_inline"> 337 337 <th scope="row"></th> 338 <td><label><textarea rows="10" cols="10" style="width:100%;" placeholder="<?php _e( 'Paste the above the fold CSS here. You can leave this empty when using the automated Critical CSS integration.', 'autoptimize' ); ?>" name="autoptimize_css_defer_inline"><?php echo autoptimizeStyles::sanitize_css( autoptimizeOptionWrapper::get_option( 'autoptimize_css_defer_inline' ) ); ?></textarea></label></td>338 <td><label><textarea rows="10" cols="10" style="width:100%;" spellcheck="false" placeholder="<?php _e( 'Paste the above the fold CSS here. You can leave this empty when using the automated Critical CSS integration.', 'autoptimize' ); ?>" name="autoptimize_css_defer_inline"><?php echo autoptimizeStyles::sanitize_css( autoptimizeOptionWrapper::get_option( 'autoptimize_css_defer_inline' ) ); ?></textarea></label></td> 339 339 </tr> 340 340 <tr valign="top" class="css_sub css_aggregate"> … … 809 809 { 810 810 static $config = array( 811 'autoptimize_html' => 0,811 'autoptimize_html' => 1, 812 812 'autoptimize_html_keepcomments' => 0, 813 813 'autoptimize_html_minify_inline' => 0, 814 814 'autoptimize_enable_site_config' => 1, 815 'autoptimize_js' => 0,815 'autoptimize_js' => 1, 816 816 'autoptimize_js_aggregate' => 0, 817 817 'autoptimize_js_defer_not_aggregate' => 1, … … 822 822 'autoptimize_js_include_inline' => 0, 823 823 'autoptimize_js_forcehead' => 0, 824 'autoptimize_css' => 0,824 'autoptimize_css' => 1, 825 825 'autoptimize_css_aggregate' => 0, 826 826 'autoptimize_css_exclude' => '', -
autoptimize/trunk/classes/autoptimizeCriticalCSSSettings.php
r2882657 r2978978 190 190 <div data-dismissible="i-know-about-disable-cron-forever" class="notice-warning notice is-dismissible"><p> 191 191 <?php 192 _e( 'WordPress cron (for task scheduling) seems to be disabled. Have a look at <a href="https:// wordpress.org/plugins/autoptimize-criticalcss/faq/" target="_blank">the FAQ</a> or the info in the Job Queue instructions if all jobs remain in "N" status and no rules are created.', 'autoptimize' );192 _e( 'WordPress cron (for task scheduling) seems to be disabled. Have a look at <a href="https://blog.futtta.be/2023/03/17/how-to-fix-autoptimize-critical-css-cron-issue/" target="_blank">the FAQ</a> or the info in the Job Queue instructions if all jobs remain in "N" status and no rules are created.', 'autoptimize' ); 193 193 ?> 194 194 </p></div> -
autoptimize/trunk/classes/autoptimizeImages.php
r2929681 r2978978 1085 1085 1086 1086 // set default exclusions. 1087 $exclude_lazyload_array = array( 'skip-lazy', 'data-no-lazy', 'notlazy', 'data-src', 'data-srcset', 'data:image/', 'data-lazyload', 'rev-slidebg', 'loading="eager"' );1087 $exclude_lazyload_array = array( 'skip-lazy', 'data-no-lazy', 'notlazy', 'data-src', 'data-srcset', 'data:image/', 'data-lazyload', 'rev-slidebg', 'loading="eager"', 'fetchpriority="high"' ); 1088 1088 1089 1089 // add from setting. -
autoptimize/trunk/classes/autoptimizeMain.php
r2879913 r2978978 192 192 193 193 // And disable Jetpack's site accelerator if JS or CSS opt. are active. 194 if ( class_exists( 'Jetpack' ) && apply_filters( 'autoptimize_filter_main_disable_jetpack_cdn', true ) && ( $conf->get( 'autoptimize_js' ) || $conf->get( 'autoptimize_css' ) ) ) { 195 add_filter( 'jetpack_force_disable_site_accelerator', '__return_true' ); 194 if ( class_exists( 'Jetpack' ) && apply_filters( 'autoptimize_filter_main_disable_jetpack_cdn', true ) && ( $conf->get( 'autoptimize_js' ) || $conf->get( 'autoptimize_css' ) || autoptimizeImages::imgopt_active() ) ) { 195 add_filter( 'jetpack_force_disable_site_accelerator', '__return_true' ); // this does not seemt to work any more? 196 add_filter( 'jetpack_photon_skip_for_url', '__return_true' ); 196 197 } 197 198 … … 225 226 new autoptimizePartners(); 226 227 new autoptimizeExitSurvey(); 228 new autoptimizeProTab(); 227 229 } 228 230 } … … 750 752 { 751 753 echo '<div class="updated"><p>'; 752 printf( __( 'Thank you for installing and activating Autoptimize. Please configure it under %1$sSettings -> Autoptimize%2$s to start improving your site\'s performance.', 'autoptimize' ), '<a href="options-general.php?page=autoptimize">', '</a>' );754 printf( __( 'Thank you for installing and activating Autoptimize. Your site is being optimized immediately, please test the frontend to ensure everything still works as expected. If needed you can change JavaScript or CSS optimization settings under %1$sSettings -> Autoptimize%2$s .', 'autoptimize' ), '<a href="options-general.php?page=autoptimize">', '</a>' ); 753 755 echo '</p></div>'; 754 756 } -
autoptimize/trunk/classes/autoptimizeScripts.php
r2851119 r2978978 378 378 379 379 // not aggregating but deferring? 380 if ( $this->defer_not_aggregate && false === $this->aggregate && ( str_replace( $this->dontmove, '', $path ) === $path || ( apply_filters( 'autoptimize_filter_js_defer_external', true ) && str_replace( $this->dontmove, '', $orig_tag ) === $orig_tag ) ) && strpos( $new_tag, ' defer' ) === false && strpos( $new_tag, ' async' ) === false ) { 381 $new_tag = str_replace( '<script ', '<script defer ', $new_tag ); 380 if ( $this->defer_not_aggregate && false === $this->aggregate && ( str_replace( $this->dontmove, '', $path ) === $path || ( apply_filters( 'autoptimize_filter_js_defer_external', true ) && str_replace( $this->dontmove, '', $orig_tag ) === $orig_tag ) ) && strpos( $new_tag, ' defer' ) === false ) { 381 if ( false !== strpos( $new_tag, ' async' ) && true === apply_filters( 'autoptimize_filter_js_defer_trumps_async', true ) ) { 382 // remove async flag to ensure JS is properly deferred, otherwise the asynced JS might fire 383 // before deferred inlined JS is executed, off course except filter is set to false which 384 // re-institutes previous behavior. 385 $new_tag = str_replace( array( " async='async'", ' async="async"', ' async=async', ' async' ), '', $new_tag ); 386 } 387 388 if ( false === strpos( $new_tag, ' async' ) ) { 389 // either async wasn't there to begin with or it was removed. 390 // if async is there, the autoptimize_filter_js_defer_trumps_async 391 // filter was set to false and in that case defer should not be added. 392 $new_tag = str_replace( '<script ', '<script defer ', $new_tag ); 393 } 382 394 } 383 395 … … 461 473 462 474 $new_tag = '<script defer ' . $_id . 'src="data:text/javascript;base64,' . base64_encode( $match[3] ) . '"></script>'; 463 $this->content = str_replace( $t ag, $new_tag, $this->content );475 $this->content = str_replace( $this->hide_comments( $tag ), $new_tag, $this->content ); 464 476 $tag = ''; 465 477 } else { -
autoptimize/trunk/classes/autoptimizeUtils.php
r2903008 r2978978 410 410 $_page_cache_constants = array( 411 411 'NgInx' => 'NGINX_HELPER_BASENAME', 412 'Kinsta' => 'KINSTA _CACHE_ZONE',412 'Kinsta' => 'KINSTAMU_VERSION', 413 413 'Presslabs' => 'PL_INSTANCE_REF', 414 414 'Cache Enabler' => 'CACHE_ENABLER_VERSION', … … 491 491 */ 492 492 public static function is_ao_settings() { 493 $_is_ao_settings = ( str_replace( array( 'autoptimize', 'autoptimize_imgopt', 'ao_critcss', 'autoptimize_extra', 'ao_partners', 'ao_pro_boosters' ), '', $_SERVER['REQUEST_URI'] ) !== $_SERVER['REQUEST_URI'] ? true : false );493 $_is_ao_settings = ( str_replace( array( 'autoptimize', 'autoptimize_imgopt', 'ao_critcss', 'autoptimize_extra', 'ao_partners', 'ao_pro_boosters', 'ao_pro_pagecache', 'ao_protab' ), '', $_SERVER['REQUEST_URI'] ) !== $_SERVER['REQUEST_URI'] ? true : false ); 494 494 return $_is_ao_settings; 495 495 } … … 557 557 // localhost IPv4/ IPv6. 558 558 $_is_local_server = true; 559 } elseif ( 0 === strpos( $_domain, '127.' ) || 0 === strpos( $_domain, '192.168.' ) || 0 === strpos( $_domain, ' fd' ) ) {559 } elseif ( 0 === strpos( $_domain, '127.' ) || 0 === strpos( $_domain, '192.168.' ) || 0 === strpos( $_domain, '10.' ) || 0 === strpos( $_domain, 'fd' ) ) { 560 560 // private ranges so unreachable for imgopt/ CCSS. 561 // fixme; 172.16.0.0–172.31.255.255 also private. 561 562 $_is_local_server = true; 562 563 } elseif ( autoptimizeUtils::str_ends_in( $_domain, '.local') ) { -
autoptimize/trunk/classes/critcss-inc/admin_settings_explain.php
r2703914 r2978978 35 35 if ( '200' == wp_remote_retrieve_response_code( $ccss_expl_resp ) ) { 36 36 $ccss_explanation = wp_kses_post( wp_remote_retrieve_body( $ccss_expl_resp ) ); 37 set_transient( 'ao3_ccss_explain', $ccss_explanation, WEEK_IN_SECONDS );37 set_transient( $_transient, $ccss_explanation, WEEK_IN_SECONDS ); 38 38 } 39 39 } -
autoptimize/trunk/classes/critcss-inc/admin_settings_rules.js.php
r2786932 r2978978 233 233 jQuery("#critcss_addedit_file").val(crit_file); 234 234 jQuery("#critcss_addedit_css").attr("placeholder", "<?php _e( 'Loading critical CSS...', 'autoptimize' ); ?>"); 235 jQuery("#critcss_addedit_css").attr("spellcheck",false); 235 236 jQuery("#critcss_addedit_type").attr("disabled",true); 236 237 … … 265 266 // default: paths, hide content type field 266 267 jQuery("#critcss_addedit_type").val("paths"); 268 jQuery("#critcss_addedit_css").attr("spellcheck",false); 267 269 jQuery("#critcss_addedit_pagetype_wrapper").hide(); 268 270 … … 316 318 function editDefaultCritCss(){ 317 319 document.getElementById("dummyDefault").value=document.getElementById("autoptimize_css_defer_inline").value; 320 jQuery("#dummyDefault").attr("spellcheck",false); 318 321 jQuery("#default_critcss_wrapper").dialog({ 319 322 autoOpen: true, … … 337 340 function editAdditionalCritCss(){ 338 341 document.getElementById("dummyAdditional").value=document.getElementById("autoptimize_ccss_additional").value; 342 jQuery("#dummyAdditional").attr("spellcheck",false); 339 343 jQuery("#additional_critcss_wrapper").dialog({ 340 344 autoOpen: true, -
autoptimize/trunk/readme.txt
r2952963 r2978978 3 3 Tags: optimize, minify, performance, images, core web vitals, lazy-load, pagespeed, google fonts 4 4 Donate link: http://blog.futtta.be/2013/10/21/do-not-donate-to-me/ 5 Requires at least: 5.3 6 Tested up to: 6. 35 Requires at least: 5.3 6 Tested up to: 6.4 7 7 Requires PHP: 5.6 8 8 Stable tag: 3.1.8.1 … … 21 21 > We provide great [Premium Support and Web Performance Optimization services](https://misc.optimizingmatters.com/partners/?from=partnertab&partner=autoptimizepro), check out our offering on [https://accelera.site/](https://misc.optimizingmatters.com/partners/?from=partnertab&partner=autoptimizepro)! 22 22 23 (Speed-surfing image under creative commons [by LL Twistiti](https://www.flickr.com/photos/twistiti/818552808/))23 (Speed-surfing image under creative commons [by LL Twistiti](https://www.flickr.com/photos/twistiti/818552808/)) 24 24 25 25 == Installation == … … 320 320 == Changelog == 321 321 322 = 3.1.9 = 323 * improvement: activate JS, CSS & HTML optimization upon plugin activation (hat tip to Adam Silverstein (developer relations engineer at Google)) 324 * improvement: also defer asynced JS (to ensure execution order remains intact; asynced JS should not execute before deferred inline JS which it might depend upon) 325 * improvement: exclude images from being lazyloaded if they have fetchpriority attribute set to high (as done by WordPress core since 6.3) 326 * bugfix: disable spellcheck on CSS textarea's (above the fold CSS/ critical CSS) which in some cases caused browser issues 327 * add tab to explain Autoptimize Pro. 328 * confirmed working with WordPress 6.4 (beta 3) 329 * some other minor changes/ improvements/ filters, see the [GitHub commit log](https://github.com/futtta/autoptimize/commits/beta). 330 322 331 = 3.1.8.1 = 323 332 * urgent fix for PHP error, sorry about that!
Note: See TracChangeset
for help on using the changeset viewer.