Skip to content

Commit

Permalink
Merge pull request #28 from ClassicPress/update/plugins
Browse files Browse the repository at this point in the history
Update plugins: Autoptimize, Which Template File and Mobile Menu
  • Loading branch information
timbocode authored Mar 2, 2021
2 parents 5291ff1 + 3eef845 commit a9bf57e
Show file tree
Hide file tree
Showing 113 changed files with 5,707 additions and 40,022 deletions.
4 changes: 2 additions & 2 deletions wp-content/plugins/autoptimize/autoptimize.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Autoptimize
* Plugin URI: https://autoptimize.com/
* Description: Makes your site faster by optimizing CSS, JS, Images, Google fonts and more.
* Version: 2.7.7
* Version: 2.8.1
* Author: Frank Goossens (futtta)
* Author URI: https://autoptimize.com/
* Text Domain: autoptimize
Expand All @@ -21,7 +21,7 @@
exit;
}

define( 'AUTOPTIMIZE_PLUGIN_VERSION', '2.7.7' );
define( 'AUTOPTIMIZE_PLUGIN_VERSION', '2.8.1' );

// plugin_dir_path() returns the trailing slash!
define( 'AUTOPTIMIZE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
Expand Down
16 changes: 14 additions & 2 deletions wp-content/plugins/autoptimize/classes/autoptimizeCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ public function retrieve()
*/
public function cache( $data, $mime )
{
// readonly FS explicitly OK'ed by developer, so just pretend all is OK.
if ( defined( 'AUTOPTIMIZE_CACHE_READONLY' ) ) {
return true;
}

// off by default; check if cachedirs exist every time before caching
//
// to be activated for users that experience these ugly errors;
Expand Down Expand Up @@ -529,6 +534,11 @@ protected static function stats_scan()
*/
public static function cacheavail()
{
// readonly FS explicitly OK'ed by dev, let's assume the cache dirs are there!
if ( defined( 'AUTOPTIMIZE_CACHE_READONLY' ) ) {
return true;
}

if ( false === autoptimizeCache::check_and_create_dirs() ) {
return false;
}
Expand Down Expand Up @@ -622,7 +632,7 @@ public static function check_fallback_php() {
$_fallback_php = trailingslashit( WP_CONTENT_DIR ) . $_fallback_filename;
$_fallback_status = true;

if ( ! file_exists( $_fallback_php ) ) {
if ( ! file_exists( $_fallback_php ) && is_writable( WP_CONTENT_DIR ) ) {
$_fallback_php_contents = file_get_contents( AUTOPTIMIZE_PLUGIN_DIR . 'config/' . $_fallback_filename );
$_fallback_php_contents = str_replace( '<?php exit;', '<?php', $_fallback_php_contents );
$_fallback_php_contents = str_replace( '<!--ao-cache-dir-->', AUTOPTIMIZE_CACHE_DIR, $_fallback_php_contents );
Expand All @@ -647,7 +657,7 @@ public static function do_fallback() {
static $_do_fallback = null;

if ( null === $_do_fallback ) {
$_do_fallback = (bool) apply_filters( 'autoptimize_filter_cache_do_fallback', autoptimizeOptionWrapper::get_option( 'autoptimize_cache_fallback', '' ) );
$_do_fallback = (bool) apply_filters( 'autoptimize_filter_cache_do_fallback', autoptimizeOptionWrapper::get_option( 'autoptimize_cache_fallback', '1' ) );
}

return $_do_fallback;
Expand Down Expand Up @@ -761,6 +771,8 @@ public static function flushPageCache()
w3tc_pgcache_flush();
} elseif ( function_exists( 'wp_fast_cache_bulk_delete_all' ) ) {
wp_fast_cache_bulk_delete_all();
} elseif ( function_exists( 'rapidcache_clear_cache' ) ) {
rapidcache_clear_cache();
} elseif ( class_exists( 'Swift_Performance_Cache' ) ) {
Swift_Performance_Cache::clear_all_cache();
} elseif ( class_exists( 'WpFastestCache' ) ) {
Expand Down
91 changes: 60 additions & 31 deletions wp-content/plugins/autoptimize/classes/autoptimizeConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ private function __construct()

add_action( 'admin_menu', array( $this, 'addmenu' ) );
add_action( 'admin_init', array( $this, 'registersettings' ) );
add_action( 'admin_init', array( 'PAnD', 'init' ) );

// Set meta info.
if ( function_exists( 'plugin_row_meta' ) ) {
Expand Down Expand Up @@ -114,6 +115,8 @@ public function show_config()

input[type=url]:invalid {color: red; border-color:red;} .form-table th{font-weight:normal;}
#autoptimize_main .cb_label {display: block; padding-left: 25px; text-indent: -25px;}
#autoptimize_main .form-table th {padding-top: 15px; padding-bottom: 15px;}
#autoptimize_main .js_not_aggregate td, #autoptimize_main .js_not_aggregate th{padding-top:0px;}

/* rss block */
#futtta_feed ul{list-style:outside;}
Expand Down Expand Up @@ -221,11 +224,16 @@ public function show_config()
<th scope="row"><?php _e( 'Optimize JavaScript Code?', 'autoptimize' ); ?></th>
<td><input type="checkbox" id="autoptimize_js" name="autoptimize_js" <?php echo autoptimizeOptionWrapper::get_option( 'autoptimize_js' ) ? 'checked="checked" ' : ''; ?>/></td>
</tr>
<tr valign="top" class="js_sub">
<tr valign="top" class="js_sub js_aggregate_master">
<th scope="row"><?php _e( 'Aggregate JS-files?', 'autoptimize' ); ?></th>
<td><label class="cb_label"><input type="checkbox" id="autoptimize_js_aggregate" name="autoptimize_js_aggregate" <?php echo $conf->get( 'autoptimize_js_aggregate' ) ? 'checked="checked" ' : ''; ?>/>
<?php _e( 'Aggregate all linked JS-files to have them loaded non-render blocking? If this option is off, the individual JS-files will remain in place but will be minified.', 'autoptimize' ); ?></label></td>
</tr>
<tr valign="top" class="js_sub js_not_aggregate">
<th scope="row"><?php _e( 'Do not aggregate but defer?', 'autoptimize' ); ?></th>
<td><label class="cb_label"><input type="checkbox" id="autoptimize_js_defer_not_aggregate" name="autoptimize_js_defer_not_aggregate" <?php echo $conf->get( 'autoptimize_js_defer_not_aggregate' ) ? 'checked="checked" ' : ''; ?>/>
<?php _e( 'When JS is not aggregated, all linked JS-files can be deferred instead, making them non-render-blocking.', 'autoptimize' ); ?></label></td>
</tr>
<tr valign="top" class="js_sub js_aggregate">
<th scope="row"><?php _e( 'Also aggregate inline JS?', 'autoptimize' ); ?></th>
<td><label class="cb_label"><input type="checkbox" name="autoptimize_js_include_inline" <?php echo autoptimizeOptionWrapper::get_option( 'autoptimize_js_include_inline' ) ? 'checked="checked" ' : ''; ?>/>
Expand All @@ -250,7 +258,7 @@ public function show_config()
<?php } ?>
<tr valign="top" class="js_sub">
<th scope="row"><?php _e( 'Exclude scripts from Autoptimize:', 'autoptimize' ); ?></th>
<td><label><input type="text" style="width:100%;" name="autoptimize_js_exclude" value="<?php echo esc_html( autoptimizeOptionWrapper::get_option( 'autoptimize_js_exclude', 'wp-includes/js/dist/, wp-includes/js/tinymce/, js/jquery/jquery.js' ) ); ?>"/><br />
<td><label><input type="text" style="width:100%;" name="autoptimize_js_exclude" value="<?php echo esc_attr( autoptimizeOptionWrapper::get_option( 'autoptimize_js_exclude', 'wp-includes/js/dist/, wp-includes/js/tinymce/, js/jquery/jquery.js, js/jquery/jquery.min.js' ) ); ?>"/><br />
<?php
echo __( 'A comma-separated list of scripts you want to exclude from being optimized, for example \'whatever.js, another.js\' (without the quotes) to exclude those scripts from being aggregated by Autoptimize.', 'autoptimize' ) . ' ' . __( 'Important: excluded non-minified files are still minified by Autoptimize unless that option under "misc" is disabled.', 'autoptimize' );
?>
Expand Down Expand Up @@ -321,7 +329,7 @@ public function show_config()
</tr>
<tr valign="top" class="css_sub">
<th scope="row"><?php _e( 'Exclude CSS from Autoptimize:', 'autoptimize' ); ?></th>
<td><label><input type="text" style="width:100%;" name="autoptimize_css_exclude" value="<?php echo esc_html( autoptimizeOptionWrapper::get_option( 'autoptimize_css_exclude', 'wp-content/cache/, wp-content/uploads/, admin-bar.min.css, dashicons.min.css' ) ); ?>"/><br />
<td><label><input type="text" style="width:100%;" name="autoptimize_css_exclude" value="<?php echo esc_attr( autoptimizeOptionWrapper::get_option( 'autoptimize_css_exclude', 'wp-content/cache/, wp-content/uploads/, admin-bar.min.css, dashicons.min.css' ) ); ?>"/><br />
<?php
echo __( 'A comma-separated list of CSS you want to exclude from being optimized.', 'autoptimize' ) . ' ' . __( 'Important: excluded non-minified files are still minified by Autoptimize unless that option under "misc" is disabled.', 'autoptimize' );
?>
Expand Down Expand Up @@ -520,15 +528,30 @@ public function show_config()

jQuery( "#autoptimize_js_aggregate" ).change(function() {
if (this.checked && jQuery("#autoptimize_js").prop('checked')) {
jQuery(".js_aggregate:visible").fadeTo("fast",1);
jQuery( ".js_aggregate:visible" ).fadeTo( "fast",1 );
jQuery( "#autoptimize_js_defer_not_aggregate" ).prop( 'checked', false );
jQuery( ".js_not_aggregate:visible" ).fadeTo( "fast", .33 );
jQuery( ".js_aggregate_master:visible" ).fadeTo( "fast", 1 );
jQuery( "#min_excl_row" ).show();
} else {
jQuery(".js_aggregate:visible").fadeTo("fast",.33);
if ( jQuery( "#autoptimize_css_aggregate" ).prop('checked') == false ) {
jQuery( ".js_aggregate:visible" ).fadeTo( "fast", .33 );
jQuery( ".js_not_aggregate:visible" ).fadeTo( "fast", 1 );
if ( jQuery( "#autoptimize_css_aggregate" ).prop( 'checked' ) == false ) {
jQuery( "#min_excl_row" ).hide();
}
}
});

jQuery( "#autoptimize_js_defer_not_aggregate" ).change(function() {
if (this.checked && jQuery("#autoptimize_js").prop('checked')) {
jQuery( "#autoptimize_js_aggregate" ).prop( 'checked', false );
jQuery( ".js_aggregate:visible" ).fadeTo( "fast", .33 );
jQuery( ".js_aggregate_master:visible" ).fadeTo( "fast", .33 );
jQuery( ".js_not_aggregate:visible" ).fadeTo( "fast", 1 );
} else {
jQuery( ".js_aggregate_master:visible" ).fadeTo( "fast", 1 );
}
});

jQuery( "#autoptimize_css" ).change(function() {
if (this.checked) {
Expand Down Expand Up @@ -610,6 +633,8 @@ function check_ini_state() {
}
if (!jQuery("#autoptimize_js_aggregate").prop('checked')) {
jQuery(".js_aggregate:visible").fadeTo('fast',.33);
} else {
jQuery( ".js_not_aggregate:visible" ).fadeTo( 'fast', .33 );
}
if (jQuery("#autoptimize_enable_site_config").prop('checked')) {
jQuery("li.itemDetail:not(.multiSite)").fadeTo('fast',.33);
Expand Down Expand Up @@ -663,6 +688,7 @@ public function registersettings() {
register_setting( 'autoptimize', 'autoptimize_enable_site_config' );
register_setting( 'autoptimize', 'autoptimize_js' );
register_setting( 'autoptimize', 'autoptimize_js_aggregate' );
register_setting( 'autoptimize', 'autoptimize_js_defer_not_aggregate' );
register_setting( 'autoptimize', 'autoptimize_js_exclude' );
register_setting( 'autoptimize', 'autoptimize_js_trycatch' );
register_setting( 'autoptimize', 'autoptimize_js_justhead' );
Expand Down Expand Up @@ -719,31 +745,32 @@ public function setmeta( $links, $file = null )
public static function get_defaults()
{
static $config = array(
'autoptimize_html' => 0,
'autoptimize_html_keepcomments' => 0,
'autoptimize_enable_site_config' => 1,
'autoptimize_js' => 0,
'autoptimize_js_aggregate' => 1,
'autoptimize_js_exclude' => 'wp-includes/js/dist/, wp-includes/js/tinymce/, js/jquery/jquery.js',
'autoptimize_js_trycatch' => 0,
'autoptimize_js_justhead' => 0,
'autoptimize_js_include_inline' => 0,
'autoptimize_js_forcehead' => 0,
'autoptimize_css' => 0,
'autoptimize_css_aggregate' => 1,
'autoptimize_css_exclude' => 'admin-bar.min.css, dashicons.min.css, wp-content/cache/, wp-content/uploads/',
'autoptimize_css_justhead' => 0,
'autoptimize_css_include_inline' => 1,
'autoptimize_css_defer' => 0,
'autoptimize_css_defer_inline' => '',
'autoptimize_css_inline' => 0,
'autoptimize_css_datauris' => 0,
'autoptimize_cdn_url' => '',
'autoptimize_cache_nogzip' => 1,
'autoptimize_optimize_logged' => 1,
'autoptimize_optimize_checkout' => 0,
'autoptimize_minify_excluded' => 1,
'autoptimize_cache_fallback' => 1,
'autoptimize_html' => 0,
'autoptimize_html_keepcomments' => 0,
'autoptimize_enable_site_config' => 1,
'autoptimize_js' => 0,
'autoptimize_js_aggregate' => 1,
'autoptimize_js_defer_not_aggregate' => 0,
'autoptimize_js_exclude' => 'wp-includes/js/dist/, wp-includes/js/tinymce/, js/jquery/jquery.js, js/jquery/jquery.min.js',
'autoptimize_js_trycatch' => 0,
'autoptimize_js_justhead' => 0,
'autoptimize_js_include_inline' => 0,
'autoptimize_js_forcehead' => 0,
'autoptimize_css' => 0,
'autoptimize_css_aggregate' => 1,
'autoptimize_css_exclude' => 'admin-bar.min.css, dashicons.min.css, wp-content/cache/, wp-content/uploads/',
'autoptimize_css_justhead' => 0,
'autoptimize_css_include_inline' => 1,
'autoptimize_css_defer' => 0,
'autoptimize_css_defer_inline' => '',
'autoptimize_css_inline' => 0,
'autoptimize_css_datauris' => 0,
'autoptimize_cdn_url' => '',
'autoptimize_cache_nogzip' => 1,
'autoptimize_optimize_logged' => 1,
'autoptimize_optimize_checkout' => 0,
'autoptimize_minify_excluded' => 1,
'autoptimize_cache_fallback' => 1,
);

return $config;
Expand Down Expand Up @@ -781,6 +808,8 @@ public static function get_ao_imgopt_default_options()
'autoptimize_imgopt_checkbox_field_3' => '0', // lazy load off.
'autoptimize_imgopt_checkbox_field_4' => '0', // webp off (might be removed).
'autoptimize_imgopt_text_field_5' => '', // lazy load exclusions empty.
'autoptimize_imgopt_text_field_6' => '', // optimization exclusions empty.
'autoptimize_imgopt_number_field_7' => '0', // lazy load from nth image (0 = lazyload all).
);
return $defaults;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function load_requires() {
// Required libs, core is always needed.
$criticalcss_core = new autoptimizeCriticalCSSCore();

if ( defined( 'DOING_CRON' ) || is_admin() ) {
if ( defined( 'WP_CLI' ) || defined( 'DOING_CRON' ) || is_admin() ) {
// TODO: also include if overridden somehow to force queue processing to be executed?
$criticalcss_cron = new autoptimizeCriticalCSSCron();
}
Expand All @@ -105,7 +105,7 @@ public static function fetch_options() {
$autoptimize_ccss_options['ao_ccss_queue_raw'] = get_option( 'autoptimize_ccss_queue', false );
$autoptimize_ccss_options['ao_ccss_viewport'] = get_option( 'autoptimize_ccss_viewport', false );
$autoptimize_ccss_options['ao_ccss_finclude'] = get_option( 'autoptimize_ccss_finclude', false );
$autoptimize_ccss_options['ao_ccss_rlimit'] = get_option( 'autoptimize_ccss_rlimit', '5' );
$autoptimize_ccss_options['ao_ccss_rtimelimit'] = get_option( 'autoptimize_ccss_rtimelimit', '30' );
$autoptimize_ccss_options['ao_ccss_noptimize'] = get_option( 'autoptimize_ccss_noptimize', false );
$autoptimize_ccss_options['ao_ccss_debug'] = get_option( 'autoptimize_ccss_debug', false );
$autoptimize_ccss_options['ao_ccss_key'] = get_option( 'autoptimize_ccss_key' );
Expand Down
Loading

0 comments on commit a9bf57e

Please sign in to comment.