Sucuri Security – Auditing, Malware Scanner and Security Hardening - Version 1.8.33

Version Description

  • Fixed "Added option to clear cache by path"
Download this release

Release Info

Developer unifiedexp
Plugin Icon 128x128 Sucuri Security – Auditing, Malware Scanner and Security Hardening
Version 1.8.33
Comparing to
See all releases

Code changes from version 1.8.32 to 1.8.33

inc/css/styles.css CHANGED
@@ -50,6 +50,7 @@ body.sucuri-security_page_sucuriscan_hardening {
50
  margin: 0;
51
  padding: 0 7px;
52
  line-height: 28px;
 
53
  }
54
  .sucuriscan-container fieldset {
55
  margin-bottom: 10px;
@@ -943,3 +944,36 @@ body.sucuri-security_page_sucuriscan_hardening {
943
  right: initial;
944
  left: 20px;
945
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  margin: 0;
51
  padding: 0 7px;
52
  line-height: 28px;
53
+ font-weight: 400;
54
  }
55
  .sucuriscan-container fieldset {
56
  margin-bottom: 10px;
944
  right: initial;
945
  left: 20px;
946
  }
947
+
948
+ .firewall-clear-cache-path {
949
+ margin-top: 20px;
950
+ margin-bottom: 20px;
951
+ }
952
+
953
+ .firewall-clear-cache-path fieldset {
954
+ display: flex;
955
+ flex-direction: row;
956
+ align-items: flex-end;
957
+ }
958
+
959
+ .firewall-clear-cache-path fieldset input {
960
+ min-width: 300px;
961
+ }
962
+
963
+ .firewall-clear-cache-path fieldset label{
964
+ display: flex;
965
+ flex-direction: column;
966
+ margin: 0;
967
+ }
968
+
969
+ .ml-0 {
970
+ margin-left: 0 !important;
971
+ }
972
+
973
+ .mt-2 {
974
+ margin-top: 2em !important;
975
+ }
976
+
977
+ h3.lead {
978
+ margin: .5em 0;
979
+ }
inc/tpl/firewall-clearcache.html.tpl CHANGED
@@ -20,6 +20,30 @@ jQuery(document).ready(function ($) {
20
  $('#firewall-clear-cache-response').html(data);
21
  });
22
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  $('#firewall-clear-cache-auto').on('change', 'input:checkbox', function () {
25
  var checked = $(this).is(':checked');
@@ -35,6 +59,13 @@ jQuery(document).ready(function ($) {
35
  $('#firewall-clear-cache-auto span').html('{{Clear cache when a post or page is updated}}');
36
  });
37
  });
 
 
 
 
 
 
 
38
  });
39
  </script>
40
 
@@ -50,14 +81,32 @@ jQuery(document).ready(function ($) {
50
 
51
  <p>{{A web cache (or HTTP cache) is an information technology for the temporary storage (caching) of web documents, such as HTML pages and images, to reduce bandwidth usage, server load, and perceived lag. A web cache system stores copies of documents passing through it; subsequent requests may be satisfied from the cache if certain conditions are met. A web cache system can refer either to an appliance, or to a computer program. &mdash; <a href="https://en.wikipedia.org/wiki/Web_cache" target="_blank" rel="noopener">WikiPedia - Web Cache</a>}}</p>
52
 
53
- <div id="firewall-clear-cache-auto">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  <label>
55
  <input type="checkbox" name="sucuriscan_auto_clear_cache" value="true" %%SUCURI.FirewallAutoClearCache%% />
56
- <span>{{Clear cache when a post or page is updated}}</span>
57
  </label>
58
  </div>
 
59
 
60
- <div id="firewall-clear-cache-response"></div>
61
- <button id="firewall-clear-cache-button" class="button button-primary">{{Clear Cache}}</button>
62
  </div>
63
  </div>
20
  $('#firewall-clear-cache-response').html(data);
21
  });
22
  });
23
+
24
+ $('#firewall-clear-cache-path-button').on('click', function (event) {
25
+ event.preventDefault();
26
+
27
+ var button = $(this),
28
+ pathEl = $('input[name="path"]'),
29
+ path = $(pathEl).val();
30
+
31
+ if (!path) return;
32
+
33
+ button.attr('disabled', true);
34
+ button.html('{{Loading...}}');
35
+ $('#firewall-clear-cache-response').html('');
36
+
37
+ $.post('%%SUCURI.AjaxURL.Firewall%%', {
38
+ action: 'sucuriscan_ajax',
39
+ sucuriscan_page_nonce: '%%SUCURI.PageNonce%%',
40
+ form_action: 'firewall_clear_cache',
41
+ path
42
+ }, function (data) {
43
+ $('#firewall-clear-cache-response').html(data);
44
+ button.html('{{Clear Cache}}');
45
+ });
46
+ });
47
 
48
  $('#firewall-clear-cache-auto').on('change', 'input:checkbox', function () {
49
  var checked = $(this).is(':checked');
59
  $('#firewall-clear-cache-auto span').html('{{Clear cache when a post or page is updated}}');
60
  });
61
  });
62
+
63
+ $('#firewall-clear-cache-path-input').on('keyup', function () {
64
+ var input = $(this),
65
+ button = $("#firewall-clear-cache-path-button");
66
+
67
+ button.attr('disabled', $(input).val().length === 0);
68
+ });
69
  });
70
  </script>
71
 
81
 
82
  <p>{{A web cache (or HTTP cache) is an information technology for the temporary storage (caching) of web documents, such as HTML pages and images, to reduce bandwidth usage, server load, and perceived lag. A web cache system stores copies of documents passing through it; subsequent requests may be satisfied from the cache if certain conditions are met. A web cache system can refer either to an appliance, or to a computer program. &mdash; <a href="https://en.wikipedia.org/wiki/Web_cache" target="_blank" rel="noopener">WikiPedia - Web Cache</a>}}</p>
83
 
84
+ <div class="firewall-clear-cache-path">
85
+ <form action="%%SUCURI.URL.Firewall%%" method="post" class="sucuriscan-%%SUCURI.Firewall.APIKeyFormVisibility%%">
86
+ <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
87
+ <h3 class="lead">Clear Cache by Path</h3>
88
+ <p>This option allows you to clear the cache for an individual page, post, or other path. Enter the URL you wish to clear and then click the Clear Cache button. </p>
89
+ <p>This functionality will not clear static content. (i.e. .jpg or .css)</p>
90
+ <fieldset class="sucuriscan-clearfix">
91
+ <label>
92
+ <span class="ml-0">{{Path:}}</span>
93
+ <input type="text" name="path" id="firewall-clear-cache-path-input" data-cy="firewall-clear-cache-path-input" placeholder="e.g. security/how-to-clear-a-path" class="ml-0" />
94
+ </label>
95
+ <button type="submit" class="button button-primary" id="firewall-clear-cache-path-button" disabled data-cy="sucuriscan-clear-cache-path">{{Clear Cache}}</button>
96
+ </fieldset>
97
+ </form>
98
+ </div>
99
+ <div id="firewall-clear-cache-auto" class="mt-2">
100
+ <h3 class="lead">Clear Cache Globally</h3>
101
+ <p>This option allows you to purge all of your page and files cache at once.</p>
102
+ <p>You can select the checkbox below to clear your website cache globally every time a save is made on your WordPress website.</p>
103
  <label>
104
  <input type="checkbox" name="sucuriscan_auto_clear_cache" value="true" %%SUCURI.FirewallAutoClearCache%% />
105
+ <span>{{Clear cache whenever a post or page is updated}}</span>
106
  </label>
107
  </div>
108
+ <button id="firewall-clear-cache-button" class="button button-primary">{{Clear Global Cache}}</button>
109
 
110
+ <div id="firewall-clear-cache-response" class="mt-2"></div>
 
111
  </div>
112
  </div>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate Link: https://sucuri.net/
4
  Tags: malware, security, firewall, scan, spam, virus, sucuri, protection, blocklist, detection, hardening, file integrity
5
  Requires at least: 3.6
6
  Tested up to: 6.0
7
- Stable tag: 1.8.32
8
 
9
  The Sucuri WordPress Security plugin is a security toolset for security integrity monitoring, malware detection and security hardening.
10
 
@@ -195,6 +195,9 @@ This version adds an option to refresh the malware scan results on demand, as we
195
  Daniel is no longer maintaining the Sucuri plugin at GoDaddy. We have transferred it to a dedicated team to maintain and improve it.
196
 
197
  == Changelog ==
 
 
 
198
  = 1.8.32 =
199
  * Fixed "Empty wp-config file after automatic secret key updates"
200
 
4
  Tags: malware, security, firewall, scan, spam, virus, sucuri, protection, blocklist, detection, hardening, file integrity
5
  Requires at least: 3.6
6
  Tested up to: 6.0
7
+ Stable tag: 1.8.33
8
 
9
  The Sucuri WordPress Security plugin is a security toolset for security integrity monitoring, malware detection and security hardening.
10
 
195
  Daniel is no longer maintaining the Sucuri plugin at GoDaddy. We have transferred it to a dedicated team to maintain and improve it.
196
 
197
  == Changelog ==
198
+ = 1.8.33 =
199
+ * Fixed "Added option to clear cache by path"
200
+
201
  = 1.8.32 =
202
  * Fixed "Empty wp-config file after automatic secret key updates"
203
 
src/firewall.lib.php CHANGED
@@ -665,9 +665,14 @@ class SucuriScanFirewall extends SucuriScanAPI
665
  * @param array|bool $api_key The firewall API key.
666
  * @return string|bool Message explaining the result of the operation.
667
  */
668
- public static function clearCache($api_key = false)
669
  {
670
  $params = array('a' => 'clear_cache');
 
 
 
 
 
671
 
672
  if (is_array($api_key)) {
673
  $params = array_merge($params, $api_key);
@@ -737,7 +742,8 @@ class SucuriScanFirewall extends SucuriScanAPI
737
  $api_key = self::getKey();
738
 
739
  if ($api_key) {
740
- $res = self::clearCache($api_key);
 
741
 
742
  if (is_array($res) && isset($res['messages'])) {
743
  $response = sprintf(
665
  * @param array|bool $api_key The firewall API key.
666
  * @return string|bool Message explaining the result of the operation.
667
  */
668
+ public static function clearCache($api_key = false, $path = '')
669
  {
670
  $params = array('a' => 'clear_cache');
671
+ $path = ltrim(trim($path), '/');
672
+
673
+ if ($path) {
674
+ $params['file'] = $path;
675
+ }
676
 
677
  if (is_array($api_key)) {
678
  $params = array_merge($params, $api_key);
742
  $api_key = self::getKey();
743
 
744
  if ($api_key) {
745
+ $path = SucuriScanRequest::post('path');
746
+ $res = self::clearCache($api_key, $path);
747
 
748
  if (is_array($res) && isset($res['messages'])) {
749
  $response = sprintf(
sucuri.php CHANGED
@@ -8,7 +8,7 @@
8
  * Author: Sucuri Inc.
9
  * Text Domain: sucuri-scanner
10
  * Domain Path: /lang
11
- * Version: 1.8.32
12
  *
13
  * PHP version 7
14
  *
8
  * Author: Sucuri Inc.
9
  * Text Domain: sucuri-scanner
10
  * Domain Path: /lang
11
+ * Version: 1.8.33
12
  *
13
  * PHP version 7
14
  *