| 1 |
<?php |
| 2 |
/** |
| 3 |
* Functions to improve compatibility with WP Fastest Cache. |
| 4 |
* |
| 5 |
* @package Charitable/Functions/Compatibility |
| 6 |
* @author David Bisset |
| 7 |
* @copyright Copyright (c) 2022, WP Charitable LLC |
| 8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 |
* @since 1.4.18 |
| 10 |
* @version 1.4.18 |
| 11 |
*/ |
| 12 |
|
| 13 |
// Exit if accessed directly. |
| 14 |
if ( ! defined( 'ABSPATH' ) ) { |
| 15 |
exit; |
| 16 |
} |
| 17 |
|
| 18 |
/** |
| 19 |
* Clear the campaign page cache after a donation is received. |
| 20 |
* |
| 21 |
* @since 1.4.18 |
| 22 |
* |
| 23 |
* @param int $campaign_id The campaign ID. |
| 24 |
* @return void |
| 25 |
*/ |
| 26 |
function charitable_compat_wp_fastest_cache_clear_campaign_cache( $campaign_id ) { |
| 27 |
global $wp_fastest_cache; |
| 28 |
|
| 29 |
if ( ! is_a( $wp_fastest_cache, 'WpFastestCache' ) ) { |
| 30 |
return; |
| 31 |
} |
| 32 |
|
| 33 |
$wp_fastest_cache->singleDeleteCache( false, $campaign_id ); |
| 34 |
} |
| 35 |
|
| 36 |
add_action( 'charitable_flush_campaign_cache', 'charitable_compat_wp_fastest_cache_clear_campaign_cache' ); |
| 37 |
|