Cache Enabler – WordPress Cache - Version 1.4.4

Version Description

  • Update cache handling (#100)
Download this release

Release Info

Developer keycdn
Plugin Icon 128x128 Cache Enabler – WordPress Cache
Version 1.4.4
Comparing to
See all releases

Code changes from version 1.4.3 to 1.4.4

cache-enabler.php CHANGED
@@ -6,7 +6,7 @@ Description: Simple and fast WordPress disk caching plugin.
6
  Author: KeyCDN
7
  Author URI: https://www.keycdn.com
8
  License: GPLv2 or later
9
- Version: 1.4.3
10
  */
11
 
12
  /*
6
  Author: KeyCDN
7
  Author URI: https://www.keycdn.com
8
  License: GPLv2 or later
9
+ Version: 1.4.4
10
  */
11
 
12
  /*
inc/cache_enabler.class.php CHANGED
@@ -63,7 +63,7 @@ final class Cache_Enabler {
63
  * constructor
64
  *
65
  * @since 1.0.0
66
- * @change 1.4.0
67
  */
68
 
69
  public function __construct() {
@@ -85,6 +85,7 @@ final class Cache_Enabler {
85
  add_action( 'activated_plugin', array( __CLASS__, 'on_plugin_activation_deactivation' ), 10, 2 );
86
  add_action( 'deactivated_plugin', array( __CLASS__, 'on_plugin_activation_deactivation' ), 10, 2 );
87
  add_action( 'wp_trash_post', array( __CLASS__, 'on_trash_post' ) );
 
88
  // third party
89
  add_action( 'autoptimize_action_cachepurged', array( __CLASS__, 'clear_total_cache' ) );
90
  add_action( 'woocommerce_product_set_stock', array( __CLASS__, 'on_woocommerce_stock_update' ) );
@@ -714,7 +715,7 @@ final class Cache_Enabler {
714
  '<a href="%s" title="%s">%s %s</a>',
715
  add_query_arg(
716
  array(
717
- 'page' => 'cache-enabler'
718
  ),
719
  admin_url( 'options-general.php' )
720
  ),
@@ -1408,7 +1409,7 @@ final class Cache_Enabler {
1408
  * check to bypass the cache
1409
  *
1410
  * @since 1.0.0
1411
- * @change 1.4.3
1412
  *
1413
  * @return boolean true if exception, false otherwise
1414
  *
@@ -1427,13 +1428,13 @@ final class Cache_Enabler {
1427
  return true;
1428
  }
1429
 
1430
- // check trailing slash
1431
- if ( self::_bypass_cache_for_trailing_slash() ) {
1432
  return true;
1433
  }
1434
 
1435
  // check conditional tags
1436
- if ( self::_is_index() || is_search() || is_404() || is_feed() || is_trackback() || is_robots() || is_preview() || post_password_required() ) {
1437
  return true;
1438
  }
1439
 
@@ -1500,33 +1501,6 @@ final class Cache_Enabler {
1500
  }
1501
 
1502
 
1503
- /**
1504
- * bypass cache for trailing slash
1505
- *
1506
- * @since 1.4.3
1507
- * @change 1.4.3
1508
- *
1509
- * @return boolean true if cache should be bypassed to allow a redirect, false otherwise
1510
- */
1511
-
1512
- private static function _bypass_cache_for_trailing_slash() {
1513
-
1514
- if ( self::permalink_structure_has_trailing_slash() ) {
1515
- // if trailing slash is missing, check if we have to bypass the cache to allow a redirect
1516
- if ( ! preg_match( '/\/(|\?.*)$/', $_SERVER['REQUEST_URI'] ) ) {
1517
- return true;
1518
- }
1519
- } else {
1520
- // if trailing slash is appended, check if we have to bypass the cache to allow a redirect
1521
- if ( preg_match( '/(?!^)\/(|\?.*)$/', $_SERVER['REQUEST_URI'] ) ) {
1522
- return true;
1523
- }
1524
- }
1525
-
1526
- return false;
1527
- }
1528
-
1529
-
1530
  /**
1531
  * minify HTML
1532
  *
@@ -1882,7 +1856,7 @@ final class Cache_Enabler {
1882
  * check plugin requirements
1883
  *
1884
  * @since 1.1.0
1885
- * @change 1.4.0
1886
  */
1887
 
1888
  public static function requirements_check() {
@@ -1932,7 +1906,12 @@ final class Cache_Enabler {
1932
  esc_html__( 'Cache Minification', 'cache-enabler' ),
1933
  sprintf(
1934
  '<a href="%s">%s</a>',
1935
- admin_url( 'options-general.php' ) . '?page=cache-enabler',
 
 
 
 
 
1936
  esc_html__( 'Cache Enabler Settings', 'cache-enabler' )
1937
  )
1938
  )
63
  * constructor
64
  *
65
  * @since 1.0.0
66
+ * @change 1.4.4
67
  */
68
 
69
  public function __construct() {
85
  add_action( 'activated_plugin', array( __CLASS__, 'on_plugin_activation_deactivation' ), 10, 2 );
86
  add_action( 'deactivated_plugin', array( __CLASS__, 'on_plugin_activation_deactivation' ), 10, 2 );
87
  add_action( 'wp_trash_post', array( __CLASS__, 'on_trash_post' ) );
88
+ add_action( 'permalink_structure_changed', array( __CLASS__, 'clear_total_cache' ) );
89
  // third party
90
  add_action( 'autoptimize_action_cachepurged', array( __CLASS__, 'clear_total_cache' ) );
91
  add_action( 'woocommerce_product_set_stock', array( __CLASS__, 'on_woocommerce_stock_update' ) );
715
  '<a href="%s" title="%s">%s %s</a>',
716
  add_query_arg(
717
  array(
718
+ 'page' => 'cache-enabler',
719
  ),
720
  admin_url( 'options-general.php' )
721
  ),
1409
  * check to bypass the cache
1410
  *
1411
  * @since 1.0.0
1412
+ * @change 1.4.4
1413
  *
1414
  * @return boolean true if exception, false otherwise
1415
  *
1428
  return true;
1429
  }
1430
 
1431
+ // check HTTP status code
1432
+ if ( http_response_code() !== 200 ) {
1433
  return true;
1434
  }
1435
 
1436
  // check conditional tags
1437
+ if ( self::_is_index() || is_search() || is_feed() || is_trackback() || is_robots() || is_preview() || post_password_required() ) {
1438
  return true;
1439
  }
1440
 
1501
  }
1502
 
1503
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1504
  /**
1505
  * minify HTML
1506
  *
1856
  * check plugin requirements
1857
  *
1858
  * @since 1.1.0
1859
+ * @change 1.4.4
1860
  */
1861
 
1862
  public static function requirements_check() {
1906
  esc_html__( 'Cache Minification', 'cache-enabler' ),
1907
  sprintf(
1908
  '<a href="%s">%s</a>',
1909
+ add_query_arg(
1910
+ array(
1911
+ 'page' => 'cache-enabler',
1912
+ ),
1913
+ admin_url( 'options-general.php' )
1914
+ ),
1915
  esc_html__( 'Cache Enabler Settings', 'cache-enabler' )
1916
  )
1917
  )
inc/cache_enabler_disk.class.php CHANGED
@@ -460,9 +460,9 @@ final class Cache_Enabler_Disk {
460
  * get file scheme
461
  *
462
  * @since 1.4.0
463
- * @change 1.4.0
464
  *
465
- * @return string https, http, or port
466
  */
467
 
468
  private static function _file_scheme() {
460
  * get file scheme
461
  *
462
  * @since 1.4.0
463
+ * @change 1.4.2
464
  *
465
+ * @return string https or http
466
  */
467
 
468
  private static function _file_scheme() {
readme.txt CHANGED
@@ -23,7 +23,7 @@ The Cache Enabler plugin creates static HTML files and stores them on the server
23
  * Efficient and fast disk cache engine
24
  * Automated and/or manual clearing of the cache
25
  * Manually clear the cache of specific pages
26
- * WP CLI cache clearing
27
  * Display of the actual cache size in your dashboard
28
  * Minification of HTML and inline JavaScript
29
  * WordPress multisite support
@@ -81,32 +81,34 @@ When combined with Optimus, the WordPress Cache Enabler allows you to easily del
81
 
82
  == Changelog ==
83
 
 
 
 
84
  = 1.4.3 =
85
- * Update URL cache clearing
86
- * Update advcache settings
87
 
88
  = 1.4.2 =
89
- * Update cache clearing for the Clear URL Cache admin bar button
90
- * Update scheme-based caching
91
- * Fix advanced cache
92
 
93
  = 1.4.1 =
94
  * Fix undefined constant
95
 
96
  = 1.4.0 =
97
- * Update default cache behavior for WooCommerce stock update
98
- * Update Cache Behavior setting for plugin actions
99
- * Update admin bar clear cache buttons
100
- * Update cache behavior for logged in users
101
- * Update default clear cache publishing action
102
- * Update advanced cache settings
103
- * Update trailing slash handling
104
- * Update settings page
105
- * Add Cache Behavior setting for WooCommerce stock update
106
- * Add fbclid as default URL query parameter to bypass cache
107
- * Add scheme-based caching
108
- * Fix advanced cache for multisite networks
109
- * Fix minor bugs
110
 
111
  = 1.3.5 =
112
  * WP-CLI cache clearing (Thanks to Steve Grunwell)
23
  * Efficient and fast disk cache engine
24
  * Automated and/or manual clearing of the cache
25
  * Manually clear the cache of specific pages
26
+ * WP-CLI cache clearing
27
  * Display of the actual cache size in your dashboard
28
  * Minification of HTML and inline JavaScript
29
  * WordPress multisite support
81
 
82
  == Changelog ==
83
 
84
+ = 1.4.4 =
85
+ * Update cache handling (#100)
86
+
87
  = 1.4.3 =
88
+ * Update cache clearing by URL (#99)
89
+ * Update advanced cache settings (#99)
90
 
91
  = 1.4.2 =
92
+ * Update cache clearing for the Clear URL Cache admin bar button (#98)
93
+ * Update scheme-based caching (#98)
94
+ * Fix advanced cache (#98)
95
 
96
  = 1.4.1 =
97
  * Fix undefined constant
98
 
99
  = 1.4.0 =
100
+ * Update default cache behavior for WooCommerce stock update (#88)
101
+ * Update Cache Behavior setting for plugin actions (#91)
102
+ * Update admin bar clear cache buttons (#96)
103
+ * Update cache behavior for logged in users (#95)
104
+ * Update default clear cache publishing action (#88)
105
+ * Update advanced cache settings (#91 and #92)
106
+ * Update trailing slash handling (#91)
107
+ * Update settings page (#84 and #92)
108
+ * Add Cache Behavior setting for WooCommerce stock update (#88)
109
+ * Add fbclid as default URL query parameter to bypass cache (#84)
110
+ * Add scheme-based caching (#94)
111
+ * Fix advanced cache for multisite networks (#92)
 
112
 
113
  = 1.3.5 =
114
  * WP-CLI cache clearing (Thanks to Steve Grunwell)