Breeze – WordPress Cache Plugin - Version 1.0.13

Version Description

  • Fix: Validation of nonce.
  • Fix: Remove duplication of calls in Varnish purge requests.
Download this release

Release Info

Developer adeelkhan
Plugin Icon 128x128 Breeze – WordPress Cache Plugin
Version 1.0.13
Comparing to
See all releases

Code changes from version 1.0.12 to 1.0.13

breeze.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Breeze
4
  * Description: Breeze is a WordPress cache plugin with extensive options to speed up your website. All the options including Varnish Cache are compatible with Cloudways hosting.
5
- * Version: 1.0.12
6
  * Text Domain: breeze
7
  * Domain Path: /languages
8
  * Author: Cloudways
2
  /**
3
  * Plugin Name: Breeze
4
  * Description: Breeze is a WordPress cache plugin with extensive options to speed up your website. All the options including Varnish Cache are compatible with Cloudways hosting.
5
+ * Version: 1.0.13
6
  * Text Domain: breeze
7
  * Domain Path: /languages
8
  * Author: Cloudways
inc/breeze-configuration.php CHANGED
@@ -35,7 +35,7 @@ class Breeze_Configuration{
35
  $sites = is_multisite() ? get_sites() : array();
36
  // Basic options tab
37
  if (isset($_REQUEST['breeze_basic_action']) && $_REQUEST['breeze_basic_action'] == 'breeze_basic_settings') {
38
- if (isset($_POST['breeze_settings_basic_nonce']) || wp_verify_nonce($_POST['breeze_settings_basic_nonce'], 'breeze_settings_basic')) {
39
  WP_Filesystem();
40
 
41
  $basic = array(
@@ -99,7 +99,7 @@ class Breeze_Configuration{
99
  }
100
  // Advanced options tab
101
  if (isset($_REQUEST['breeze_advanced_action']) && $_REQUEST['breeze_advanced_action'] == 'breeze_advanced_settings') {
102
- if (isset($_POST['breeze_settings_advanced_nonce']) || wp_verify_nonce($_POST['breeze_settings_advanced_nonce'], 'breeze_settings_advanced')) {
103
  $exclude_urls = $this->string_convert_arr(sanitize_textarea_field($_POST['exclude-urls']));
104
  $exclude_css = $this->string_convert_arr(sanitize_textarea_field($_POST['exclude-css']));
105
  $exclude_js = $this->string_convert_arr(sanitize_textarea_field($_POST['exclude-js']));
@@ -151,7 +151,7 @@ class Breeze_Configuration{
151
 
152
  // Database option tab
153
  if (isset($_REQUEST['breeze_database_action']) && $_REQUEST['breeze_database_action'] == 'breeze_database_settings') {
154
- if (isset($_POST['breeze_settings_database_nonce']) || wp_verify_nonce($_POST['breeze_settings_database_nonce'], 'breeze_settings_database')) {
155
  if(isset($_POST['clean'])){
156
  if (is_multisite()) {
157
  foreach ($sites as $site) {
@@ -178,7 +178,7 @@ class Breeze_Configuration{
178
 
179
  // Cdn option tab
180
  if (isset($_REQUEST['breeze_cdn_action']) && $_REQUEST['breeze_cdn_action'] == 'breeze_cdn_settings') {
181
- if (isset($_POST['breeze_settings_cdn_nonce']) || wp_verify_nonce($_POST['breeze_settings_cdn_nonce'], 'breeze_settings_cdn')) {
182
  $cdn_content = array();
183
  $exclude_content = array();
184
  if(!empty($_POST['cdn-content'])){
@@ -215,7 +215,7 @@ class Breeze_Configuration{
215
 
216
  // Varnish option tab
217
  if (isset($_REQUEST['breeze_varnish_action']) && $_REQUEST['breeze_varnish_action'] == 'breeze_varnish_settings') {
218
- if (isset($_POST['breeze_settings_varnish_nonce']) || wp_verify_nonce($_POST['breeze_settings_varnish_nonce'], 'breeze_settings_varnish')) {
219
  $varnish = array(
220
  'auto-purge-varnish' => (isset($_POST['auto-purge-varnish']) ? '1' : '0'),
221
  'breeze-varnish-server-ip' => preg_replace('/[^a-zA-Z0-9\-\_\.]*/','',$_POST['varnish-server-ip'])
35
  $sites = is_multisite() ? get_sites() : array();
36
  // Basic options tab
37
  if (isset($_REQUEST['breeze_basic_action']) && $_REQUEST['breeze_basic_action'] == 'breeze_basic_settings') {
38
+ if (isset($_POST['breeze_settings_basic_nonce']) && wp_verify_nonce($_POST['breeze_settings_basic_nonce'], 'breeze_settings_basic')) {
39
  WP_Filesystem();
40
 
41
  $basic = array(
99
  }
100
  // Advanced options tab
101
  if (isset($_REQUEST['breeze_advanced_action']) && $_REQUEST['breeze_advanced_action'] == 'breeze_advanced_settings') {
102
+ if (isset($_POST['breeze_settings_advanced_nonce']) && wp_verify_nonce($_POST['breeze_settings_advanced_nonce'], 'breeze_settings_advanced')) {
103
  $exclude_urls = $this->string_convert_arr(sanitize_textarea_field($_POST['exclude-urls']));
104
  $exclude_css = $this->string_convert_arr(sanitize_textarea_field($_POST['exclude-css']));
105
  $exclude_js = $this->string_convert_arr(sanitize_textarea_field($_POST['exclude-js']));
151
 
152
  // Database option tab
153
  if (isset($_REQUEST['breeze_database_action']) && $_REQUEST['breeze_database_action'] == 'breeze_database_settings') {
154
+ if (isset($_POST['breeze_settings_database_nonce']) && wp_verify_nonce($_POST['breeze_settings_database_nonce'], 'breeze_settings_database')) {
155
  if(isset($_POST['clean'])){
156
  if (is_multisite()) {
157
  foreach ($sites as $site) {
178
 
179
  // Cdn option tab
180
  if (isset($_REQUEST['breeze_cdn_action']) && $_REQUEST['breeze_cdn_action'] == 'breeze_cdn_settings') {
181
+ if (isset($_POST['breeze_settings_cdn_nonce']) && wp_verify_nonce($_POST['breeze_settings_cdn_nonce'], 'breeze_settings_cdn')) {
182
  $cdn_content = array();
183
  $exclude_content = array();
184
  if(!empty($_POST['cdn-content'])){
215
 
216
  // Varnish option tab
217
  if (isset($_REQUEST['breeze_varnish_action']) && $_REQUEST['breeze_varnish_action'] == 'breeze_varnish_settings') {
218
+ if (isset($_POST['breeze_settings_varnish_nonce']) && wp_verify_nonce($_POST['breeze_settings_varnish_nonce'], 'breeze_settings_varnish')) {
219
  $varnish = array(
220
  'auto-purge-varnish' => (isset($_POST['auto-purge-varnish']) ? '1' : '0'),
221
  'breeze-varnish-server-ip' => preg_replace('/[^a-zA-Z0-9\-\_\.]*/','',$_POST['varnish-server-ip'])
inc/cache/purge-varnish.php CHANGED
@@ -31,9 +31,7 @@ class Breeze_PurgeVarnish {
31
  'switch_theme', // After a theme is changed
32
  'save_post', // Save a post
33
  'deleted_post', // Delete a post
34
- 'trashed_post', // Empty Trashed post
35
  'edit_post', // Edit a post - includes leaving comments
36
- 'delete_attachment', // Delete an attachment - includes re-uploading
37
  );
38
 
39
  protected $actionsNoId = array('switch_theme');
@@ -174,6 +172,11 @@ class Breeze_PurgeVarnish {
174
  */
175
  public function purge_post($postId)
176
  {
 
 
 
 
 
177
  $this->pushUrl($postId);
178
  }
179
  /*
@@ -320,14 +323,18 @@ class Breeze_PurgeVarnish {
320
 
321
  // Now flush all the URLs we've collected provided the array isn't empty
322
  if (!empty($listofurls)) {
323
- $purgeurls = array_unique($listofurls, SORT_REGULAR);
324
-
325
- foreach ($purgeurls as $url) {
326
- array_push($this->urlsPurge, $url);
327
- }
 
 
 
 
328
  }
329
 
330
  }
331
  }
332
 
333
- new Breeze_PurgeVarnish();
31
  'switch_theme', // After a theme is changed
32
  'save_post', // Save a post
33
  'deleted_post', // Delete a post
 
34
  'edit_post', // Edit a post - includes leaving comments
 
35
  );
36
 
37
  protected $actionsNoId = array('switch_theme');
172
  */
173
  public function purge_post($postId)
174
  {
175
+ if ( 'save_post' === current_action() && did_action( 'edit_post' ) ) {
176
+ // Prevent triggering this method twice when posts are updated.
177
+ return;
178
+ }
179
+
180
  $this->pushUrl($postId);
181
  }
182
  /*
323
 
324
  // Now flush all the URLs we've collected provided the array isn't empty
325
  if (!empty($listofurls)) {
326
+ $this->urlsPurge = array_filter(
327
+ array_unique(
328
+ array_merge(
329
+ $this->urlsPurge,
330
+ $listofurls
331
+ ),
332
+ SORT_REGULAR
333
+ )
334
+ );
335
  }
336
 
337
  }
338
  }
339
 
340
+ new Breeze_PurgeVarnish();
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Cloudways
3
  Tags: cache,caching, performance, wp-cache, cdn, combine, compress, speed plugin, database cache,gzip, http compression, js cache, minify, optimize, page cache, performance, speed, expire headers
4
  Requires at least: 4.5
5
  Tested up to: 5.2.1
6
- Stable tag: 1.0.12
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -145,6 +145,10 @@ Using Gzip, Breeze compresses the request files, further reducing the size of th
145
 
146
  == Changelog ==
147
 
 
 
 
 
148
  = 1.0.12 =
149
  * Fix: Deprecated create_function
150
 
3
  Tags: cache,caching, performance, wp-cache, cdn, combine, compress, speed plugin, database cache,gzip, http compression, js cache, minify, optimize, page cache, performance, speed, expire headers
4
  Requires at least: 4.5
5
  Tested up to: 5.2.1
6
+ Stable tag: 1.0.13
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
145
 
146
  == Changelog ==
147
 
148
+ = 1.0.13 =
149
+ * Fix: Validation of nonce.
150
+ * Fix: Remove duplication of calls in Varnish purge requests.
151
+
152
  = 1.0.12 =
153
  * Fix: Deprecated create_function
154