Aruba HiSpeed Cache - Version 1.2.0

Version Description

  • Discriminant added to REST API requests to include FSE support and remove recurring clear cache requests.
  • Clear function added to the 'post_updated hook' action to include support for the editor with meta-box added by plugins and themes.
  • Log function added to files activated with WP_DEBUG set to true, created in plugin folder. N.B. If disabled, file will be deleted.
  • FILTER_SANITIZE_STRING replaced by FILTER_SANITIZE_URL to ensure compatibility with PHP 8.1.
  • ArubaHiSpeedCache_update_plugins_db() mode added to allow management of future database updates.
  • Action and filter loading system within plugin fixed.
  • Various bug fixes and other improvements.
Download this release

Release Info

Developer arubadev
Plugin Icon 128x128 Aruba HiSpeed Cache
Version 1.2.0
Comparing to
See all releases

Code changes from version 1.1.2 to 1.2.0

admin/css/aruba-hispeed-cache-admin-notice.css CHANGED
@@ -1,35 +1,35 @@
1
- :root {
2
- --icon-external-link: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"> <g style="stroke:rgb(35,82,124);stroke-width:1"> <line x1="5" y1="5" x2="5" y2="14" /> <line x1="14" y1="9" x2="14" y2="14" /> <line x1="5" y1="14" x2="14" y2="14" /> <line x1="5" y1="5" x2="9" y2="5" /> <line x1="10" y1="2" x2="17" y2="2" /> <line x1="17" y1="2" x2="17" y2="9" /> <line x1="10" y1="9" x2="17" y2="2" style="stroke-width:1.5" /></g></svg>');
3
- }
4
-
5
- #ahsc-service-error {
6
- background: rgba(208, 2, 27, 0.1);
7
- -webkit-box-shadow: 0 1px 2px 0 rgba(63, 63, 68, 0.25), inset 0 3px 0 0 #d0021b;
8
- box-shadow: 0 1px 2px 0 rgba(63, 63, 68, 0.25), inset 0 3px 0 0 #d0021b;
9
- }
10
-
11
- #ahsc-service-warning {
12
- background: rgba(245, 166, 35, 0.1);
13
- -webkit-box-shadow: 0 1px 2px 0 rgba(63, 63, 68, 0.25), inset 0 3px 0 0 #f5a623;
14
- box-shadow: 0 1px 2px 0 rgba(63, 63, 68, 0.25), inset 0 3px 0 0 #f5a623;
15
- }
16
-
17
- #ahsc-service-error,
18
- #ahsc-service-warning {
19
- border: none;
20
- margin: 15px 0;
21
- padding: 15px;
22
- }
23
-
24
- #ahsc-service-error a,
25
- #ahsc-service-warning a {
26
- text-decoration: none;
27
- font-weight: 500;
28
- }
29
-
30
- #ahsc-service-error a::after,
31
- #ahsc-service-warning a::after {
32
- content: "";
33
- background: no-repeat var(--icon-external-link);
34
- padding-right: 1em;
35
- }
1
+ :root {
2
+ --icon-external-link: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"> <g style="stroke:rgb(35,82,124);stroke-width:1"> <line x1="5" y1="5" x2="5" y2="14" /> <line x1="14" y1="9" x2="14" y2="14" /> <line x1="5" y1="14" x2="14" y2="14" /> <line x1="5" y1="5" x2="9" y2="5" /> <line x1="10" y1="2" x2="17" y2="2" /> <line x1="17" y1="2" x2="17" y2="9" /> <line x1="10" y1="9" x2="17" y2="2" style="stroke-width:1.5" /></g></svg>');
3
+ }
4
+
5
+ #ahsc-service-error {
6
+ background: rgba(208, 2, 27, 0.1);
7
+ -webkit-box-shadow: 0 1px 2px 0 rgba(63, 63, 68, 0.25), inset 0 3px 0 0 #d0021b;
8
+ box-shadow: 0 1px 2px 0 rgba(63, 63, 68, 0.25), inset 0 3px 0 0 #d0021b;
9
+ }
10
+
11
+ #ahsc-service-warning {
12
+ background: rgba(245, 166, 35, 0.1);
13
+ -webkit-box-shadow: 0 1px 2px 0 rgba(63, 63, 68, 0.25), inset 0 3px 0 0 #f5a623;
14
+ box-shadow: 0 1px 2px 0 rgba(63, 63, 68, 0.25), inset 0 3px 0 0 #f5a623;
15
+ }
16
+
17
+ #ahsc-service-error,
18
+ #ahsc-service-warning {
19
+ border: none;
20
+ margin: 15px 0;
21
+ padding: 15px;
22
+ }
23
+
24
+ #ahsc-service-error a,
25
+ #ahsc-service-warning a {
26
+ text-decoration: none;
27
+ font-weight: 500;
28
+ }
29
+
30
+ #ahsc-service-error a::after,
31
+ #ahsc-service-warning a::after {
32
+ content: "";
33
+ background: no-repeat var(--icon-external-link);
34
+ padding-right: 1em;
35
+ }
admin/css/aruba-hispeed-cache-admin.css CHANGED
@@ -1,36 +1,36 @@
1
- .clearfix {
2
- }
3
- .clearfix:before,
4
- .clearfix:after {
5
- content: " ";
6
- display: table;
7
- }
8
- .clearfix:after {
9
- clear: both;
10
- }
11
-
12
- .form-table th,
13
- .form-wrap label {
14
- vertical-align: middle;
15
- }
16
-
17
- .form-table th {
18
- width: 25% !important;
19
- }
20
-
21
- .ahsc-options-wrapper tr td label {
22
- width: 100%;
23
- }
24
-
25
- h2,
26
- h3 {
27
- color: #1d2327 !important;
28
- font-size: 1.3em !important;
29
- margin: 1em 0 !important;
30
- padding: 8px 12px 8px 0px !important;
31
- }
32
-
33
- small::before {
34
- content: "\a";
35
- white-space: pre;
36
- }
1
+ .clearfix {
2
+ }
3
+ .clearfix:before,
4
+ .clearfix:after {
5
+ content: " ";
6
+ display: table;
7
+ }
8
+ .clearfix:after {
9
+ clear: both;
10
+ }
11
+
12
+ .form-table th,
13
+ .form-wrap label {
14
+ vertical-align: middle;
15
+ }
16
+
17
+ .form-table th {
18
+ width: 25% !important;
19
+ }
20
+
21
+ .ahsc-options-wrapper tr td label {
22
+ width: 100%;
23
+ }
24
+
25
+ h2,
26
+ h3 {
27
+ color: #1d2327 !important;
28
+ font-size: 1.3em !important;
29
+ margin: 1em 0 !important;
30
+ padding: 8px 12px 8px 0px !important;
31
+ }
32
+
33
+ small::before {
34
+ content: "\a";
35
+ white-space: pre;
36
+ }
admin/index.php CHANGED
@@ -1,4 +1,4 @@
1
- <?php
2
- /**
3
- * Silence.
4
- */
1
+ <?php
2
+ /**
3
+ * Silence.
4
+ */
admin/js/aruba-hispeed-cache-admin.js CHANGED
@@ -1,33 +1,33 @@
1
- (() => {
2
- "use strict";
3
-
4
- const ahsc_show_option = () => {
5
- let ahsc_enable_purge = document.querySelector("input#ahsc_enable_purge");
6
-
7
- ahsc_enable_purge.addEventListener("change", (e) => {
8
- let form_parts = document.querySelector("form#post_form > div > div").children;
9
-
10
- if (form_parts[1].style.display === "none" && form_parts[2].style.display === "none") {
11
- form_parts[1].style.removeProperty("display");
12
- form_parts[2].style.removeProperty("display");
13
- } else {
14
- form_parts[1].style.display = "none";
15
- form_parts[2].style.display = "none";
16
- }
17
- });
18
- };
19
-
20
- document.addEventListener("DOMContentLoaded", function (event) {
21
- const purge_btn = document.querySelector("a#purgeall");
22
-
23
- purge_btn.addEventListener("click", (e) => {
24
- if (confirm(aruba_hispeed_cache.purge_confirm_string) === true) {
25
- // Continue submitting form.
26
- } else {
27
- e.preventDefault();
28
- }
29
- });
30
-
31
- ahsc_show_option();
32
- });
33
- })();
1
+ (() => {
2
+ "use strict";
3
+
4
+ const ahsc_show_option = () => {
5
+ let ahsc_enable_purge = document.querySelector("input#ahsc_enable_purge");
6
+
7
+ ahsc_enable_purge.addEventListener("change", (e) => {
8
+ let form_parts = document.querySelector("form#post_form > div > div").children;
9
+
10
+ if (form_parts[1].style.display === "none" && form_parts[2].style.display === "none") {
11
+ form_parts[1].style.removeProperty("display");
12
+ form_parts[2].style.removeProperty("display");
13
+ } else {
14
+ form_parts[1].style.display = "none";
15
+ form_parts[2].style.display = "none";
16
+ }
17
+ });
18
+ };
19
+
20
+ document.addEventListener("DOMContentLoaded", function (event) {
21
+ const purge_btn = document.querySelector("a#purgeall");
22
+
23
+ purge_btn.addEventListener("click", (e) => {
24
+ if (confirm(aruba_hispeed_cache.purge_confirm_string) === true) {
25
+ // Continue submitting form.
26
+ } else {
27
+ e.preventDefault();
28
+ }
29
+ });
30
+
31
+ ahsc_show_option();
32
+ });
33
+ })();
admin/partials/admin-display.php CHANGED
@@ -1,24 +1,24 @@
1
- <?php
2
- global $pagenow;
3
- ?>
4
-
5
- <!-- This file should primarily consist of HTML with a little bit of PHP. -->
6
-
7
- <div class="wrap ahsc-wrapper">
8
- <h1 class="ahsc-option-title">
9
- <?php \esc_html_e('Aruba HiSpeed Cache Settings ', 'aruba-hispeed-cache'); ?>
10
- </h1>
11
-
12
- <div id="poststuff">
13
- <div id="post-body" class="metabox-holder columns-2">
14
- <div id="post-body-content">
15
- <?php
16
- require ARUBA_HISPEED_CACHE_BASEPATH . 'admin' .AHSC_DS. 'partials' .AHSC_DS. 'admin-general-options.php';
17
- ?>
18
- </div> <!-- End of #post-body-content -->
19
- <div id="postbox-container-1" class="postbox-container">
20
- <!-- empty sidebar -->
21
- </div> <!-- End of #postbox-container-1 -->
22
- </div> <!-- End of #post-body -->
23
- </div> <!-- End of #poststuff -->
24
- </div> <!-- End of .wrap .ahsc-wrapper -->
1
+ <?php
2
+ global $pagenow;
3
+ ?>
4
+
5
+ <!-- This file should primarily consist of HTML with a little bit of PHP. -->
6
+
7
+ <div class="wrap ahsc-wrapper">
8
+ <h1 class="ahsc-option-title">
9
+ <?php \esc_html_e('Aruba HiSpeed Cache Settings ', 'aruba-hispeed-cache'); ?>
10
+ </h1>
11
+
12
+ <div id="poststuff">
13
+ <div id="post-body" class="metabox-holder columns-2">
14
+ <div id="post-body-content">
15
+ <?php
16
+ require ARUBA_HISPEED_CACHE_BASEPATH . 'admin' .AHSC_DS. 'partials' .AHSC_DS. 'admin-general-options.php';
17
+ ?>
18
+ </div> <!-- End of #post-body-content -->
19
+ <div id="postbox-container-1" class="postbox-container">
20
+ <!-- empty sidebar -->
21
+ </div> <!-- End of #postbox-container-1 -->
22
+ </div> <!-- End of #post-body -->
23
+ </div> <!-- End of #poststuff -->
24
+ </div> <!-- End of .wrap .ahsc-wrapper -->
admin/partials/admin-notice-not-aruba-server.php CHANGED
@@ -1,10 +1,10 @@
1
- <div id="ahsc-service-error" class="notice notice-error">
2
- <p>
3
- <?php
4
- printf(
5
- \wp_kses(__('<strong>The Aruba HiSpeed Cache plugin cannot be used because your WordPress website is not hosted on an Aruba hosting platform.</strong> Buy an <a href="%s" rel="nofollow" target="_blank">Aruba hosting</a> service and migrate your website to use the plugin.', 'aruba-hispeed-cache'), array( 'strong' => array(), 'a' => array( 'href' => array(), 'target' => array(), 'rel' => array()) )),
6
- esc_url(ArubaHiSpeedCache\includes\ArubaHiSpeedCacheConfigs::getLocalizedLink('link_hosting_truck'))
7
- );
8
- ?>
9
- </p>
10
- </div>
1
+ <div id="ahsc-service-error" class="notice notice-error">
2
+ <p>
3
+ <?php
4
+ printf(
5
+ \wp_kses(__('<strong>The Aruba HiSpeed Cache plugin cannot be used because your WordPress website is not hosted on an Aruba hosting platform.</strong> Buy an <a href="%s" rel="nofollow" target="_blank">Aruba hosting</a> service and migrate your website to use the plugin.', 'aruba-hispeed-cache'), array( 'strong' => array(), 'a' => array( 'href' => array(), 'target' => array(), 'rel' => array()) )),
6
+ esc_url(ArubaHiSpeedCache\includes\ArubaHiSpeedCacheConfigs::getLocalizedLink('link_hosting_truck'))
7
+ );
8
+ ?>
9
+ </p>
10
+ </div>
admin/partials/admin-notice-purge-completed.php CHANGED
@@ -1,7 +1,7 @@
1
- <div class="updated">
2
- <p>
3
- <?php
4
- \esc_html_e('Purge completed', 'aruba-hispeed-cache');
5
- ?>
6
- </p>
7
- </div>
1
+ <div class="updated">
2
+ <p>
3
+ <?php
4
+ \esc_html_e('Purge completed', 'aruba-hispeed-cache');
5
+ ?>
6
+ </p>
7
+ </div>
admin/partials/admin-notice-service-unavailable.php CHANGED
@@ -1,10 +1,10 @@
1
-
2
- <div id="ahsc-service-error" class="notice notice-error">
3
- <p>
4
- <?php printf(
5
- \wp_kses(__('<strong>The HiSpeed Cache feature, with which the plugin interfaces, is not available on the server that hosts your website.</strong> To use HiSpeed Cache and the plugin, contact <a href="%s" rel="nofollow" target="_blank">support</a>.', 'aruba-hispeed-cache'), array( 'strong' => array(), 'a' => array( 'href' => array(), 'target' => array(), 'rel' => array()) )),
6
- esc_url(ArubaHiSpeedCache\includes\ArubaHiSpeedCacheConfigs::getLocalizedLink('link_assistance'))
7
- );
8
- ?>
9
- </p>
10
- </div>
1
+
2
+ <div id="ahsc-service-error" class="notice notice-error">
3
+ <p>
4
+ <?php printf(
5
+ \wp_kses(__('<strong>The HiSpeed Cache feature, with which the plugin interfaces, is not available on the server that hosts your website.</strong> To use HiSpeed Cache and the plugin, contact <a href="%s" rel="nofollow" target="_blank">support</a>.', 'aruba-hispeed-cache'), array( 'strong' => array(), 'a' => array( 'href' => array(), 'target' => array(), 'rel' => array()) )),
6
+ esc_url(ArubaHiSpeedCache\includes\ArubaHiSpeedCacheConfigs::getLocalizedLink('link_assistance'))
7
+ );
8
+ ?>
9
+ </p>
10
+ </div>
admin/partials/admin-notice-settings-saved.php CHANGED
@@ -1,7 +1,7 @@
1
- <div class="updated">
2
- <p>
3
- <?php
4
- \esc_html_e('Settings saved.', 'aruba-hispeed-cache');
5
- ?>
6
- </p>
7
- </div>
1
+ <div class="updated">
2
+ <p>
3
+ <?php
4
+ \esc_html_e('Settings saved.', 'aruba-hispeed-cache');
5
+ ?>
6
+ </p>
7
+ </div>
admin/partials/admin-notice-version.php CHANGED
@@ -1,15 +1,15 @@
1
-
2
- <div id="message" class="error">
3
- <p>
4
- <strong>
5
- <?php
6
- /**
7
- * Printf
8
- */
9
- \printf(
10
- \esc_html__('Sorry, Aruba HiSpeed Cache requires WordPress %s or higher.', 'aruba-hispeed-cache'),
11
- \esc_html(ArubaHiSpeedCache\includes\ArubaHiSpeedCacheConfigs::ArubaHiSpeedCache_getConfigs('MINIMUM_WP'))
12
- ); ?>
13
- </strong>
14
- </p>
15
- </div>
1
+
2
+ <div id="message" class="error">
3
+ <p>
4
+ <strong>
5
+ <?php
6
+ /**
7
+ * Printf
8
+ */
9
+ \printf(
10
+ \esc_html__('Sorry, Aruba HiSpeed Cache requires WordPress %s or higher.', 'aruba-hispeed-cache'),
11
+ \esc_html(ArubaHiSpeedCache\includes\ArubaHiSpeedCacheConfigs::ArubaHiSpeedCache_getConfigs('MINIMUM_WP'))
12
+ ); ?>
13
+ </strong>
14
+ </p>
15
+ </div>
aruba-hispeed-cache.php CHANGED
@@ -1,17 +1,18 @@
1
  <?php
2
  /**
3
  * Aruba HiSpeed Cache
 
4
  *
5
  * @category Wordpress-plugin
6
  * @package Aruba-HiSpeed-Cache
7
  * @author Aruba Developer <hispeedcache.developer@aruba.it>
8
  * @license https://www.gnu.org/licenses/gpl-2.0.html GPLv2 or later
9
- * @link Null
10
  * @since 1.0.0
11
  *
12
  * @wordpress-plugin
13
  * Plugin Name: Aruba HiSpeed Cache
14
- * Version: 1.1.2
15
  * Plugin URI: https://hosting.aruba.it/wordpress.aspx
16
  * Description: Aruba HiSpeed Cache interfaces directly with an Aruba hosting platform's HiSpeed Cache service and automates its management.
17
  * Author: Aruba.it
1
  <?php
2
  /**
3
  * Aruba HiSpeed Cache
4
+ * php version 5.6
5
  *
6
  * @category Wordpress-plugin
7
  * @package Aruba-HiSpeed-Cache
8
  * @author Aruba Developer <hispeedcache.developer@aruba.it>
9
  * @license https://www.gnu.org/licenses/gpl-2.0.html GPLv2 or later
10
+ * @link null
11
  * @since 1.0.0
12
  *
13
  * @wordpress-plugin
14
  * Plugin Name: Aruba HiSpeed Cache
15
+ * Version: 1.2.0
16
  * Plugin URI: https://hosting.aruba.it/wordpress.aspx
17
  * Description: Aruba HiSpeed Cache interfaces directly with an Aruba hosting platform's HiSpeed Cache service and automates its management.
18
  * Author: Aruba.it
includes/ArubaHiSpeedCacheBootstrap.php CHANGED
@@ -17,12 +17,14 @@ use \esc_html;
17
  use \esc_html__;
18
  use \is_multisite;
19
  use \version_compare;
 
20
 
21
  use ArubaHiSpeedCache\includes\ArubaHiSpeedCachei18n;
22
  use ArubaHiSpeedCache\includes\ArubaHiSpeedCacheAdmin;
23
  use ArubaHiSpeedCache\includes\ArubaHiSpeedCacheLoader;
24
  use ArubaHiSpeedCache\includes\ArubaHiSpeedCacheConfigs;
25
  use ArubaHiSpeedCache\includes\HiSpeedCacheServiceChecker;
 
26
 
27
  if (! class_exists(__NAMESPACE__ . '\ArubaHiSpeedCacheBootstrap')) {
28
  class ArubaHiSpeedCacheBootstrap
@@ -74,6 +76,14 @@ if (! class_exists(__NAMESPACE__ . '\ArubaHiSpeedCacheBootstrap')) {
74
 
75
  include_once \plugin_dir_path(ARUBA_HISPEED_CACHE_FILE) . 'includes' .AHSC_DS. 'HiSpeedCacheServiceChecker.php';
76
 
 
 
 
 
 
 
 
 
77
  $this->loader = new ArubaHiSpeedCacheLoader();
78
  }
79
 
@@ -96,7 +106,7 @@ if (! class_exists(__NAMESPACE__ . '\ArubaHiSpeedCacheBootstrap')) {
96
  */
97
  private function _define_admin_hooks()
98
  {
99
- global $aruba_hispeed_cache_admin, $aruba_hispeed_cache_purger;
100
 
101
  $aruba_hispeed_cache_admin = new ArubaHiSpeedCacheAdmin();
102
  $aruba_hispeed_cache_purger = new ArubaHiSpeedCacheWpPurger($aruba_hispeed_cache_admin);
@@ -139,14 +149,56 @@ if (! class_exists(__NAMESPACE__ . '\ArubaHiSpeedCacheBootstrap')) {
139
  $this->loader->add_action('delete_term', $aruba_hispeed_cache_purger, 'ahsc_delete_term', 20, 4);
140
 
141
  $this->loader->add_action('check_ajax_referer', $aruba_hispeed_cache_purger, 'ahsc_check_ajax_referer', 20);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  }
143
 
144
  $this->loader->add_action('admin_bar_init', $aruba_hispeed_cache_purger, 'ahsc_admin_bar_init');
145
 
146
  //the chech on activation of plugin
147
- //$this->loader->add_action('activated_plugin', $this, 'check_hispeed_cache_services', 20, 1);
148
- //the activation notification in the established cases
149
  $this->loader->add_action('admin_notices', $aruba_hispeed_cache_admin, 'check_hispeed_cache_notices');
 
 
 
150
  }
151
 
152
  /**
@@ -246,3 +298,31 @@ if (! class_exists(__NAMESPACE__ . '\ArubaHiSpeedCacheBootstrap')) {
246
  }
247
  }
248
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  use \esc_html__;
18
  use \is_multisite;
19
  use \version_compare;
20
+ use \wp_delete_file;
21
 
22
  use ArubaHiSpeedCache\includes\ArubaHiSpeedCachei18n;
23
  use ArubaHiSpeedCache\includes\ArubaHiSpeedCacheAdmin;
24
  use ArubaHiSpeedCache\includes\ArubaHiSpeedCacheLoader;
25
  use ArubaHiSpeedCache\includes\ArubaHiSpeedCacheConfigs;
26
  use ArubaHiSpeedCache\includes\HiSpeedCacheServiceChecker;
27
+ use ArubaHiSpeedCache\includes\ArubaHispeeCacheLogger as Logger;
28
 
29
  if (! class_exists(__NAMESPACE__ . '\ArubaHiSpeedCacheBootstrap')) {
30
  class ArubaHiSpeedCacheBootstrap
76
 
77
  include_once \plugin_dir_path(ARUBA_HISPEED_CACHE_FILE) . 'includes' .AHSC_DS. 'HiSpeedCacheServiceChecker.php';
78
 
79
+ if (\file_exists(\plugin_dir_path(ARUBA_HISPEED_CACHE_FILE) . 'includes' .AHSC_DS. 'ArubaHispeedCacheLogger.php') && WP_DEBUG) {
80
+ include_once \plugin_dir_path(ARUBA_HISPEED_CACHE_FILE) . 'includes' .AHSC_DS. 'ArubaHispeedCacheLogger.php';
81
+ } else {
82
+ if (file_exists(\plugin_dir_path(ARUBA_HISPEED_CACHE_FILE) . 'ahscLog.log')) {
83
+ \wp_delete_file(\plugin_dir_path(ARUBA_HISPEED_CACHE_FILE) . 'ahscLog.log');
84
+ }
85
+ }
86
+
87
  $this->loader = new ArubaHiSpeedCacheLoader();
88
  }
89
 
106
  */
107
  private function _define_admin_hooks()
108
  {
109
+ global $aruba_hispeed_cache_admin, $aruba_hispeed_cache_purger, $pagenow;
110
 
111
  $aruba_hispeed_cache_admin = new ArubaHiSpeedCacheAdmin();
112
  $aruba_hispeed_cache_purger = new ArubaHiSpeedCacheWpPurger($aruba_hispeed_cache_admin);
149
  $this->loader->add_action('delete_term', $aruba_hispeed_cache_purger, 'ahsc_delete_term', 20, 4);
150
 
151
  $this->loader->add_action('check_ajax_referer', $aruba_hispeed_cache_purger, 'ahsc_check_ajax_referer', 20);
152
+
153
+ /**
154
+ * If you are on the menu management page, remove the hooks queuing.
155
+ *
156
+ * @since 1.2.0
157
+ */
158
+ if (is_admin() && 'nav-menus.php' === $pagenow) {
159
+ $this->loader->remove_action('edit_term');
160
+ $this->loader->remove_action('transition_post_status');
161
+ $this->loader->add_action('wp_update_nav_menu', $aruba_hispeed_cache_purger, 'ahsc_wp_update_nav_menu', 20, 1);
162
+ }
163
+
164
+ /**
165
+ * FES support.
166
+ *
167
+ * @since 1.2.0
168
+ */
169
+ if (is_admin()) {
170
+ $this->loader->add_action('admin_init', $aruba_hispeed_cache_purger, 'ahsc_deferred_purge_by_transient', 200);
171
+ //
172
+ $this->loader->add_action('check_admin_referer', $aruba_hispeed_cache_purger, 'ahsc_bulk_manager', 20, 2);
173
+
174
+ $this->loader->add_action('post_updated', $aruba_hispeed_cache_purger, 'ahsc_post_updated', 200);
175
+ //$this->loader->add_action('wp_after_insert_post', $aruba_hispeed_cache_purger, 'ahsc_post_updated', 200);
176
+ }
177
+
178
+ /**
179
+ * Plugin actions
180
+ *
181
+ * @since 1.2.0
182
+ */
183
+ $this->loader->add_action('activated_plugin', $aruba_hispeed_cache_purger, 'ahsc_purge_on_plugin_actions', 200, 1);
184
+ $this->loader->add_action('deactivate_plugin', $aruba_hispeed_cache_purger, 'ahsc_purge_on_plugin_actions', 200, 1);
185
+ $this->loader->add_action('delete_plugin', $aruba_hispeed_cache_purger, 'ahsc_purge_on_plugin_actions', 200, 1);
186
+
187
+ /**
188
+ * Theme action
189
+ *
190
+ * @since 1.2.0
191
+ */
192
+ $this->loader->add_action('switch_theme', $aruba_hispeed_cache_purger, 'ahsc_purge_on_theme_actions', 200, 3);
193
  }
194
 
195
  $this->loader->add_action('admin_bar_init', $aruba_hispeed_cache_purger, 'ahsc_admin_bar_init');
196
 
197
  //the chech on activation of plugin
 
 
198
  $this->loader->add_action('admin_notices', $aruba_hispeed_cache_admin, 'check_hispeed_cache_notices');
199
+
200
+ //init
201
+ $this->loader->add_action('admin_init', '\ArubaHiSpeedCache\includes\ArubaHiSpeedCacheConfigs', 'ArubaHiSpeedCache_update_plugins_db');
202
  }
203
 
204
  /**
298
  }
299
  }
300
  }
301
+
302
+
303
+ //--------------
304
+ // Logger function
305
+ //--------------
306
+ function logger($message, string $name = '', string $livel = 'debug')
307
+ {
308
+ if (!class_exists(__NAMESPACE__ . '\ArubaHispeeCacheLogger')) {
309
+ return;
310
+ }
311
+
312
+ switch ($livel) {
313
+ case 'debug':
314
+ Logger::debug($message, $name);
315
+ break;
316
+ case 'info':
317
+ Logger::info($message, $name);
318
+ break;
319
+ case 'warning':
320
+ Logger::warning($message, $name);
321
+ break;
322
+ case 'error':
323
+ Logger::error($message, $name);
324
+ break;
325
+ }
326
+
327
+ return;
328
+ }
includes/ArubaHiSpeedCacheConfigs.php CHANGED
@@ -36,6 +36,7 @@ if (! \class_exists('ArubaHiSpeedCache\includes\ArubaHiSpeedCacheConfigs')) {
36
  /**
37
  * USER_CAP array
38
  */
 
39
  public static $USER_CAP = array(
40
  'Aruba Hispeed Cache | Config',
41
  'Aruba Hispeed Cache | Purge cache'
@@ -49,7 +50,7 @@ if (! \class_exists('ArubaHiSpeedCache\includes\ArubaHiSpeedCacheConfigs')) {
49
  /**
50
  * PLUGIN_VERSION string
51
  */
52
- public static $PLUGIN_VERSION = '1.1.2';
53
 
54
  /**
55
  * MINIMUM_WP string
@@ -205,6 +206,27 @@ if (! \class_exists('ArubaHiSpeedCache\includes\ArubaHiSpeedCacheConfigs')) {
205
  \update_site_option(ARUBA_HISPEED_CACHE_OPTIONS_NAME, $options);
206
  }
207
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  /**
209
  * ArubaHiSpeedCache_deactivate
210
  *
36
  /**
37
  * USER_CAP array
38
  */
39
+ //@todo to remove?
40
  public static $USER_CAP = array(
41
  'Aruba Hispeed Cache | Config',
42
  'Aruba Hispeed Cache | Purge cache'
50
  /**
51
  * PLUGIN_VERSION string
52
  */
53
+ public static $PLUGIN_VERSION = '1.2.0';
54
 
55
  /**
56
  * MINIMUM_WP string
206
  \update_site_option(ARUBA_HISPEED_CACHE_OPTIONS_NAME, $options);
207
  }
208
 
209
+ /**
210
+ * Undocumented ArubaHiSpeedCache_register_setting
211
+ *
212
+ * @return void
213
+ */
214
+ public static function ArubaHiSpeedCache_update_plugins_db()
215
+ {
216
+ //get the option
217
+ $current_options = \get_site_option(ARUBA_HISPEED_CACHE_OPTIONS_NAME);
218
+ $new_options = self::ArubaHiSpeedCache_get_default_settings();
219
+
220
+ $option_to_update = array_diff_key($new_options, $current_options);
221
+
222
+ if (!empty($option_to_update)) {
223
+ $option_merge = array_merge($new_options, $current_options);
224
+ \update_site_option(ARUBA_HISPEED_CACHE_OPTIONS_NAME, $option_merge);
225
+ }
226
+
227
+ return;
228
+ }
229
+
230
  /**
231
  * ArubaHiSpeedCache_deactivate
232
  *
includes/ArubaHiSpeedCacheLoader.php CHANGED
@@ -1,10 +1,14 @@
1
  <?php
2
  /**
 
 
 
3
  * @category Wordpress-plugin
4
  * @package Aruba-HiSpeed-Cache
5
  * @author Aruba Developer <hispeedcache.developer@aruba.it>
6
  * @license https://www.gnu.org/licenses/gpl-2.0.html GPLv2 or later
7
  * @link run_aruba_hispeed_cache
 
8
  */
9
 
10
 
@@ -15,109 +19,197 @@ use \Throwable;
15
  use \add_action;
16
  use \add_filter;
17
 
18
- /**
19
- * Undocumented class
20
- */
21
- class ArubaHiSpeedCacheLoader
22
- {
23
- /**
24
- * Actions
25
- *
26
- * @var array
27
- */
28
- protected $actions = array();
29
 
30
  /**
31
- * Filters
32
  *
33
- * @var array
34
- */
35
- protected $filters = array();
36
-
37
- // public function __construct()
38
- // {}
39
-
40
- /**
41
- * Add_action
42
- * Wrap for the wp method add_action
43
  *
44
- * @see https://developer.wordpress.org/reference/functions/add_action/
45
- *
46
- * @param string $hook
47
- * @param object $component
48
- * @param string $callback
49
- * @param integer $priority
50
- * @param integer $accepted_args
51
- * @return void
52
  */
53
- public function add_action($hook, $component, $callback, $priority = 10, $accepted_args = 1)
54
  {
55
- $this->actions = $this->add($this->actions, $hook, $component, $callback, $priority, $accepted_args);
56
- }
 
 
 
 
57
 
58
- /**
59
- * Add_filter
60
- *
61
- * Wrap for the wp method add_filter
62
- *
63
- * @see https://developer.wordpress.org/reference/functions/add_filter/
64
- *
65
- * @param string $hook
66
- * @param object $component
67
- * @param string $callback
68
- * @param integer $priority
69
- * @param integer $accepted_args
70
- * @return void
71
- */
72
- public function add_filter($hook, $component, $callback, $priority = 10, $accepted_args = 1)
73
- {
74
- $this->filters = $this->add($this->filters, $hook, $component, $callback, $priority, $accepted_args);
75
- }
76
 
77
- /**
78
- * Add
79
- *
80
- * Helper method for populating arrays filters and actions
81
- *
82
- * @param string $hooks
83
- * @param string $hook
84
- * @param object $component
85
- * @param string $callback
86
- * @param integer $priority
87
- * @param integer $accepted_args
88
- * @return array
89
- */
90
- private function add($hooks, $hook, $component, $callback, $priority, $accepted_args)
91
- {
92
- $hooks[] = array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  'hook' => $hook,
94
  'component' => $component,
95
  'callback' => $callback,
96
  'priority' => $priority,
97
  'accepted_args' => $accepted_args,
98
- );
99
 
100
- return $hooks;
101
- }
102
 
103
- /**
104
- * Run
105
- *
106
- * Runner method for queuing actions and filters
107
- *
108
- * @return void
109
- */
110
- public function run()
111
- {
112
- if (!empty($this->filters)) {
113
- foreach ($this->filters as $hook) {
114
- \add_filter($hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args']);
 
 
 
 
 
 
115
  }
116
- }
117
 
118
- if (!empty($this->actions)) {
119
- foreach ($this->actions as $hook) {
120
- \add_action($hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args']);
 
 
 
 
 
 
121
  }
122
  }
123
  }
1
  <?php
2
  /**
3
+ * ArubaHiSpeedCacheLoader.php contains an abstraction of the wordpress hook system.
4
+ * php version 5.6
5
+ *
6
  * @category Wordpress-plugin
7
  * @package Aruba-HiSpeed-Cache
8
  * @author Aruba Developer <hispeedcache.developer@aruba.it>
9
  * @license https://www.gnu.org/licenses/gpl-2.0.html GPLv2 or later
10
  * @link run_aruba_hispeed_cache
11
+ * @since 1.0.0
12
  */
13
 
14
 
19
  use \add_action;
20
  use \add_filter;
21
 
22
+ if (!class_exists(__NAMESPACE__ . '\ArubaHiSpeedCacheLoader')) {
 
 
 
 
 
 
 
 
 
 
23
 
24
  /**
25
+ * ArubaHiSpeedCacheLoader
26
  *
27
+ * Contains an abstraction of the wordpress hook system
 
 
 
 
 
 
 
 
 
28
  *
29
+ * @category Wordpress-plugin
30
+ * @package Aruba-HiSpeed-Cache
31
+ * @author Aruba Developer <hispeedcache.developer@aruba.it>
32
+ * @license https://www.gnu.org/licenses/gpl-2.0.html GPLv2 or later
33
+ * @link run_aruba_hispeed_cache
34
+ * @since 1.0.0
 
 
35
  */
36
+ class ArubaHiSpeedCacheLoader
37
  {
38
+ /**
39
+ * Actions
40
+ *
41
+ * @var array
42
+ */
43
+ protected $actions = array();
44
 
45
+ /**
46
+ * Filters
47
+ *
48
+ * @var array
49
+ */
50
+ protected $filters = array();
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
+ /**
53
+ * Add_action - Wrap for the wp method add_action
54
+ *
55
+ * @param string $hook Hook name
56
+ * @param object $component Calss targhet
57
+ * @param string $callback Function to fire on action
58
+ * @param integer $priority The priority of action
59
+ * @param integer $accepted_args Number of var passed to function.
60
+ *
61
+ * @see https://developer.wordpress.org/reference/functions/add_action/
62
+ *
63
+ * @since 1.0.0
64
+ *
65
+ * @return void
66
+ */
67
+ public function add_action(
68
+ $hook,
69
+ $component,
70
+ $callback,
71
+ $priority = 10,
72
+ $accepted_args = 1
73
+ ) {
74
+ $this->actions = $this->_add(
75
+ $this->actions,
76
+ $hook,
77
+ $component,
78
+ $callback,
79
+ $priority,
80
+ $accepted_args
81
+ );
82
+ }
83
+
84
+ /**
85
+ * Remove_action
86
+ * Removes the action element of the indicated list if it is present.
87
+ *
88
+ * @param string $hook Hook name
89
+ *
90
+ * @since 1.0.3
91
+ *
92
+ * @return void
93
+ */
94
+ public function remove_action($hook)
95
+ {
96
+ if (array_key_exists($hook, $this->actions)) {
97
+ unset($this->actions[$hook]);
98
+ }
99
+ }
100
+
101
+ /**
102
+ * Add_filter
103
+ * Wrap for the wp method add_filter
104
+ *
105
+ * @param string $hook Hook name
106
+ * @param object $component Calss targhet
107
+ * @param string $callback Function to fire on action
108
+ * @param integer $priority The priority of action
109
+ * @param integer $accepted_args Number of var passed to function.
110
+ *
111
+ * @see https://developer.wordpress.org/reference/functions/add_filter/
112
+ *
113
+ * @since 1.0.0
114
+ *
115
+ * @return void
116
+ */
117
+ public function add_filter(
118
+ $hook,
119
+ $component,
120
+ $callback,
121
+ $priority = 10,
122
+ $accepted_args = 1
123
+ ) {
124
+ $this->filters = $this->_add(
125
+ $this->filters,
126
+ $hook,
127
+ $component,
128
+ $callback,
129
+ $priority,
130
+ $accepted_args
131
+ );
132
+ }
133
+
134
+ /**
135
+ * Remove_filter
136
+ * Removes the filter element of the indicated list if it is present.
137
+ *
138
+ * @param string $hook Hook name
139
+ *
140
+ * @since 1.0.3
141
+ *
142
+ * @return void
143
+ */
144
+ public function remove_filter($hook)
145
+ {
146
+ if (array_key_exists($hook, $this->filters)) {
147
+ unset($this->filters[$hook]);
148
+ }
149
+ }
150
+
151
+ /**
152
+ * Add
153
+ *
154
+ * Helper method for populating filters and actions arrays
155
+ *
156
+ * @param string $hooks Array targhet
157
+ * @param string $hook Hook name
158
+ * @param object $component Calss
159
+ * @param string $callback Class::methos
160
+ * @param integer $priority The priority
161
+ * @param integer $accepted_args Number of var passed by wp hook
162
+ *
163
+ * @return array
164
+ */
165
+ private function _add(
166
+ $hooks,
167
+ $hook,
168
+ $component,
169
+ $callback,
170
+ $priority,
171
+ $accepted_args
172
+ ) {
173
+ $hooks[] = array(
174
  'hook' => $hook,
175
  'component' => $component,
176
  'callback' => $callback,
177
  'priority' => $priority,
178
  'accepted_args' => $accepted_args,
179
+ );
180
 
181
+ return $hooks;
182
+ }
183
 
184
+ /**
185
+ * Run
186
+ *
187
+ * Runner method for queuing actions and filters
188
+ *
189
+ * @return void
190
+ */
191
+ public function run()
192
+ {
193
+ if (!empty($this->filters)) {
194
+ foreach ($this->filters as $hook) {
195
+ \add_filter(
196
+ $hook['hook'],
197
+ array( $hook['component'], $hook['callback'] ),
198
+ $hook['priority'],
199
+ $hook['accepted_args']
200
+ );
201
+ }
202
  }
 
203
 
204
+ if (!empty($this->actions)) {
205
+ foreach ($this->actions as $hook) {
206
+ \add_action(
207
+ $hook['hook'],
208
+ array( $hook['component'], $hook['callback'] ),
209
+ $hook['priority'],
210
+ $hook['accepted_args']
211
+ );
212
+ }
213
  }
214
  }
215
  }
includes/ArubaHiSpeedCachePurger.php CHANGED
@@ -1,16 +1,27 @@
1
  <?php
2
  /**
 
 
 
3
  * @category Project
4
- * @package Aruba-HiSpeed-Cache
5
  * @author Aruba Developer <hispeedcache.developer@aruba.it>
6
  * @license https://www.gnu.org/licenses/gpl-2.0.html GPLv2 or later
 
 
7
  */
8
 
9
-
10
  namespace ArubaHiSpeedCache;
11
 
12
  /**
13
- * Undocumented class
 
 
 
 
 
 
 
14
  */
15
  abstract class ArubaHiSpeedCachePurger
16
  {
@@ -39,7 +50,8 @@ abstract class ArubaHiSpeedCachePurger
39
  /**
40
  * Purge the cache of a single page
41
  *
42
- * @param string $url
 
43
  * @return void
44
  */
45
  abstract public function purgeUrl($url);
@@ -47,7 +59,8 @@ abstract class ArubaHiSpeedCachePurger
47
  /**
48
  * Purge the cache of a list of pages
49
  *
50
- * @param array $urls
 
51
  * @return void
52
  */
53
  abstract public function purgeUrls($urls);
@@ -63,12 +76,11 @@ abstract class ArubaHiSpeedCachePurger
63
  /**
64
  * DoRemoteGet
65
  *
66
- * @param string $path path to purge
67
- * @param string $host the host name for log reason
68
  *
69
  * @return void
70
  */
71
- abstract public function doRemoteGet($path = '/', $host = '');
72
 
73
  /**
74
  * PreparePurgeRequestUri
@@ -96,7 +108,8 @@ abstract class ArubaHiSpeedCachePurger
96
  * 'server_port' => string '8889'
97
  * ];
98
  *
99
- * @param array $configs
 
100
  * @return void
101
  */
102
  public function setPurger($configs)
1
  <?php
2
  /**
3
+ * ArubaHiSpeedCacheWpPurger
4
+ * php version 5.6
5
+ *
6
  * @category Project
7
+ * @package ArubaHiSpeedCachePurger
8
  * @author Aruba Developer <hispeedcache.developer@aruba.it>
9
  * @license https://www.gnu.org/licenses/gpl-2.0.html GPLv2 or later
10
+ * @link null
11
+ * @since 1.0.0
12
  */
13
 
 
14
  namespace ArubaHiSpeedCache;
15
 
16
  /**
17
+ * ArubaHiSpeedCachePurger
18
+ *
19
+ * @category Project
20
+ * @package ArubaHiSpeedCache
21
+ * @author Aruba Developer <hispeedcache.developer@aruba.it>
22
+ * @license https://www.gnu.org/licenses/gpl-2.0.html GPLv2 or later
23
+ * @link null
24
+ * @since 1.0.0
25
  */
26
  abstract class ArubaHiSpeedCachePurger
27
  {
50
  /**
51
  * Purge the cache of a single page
52
  *
53
+ * @param string $url The url to purge
54
+ *
55
  * @return void
56
  */
57
  abstract public function purgeUrl($url);
59
  /**
60
  * Purge the cache of a list of pages
61
  *
62
+ * @param array $urls The urls to purge
63
+ *
64
  * @return void
65
  */
66
  abstract public function purgeUrls($urls);
76
  /**
77
  * DoRemoteGet
78
  *
79
+ * @param string $target path to purge
 
80
  *
81
  * @return void
82
  */
83
+ abstract public function doRemoteGet($target = '/');
84
 
85
  /**
86
  * PreparePurgeRequestUri
108
  * 'server_port' => string '8889'
109
  * ];
110
  *
111
+ * @param array $configs The configs
112
+ *
113
  * @return void
114
  */
115
  public function setPurger($configs)
includes/ArubaHiSpeedCacheWpPurger.php CHANGED
@@ -11,8 +11,6 @@
11
  * @since 1.0.0
12
  */
13
 
14
-
15
-
16
  namespace ArubaHiSpeedCache\includes;
17
 
18
  use ArubaHiSpeedCache\ArubaHiSpeedCachePurger;
@@ -46,84 +44,119 @@ use \icl_get_home_url;
46
  use \is_multisite;
47
  use \get_current_blog_id;
48
  use \get_site_url;
49
-
50
  use \str_replace;
51
  use \in_array;
52
  use \array_reverse;
53
  use \implode;
54
  use \filter_input;
55
  use \filter_var;
 
56
  use \sprintf;
57
 
58
- if (!class_exists(__NAMESPACE__ . 'ArubaHiSpeedCacheWpPurger')) {
 
 
 
 
 
 
 
 
 
 
 
59
  class ArubaHiSpeedCacheWpPurger extends ArubaHiSpeedCachePurger
60
  {
61
  /**
62
- * Undocumented variable
63
  *
64
- * @var array
 
65
  */
 
66
  private $settings;
67
 
68
  /**
69
- * Undocumented variable
 
 
70
  *
71
- * @var [type]
72
  */
 
73
  private $admin;
74
 
 
 
 
 
 
 
 
 
75
 
76
  /**
77
- * Undocumented function
78
  *
79
- * @param \ArubaHiSpeedCache\includes\ArubaHiSpeedCacheConfigs $configs
80
- * @param \ArubaHiSpeedCache\includes\ArubaHiSpeedCacheAdmin $aruba_hispeed_cache
81
  */
82
- public function __construct($aruba_hispeed_cache)
83
  {
84
  $this->setPurger(
85
  array(
86
- 'time_out' => ArubaHiSpeedCacheConfigs::ArubaHiSpeedCache_getConfigs('PURGE_TIME_OUT'),
87
- 'server_host' => ArubaHiSpeedCacheConfigs::ArubaHiSpeedCache_getConfigs('PURGE_HOST'),
88
- 'server_port' => ArubaHiSpeedCacheConfigs::ArubaHiSpeedCache_getConfigs('PURGE_PORT')
89
  )
90
  );
91
 
92
- $this->admin = $aruba_hispeed_cache;
93
- $this->settings = $aruba_hispeed_cache->options;
 
94
  }
95
 
96
  /**
97
  * PurgeUrl
98
  * Purge the cache of url passed.
99
  *
100
- * @param string $url
 
101
  * @return void
102
  */
103
  public function purgeUrl($url)
104
  {
105
- $site_url = $this->getParseSiteUrl();
106
- $host = $site_url['host'];
107
 
108
  $_url = \filter_var($url, FILTER_SANITIZE_URL);
109
 
110
- return $this->doRemoteGet($_url, $host);
 
 
 
 
111
  }
112
 
113
  /**
114
  * PurgeUrls
115
  * Purge the cache of urls passed
116
  *
117
- * @param array $urls
 
118
  * @return void
119
  */
120
  public function purgeUrls($urls)
121
  {
122
- $site_url = $this->getParseSiteUrl();
123
- $host = $site_url['host'];
124
 
125
- foreach ($urls as $kurl => $url) {
126
- $this->doRemoteGet($_url, $host);
 
 
 
 
127
  }
128
  }
129
 
@@ -135,22 +168,36 @@ if (!class_exists(__NAMESPACE__ . 'ArubaHiSpeedCacheWpPurger')) {
135
  */
136
  public function purgeAll()
137
  {
138
- $site_url = $this->getParseSiteUrl();
139
- $host = $site_url['host'];
140
- return $this->doRemoteGet('/', $host);
 
 
 
 
 
141
  }
142
 
143
  /**
144
  * DoRemoteGet
145
  * Make request to purger
146
  *
147
- * @param string $path
148
- * @param string $host
149
  * @return void
150
  */
151
- public function doRemoteGet($path = '/', $host = '')
152
  {
153
- $purgeUrl = $this->preparePurgeRequestUri($path);
 
 
 
 
 
 
 
 
 
154
 
155
  $response = \wp_remote_get(
156
  $purgeUrl,
@@ -184,8 +231,9 @@ if (!class_exists(__NAMESPACE__ . 'ArubaHiSpeedCacheWpPurger')) {
184
  /**
185
  * ParseUrl
186
  *
187
- * @param string $url
188
- * @return path of url
 
189
  */
190
  public function parseUrl($url)
191
  {
@@ -205,13 +253,14 @@ if (!class_exists(__NAMESPACE__ . 'ArubaHiSpeedCacheWpPurger')) {
205
  */
206
  public function getHomepage()
207
  {
208
- return \ArubaHiSpeedCache\includes\ArubaHiSpeedCacheConfigs::getSiteHome();
209
  }
210
 
211
  /**
212
  * Is_enable_setting
213
  *
214
- * @param string $setting
 
215
  * @return boolean
216
  */
217
  public function is_enable_setting($setting)
@@ -237,45 +286,59 @@ if (!class_exists(__NAMESPACE__ . 'ArubaHiSpeedCacheWpPurger')) {
237
  // return;
238
  // }
239
 
240
- $method = \filter_input(INPUT_SERVER, 'REQUEST_METHOD', FILTER_SANITIZE_STRING);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
 
242
- if ('POST' === $method) {
243
- $action = \filter_input(INPUT_POST, 'aruba_hispeed_cache_action', FILTER_SANITIZE_STRING);
244
- } else {
245
- $action = \filter_input(INPUT_GET, 'aruba_hispeed_cache_action', FILTER_SANITIZE_STRING);
246
- }
247
 
248
  if (empty($action)) {
249
  return;
250
  }
251
 
252
- /**
253
- * @see https://developer.wordpress.org/reference/functions/wp_die/
254
- */
255
  if (! \current_user_can('manage_options')) {
256
  \wp_die(
257
  \sprintf(
258
  '<h3>%s</h3><p>%s</p>',
259
  \_e('An error has occurred.', 'aruba-hispeed-cache'),
260
- \_e('Sorry, you do not have the necessary privileges to edit these options.', 'aruba-hispeed-cache')
261
  ),
262
  '',
263
  array(
264
- 'link_url' => \esc_url(ArubaHiSpeedCache\includes\ArubaHiSpeedCacheConfigs::getLocalizedLink('link_assistance')),
265
- 'link_text' => \_e('Contact customer service', 'aruba-hispeed-cache')
266
  )
267
  );
268
  }
269
 
270
  if ('done' === $action) {
271
- \add_action('admin_notices', array( $this->admin, 'display_notices_purge_initied' ));
272
- \add_action('network_admin_notices', array( $this->admin, 'display_notices_purge_initied' ));
273
  return;
274
  }
275
 
276
- /**
277
- * @see https://developer.wordpress.org/reference/functions/check_admin_referer/
278
- */
279
  \check_admin_referer('aruba_hispeed_cache-purge_all');
280
 
281
  // current url if permalink is set to simple
@@ -286,11 +349,14 @@ if (!class_exists(__NAMESPACE__ . 'ArubaHiSpeedCacheWpPurger')) {
286
  $current_url = \user_trailingslashit(\home_url($wp->request));
287
  }
288
 
 
 
 
 
 
289
  if (! \is_admin()) {
290
  $action = 'purge_current_page';
291
  $redirect_url = $current_url;
292
- } else {
293
- $redirect_url = \add_query_arg(array( 'aruba_hispeed_cache_action' => 'done' ));
294
  }
295
 
296
  switch ($action) {
@@ -303,22 +369,24 @@ if (!class_exists(__NAMESPACE__ . 'ArubaHiSpeedCacheWpPurger')) {
303
  $this->purgeAll();
304
  } else {
305
  $parse_url = \wp_parse_url($current_url);
306
- $url_to_purge = (!isset($parse_url['query'])) ? $parse_url['path'] : '/?' . $parse_url['query'];
307
  $this->purgeUrl($url_to_purge);
308
  }
309
 
310
  break;
311
  }
312
 
313
- \wp_redirect(\esc_url_raw($redirect_url));
314
- exit();
 
315
  }
316
 
317
  /**
318
  * Ahsc_check_ajax_referer
319
  * Purge the cache on 'save-sidebar-widgets' ajax request
320
  *
321
- * @param int|string $action
 
322
  * @return void
323
  */
324
  public function ahsc_check_ajax_referer($action)
@@ -328,14 +396,18 @@ if (!class_exists(__NAMESPACE__ . 'ArubaHiSpeedCacheWpPurger')) {
328
  }
329
 
330
  switch ($action) {
331
-
332
  case 'save-sidebar-widgets':
333
  $this->purgeUrl($this->getHomepage());
 
 
 
 
 
 
 
334
  break;
335
-
336
  default:
337
  break;
338
-
339
  }
340
  }
341
 
@@ -343,9 +415,10 @@ if (!class_exists(__NAMESPACE__ . 'ArubaHiSpeedCacheWpPurger')) {
343
  * Ahsc_edit_term
344
  * Purge the cache of term item or home on term edit.
345
  *
346
- * @param int $term_id
347
- * @param int $tt_id
348
- * @param string $taxon
 
349
  * @return void
350
  */
351
  public function ahsc_edit_term($term_id, $tt_id, $taxon)
@@ -354,28 +427,44 @@ if (!class_exists(__NAMESPACE__ . 'ArubaHiSpeedCacheWpPurger')) {
354
  return;
355
  }
356
 
357
- $term_link = \get_term_link($term_id, $taxon);
358
-
359
  if (!$this->is_enable_setting('ahsc_purge_archive_on_edit')) {
360
  return;
361
  }
362
 
363
- $this->purgeUrl($this->parseUrl($term_link));
364
-
365
  if ($this->is_enable_setting('ahsc_purge_homepage_on_edit')) {
366
  $this->purgeUrl($this->parseUrl($this->getHomepage()));
 
 
 
 
 
 
 
 
367
  }
 
 
 
 
 
 
 
 
 
 
 
 
368
  return true;
369
  }
370
 
371
  /**
372
- * ahsc_delete_term
 
 
 
 
 
373
  *
374
- * @param integer $term
375
- * @param integer $tt_id
376
- * @param string $taxonomy
377
- * @param \WP_Term $deleted_term
378
- * @param array $object_ids
379
  * @return void
380
  */
381
  public function ahsc_delete_term($term, $tt_id, $taxonomy, $deleted_term)
@@ -399,23 +488,33 @@ if (!class_exists(__NAMESPACE__ . 'ArubaHiSpeedCacheWpPurger')) {
399
 
400
  if (! empty($t->rewrite['hierarchical'])) {
401
  $hierarchical_slugs = array();
402
- $ancestors = \get_ancestors($deleted_term->term_id, $taxonomy, 'taxonomy');
403
  foreach ((array) $ancestors as $ancestor) {
404
  $ancestor_term = \get_term($ancestor, $taxonomy);
405
  $hierarchical_slugs[] = $ancestor_term->slug;
406
  }
407
  $hierarchical_slugs = array_reverse($hierarchical_slugs);
408
  $hierarchical_slugs[] = $slug;
409
- $termlink = \str_replace("%$taxonomy%", \implode('/', $hierarchical_slugs), $termlink);
410
  }
411
 
412
  $termlink = \user_trailingslashit($termlink, 'category');
413
 
414
  // purge the term cache.
415
  $this->purgeUrl($termlink);
 
 
 
416
 
417
  if ($this->is_enable_setting('ahsc_purge_homepage_on_del')) {
418
  $this->purgeUrl($this->parseUrl($this->getHomepage()));
 
 
 
 
 
 
 
419
  }
420
 
421
  return true;
@@ -425,9 +524,10 @@ if (!class_exists(__NAMESPACE__ . 'ArubaHiSpeedCacheWpPurger')) {
425
  * Ahsc_transition_post_status
426
  * Purge the cache of item or site on transition post status
427
  *
428
- * @param int|string $new_status
429
- * @param int|string $old_status
430
- * @param \WP_Post $post
 
431
  * @return void
432
  */
433
  public function ahsc_transition_post_status($new_status, $old_status, $post)
@@ -436,48 +536,176 @@ if (!class_exists(__NAMESPACE__ . 'ArubaHiSpeedCacheWpPurger')) {
436
  return;
437
  }
438
 
439
- if ($this->is_enable_setting('ahsc_purge_page_on_mod') || $this->is_enable_setting('ahsc_purge_archive_on_edit')) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
440
  $status = array( 'publish', 'future' );
441
 
442
  if (in_array($new_status, $status, true)) {
443
  $post_url = \get_permalink($post->ID);
444
  $this->purgeUrl($this->parseUrl($post_url));
 
 
 
 
 
 
 
 
 
445
 
446
- if ($this->is_enable_setting('ahsc_purge_homepage_on_edit')) {
447
- $this->purgeUrl($this->parseUrl($this->getHomepage()));
448
- }
 
 
 
 
 
 
 
 
 
 
 
 
449
  }
 
 
 
 
 
 
 
 
 
 
 
450
  }
 
451
 
452
- if ($this->is_enable_setting('ahsc_purge_archive_on_del')) {
453
- if ('trash' === $new_status) {
454
- $slug = \str_replace('__trashed', '', $post->post_name);
455
- $post_url = \home_url($slug);
456
- $this->purgeUrl($this->parseUrl($post_url));
 
457
 
458
- if ($this->is_enable_setting('ahsc_purge_homepage_on_del')) {
459
- $this->purgeUrl($this->parseUrl($this->getHomepage()));
460
- }
 
 
 
 
 
 
 
 
 
 
 
461
  }
462
  }
463
  }
464
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
465
  /**
466
  * Ahsc_transition_comment_status
467
  * Purge the cache of item or site on canghe status of the comment
468
  *
469
- * @param int|string $new_status
470
- * @param int|string $old_status
471
- * @param \WP_Comment $comment
 
472
  * @return void
473
  */
474
- public function ahsc_transition_comment_status($new_status, $old_status, $comment)
475
  {
476
  if (!$this->is_enable_setting('ahsc_enable_purge')) {
477
  return;
478
  }
479
 
480
- if ($this->is_enable_setting('ahsc_purge_page_on_new_comment') || $this->is_enable_setting('ahsc_purge_page_on_deleted_comment')) {
481
  $_post_id = $comment->comment_post_ID;
482
 
483
  $post_url = \get_permalink($_post_id);
@@ -486,26 +714,43 @@ if (!class_exists(__NAMESPACE__ . 'ArubaHiSpeedCacheWpPurger')) {
486
  case 'approved':
487
  if ($this->is_enable_setting('ahsc_purge_page_on_new_comment')) {
488
  $this->purgeUrl($this->parseUrl($post_url));
 
 
 
 
 
 
 
489
  }
490
  break;
491
 
492
  case 'spam':
493
  case 'unapproved':
494
  case 'trash':
495
- if ('approved' === $old_status && $this->is_enable_setting('ahsc_purge_page_on_deleted_comment')) {
496
  $this->purgeUrl($this->parseUrl($post_url));
 
 
 
 
 
 
 
497
  }
498
  break;
499
  }
500
  }
 
 
501
  }
502
 
503
  /**
504
  * Ahsc_wp_insert_comment
505
  * Purge the cache of item on insert the comment
506
  *
507
- * @param integer $id
508
- * @param \WP_Comment $comment
 
509
  * @return void
510
  */
511
  public function ahsc_wp_insert_comment($id, $comment)
@@ -518,14 +763,246 @@ if (!class_exists(__NAMESPACE__ . 'ArubaHiSpeedCacheWpPurger')) {
518
  return;
519
  }
520
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
521
  $_post_id = $comment->comment_post_ID;
522
  $post_url = \get_permalink($_post_id);
523
 
524
  $this->purgeUrl($this->parseUrl($post_url));
 
 
 
 
 
 
 
 
525
 
526
- if ($this->is_enable_setting('ahsc_purge_homepage_on_edit')) {
 
 
 
 
 
 
 
 
 
 
 
527
  $this->purgeUrl($this->parseUrl($this->getHomepage()));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
528
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
529
  }
530
  }
531
  }
11
  * @since 1.0.0
12
  */
13
 
 
 
14
  namespace ArubaHiSpeedCache\includes;
15
 
16
  use ArubaHiSpeedCache\ArubaHiSpeedCachePurger;
44
  use \is_multisite;
45
  use \get_current_blog_id;
46
  use \get_site_url;
47
+ use \wp_is_post_autosave;
48
  use \str_replace;
49
  use \in_array;
50
  use \array_reverse;
51
  use \implode;
52
  use \filter_input;
53
  use \filter_var;
54
+ use PHP_CodeSniffer\Files\DummyFile;
55
  use \sprintf;
56
 
57
+ if (!class_exists(__NAMESPACE__ . '\ArubaHiSpeedCacheWpPurger')) {
58
+
59
+ /**
60
+ * ArubaHiSpeedCacheWpPurger
61
+ *
62
+ * @category ArubaHiSpeedCache
63
+ * @package ArubaHiSpeedCache
64
+ * @author Aruba Developer <hispeedcache.developer@aruba.it>
65
+ * @license https://www.gnu.org/licenses/gpl-2.0.html GPLv2 or later
66
+ * @link null
67
+ * @since 1.0.0
68
+ */
69
  class ArubaHiSpeedCacheWpPurger extends ArubaHiSpeedCachePurger
70
  {
71
  /**
72
+ * Settings The plugin settings.
73
  *
74
+ * @since 1.0.0
75
+ * @var array
76
  */
77
+ // phpcs:ignore
78
  private $settings;
79
 
80
  /**
81
+ * Adimin utils
82
+ *
83
+ * @since 1.0.0
84
  *
85
+ * @var \ArubaHiSpeedCache\includes\ArubaHiSpeedCacheAdmin
86
  */
87
+ // phpcs:ignore
88
  private $admin;
89
 
90
+ /**
91
+ * Control variable. Check if the cache has already
92
+ * been cleaned by the same process.
93
+ *
94
+ * @var bool
95
+ */
96
+ // phpcs:ignore
97
+ private $is_purged = false;
98
 
99
  /**
100
+ * ArubaHiSpeedCacheWpPurger
101
  *
102
+ * @param \ArubaHiSpeedCache\includes\ArubaHiSpeedCacheAdmin $admin admin utils
 
103
  */
104
+ public function __construct($admin)
105
  {
106
  $this->setPurger(
107
  array(
108
+ 'time_out' => ArubaHiSpeedCacheConfigs::ArubaHiSpeedCache_getConfigs('PURGE_TIME_OUT'), // phpcs:ignore
109
+ 'server_host' => ArubaHiSpeedCacheConfigs::ArubaHiSpeedCache_getConfigs('PURGE_HOST'), // phpcs:ignore
110
+ 'server_port' => ArubaHiSpeedCacheConfigs::ArubaHiSpeedCache_getConfigs('PURGE_PORT') // phpcs:ignore
111
  )
112
  );
113
 
114
+ //@todo We should think about how to remove this dispensation.
115
+ $this->admin = $admin;
116
+ $this->settings = $admin->options;
117
  }
118
 
119
  /**
120
  * PurgeUrl
121
  * Purge the cache of url passed.
122
  *
123
+ * @param string $url page to purge.
124
+ *
125
  * @return void
126
  */
127
  public function purgeUrl($url)
128
  {
129
+ // $site_url = $this->getParseSiteUrl();
130
+ // $host = $site_url['host'];
131
 
132
  $_url = \filter_var($url, FILTER_SANITIZE_URL);
133
 
134
+ //Logger
135
+ logger('targhet ' . $_url, 'purgeUrl()', 'info');
136
+ ///Logger
137
+
138
+ return $this->doRemoteGet($_url);
139
  }
140
 
141
  /**
142
  * PurgeUrls
143
  * Purge the cache of urls passed
144
  *
145
+ * @param array $urls urls to purge
146
+ *
147
  * @return void
148
  */
149
  public function purgeUrls($urls)
150
  {
151
+ // $site_url = $this->getParseSiteUrl();
152
+ // $host = $site_url['host'];
153
 
154
+ foreach ($urls as $url) {
155
+ $this->doRemoteGet($url);
156
+
157
+ //Logger
158
+ logger('targhet ' . $url, 'purgeUrls()', 'info');
159
+ ///Logger
160
  }
161
  }
162
 
168
  */
169
  public function purgeAll()
170
  {
171
+ // $site_url = $this->getParseSiteUrl();
172
+ // $host = $site_url['host'];
173
+
174
+ //Logger
175
+ logger('targhet /', 'purgeAll()', 'info');
176
+ ///Logger
177
+
178
+ return $this->doRemoteGet('/');
179
  }
180
 
181
  /**
182
  * DoRemoteGet
183
  * Make request to purger
184
  *
185
+ * @param string $target The subdomine of page to purge
186
+ *
187
  * @return void
188
  */
189
+ public function doRemoteGet($target = '/')
190
  {
191
+ $purgeUrl = $this->preparePurgeRequestUri($target);
192
+
193
+ $blog_id = null;
194
+
195
+ if (!is_multisite()) {
196
+ $blog_id = \get_current_blog_id();
197
+ }
198
+
199
+ $host = \wp_parse_url(\get_site_url($blog_id));
200
+ $host = $host['host'];
201
 
202
  $response = \wp_remote_get(
203
  $purgeUrl,
231
  /**
232
  * ParseUrl
233
  *
234
+ * @param string $url Url to parse
235
+ *
236
+ * @return string
237
  */
238
  public function parseUrl($url)
239
  {
253
  */
254
  public function getHomepage()
255
  {
256
+ return \ArubaHiSpeedCache\includes\ArubaHiSpeedCacheConfigs::getSiteHome(); // phpcs:ignore
257
  }
258
 
259
  /**
260
  * Is_enable_setting
261
  *
262
+ * @param string $setting Setting to check
263
+ *
264
  * @return boolean
265
  */
266
  public function is_enable_setting($setting)
286
  // return;
287
  // }
288
 
289
+ // $method = \filter_input(
290
+ // INPUT_SERVER,
291
+ // 'REQUEST_METHOD',
292
+ // FILTER_SANITIZE_URL
293
+ // );
294
+
295
+ // if ('POST' === $method) {
296
+ // $action = \filter_input(
297
+ // INPUT_POST,
298
+ // 'aruba_hispeed_cache_action',
299
+ // FILTER_SANITIZE_URL
300
+ // );
301
+ // } else {
302
+ // $action = \filter_input(
303
+ // INPUT_GET,
304
+ // 'aruba_hispeed_cache_action',
305
+ // FILTER_SANITIZE_URL
306
+ // );
307
+ // }
308
 
309
+ $action = \filter_input(
310
+ INPUT_GET,
311
+ 'aruba_hispeed_cache_action',
312
+ FILTER_SANITIZE_URL
313
+ );
314
 
315
  if (empty($action)) {
316
  return;
317
  }
318
 
319
+ //@see https://developer.wordpress.org/reference/functions/wp_die/
 
 
320
  if (! \current_user_can('manage_options')) {
321
  \wp_die(
322
  \sprintf(
323
  '<h3>%s</h3><p>%s</p>',
324
  \_e('An error has occurred.', 'aruba-hispeed-cache'),
325
+ \_e('Sorry, you do not have the necessary privileges to edit these options.', 'aruba-hispeed-cache') // phpcs:ignore
326
  ),
327
  '',
328
  array(
329
+ 'link_url' => \esc_url(\ArubaHiSpeedCache\includes\ArubaHiSpeedCacheConfigs::getLocalizedLink('link_assistance')), // phpcs:ignore
330
+ 'link_text' => \_e('Contact customer service', 'aruba-hispeed-cache') // phpcs:ignore
331
  )
332
  );
333
  }
334
 
335
  if ('done' === $action) {
336
+ \add_action('admin_notices', array( $this->admin, 'display_notices_purge_initied' )); // phpcs:ignore
337
+ \add_action('network_admin_notices', array( $this->admin, 'display_notices_purge_initied' )); // phpcs:ignore
338
  return;
339
  }
340
 
341
+ //@see https://developer.wordpress.org/reference/functions/check_admin_referer/
 
 
342
  \check_admin_referer('aruba_hispeed_cache-purge_all');
343
 
344
  // current url if permalink is set to simple
349
  $current_url = \user_trailingslashit(\home_url($wp->request));
350
  }
351
 
352
+ //add done
353
+ $redirect_url = \add_query_arg(
354
+ array( 'aruba_hispeed_cache_action' => 'done' )
355
+ );
356
+
357
  if (! \is_admin()) {
358
  $action = 'purge_current_page';
359
  $redirect_url = $current_url;
 
 
360
  }
361
 
362
  switch ($action) {
369
  $this->purgeAll();
370
  } else {
371
  $parse_url = \wp_parse_url($current_url);
372
+ $url_to_purge = (!isset($parse_url['query'])) ? $parse_url['path'] : '/?' . $parse_url['query']; // phpcs:ignore
373
  $this->purgeUrl($url_to_purge);
374
  }
375
 
376
  break;
377
  }
378
 
379
+ if (\wp_redirect(\esc_url_raw($redirect_url))) {
380
+ exit;
381
+ }
382
  }
383
 
384
  /**
385
  * Ahsc_check_ajax_referer
386
  * Purge the cache on 'save-sidebar-widgets' ajax request
387
  *
388
+ * @param int|string $action Action name
389
+ *
390
  * @return void
391
  */
392
  public function ahsc_check_ajax_referer($action)
396
  }
397
 
398
  switch ($action) {
 
399
  case 'save-sidebar-widgets':
400
  $this->purgeUrl($this->getHomepage());
401
+ //Logger
402
+ logger(
403
+ 'targhet ' . $this->getHomepage(),
404
+ 'hook:check_ajax_referer',
405
+ 'info'
406
+ );
407
+ ///Logger
408
  break;
 
409
  default:
410
  break;
 
411
  }
412
  }
413
 
415
  * Ahsc_edit_term
416
  * Purge the cache of term item or home on term edit.
417
  *
418
+ * @param int $term_id The term id
419
+ * @param int $tt_id The taxnomi id
420
+ * @param string $taxon Taxon
421
+ *
422
  * @return void
423
  */
424
  public function ahsc_edit_term($term_id, $tt_id, $taxon)
427
  return;
428
  }
429
 
 
 
430
  if (!$this->is_enable_setting('ahsc_purge_archive_on_edit')) {
431
  return;
432
  }
433
 
 
 
434
  if ($this->is_enable_setting('ahsc_purge_homepage_on_edit')) {
435
  $this->purgeUrl($this->parseUrl($this->getHomepage()));
436
+ //Logger
437
+ logger(
438
+ 'targhet ' . $this->parseUrl($this->getHomepage()),
439
+ 'hook:edit_term::home',
440
+ 'info'
441
+ );
442
+ ///Logger
443
+ return;
444
  }
445
+
446
+ $term_link = \get_term_link($term_id, $taxon);
447
+
448
+ $this->purgeUrl($this->parseUrl($term_link));
449
+ //Logger
450
+ logger(
451
+ 'targhet ' . $this->parseUrl($term_link),
452
+ 'hook:edit_term',
453
+ 'info'
454
+ );
455
+ ///Logger
456
+
457
  return true;
458
  }
459
 
460
  /**
461
+ * Ahsc_delete_term
462
+ *
463
+ * @param integer $term Term
464
+ * @param integer $tt_id Taxon id
465
+ * @param string $taxonomy Taxon
466
+ * @param \WP_Term $deleted_term Delete Taxon
467
  *
 
 
 
 
 
468
  * @return void
469
  */
470
  public function ahsc_delete_term($term, $tt_id, $taxonomy, $deleted_term)
488
 
489
  if (! empty($t->rewrite['hierarchical'])) {
490
  $hierarchical_slugs = array();
491
+ $ancestors = \get_ancestors($deleted_term->term_id, $taxonomy, 'taxonomy'); // phpcs:ignore
492
  foreach ((array) $ancestors as $ancestor) {
493
  $ancestor_term = \get_term($ancestor, $taxonomy);
494
  $hierarchical_slugs[] = $ancestor_term->slug;
495
  }
496
  $hierarchical_slugs = array_reverse($hierarchical_slugs);
497
  $hierarchical_slugs[] = $slug;
498
+ $termlink = \str_replace("%$taxonomy%", \implode('/', $hierarchical_slugs), $termlink); // phpcs:ignore
499
  }
500
 
501
  $termlink = \user_trailingslashit($termlink, 'category');
502
 
503
  // purge the term cache.
504
  $this->purgeUrl($termlink);
505
+ //Logger
506
+ logger('targhet ' . $termlink, 'hook:delete_term', 'info');
507
+ ///Logger
508
 
509
  if ($this->is_enable_setting('ahsc_purge_homepage_on_del')) {
510
  $this->purgeUrl($this->parseUrl($this->getHomepage()));
511
+ //Logger
512
+ logger(
513
+ 'targhet ' . $this->parseUrl($this->getHomepage()),
514
+ 'hook:delete_term::home',
515
+ 'info'
516
+ );
517
+ ///Logger
518
  }
519
 
520
  return true;
524
  * Ahsc_transition_post_status
525
  * Purge the cache of item or site on transition post status
526
  *
527
+ * @param int|string $new_status new status
528
+ * @param int|string $old_status old status
529
+ * @param \WP_Post $post Post object
530
+ *
531
  * @return void
532
  */
533
  public function ahsc_transition_post_status($new_status, $old_status, $post)
536
  return;
537
  }
538
 
539
+ /**
540
+ * Prevent multiple calls
541
+ */
542
+ if ($this->is_purged) {
543
+ return;
544
+ }
545
+
546
+ $this->is_purged = true;
547
+ // Prevent multiple calls
548
+
549
+ /**
550
+ * Disable on autosave
551
+ */
552
+ if (\wp_is_post_autosave($post)) {
553
+ return;
554
+ }
555
+
556
+ /**
557
+ * For json call
558
+ */
559
+ if (\wp_is_json_request()) {
560
+ // $is_multisite = \is_multisite();
561
+ // $do_purge = ($is_multisite) ? \get_site_transient('ahsc_do_purge') : \get_transient('ahsc_do_purge'); // phpcs:ignore
562
+
563
+ // if (!$do_purge) {
564
+ // logger('transint non presente presente lo imposto', 'deffer');
565
+ // if ($is_multisite) {
566
+ // \set_site_transient('ahsc_do_purge', true, 15);
567
+ // } else {
568
+ // \set_transient('ahsc_do_purge', true, 15);
569
+ // }
570
+ // }
571
+
572
+ // logger('transint presente', 'deffer');
573
+ return;
574
+ }
575
+
576
+ /**
577
+ * Edit item
578
+ */
579
+ if ($this->is_enable_setting('ahsc_purge_page_on_mod') || $this->is_enable_setting('ahsc_purge_archive_on_edit')) { // phpcs:ignore
580
+ if ($this->is_enable_setting('ahsc_purge_homepage_on_edit')) {
581
+ $this->purgeUrl($this->parseUrl($this->getHomepage()));
582
+ //Logger
583
+ logger(
584
+ 'targhet ' . $this->parseUrl($this->getHomepage()),
585
+ 'hook:transition_post_status:edit::home',
586
+ 'info'
587
+ );
588
+ ///Logger
589
+ return;
590
+ }
591
+
592
+
593
  $status = array( 'publish', 'future' );
594
 
595
  if (in_array($new_status, $status, true)) {
596
  $post_url = \get_permalink($post->ID);
597
  $this->purgeUrl($this->parseUrl($post_url));
598
+ //Logger
599
+ logger(
600
+ 'targhet ' . $this->parseUrl($post_url),
601
+ 'hook:Iif:transition_post_status',
602
+ 'info'
603
+ );
604
+ ///Logger
605
+ }
606
+ }
607
 
608
+ /**
609
+ * Move item to trash
610
+ */
611
+ if ($this->is_enable_setting('ahsc_purge_archive_on_del') && 'trash' === $new_status) { // phpcs:ignore
612
+
613
+ if ($this->is_enable_setting('ahsc_purge_homepage_on_del')) {
614
+ $this->purgeUrl($this->parseUrl($this->getHomepage()));
615
+ //Logger
616
+ logger(
617
+ 'targhet ' . $this->parseUrl($this->getHomepage()),
618
+ 'hook:transition_post_status:del::home',
619
+ 'info'
620
+ );
621
+ ///Logger
622
+ return;
623
  }
624
+
625
+ $slug = \str_replace('__trashed', '', $post->post_name);
626
+ $post_url = \home_url($slug);
627
+ $this->purgeUrl($this->parseUrl($post_url));
628
+ //Logger
629
+ logger(
630
+ 'targhet ' . $this->parseUrl($post_url),
631
+ 'hook:transition_post_status::trashPost',
632
+ 'info'
633
+ );
634
+ ///Logger
635
  }
636
+ }
637
 
638
+ //ref tags/6.0/src/wp-includes/post.php
639
+ public function ahsc_post_updated()
640
+ {
641
+ if (!$this->is_enable_setting('ahsc_enable_purge')) {
642
+ return;
643
+ }
644
 
645
+ /**
646
+ * Edit item
647
+ */
648
+ if ($this->is_enable_setting('ahsc_purge_page_on_mod') || $this->is_enable_setting('ahsc_purge_archive_on_edit')) { // phpcs:ignore
649
+ if ($this->is_enable_setting('ahsc_purge_homepage_on_edit')) {
650
+ $this->purgeUrl($this->parseUrl($this->getHomepage()));
651
+ //Logger
652
+ logger(
653
+ 'targhet ' . $this->parseUrl($this->getHomepage()),
654
+ 'hook:post_updated:edit::home',
655
+ 'info'
656
+ );
657
+ ///Logger
658
+ return;
659
  }
660
  }
661
  }
662
 
663
+ /**
664
+ * Ahsc_wp_update_nav_menu
665
+ *
666
+ * @param int $menu_id Menu id
667
+ *
668
+ * @since 1.03
669
+ *
670
+ * @return void
671
+ */
672
+ public function ahsc_wp_update_nav_menu($menu_id)
673
+ {
674
+ //call from wp-admin/nav-menus.php
675
+ $stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
676
+ $admin_call = end($stack);
677
+
678
+ if ('wp_nav_menu_update_menu_items' != $admin_call['function']) {
679
+ return;
680
+ }
681
+
682
+ $this->purgeUrl($this->parseUrl($this->getHomepage()));
683
+ //Logger
684
+ logger(
685
+ 'targhet ' . $this->parseUrl($this->getHomepage()),
686
+ 'hook:wp_update_nav_menu:home',
687
+ 'info'
688
+ );
689
+ ///Logger
690
+ }
691
+
692
  /**
693
  * Ahsc_transition_comment_status
694
  * Purge the cache of item or site on canghe status of the comment
695
  *
696
+ * @param int|string $new_status new status
697
+ * @param int|string $old_status old status
698
+ * @param \WP_Comment $comment comment object
699
+ *
700
  * @return void
701
  */
702
+ public function ahsc_transition_comment_status($new_status, $old_status, $comment) // phpcs:ignore
703
  {
704
  if (!$this->is_enable_setting('ahsc_enable_purge')) {
705
  return;
706
  }
707
 
708
+ if ($this->is_enable_setting('ahsc_purge_page_on_new_comment') || $this->is_enable_setting('ahsc_purge_page_on_deleted_comment')) { // phpcs:ignore
709
  $_post_id = $comment->comment_post_ID;
710
 
711
  $post_url = \get_permalink($_post_id);
714
  case 'approved':
715
  if ($this->is_enable_setting('ahsc_purge_page_on_new_comment')) {
716
  $this->purgeUrl($this->parseUrl($post_url));
717
+ //Logger
718
+ logger(
719
+ 'targhet ' . $this->parseUrl($post_url),
720
+ 'hook:approved:transition_comment_status',
721
+ 'info'
722
+ );
723
+ ///Logger
724
  }
725
  break;
726
 
727
  case 'spam':
728
  case 'unapproved':
729
  case 'trash':
730
+ if ('approved' === $old_status && $this->is_enable_setting('ahsc_purge_page_on_deleted_comment')) { // phpcs:ignore
731
  $this->purgeUrl($this->parseUrl($post_url));
732
+ //Logger
733
+ logger(
734
+ 'targhet ' . $this->parseUrl($post_url),
735
+ 'hook:trash:transition_comment_status',
736
+ 'info'
737
+ );
738
+ ///Logger
739
  }
740
  break;
741
  }
742
  }
743
+
744
+ return true;
745
  }
746
 
747
  /**
748
  * Ahsc_wp_insert_comment
749
  * Purge the cache of item on insert the comment
750
  *
751
+ * @param int $id the comment id
752
+ * @param \WP_Comment $comment comment object
753
+ *
754
  * @return void
755
  */
756
  public function ahsc_wp_insert_comment($id, $comment)
763
  return;
764
  }
765
 
766
+ /**
767
+ * Prevent multiple calls
768
+ */
769
+ if ($this->is_purged) {
770
+ return;
771
+ }
772
+
773
+ $this->is_purged = true;
774
+ // Prevent multiple calls
775
+
776
+ if ($this->is_enable_setting('ahsc_purge_homepage_on_edit')) {
777
+ $this->purgeUrl($this->parseUrl($this->getHomepage()));
778
+ //Logger
779
+ logger(
780
+ 'targhet ' . $this->parseUrl($this->getHomepage()),
781
+ 'hook:wp_insert_comment::home',
782
+ 'info'
783
+ );
784
+ ///Logger
785
+ return;
786
+ }
787
+
788
  $_post_id = $comment->comment_post_ID;
789
  $post_url = \get_permalink($_post_id);
790
 
791
  $this->purgeUrl($this->parseUrl($post_url));
792
+ //Logger
793
+ logger(
794
+ 'targhet ' . $this->parseUrl($post_url),
795
+ 'hook:wp_insert_comment',
796
+ 'info'
797
+ );
798
+ ///Logger
799
+ }
800
 
801
+ /**
802
+ * Ahsc_deferred_purge
803
+ * Deferred cache cleanup, which is triggered when the last
804
+ * item imported from the bulk operation is iterated
805
+ *
806
+ * @since 1.0.3
807
+ *
808
+ * @return void
809
+ */
810
+ public function ahsc_deferred_purge()
811
+ {
812
+ if ($this->i === $this->iterations) {
813
  $this->purgeUrl($this->parseUrl($this->getHomepage()));
814
+ //Logger
815
+ logger(
816
+ 'targhet ' . $this->parseUrl($this->getHomepage()),
817
+ 'ahsc_deferred_purge',
818
+ 'info'
819
+ );
820
+ ///Logger
821
+ }
822
+
823
+ $this->i++;
824
+ return;
825
+ }
826
+
827
+ /**
828
+ * Ahsc_purge_on_plugin_actions
829
+ * Purge cache on plugin activation, deativation
830
+ *
831
+ * @param string $plugin The plugin name/file
832
+ *
833
+ * @since 1.2.0
834
+ *
835
+ * @return void
836
+ */
837
+ public function ahsc_purge_on_plugin_actions($plugin)
838
+ {
839
+ $this->purgeUrl($this->parseUrl($this->getHomepage()));
840
+ //Logger
841
+ logger(
842
+ 'targhet ' . $this->parseUrl($this->getHomepage()),
843
+ 'hook:ahsc_purge_on_plugin_actions:home',
844
+ 'info'
845
+ );
846
+ ///Logger
847
+ }
848
+
849
+ /**
850
+ * Ahsc_purge_on_theme_actions
851
+ * Purge cache on theme switch
852
+ *
853
+ * @param string $new_name New Name
854
+ * @param string $new_theme New theme
855
+ * @param string $old_theme Old theme
856
+ *
857
+ * @since 1.2.0
858
+ *
859
+ * @return void
860
+ */
861
+ public function ahsc_purge_on_theme_actions($new_name, $new_theme, $old_theme) // phpcs:ignore
862
+ {
863
+ $this->purgeUrl($this->parseUrl($this->getHomepage()));
864
+ //Logger
865
+ logger(
866
+ 'targhet ' . $this->parseUrl($this->getHomepage()),
867
+ 'hook:ahsc_purge_on_theme_actions:home',
868
+ 'info'
869
+ );
870
+ ///Logger
871
+ }
872
+
873
+ /**
874
+ * Ahsc_deferred_purge_by_transient
875
+ * Deferred cache cleanup, which is triggered when the last
876
+ * item imported from the bulk operation is iterated
877
+ *
878
+ * @since 1.0.3
879
+ *
880
+ * @return void
881
+ */
882
+ public function ahsc_deferred_purge_by_transient()
883
+ {
884
+ // if (wp_is_json_request()) {
885
+ // logger('json request non faccio niente', 'ahsc_deferred_purge_by_transient'); // phpcs:ignore
886
+ // return;
887
+ // }
888
+
889
+ // $is_multisite = \is_multisite();
890
+ // $do_purge = ($is_multisite) ? \get_site_transient('ahsc_do_purge') : \get_transient('ahsc_do_purge'); // phpcs:ignore
891
+
892
+ // if ($do_purge) {
893
+ // logger('trovato il transients', 'deffer by ahsc_deferred_purge_by_transient'); // phpcs:ignore
894
+
895
+ // $this->purgeUrl($this->parseUrl($this->getHomepage()));
896
+ // //Logger
897
+ // logger('targhet ' . $this->parseUrl($this->getHomepage()), 'ahsc_deferred_purge_by_transient', 'info'); // phpcs:ignore
898
+ // ///Logger
899
+
900
+ // //remove the transient to prevent moltiple calls.
901
+ // if ($is_multisite) {
902
+ // \delete_site_transient('ahsc_do_purge');
903
+ // } else {
904
+ // \delete_transient('ahsc_do_purge');
905
+ // }
906
+ // }
907
+
908
+ return;
909
+ }
910
+
911
+ /**
912
+ * Ahsc_bulk_manager
913
+ * Hooked to check_admin_referer to check if this is a bulk operation. If so.
914
+ * I remove the "single" hook and add a deferred action that fires in the
915
+ * last iteration of the loop.
916
+ *
917
+ * @param string $action the anction name passed from check.
918
+ * @param integer $result result of the action
919
+ *
920
+ * @since 1.0.3
921
+ *
922
+ * @return void
923
+ */
924
+ public function ahsc_bulk_manager($action, $result)
925
+ {
926
+ // bulk-tags
927
+ global $wp_filter;
928
+
929
+ $this->i = 1;
930
+
931
+ if ('bulk-tags' == $action) {
932
+ $current_action = (_get_list_table('WP_Terms_List_Table')) ? (_get_list_table('WP_Terms_List_Table'))->current_action() : false; // phpcs:ignore
933
+
934
+ if ('bulk-delete' === $current_action) {
935
+ logger('Tolgo il delete_term hook', 'Rimozione');
936
+ $this->iterations = count((array) $_REQUEST['delete_tags']);
937
+ $wp_filter['delete_term']->remove_filter('delete_term', array($this, 'ahsc_delete_term'), 20); // phpcs:ignore
938
+ $wp_filter['delete_term']->add_filter('delete_term', array($this, 'ahsc_deferred_purge'), 20, 0); // phpcs:ignore
939
+ }
940
+ return;
941
  }
942
+
943
+ if ('bulk-posts' == $action) {
944
+ //@see https://github.com/WordPress/WordPress/blob/master/wp-admin/edit.php
945
+ logger('Tolgo il transition_post_status hook', 'Rimozione');
946
+ $this->iterations = count((array) $_REQUEST['post']);
947
+ $wp_filter['transition_post_status']->remove_filter('transition_post_status', array($this, 'ahsc_transition_post_status'), 20); // phpcs:ignore
948
+ $wp_filter['transition_post_status']->add_filter('transition_post_status', array($this, 'ahsc_deferred_purge'), 20, 0); // phpcs:ignore
949
+ return;
950
+ }
951
+
952
+ if ('bulk-comments' == $action) {
953
+ //@see https://github.com/WordPress/WordPress/blob/b8e44627c834677be9608422cd97cdaa93ef39df/wp-admin/edit-comments.php#L38
954
+ logger('Tolgo il transition_comment_status hook', 'Rimozione');
955
+ $this->iterations = count((array) $_REQUEST['delete_comments']);
956
+ $wp_filter['transition_comment_status']->remove_filter('transition_comment_status', array($this, 'ahsc_transition_comment_status'), 200); // phpcs:ignore
957
+ $wp_filter['transition_comment_status']->add_filter('transition_comment_status', array($this, 'ahsc_deferred_purge'), 200, 0); // phpcs:ignore
958
+ return;
959
+ }
960
+
961
+ if ('bulk-plugins' == $action or 'bulk-update-plugins' == $action) {
962
+ //@see https://github.com/WordPress/WordPress/blob/223cda987f3f4406182e326eaa555958610e1c17/wp-admin/plugins.php
963
+ logger('Tolgo il plugin actions hook', 'Rimozione');
964
+ $this->iterations = count(isset($_POST['checked']) ? (array) wp_unslash($_POST['checked']) : array()); // phpcs:ignore
965
+
966
+
967
+ $wp_filter['activated_plugin']->remove_filter('activated_plugin', array($this, 'ahsc_purge_on_plugin_actions'), 200); // phpcs:ignore
968
+ $wp_filter['deactivate_plugin']->remove_filter('deactivate_plugin', array($this, 'ahsc_purge_on_plugin_actions'), 200); // phpcs:ignore
969
+ $wp_filter['delete_plugin']->remove_filter('delete_plugin', array($this, 'ahsc_purge_on_plugin_actions'), 200); // phpcs:ignore
970
+
971
+ $wp_filter['activated_plugin']->add_filter('activated_plugin', array($this, 'ahsc_deferred_purge'), 200, 0); // phpcs:ignore
972
+ $wp_filter['deactivate_plugin']->add_filter('deactivate_plugin', array($this, 'ahsc_deferred_purge'), 200, 0); // phpcs:ignore
973
+ $wp_filter['delete_plugin']->add_filter('delete_plugin', array($this, 'ahsc_deferred_purge'), 200, 0); // phpcs:ignore
974
+ return;
975
+ }
976
+
977
+ if ('meta-box-loader' == $action) {
978
+ logger('The bypass ' .$action. ' has been detected', 'info');
979
+ return;
980
+ }
981
+
982
+ if (strpos($action, 'update-post_') >= 0) {
983
+ /**
984
+ * Remove the transient if present
985
+ */
986
+ // $is_multisite = \is_multisite();
987
+ // $do_purge = ($is_multisite) ? \get_site_transient('ahsc_do_purge') : \get_transient('ahsc_do_purge'); // phpcs:ignore
988
+ // if ($do_purge) {
989
+ // logger('transiente delete....', 'transient');
990
+ // //remove the transient to prevent moltiple calls.
991
+ // if ($is_multisite) {
992
+ // \delete_site_transient('ahsc_do_purge');
993
+ // } else {
994
+ // \delete_transient('ahsc_do_purge');
995
+ // }
996
+ // }
997
+
998
+
999
+
1000
+ return;
1001
+ }
1002
+
1003
+ //Default
1004
+ logger('Bulk action detected action: ' .$action, 'action-no-mapped');
1005
+ return;
1006
  }
1007
  }
1008
  }
includes/ArubaHiSpeedCachei18n.php CHANGED
@@ -1,59 +1,59 @@
1
- <?php
2
- /**
3
- * @category Wordpress-plugin
4
- * @package Aruba-HiSpeed-Cache
5
- * @author Aruba Developer <hispeedcache.developer@aruba.it>
6
- * @license https://www.gnu.org/licenses/gpl-2.0.html GPLv2 or later
7
- * @link run_aruba_hispeed_cache
8
- */
9
-
10
-
11
- namespace ArubaHiSpeedCache\includes;
12
-
13
- use load_plugin_textdomain;
14
-
15
- /**
16
- * ArubaHiSpeedCachei18n
17
- */
18
- class ArubaHiSpeedCachei18n
19
- {
20
- /**
21
- * Domain
22
- *
23
- * @var string plugin name
24
- */
25
- private $domain;
26
-
27
- /**
28
- * DirRelPath
29
- *
30
- * @var [type]
31
- */
32
- private $dirRelPath;
33
-
34
- /**
35
- * Undocumented function
36
- *
37
- * @param string $domain
38
- * @param string $plugin_rel_path
39
- */
40
- public function __construct($domain = '', $plugin_rel_path = '')
41
- {
42
- $this->domain = $domain;
43
- $this->dirRelPath = dirname($plugin_rel_path);
44
- }
45
-
46
- /**
47
- * Load_plugin_textdomain
48
- *
49
- * @return void
50
- */
51
- public function load_plugin_textdomain()
52
- {
53
- \load_plugin_textdomain(
54
- $this->domain,
55
- false,
56
- $this->dirRelPath . '/languages'
57
- );
58
- }
59
- }
1
+ <?php
2
+ /**
3
+ * @category Wordpress-plugin
4
+ * @package Aruba-HiSpeed-Cache
5
+ * @author Aruba Developer <hispeedcache.developer@aruba.it>
6
+ * @license https://www.gnu.org/licenses/gpl-2.0.html GPLv2 or later
7
+ * @link run_aruba_hispeed_cache
8
+ */
9
+
10
+
11
+ namespace ArubaHiSpeedCache\includes;
12
+
13
+ use load_plugin_textdomain;
14
+
15
+ /**
16
+ * ArubaHiSpeedCachei18n
17
+ */
18
+ class ArubaHiSpeedCachei18n
19
+ {
20
+ /**
21
+ * Domain
22
+ *
23
+ * @var string plugin name
24
+ */
25
+ private $domain;
26
+
27
+ /**
28
+ * DirRelPath
29
+ *
30
+ * @var [type]
31
+ */
32
+ private $dirRelPath;
33
+
34
+ /**
35
+ * Undocumented function
36
+ *
37
+ * @param string $domain
38
+ * @param string $plugin_rel_path
39
+ */
40
+ public function __construct($domain = '', $plugin_rel_path = '')
41
+ {
42
+ $this->domain = $domain;
43
+ $this->dirRelPath = dirname($plugin_rel_path);
44
+ }
45
+
46
+ /**
47
+ * Load_plugin_textdomain
48
+ *
49
+ * @return void
50
+ */
51
+ public function load_plugin_textdomain()
52
+ {
53
+ \load_plugin_textdomain(
54
+ $this->domain,
55
+ false,
56
+ $this->dirRelPath . '/languages'
57
+ );
58
+ }
59
+ }
includes/ArubaHispeedCacheLogger.php ADDED
@@ -0,0 +1,367 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ArubaHiSpeedCacheWpPurger
4
+ * php version 5.6
5
+ *
6
+ * @category Wordpress-plugin
7
+ * @package Aruba-HiSpeed-Cache
8
+ * @author Aruba Developer <hispeedcache.developer@aruba.it>
9
+ * @license https://www.gnu.org/licenses/gpl-2.0.html GPLv2 or later
10
+ * @link \ArubaHiSpeedCache\Run_Aruba_Hispeed_cache()
11
+ * @since 1.2.0
12
+ */
13
+
14
+ namespace ArubaHiSpeedCache\includes;
15
+
16
+ /**
17
+ * ArubaHispeeCacheLogger - Log entries can be added with any of the following methods:
18
+ * Logger::info( $message, $title = '' ) // an informational message intended for the user
19
+ * Logger::debug( $message, $title = '' ) // a diagnostic message intended for the developer
20
+ * Logger::warning( $message, $title = '' ) // a warning that something might go wrong
21
+ * Logger::error( $message, $title = '' ) // explain why the program is going to crash
22
+ *
23
+ * @category Project
24
+ * @package ArubaHiSpeedCache
25
+ * @author Aruba Developer <hispeedcache.developer@aruba.it>
26
+ * @license https://www.gnu.org/licenses/gpl-2.0.html GPLv2 or later
27
+ * @link null
28
+ * @since 1.2.0
29
+ */
30
+ class ArubaHispeeCacheLogger
31
+ {
32
+
33
+ /**
34
+ * Incremental log, where each entry is an array with the following elements:
35
+ *
36
+ * - timestamp => timestamp in seconds as returned by time()
37
+ * - level => severity of the bug; one between debug, info, warning, error
38
+ * - name => name of the log entry, optional
39
+ * - message => actual log message
40
+ */
41
+ protected static $log = [];
42
+
43
+ /**
44
+ * Whether to print log entries to screen as they are added.
45
+ */
46
+ public static $print_log = false;
47
+
48
+ /**
49
+ * Whether to write log entries to file as they are added.
50
+ */
51
+ public static $write_log = true;
52
+
53
+ // /**
54
+ // * Directory where the log will be dumped, without final slash; default
55
+ // * is this file's directory
56
+ // */
57
+ // public static $log_dir =__DIR__;
58
+
59
+ /**
60
+ * File name for the log saved in the log dir
61
+ */
62
+ public static $log_file_name = "ahscLog";
63
+
64
+ /**
65
+ * File extension for the logs saved in the log dir
66
+ */
67
+ public static $log_file_extension = "log";
68
+
69
+ /**
70
+ * Whether to append to the log file (true) or to overwrite it (false)
71
+ */
72
+ public static $log_file_append = true;
73
+
74
+ /**
75
+ * Set the maximum level of logging to write to logs
76
+ */
77
+ public static $log_level = 'error';
78
+
79
+ /**
80
+ * Name for the default timer
81
+ */
82
+ public static $default_timer = 'timer';
83
+
84
+ /**
85
+ * Map logging levels to syslog specifications, there's room for the other levels
86
+ */
87
+ private static $log_level_integers = [
88
+ 'debug' => 7,
89
+ 'info' => 6,
90
+ 'warning' => 4,
91
+ 'error' => 3
92
+ ];
93
+
94
+ /**
95
+ * Absolute path of the log file, built at run time
96
+ */
97
+ private static $log_file_path = '';
98
+
99
+ /**
100
+ * Where should we write/print the output to? Built at run time
101
+ */
102
+ private static $output_streams = [];
103
+
104
+ /**
105
+ * Whether the init() function has already been called
106
+ */
107
+ private static $logger_ready = false;
108
+
109
+ /**
110
+ * Associative array used as a buffer to keep track of timed logs
111
+ */
112
+ private static $time_tracking = [];
113
+
114
+
115
+ /**
116
+ * Add a log entry with a diagnostic message for the developer.
117
+ */
118
+ public static function debug($message, $name = '')
119
+ {
120
+ return self::add($message, $name, 'debug');
121
+ }
122
+
123
+
124
+ /**
125
+ * Add a log entry with an informational message for the user.
126
+ */
127
+ public static function info($message, $name = '')
128
+ {
129
+ return self::add($message, $name, 'info');
130
+ }
131
+
132
+
133
+ /**
134
+ * Add a log entry with a warning message.
135
+ */
136
+ public static function warning($message, $name = '')
137
+ {
138
+ return self::add($message, $name, 'warning');
139
+ }
140
+
141
+
142
+ /**
143
+ * Add a log entry with an error - usually followed by
144
+ * script termination.
145
+ */
146
+ public static function error($message, $name = '')
147
+ {
148
+ return self::add($message, $name, 'error');
149
+ }
150
+
151
+
152
+ /**
153
+ * Start counting time, using $name as identifier.
154
+ *
155
+ * Returns the start time or false if a time tracker with the same name
156
+ * exists
157
+ */
158
+ public static function time(string $name = null)
159
+ {
160
+ if ($name === null) {
161
+ $name = self::$default_timer;
162
+ }
163
+
164
+ if (! isset(self::$time_tracking[ $name ])) {
165
+ self::$time_tracking[ $name ] = microtime(true);
166
+ return self::$time_tracking[ $name ];
167
+ } else {
168
+ return false;
169
+ }
170
+ }
171
+
172
+
173
+ /**
174
+ * Stop counting time, and create a log entry reporting the elapsed amount of
175
+ * time.
176
+ *
177
+ * Returns the total time elapsed for the given time-tracker, or false if the
178
+ * time tracker is not found.
179
+ */
180
+ public static function timeEnd(string $name = null, int $decimals = 6, $level = 'debug')
181
+ {
182
+ $is_default_timer = $name === null;
183
+
184
+ if ($is_default_timer) {
185
+ $name = self::$default_timer;
186
+ }
187
+
188
+ if (isset(self::$time_tracking[ $name ])) {
189
+ $start = self::$time_tracking[ $name ];
190
+ $end = microtime(true);
191
+ $elapsed_time = number_format(($end - $start), $decimals);
192
+ unset(self::$time_tracking[ $name ]);
193
+ if (! $is_default_timer) {
194
+ self::add("$elapsed_time seconds", "Elapsed time for '$name'", $level);
195
+ } else {
196
+ self::add("$elapsed_time seconds", "Elapsed time", $level);
197
+ }
198
+ return $elapsed_time;
199
+ } else {
200
+ return false;
201
+ }
202
+ }
203
+
204
+
205
+ /**
206
+ * Add an entry to the log.
207
+ *
208
+ * This function does not update the pretty log.
209
+ */
210
+ private static function add($message, $name = '', $level = 'debug')
211
+ {
212
+ /* Check if the logging level severity warrants writing this log */
213
+ // if (self::$log_level_integers[$level] > self::$log_level_integers[self::$log_level]) {
214
+ // return;
215
+ // }
216
+
217
+ /* Create the log entry */
218
+ $log_entry = [
219
+ 'timestamp' => time(),
220
+ 'name' => $name,
221
+ 'message' => $message,
222
+ 'level' => $level,
223
+ ];
224
+
225
+ /* Add the log entry to the incremental log */
226
+ self::$log[] = $log_entry;
227
+
228
+ /* Initialize the logger if it hasn't been done already */
229
+ if (! self::$logger_ready) {
230
+ self::init();
231
+ }
232
+
233
+ /* Write the log to output, if requested */
234
+ if (self::$logger_ready && count(self::$output_streams) > 0) {
235
+ $output_line = self::format_log_entry($log_entry) . PHP_EOL;
236
+ foreach (self::$output_streams as $key => $stream) {
237
+ fputs($stream, $output_line);
238
+ }
239
+ }
240
+
241
+ return $log_entry;
242
+ }
243
+
244
+
245
+ /**
246
+ * Take one log entry and return a one-line human readable string
247
+ */
248
+ public static function format_log_entry(array $log_entry) : string
249
+ {
250
+ $log_line = "";
251
+
252
+ if (! empty($log_entry)) {
253
+
254
+ /* Make sure the log entry is stringified */
255
+ $log_entry = array_map(function ($v) {
256
+ return print_r($v, true);
257
+ }, $log_entry);
258
+
259
+ /* Build a line of the pretty log */
260
+ $log_line .= date('c', $log_entry['timestamp']) . " ";
261
+ $log_line .= "[" . strtoupper($log_entry['level']) . "] : ";
262
+ if (! empty($log_entry['name'])) {
263
+ $log_line .= $log_entry['name'] . " => ";
264
+ }
265
+ $log_line .= $log_entry['message'];
266
+ }
267
+
268
+ return $log_line;
269
+ }
270
+
271
+
272
+ /**
273
+ * Determine whether an where the log needs to be written; executed only
274
+ * once.
275
+ *
276
+ * @return {array} - An associative array with the output streams. The
277
+ * keys are 'output' for STDOUT and the filename for file streams.
278
+ */
279
+ public static function init()
280
+ {
281
+ if (! self::$logger_ready) {
282
+
283
+ /* Print to screen */
284
+ if (true === self::$print_log) {
285
+ self::$output_streams[ 'stdout' ] = STDOUT;
286
+ }
287
+
288
+ /* Build log file path */
289
+ if (file_exists(dirname(__DIR__))) {
290
+ self::$log_file_path = implode(DIRECTORY_SEPARATOR, [ dirname(__DIR__), self::$log_file_name ]);
291
+ if (! empty(self::$log_file_extension)) {
292
+ self::$log_file_path .= "." . self::$log_file_extension;
293
+ }
294
+ }
295
+
296
+ /* Print to log file */
297
+ if (true === self::$write_log) {
298
+ if (file_exists(dirname(__DIR__))) {
299
+ $mode = self::$log_file_append ? "a" : "w";
300
+ self::$output_streams[ self::$log_file_path ] = fopen(self::$log_file_path, $mode);
301
+ }
302
+ }
303
+ }
304
+
305
+ /* Now that we have assigned the output stream, this function does not need
306
+ to be called anymore */
307
+ self::$logger_ready = true;
308
+ }
309
+
310
+
311
+ /**
312
+ * Dump the whole log to the given file.
313
+ *
314
+ * Useful if you don't know before-hand the name of the log file. Otherwise,
315
+ * you should use the real-time logging option, that is, the $write_log or
316
+ * $print_log options.
317
+ *
318
+ * The method format_log_entry() is used to format the log.
319
+ *
320
+ * @param {string} $file_path - Absolute path of the output file. If empty,
321
+ * will use the class property $log_file_path.
322
+ */
323
+ public static function dump_to_file($file_path='')
324
+ {
325
+ if (! $file_path) {
326
+ $file_path = self::$log_file_path;
327
+ }
328
+
329
+ if (file_exists(dirname($file_path))) {
330
+ $mode = self::$log_file_append ? "a" : "w";
331
+ $output_file = fopen($file_path, $mode);
332
+
333
+ foreach (self::$log as $log_entry) {
334
+ $log_line = self::format_log_entry($log_entry);
335
+ fwrite($output_file, $log_line . PHP_EOL);
336
+ }
337
+
338
+ fclose($output_file);
339
+ }
340
+ }
341
+
342
+
343
+ /**
344
+ * Dump the whole log to string, and return it.
345
+ *
346
+ * The method format_log_entry() is used to format the log.
347
+ */
348
+ public static function dump_to_string()
349
+ {
350
+ $output = '';
351
+
352
+ foreach (self::$log as $log_entry) {
353
+ $log_line = self::format_log_entry($log_entry);
354
+ $output .= $log_line . PHP_EOL;
355
+ }
356
+
357
+ return $output;
358
+ }
359
+
360
+ /**
361
+ * Empty the log
362
+ */
363
+ public static function clear_log()
364
+ {
365
+ self::$log = [];
366
+ }
367
+ }
includes/HiSpeedCacheServiceChecker.php CHANGED
@@ -7,7 +7,7 @@
7
  * @package Aruba-HiSpeed-Cache
8
  * @author Aruba Developer <hispeedcache.developer@aruba.it>
9
  * @license https://www.gnu.org/licenses/gpl-2.0.html GPLv2 or later
10
- * @link Null
11
  * @since 1.0.1
12
  */
13
 
@@ -21,23 +21,113 @@ use \is_wp_error;
21
  use \wp_remote_get;
22
 
23
  if (!class_exists(__NAMESPACE__ . '\HiSpeedCacheServiceChecker')) {
 
 
 
 
 
 
 
 
 
 
 
24
  class HiSpeedCacheServiceChecker
25
  {
 
 
 
 
 
 
26
  private $target = null;
27
 
 
 
 
 
 
 
28
  private $headers = array();
29
 
 
 
 
 
 
 
 
30
  private $status_code = null;
31
 
 
 
 
 
 
 
32
  public $serviceIsActivabile = false;
 
 
 
 
 
 
 
 
 
33
  public $serviceIsActive = false;
 
 
 
 
 
 
 
34
  public $serviceStatus = null;
 
 
 
 
 
 
 
35
  public $isArubaServer = false;
36
 
 
 
 
 
 
 
 
37
  private $check_error = false;
38
- private $error_code = null;
39
- private $error_message = null;
40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  public function __construct($target = null)
42
  {
43
  $this->target = (null === $target) ?
@@ -47,14 +137,23 @@ if (!class_exists(__NAMESPACE__ . '\HiSpeedCacheServiceChecker')) {
47
  $this->_getHeaders();
48
  }
49
 
 
 
 
 
 
 
50
  private function _getHeaders()
51
  {
52
- $response = \wp_remote_get($this->target, array(
 
 
53
  'sslverify' => false,
54
  'user-agent' => 'aruba-ua',
55
  'httpversion' => '1.1',
56
  'timeout' => \ArubaHiSpeedCache\includes\ArubaHiSpeedCacheConfigs::ArubaHiSpeedCache_getConfigs('CHECK_TIMEOUT')
57
- ));
 
58
 
59
  if (\is_array($response) && ! \is_wp_error($response)) {
60
  $this->headers = $response['headers']->getAll();
@@ -65,24 +164,36 @@ if (!class_exists(__NAMESPACE__ . '\HiSpeedCacheServiceChecker')) {
65
 
66
  if (\is_wp_error($response)) {
67
  $this->check_error = true;
68
- $this->error_code = $response->get_error_code();
69
- $this->error_message = $response->get_error_message();
70
  }
71
 
72
  return false;
73
  }
74
 
 
 
 
 
 
 
75
  private function _headersAnalizer()
76
  {
77
 
78
- //is headers empty or has request error
 
 
 
79
  if (empty($this->headers) or $this->check_error) {
80
  $this->isArubaServer = true;
81
  $this->serviceIsActive = true;
82
  return;
83
  }
84
 
85
- //is ow aruba server?
 
 
 
86
  if (array_key_exists('x-aruba-cache', $this->headers)) {
87
  $this->isArubaServer = true;
88
  $this->serviceStatus = $this->headers['x-aruba-cache'];
@@ -100,7 +211,17 @@ if (!class_exists(__NAMESPACE__ . '\HiSpeedCacheServiceChecker')) {
100
  return;
101
  }
102
 
103
- //it is not ow aruba server !
 
 
 
 
 
 
 
 
 
 
104
  if (array_key_exists('server', $this->headers)) {
105
  switch ($this->headers['server']) {
106
  case 'aruba-proxy':
@@ -109,7 +230,9 @@ if (!class_exists(__NAMESPACE__ . '\HiSpeedCacheServiceChecker')) {
109
  default:
110
  $this->serviceIsActivabile = false;
111
 
112
- if (array_key_exists('x-servername', $this->headers) && str_contains($this->headers['x-servername'], 'aruba.it')) {
 
 
113
  $this->serviceIsActivabile = true;
114
  }
115
  break;
@@ -118,6 +241,12 @@ if (!class_exists(__NAMESPACE__ . '\HiSpeedCacheServiceChecker')) {
118
  }
119
  }
120
 
 
 
 
 
 
 
121
  public function check()
122
  {
123
  $this->_headersAnalizer();
@@ -131,6 +260,13 @@ if (!class_exists(__NAMESPACE__ . '\HiSpeedCacheServiceChecker')) {
131
  }
132
  }
133
 
 
 
 
 
 
 
 
134
  public function debugger()
135
  {
136
  $data = array(
7
  * @package Aruba-HiSpeed-Cache
8
  * @author Aruba Developer <hispeedcache.developer@aruba.it>
9
  * @license https://www.gnu.org/licenses/gpl-2.0.html GPLv2 or later
10
+ * @link null
11
  * @since 1.0.1
12
  */
13
 
21
  use \wp_remote_get;
22
 
23
  if (!class_exists(__NAMESPACE__ . '\HiSpeedCacheServiceChecker')) {
24
+
25
+ /**
26
+ * ArubaHiSpeedCacheConfigs
27
+ *
28
+ * @category ArubaHiSpeedCache
29
+ * @package ArubaHiSpeedCache
30
+ * @author Aruba Developer <hispeedcache.developer@aruba.it>
31
+ * @license https://www.gnu.org/licenses/gpl-2.0.html GPLv2 or later
32
+ * @link null
33
+ * @since 1.0.1
34
+ */
35
  class HiSpeedCacheServiceChecker
36
  {
37
+ /**
38
+ * Target The address you want to test default is null
39
+ *
40
+ * @var string
41
+ */
42
+ // phpcs:ignore
43
  private $target = null;
44
 
45
+ /**
46
+ * Header Request header parameters.
47
+ *
48
+ * @var array
49
+ */
50
+ // phpcs:ignore
51
  private $headers = array();
52
 
53
+ /**
54
+ * $status_code The code of the request.
55
+ * It is used to perform some integrity checks
56
+ *
57
+ * @var int
58
+ */
59
+ // phpcs:ignore
60
  private $status_code = null;
61
 
62
+ /**
63
+ * ServiceIsActivabile
64
+ * Valued as true if the site is hosted on OW Aruba servers. Default False
65
+ *
66
+ * @var boolean
67
+ */
68
  public $serviceIsActivabile = false;
69
+
70
+ /**
71
+ * ServiceIsActive
72
+ * Valued as true if the site is hosted on OW Aruba servers
73
+ * and the service is active.
74
+ * Default False
75
+ *
76
+ * @var boolean
77
+ */
78
  public $serviceIsActive = false;
79
+
80
+ /**
81
+ * ServiceIsActive
82
+ * Valued on the basis of the x-aruba-cache value.
83
+ *
84
+ * @var string
85
+ */
86
  public $serviceStatus = null;
87
+
88
+ /**
89
+ * IsArubaServer Control variables that is used to determine
90
+ * if you are on Aruba server or not.
91
+ *
92
+ * @var boolean
93
+ */
94
  public $isArubaServer = false;
95
 
96
+ /**
97
+ * Check_error Control variable to determine
98
+ * if an error was encountered during the request.
99
+ *
100
+ * @var boolean
101
+ */
102
+ // phpcs:ignore
103
  private $check_error = false;
 
 
104
 
105
+ //
106
+ // Error_code Control variable to determine
107
+ // if an error was encountered during the request.
108
+ //
109
+ // @var int
110
+ //
111
+ // phpcs:ignore
112
+ //private $error_code = null;
113
+
114
+ //
115
+ // Error_code Control variable to determine
116
+ // if an error was encountered during the request.
117
+ //
118
+ // @var string
119
+ //
120
+ // phpcs:ignore
121
+ //private $error_message = null;
122
+
123
+ /**
124
+ * HiSpeedCacheServiceChecker
125
+ *
126
+ * @param string $target Target The address you want to test default is null
127
+ *
128
+ * @since 1.0.1
129
+ * @return void
130
+ */
131
  public function __construct($target = null)
132
  {
133
  $this->target = (null === $target) ?
137
  $this->_getHeaders();
138
  }
139
 
140
+ /**
141
+ * _getHeaders - Getter of the headers for the request to perform the check.
142
+ *
143
+ * @since 1.0.1
144
+ * @return bool
145
+ */
146
  private function _getHeaders()
147
  {
148
+ $response = \wp_remote_get(
149
+ $this->target,
150
+ array(
151
  'sslverify' => false,
152
  'user-agent' => 'aruba-ua',
153
  'httpversion' => '1.1',
154
  'timeout' => \ArubaHiSpeedCache\includes\ArubaHiSpeedCacheConfigs::ArubaHiSpeedCache_getConfigs('CHECK_TIMEOUT')
155
+ )
156
+ );
157
 
158
  if (\is_array($response) && ! \is_wp_error($response)) {
159
  $this->headers = $response['headers']->getAll();
164
 
165
  if (\is_wp_error($response)) {
166
  $this->check_error = true;
167
+ // $this->error_code = $response->get_error_code();
168
+ // $this->error_message = $response->get_error_message();
169
  }
170
 
171
  return false;
172
  }
173
 
174
+ /**
175
+ * _headersAnalizer - Analyze the request headers and value the variables.
176
+ *
177
+ * @since 1.0.1
178
+ * @return void
179
+ */
180
  private function _headersAnalizer()
181
  {
182
 
183
+ /**
184
+ * If the request headers are empty or the request
185
+ * produced a wp_error then I set everything to true.
186
+ */
187
  if (empty($this->headers) or $this->check_error) {
188
  $this->isArubaServer = true;
189
  $this->serviceIsActive = true;
190
  return;
191
  }
192
 
193
+ /**
194
+ * If the headers contain 'x-aruba-cache' we are on an aruba server.
195
+ * If it has value NA we are on servers without cache.
196
+ */
197
  if (array_key_exists('x-aruba-cache', $this->headers)) {
198
  $this->isArubaServer = true;
199
  $this->serviceStatus = $this->headers['x-aruba-cache'];
211
  return;
212
  }
213
 
214
+
215
+ /**
216
+ * If the headers do not contain 'x-aruba-cache'
217
+ * we are not on the aruba server.
218
+ *
219
+ * If the 'server' header contains 'aruba-proxy'
220
+ * the service can be activated.
221
+ *
222
+ * If it is different from 'aruba-proxy' we are
223
+ * not on aruba server or behind cdn.
224
+ */
225
  if (array_key_exists('server', $this->headers)) {
226
  switch ($this->headers['server']) {
227
  case 'aruba-proxy':
230
  default:
231
  $this->serviceIsActivabile = false;
232
 
233
+ if (array_key_exists('x-servername', $this->headers)
234
+ && str_contains($this->headers['x-servername'], 'aruba.it')
235
+ ) {
236
  $this->serviceIsActivabile = true;
237
  }
238
  break;
241
  }
242
  }
243
 
244
+ /**
245
+ * Check - Check the populated variables and issue a control message.
246
+ *
247
+ * @since 1.0.1
248
+ * @return string
249
+ */
250
  public function check()
251
  {
252
  $this->_headersAnalizer();
260
  }
261
  }
262
 
263
+ /**
264
+ * Debugger - It exposes some elements of the control to
265
+ * try to resolve any errors. To activate it, just go to the
266
+ * dominio.tld/wp-admin/options-general.php?page=aruba-hispeed-cache&debug=1
267
+ *
268
+ * @return string
269
+ */
270
  public function debugger()
271
  {
272
  $data = array(
includes/index.php CHANGED
@@ -7,6 +7,6 @@
7
  * @package Aruba-HiSpeed-Cache
8
  * @author Aruba Developer <hispeedcache.developer@aruba.it>
9
  * @license https://www.gnu.org/licenses/gpl-2.0.html GPLv2 or later
10
- * @link \ArubaHiSpeedCache\Run_Aruba_Hispeed_cache()
11
  * @since 1.0.0
12
  */
7
  * @package Aruba-HiSpeed-Cache
8
  * @author Aruba Developer <hispeedcache.developer@aruba.it>
9
  * @license https://www.gnu.org/licenses/gpl-2.0.html GPLv2 or later
10
+ * @link null
11
  * @since 1.0.0
12
  */
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: HiSpeed Cache, Aruba, cache, caching, performance, pagespeed, optimize, WP
5
  Requires at least: 5.4
6
  Tested up to: 6.0
7
  Requires PHP: 5.6
8
- Stable tag: 1.1.2
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -70,11 +70,19 @@ wordpress_no_cache, comment_author, wordpress_logged_in_, yith_wcwl_products, wp
70
 
71
  == Changelog ==
72
 
 
 
 
 
 
 
 
 
 
73
  = 1.1.2 =
74
  * Problem regarding check resolved. In the event of a false positive during activation, go to the plugin page (../wp-admin/options-general.php?page=aruba-hispeed-cache) to repeat check.
75
  * Various bug corrections and other improvements.
76
 
77
-
78
  = 1.1.1 =
79
  * Problem resolution. Display "service can be activated" message when cache is purged.;
80
  * Update Plugin URI value;
@@ -92,6 +100,11 @@ wordpress_no_cache, comment_author, wordpress_logged_in_, yith_wcwl_products, wp
92
 
93
  == Upgrade Notice ==
94
 
95
- = 1.1.2 =
96
- * Problem regarding check resolved. In the event of a false positive during activation, go to the plugin page (../wp-admin/options-general.php?page=aruba-hispeed-cache) to repeat check.
97
- * Various bug corrections and other improvements.
 
 
 
 
 
5
  Requires at least: 5.4
6
  Tested up to: 6.0
7
  Requires PHP: 5.6
8
+ Stable tag: 1.2.0
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
70
 
71
  == Changelog ==
72
 
73
+ = 1.2.0 =
74
+ * Discriminant added to REST API requests to include FSE support and remove recurring clear cache requests.
75
+ * Clear function added to the 'post_updated hook' action to include support for the editor with meta-box added by plugins and themes.
76
+ * Log function added to files activated with WP_DEBUG set to true, created in plugin folder. N.B. If disabled, file will be deleted.
77
+ * FILTER_SANITIZE_STRING replaced by FILTER_SANITIZE_URL to ensure compatibility with PHP 8.1.
78
+ * ArubaHiSpeedCache_update_plugins_db() mode added to allow management of future database updates.
79
+ * Action and filter loading system within plugin fixed.
80
+ * Various bug fixes and other improvements.
81
+
82
  = 1.1.2 =
83
  * Problem regarding check resolved. In the event of a false positive during activation, go to the plugin page (../wp-admin/options-general.php?page=aruba-hispeed-cache) to repeat check.
84
  * Various bug corrections and other improvements.
85
 
 
86
  = 1.1.1 =
87
  * Problem resolution. Display "service can be activated" message when cache is purged.;
88
  * Update Plugin URI value;
100
 
101
  == Upgrade Notice ==
102
 
103
+ = 1.2.0 =
104
+ * Discriminant added to REST API requests to include FSE support and remove recurring clear cache requests.
105
+ * Clear function added to the 'post_updated hook' action to include support for the editor with meta-box added by plugins and themes.
106
+ * Log function added to files activated with WP_DEBUG set to true, created in plugin folder. N.B. If disabled, file will be deleted.
107
+ * FILTER_SANITIZE_STRING replaced by FILTER_SANITIZE_URL to ensure compatibility with PHP 8.1.
108
+ * ArubaHiSpeedCache_update_plugins_db() mode added to allow management of future database updates.
109
+ * Action and filter loading system within plugin fixed.
110
+ * Various bug fixes and other improvements.