diff --git a/inc/compatibilities/aruba_hsc.php b/inc/compatibilities/aruba_hsc.php new file mode 100644 index 00000000..52df8baf --- /dev/null +++ b/inc/compatibilities/aruba_hsc.php @@ -0,0 +1,68 @@ +setPurger( AHSC_PURGER ); + + // Purge all cache when no location is provided. + if ( $location === true && method_exists( $purge, 'purgeAll' ) ) { + $purge->purgeAll(); + return; + } + + // Purge single URL based on the location parameter. + if ( ! method_exists( $purge, 'purgeUrl' ) ) { + return; + } + + $purge->purgeUrl( $location ); + } +} diff --git a/inc/compatibilities/cache_enabler.php b/inc/compatibilities/cache_enabler.php index 4dd046c0..11c80991 100644 --- a/inc/compatibilities/cache_enabler.php +++ b/inc/compatibilities/cache_enabler.php @@ -32,6 +32,23 @@ function () { do_action( 'cache_enabler_clear_site_cache' ); } ); + + add_action( 'optml_clear_cache', [ $this, 'add_clear_cache_action' ] ); + } + + /** + * Clear cache for Super Page Cache for Cloudflare. + * + * @param string|bool $location The location to clear the cache for. If true, clear the cache globally. If a string, clear the cache for a particular url. + * @return void + */ + public function add_clear_cache_action( $location ) { + if ( $location === true ) { + do_action( 'cache_enabler_clear_site_cache' ); + return; + } + + do_action( 'cache_enabler_clear_page_cache_by_url', $location ); } /** diff --git a/inc/compatibilities/hummingbird.php b/inc/compatibilities/hummingbird.php new file mode 100644 index 00000000..1b19327d --- /dev/null +++ b/inc/compatibilities/hummingbird.php @@ -0,0 +1,74 @@ +clear_cache(); + return; + } + + // Clear specific URL + if ( ! is_string( $location ) || empty( $location ) ) { + return; + } + + $url_path = wp_parse_url( $location, PHP_URL_PATH ); + if ( $url_path ) { + $page_cache->clear_cache( trailingslashit( $url_path ), true ); + } + } +} diff --git a/inc/compatibilities/spc.php b/inc/compatibilities/spc.php new file mode 100644 index 00000000..e8fd786d --- /dev/null +++ b/inc/compatibilities/spc.php @@ -0,0 +1,54 @@ +