PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.11.3
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.11.3
1.8.13.1 1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 All 212 releases
charitable / includes / compat / charitable-w3tc-compat-functions.php

charitable-w3tc-compat-functions.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.11.3, at includes/compat/charitable-w3tc-compat-functions.php

54 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Functions to improve compatibility with W3TC.
4 *
5 * @package Charitable/Functions/Compatibility
6 * @version 1.4.18
7 * @author David Bisset
8 * @copyright Copyright (c) 2023, WP Charitable LLC
9 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
10 */
11
12 // Exit if accessed directly.
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit;
15 }
16
17 /**
18 * Clear the campaign page cache after a donation is received.
19 *
20 * @since 1.4.18
21 *
22 * @param int $campaign_id The campaign ID.
23 * @return void
24 */
25 function charitable_compat_w3tc_clear_campaign_cache( $campaign_id ) {
26 if ( function_exists( 'w3tc_flush_post' ) ) {
27 w3tc_flush_post( $campaign_id );
28 }
29 }
30
31 add_action( 'charitable_flush_campaign_cache', 'charitable_compat_w3tc_clear_campaign_cache' );
32
33 /**
34 * When W3TC database caching is turned on, notices can be
35 * triggered during donation processing.
36 *
37 * DONOTCACHEDB is a constant which will, by default, prevent
38 * database caching.
39 *
40 * @see https://github.com/Charitable/Charitable/issues/347
41 *
42 * @since 1.4.18
43 *
44 * @return void
45 */
46 function charitable_compat_w3tc_turn_off_donation_cache() {
47 if ( ! defined( 'DONOTCACHEDB' ) ) {
48 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound -- DONOTCACHEDB is a third-party constant defined by W3 Total Cache plugin for compatibility.
49 define( 'DONOTCACHEDB', true );
50 }
51 }
52
53 add_action( 'charitable_before_save_donation', 'charitable_compat_w3tc_turn_off_donation_cache' );
54