Cache Enabler – WordPress Cache - Version 1.5.3

Version Description

  • Add default query string exclusion (#154)
Download this release

Release Info

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

Code changes from version 1.5.2 to 1.5.3

cache-enabler.php CHANGED
@@ -6,7 +6,7 @@ Description: Simple and fast WordPress caching plugin.
6
  Author: KeyCDN
7
  Author URI: https://www.keycdn.com
8
  License: GPLv2 or later
9
- Version: 1.5.2
10
  */
11
 
12
  /*
@@ -32,7 +32,7 @@ if ( ! defined( 'ABSPATH' ) ) {
32
  }
33
 
34
  // constants
35
- define( 'CE_VERSION', '1.5.2' );
36
  define( 'CE_MIN_WP', '5.1' );
37
  define( 'CE_FILE', __FILE__ );
38
  define( 'CE_BASE', plugin_basename( __FILE__ ) );
6
  Author: KeyCDN
7
  Author URI: https://www.keycdn.com
8
  License: GPLv2 or later
9
+ Version: 1.5.3
10
  */
11
 
12
  /*
32
  }
33
 
34
  // constants
35
+ define( 'CE_VERSION', '1.5.3' );
36
  define( 'CE_MIN_WP', '5.1' );
37
  define( 'CE_FILE', __FILE__ );
38
  define( 'CE_BASE', plugin_basename( __FILE__ ) );
css/settings.css CHANGED
@@ -29,3 +29,7 @@
29
  .checkbox--form-control {
30
  height: 23px;
31
  }
 
 
 
 
29
  .checkbox--form-control {
30
  height: 23px;
31
  }
32
+
33
+ .code--form-control {
34
+ line-height: 1.8;
35
+ }
css/settings.min.css CHANGED
@@ -1 +1 @@
1
- .badge{display:inline-block;padding:.25em .4em;margin-left:.5rem;border-radius:.25rem;font-size:10px;font-weight:700;text-transform:capitalize;white-space:nowrap}.badge--success{background-color:#d4edda;color:#155724}.subheading{font-size:80%!important;font-weight:600;text-transform:uppercase}.subheading:not(:first-of-type){margin-top:15px!important}.checkbox--form-control{height:23px}
1
+ .badge{display:inline-block;padding:.25em .4em;margin-left:.5rem;border-radius:.25rem;font-size:10px;font-weight:700;text-transform:capitalize;white-space:nowrap}.badge--success{background-color:#d4edda;color:#155724}.subheading{font-size:80%!important;font-weight:600;text-transform:uppercase}.subheading:not(:first-of-type){margin-top:15px!important}.checkbox--form-control{height:23px}.code--form-control{line-height:1.8}
inc/cache_enabler.class.php CHANGED
@@ -1624,7 +1624,7 @@ final class Cache_Enabler {
1624
  * settings page
1625
  *
1626
  * @since 1.0.0
1627
- * @change 1.5.0
1628
  */
1629
 
1630
  public static function settings_page() {
@@ -1770,10 +1770,10 @@ final class Cache_Enabler {
1770
  <p class="description">
1771
  <?php
1772
  // translators: %s: ,
1773
- printf( esc_html__( 'Post IDs separated by a %s that should bypass the cache.', 'cache-enabler' ), '<code>,</code>' );
1774
  ?>
1775
  </p>
1776
- <p><?php esc_html_e( 'Example:', 'cache-enabler' ); ?> <code>2,43,65</code></p>
1777
  </label>
1778
 
1779
  <br />
@@ -1782,7 +1782,7 @@ final class Cache_Enabler {
1782
  <label for="excluded_page_paths">
1783
  <input name="cache_enabler[excluded_page_paths]" type="text" id="excluded_page_paths" value="<?php echo esc_attr( Cache_Enabler_Engine::$settings['excluded_page_paths'] ) ?>" class="regular-text code" />
1784
  <p class="description"><?php esc_html_e( 'A regex matching page paths that should bypass the cache.', 'cache-enabler' ); ?></p>
1785
- <p><?php esc_html_e( 'Example:', 'cache-enabler' ); ?> <code>/^(\/|\/forums\/)$/</code></p>
1786
  </label>
1787
 
1788
  <br />
@@ -1791,7 +1791,8 @@ final class Cache_Enabler {
1791
  <label for="excluded_query_strings">
1792
  <input name="cache_enabler[excluded_query_strings]" type="text" id="excluded_query_strings" value="<?php echo esc_attr( Cache_Enabler_Engine::$settings['excluded_query_strings'] ) ?>" class="regular-text code" />
1793
  <p class="description"><?php esc_html_e( 'A regex matching query strings that should bypass the cache.', 'cache-enabler' ); ?></p>
1794
- <p><?php esc_html_e( 'Example:', 'cache-enabler' ); ?> <code>/^nocache$/</code></p>
 
1795
  </label>
1796
 
1797
  <br />
@@ -1800,8 +1801,8 @@ final class Cache_Enabler {
1800
  <label for="excluded_cookies">
1801
  <input name="cache_enabler[excluded_cookies]" type="text" id="excluded_cookies" value="<?php echo esc_attr( Cache_Enabler_Engine::$settings['excluded_cookies'] ) ?>" class="regular-text code" />
1802
  <p class="description"><?php esc_html_e( 'A regex matching cookies that should bypass the cache.', 'cache-enabler' ); ?></p>
1803
- <p><?php esc_html_e( 'Example:', 'cache-enabler' ); ?> <code>/^(comment_author|woocommerce_items_in_cart|wp_woocommerce_session)_?/</code></p>
1804
- <p><?php esc_html_e( 'Default if unset:', 'cache-enabler' ); ?> <code>/^(wp-postpass|wordpress_logged_in|comment_author)_/</code></p>
1805
  </label>
1806
  </fieldset>
1807
  </td>
1624
  * settings page
1625
  *
1626
  * @since 1.0.0
1627
+ * @change 1.5.3
1628
  */
1629
 
1630
  public static function settings_page() {
1770
  <p class="description">
1771
  <?php
1772
  // translators: %s: ,
1773
+ printf( esc_html__( 'Post IDs separated by a %s that should bypass the cache.', 'cache-enabler' ), '<code class="code--form-control">,</code>' );
1774
  ?>
1775
  </p>
1776
+ <p><?php esc_html_e( 'Example:', 'cache-enabler' ); ?> <code class="code--form-control">2,43,65</code></p>
1777
  </label>
1778
 
1779
  <br />
1782
  <label for="excluded_page_paths">
1783
  <input name="cache_enabler[excluded_page_paths]" type="text" id="excluded_page_paths" value="<?php echo esc_attr( Cache_Enabler_Engine::$settings['excluded_page_paths'] ) ?>" class="regular-text code" />
1784
  <p class="description"><?php esc_html_e( 'A regex matching page paths that should bypass the cache.', 'cache-enabler' ); ?></p>
1785
+ <p><?php esc_html_e( 'Example:', 'cache-enabler' ); ?> <code class="code--form-control">/^(\/|\/forums\/)$/</code></p>
1786
  </label>
1787
 
1788
  <br />
1791
  <label for="excluded_query_strings">
1792
  <input name="cache_enabler[excluded_query_strings]" type="text" id="excluded_query_strings" value="<?php echo esc_attr( Cache_Enabler_Engine::$settings['excluded_query_strings'] ) ?>" class="regular-text code" />
1793
  <p class="description"><?php esc_html_e( 'A regex matching query strings that should bypass the cache.', 'cache-enabler' ); ?></p>
1794
+ <p><?php esc_html_e( 'Example:', 'cache-enabler' ); ?> <code class="code--form-control">/^nocache$/</code></p>
1795
+ <p><?php esc_html_e( 'Default if unset:', 'cache-enabler' ); ?> <code class="code--form-control">/^(?!(fbclid|ref|mc_(cid|eid)|utm_(source|medium|campaign|term|content|expid)|gclid|fb_(action_ids|action_types|source)|age-verified|ao_noptimize|usqp|cn-reloaded|_ga|_ke)).+$/</code></p>
1796
  </label>
1797
 
1798
  <br />
1801
  <label for="excluded_cookies">
1802
  <input name="cache_enabler[excluded_cookies]" type="text" id="excluded_cookies" value="<?php echo esc_attr( Cache_Enabler_Engine::$settings['excluded_cookies'] ) ?>" class="regular-text code" />
1803
  <p class="description"><?php esc_html_e( 'A regex matching cookies that should bypass the cache.', 'cache-enabler' ); ?></p>
1804
+ <p><?php esc_html_e( 'Example:', 'cache-enabler' ); ?> <code class="code--form-control">/^(comment_author|woocommerce_items_in_cart|wp_woocommerce_session)_?/</code></p>
1805
+ <p><?php esc_html_e( 'Default if unset:', 'cache-enabler' ); ?> <code class="code--form-control">/^(wp-postpass|wordpress_logged_in|comment_author)_/</code></p>
1806
  </label>
1807
  </fieldset>
1808
  </td>
inc/cache_enabler_engine.class.php CHANGED
@@ -260,7 +260,7 @@ final class Cache_Enabler_Engine {
260
  * check if page is excluded from cache
261
  *
262
  * @since 1.5.0
263
- * @change 1.5.0
264
  *
265
  * @return boolean true if page is excluded from the cache, false otherwise
266
  */
@@ -284,10 +284,17 @@ final class Cache_Enabler_Engine {
284
  }
285
 
286
  // if query string excluded
287
- if ( ! empty( self::$settings['excluded_query_strings'] ) ) {
 
 
 
 
 
 
 
288
  $query_string = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_QUERY );
289
 
290
- if ( preg_match( self::$settings['excluded_query_strings'], $query_string ) ) {
291
  return true;
292
  }
293
  }
260
  * check if page is excluded from cache
261
  *
262
  * @since 1.5.0
263
+ * @change 1.5.3
264
  *
265
  * @return boolean true if page is excluded from the cache, false otherwise
266
  */
284
  }
285
 
286
  // if query string excluded
287
+ if ( ! empty( $_GET ) ) {
288
+ // set regex matching query strings that should bypass the cache
289
+ if ( ! empty( self::$settings['excluded_query_strings'] ) ) {
290
+ $query_string_regex = self::$settings['excluded_query_strings'];
291
+ } else {
292
+ $query_string_regex = '/^(?!(fbclid|ref|mc_(cid|eid)|utm_(source|medium|campaign|term|content|expid)|gclid|fb_(action_ids|action_types|source)|age-verified|ao_noptimize|usqp|cn-reloaded|_ga|_ke)).+$/';
293
+ }
294
+
295
  $query_string = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_QUERY );
296
 
297
+ if ( preg_match( $query_string_regex, $query_string ) ) {
298
  return true;
299
  }
300
  }
readme.txt CHANGED
@@ -80,6 +80,10 @@ When combined with Optimus, the WordPress Cache Enabler allows you to easily del
80
 
81
  == Changelog ==
82
 
 
 
 
 
83
  = 1.5.2 =
84
 
85
  * Update late cache engine start to be on the `init` hook instead of `plugins_loaded` (#153)
80
 
81
  == Changelog ==
82
 
83
+ = 1.5.3 =
84
+
85
+ * Add default query string exclusion (#154)
86
+
87
  = 1.5.2 =
88
 
89
  * Update late cache engine start to be on the `init` hook instead of `plugins_loaded` (#153)