PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.7.0.12
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.7.0.12
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 / donations / charitable-donation-hooks.php

charitable-donation-hooks.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.7.0.12, at includes/donations/charitable-donation-hooks.php

128 lines 4.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Charitable Donation Hooks.
4 *
5 * Action/filter hooks used for Charitable donations.
6 *
7 * @package Charitable/Functions/Donations
8 * @author David Bisset
9 * @copyright Copyright (c) 2022, WP Charitable LLC
10 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
11 * @since 1.0.0
12 * @version 1.6.34
13 */
14
15 // Exit if accessed directly.
16 if ( ! defined( 'ABSPATH' ) ) {
17 exit;
18 }
19
20 /**
21 * Start a donation.
22 *
23 * In default Charitable, this happens when the donation form is loaded. The
24 * donation is not saved to the database yet; it just exists in the user's
25 * session.
26 *
27 * @see Charitable_Donation_Processor::add_donation_to_session
28 */
29 add_action( 'charitable_start_donation', array( 'Charitable_Donation_Processor', 'add_donation_to_session' ) );
30
31 /**
32 * Make a donation.
33 *
34 * This is when a donation is saved to the database.
35 *
36 * @see Charitable_Donation_Processor::make_donation
37 */
38 add_action( 'charitable_make_donation', array( 'Charitable_Donation_Processor', 'process_donation_form_submission' ) );
39
40 /**
41 * AJAX hook to process a donation.
42 *
43 * @see Charitable_Donation_Processor::ajax_process_donation_form_submission
44 */
45 add_action( 'wp_ajax_make_donation', array( 'Charitable_Donation_Processor', 'ajax_process_donation_form_submission' ) );
46 add_action( 'wp_ajax_nopriv_make_donation', array( 'Charitable_Donation_Processor', 'ajax_process_donation_form_submission' ) );
47
48 /**
49 * Make a streamlined donation.
50 *
51 * This hook is fired when a form generated by Charitable_Donation_Amount_Form
52 * is submitted. By default, it just includes the amount to be donated and
53 * the campaign.
54 *
55 * @see Charitable_Donation_Processor::make_donation_streamlined
56 */
57 add_action( 'charitable_make_donation_streamlined', array( 'Charitable_Donation_Processor', 'make_donation_streamlined' ) );
58
59 /**
60 * Donation update.
61 *
62 * @see charitable_flush_campaigns_donation_cache
63 */
64 add_action( 'save_post_' . Charitable::DONATION_POST_TYPE, 'charitable_flush_campaigns_donation_cache' );
65
66 /**
67 * Sanitize donation meta.
68 *
69 * @see charitable_sanitize_donation_meta
70 */
71 add_filter( 'charitable_sanitize_donation_meta', 'charitable_sanitize_donation_meta', 10, 2 );
72
73 /**
74 * Delete a donation.
75 *
76 * @see Charitable_Campaign_Donations_DB::delete_donation()
77 */
78 add_action( 'deleted_post', array( 'Charitable_Campaign_Donations_DB', 'delete_donation_records' ) );
79
80 /**
81 * Post donation hook.
82 *
83 * @see charitable_is_after_donation()
84 */
85 add_action( 'init', 'charitable_is_after_donation', 20 );
86
87 /**
88 * Cancel donation.
89 *
90 * @see charitable_cancel_donation()
91 */
92 add_action( 'template_redirect', 'charitable_cancel_donation' );
93
94 /**
95 * Handle PayPal gateway payments.
96 *
97 * @see Charitable_Gateway_Paypal::validate_donation
98 * @see Charitable_Gateway_Paypal::process_donation
99 * @see Charitable_Gateway_Paypal::process_ipn
100 * @see Charitable_Gateway_Paypal::process_web_accept
101 */
102 add_filter( 'charitable_validate_donation_form_submission_gateway', array( 'Charitable_Gateway_Paypal', 'validate_donation' ), 10, 3 );
103 add_filter( 'charitable_process_donation_paypal', array( 'Charitable_Gateway_Paypal', 'process_donation' ), 10, 3 );
104 add_action( 'charitable_process_ipn_paypal', array( 'Charitable_Gateway_Paypal', 'process_ipn' ) );
105 add_action( 'charitable_paypal_web_accept', array( 'Charitable_Gateway_Paypal', 'process_web_accept' ), 10, 2 );
106
107 /**
108 * Handle PayPal refund.
109 *
110 * @see Charitable_Gateway_Paypal::process_refund
111 */
112 add_action( 'charitable_process_refund_paypal', array( 'Charitable_Gateway_Paypal', 'process_refund' ) );
113
114 /**
115 * Load charitable-donation-form.js before donation form.
116 *
117 * @see charitable_load_donation_form_script()
118 */
119 add_action( 'charitable_donation_form_before', 'charitable_load_donation_form_script' );
120
121 /**
122 * Refresh a donation in cache after its status is updated.
123 *
124 * @see charitable_update_cached_donation()
125 */
126 add_action( 'charitable_donation_status_changed', 'charitable_update_cached_donation' );
127 add_action( 'charitable_recurring_donation_status_changed', 'charitable_update_cached_donation' );
128