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

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

180 lines 6.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Charitable Admin Donations Hooks.
4 *
5 * Action/filter hooks used for setting up donations in the admin.
6 *
7 * @package Charitable/Functions/Admin
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.5.0
12 * @version 1.6.39
13 */
14
15 // Exit if accessed directly.
16 if ( ! defined( 'ABSPATH' ) ) {
17 exit;
18 }
19
20 /**
21 * Add and remove metaboxes.
22 *
23 * @see Charitable_Donation_Meta_Boxes::add_meta_boxes()
24 * @see Charitable_Donation_Meta_Boxes::remove_meta_boxes()
25 */
26 add_action( 'add_meta_boxes_' . Charitable::DONATION_POST_TYPE, array( Charitable_Donation_Meta_Boxes::get_instance(), 'add_meta_boxes' ) );
27 add_action( 'add_meta_boxes_' . Charitable::DONATION_POST_TYPE, array( Charitable_Donation_Meta_Boxes::get_instance(), 'remove_meta_boxes' ), 20 );
28
29 /**
30 * Add status changes to donation actions.
31 *
32 * @see Charitable_Donation_Meta_Boxes::add_status_change_donation_actions()
33 */
34 add_action( 'admin_init', array( Charitable_Donation_Meta_Boxes::get_instance(), 'register_donation_actions' ) );
35
36 /**
37 * Save the donation.
38 *
39 * @see Charitable_Donation_Meta_Boxes::save_donation()
40 */
41 add_action( 'save_post_' . Charitable::DONATION_POST_TYPE, array( Charitable_Donation_Meta_Boxes::get_instance(), 'save_donation' ), 10, 2 );
42
43 /**
44 * Maybe prevent emails if we're saving a donation.
45 *
46 * @see Charitable_Donation_Meta_Boxes::maybe_block_new_donation_email()
47 * @see Charitable_Donation_Meta_Boxes::maybe_block_donation_receipt_email()
48 */
49 add_filter( 'charitable_send_' . Charitable_Email_New_Donation::get_email_id(), array( Charitable_Donation_Meta_Boxes::get_instance(), 'maybe_block_new_donation_email' ), 10, 2 );
50 add_filter( 'charitable_send_' . Charitable_Email_Donation_Receipt::get_email_id(), array( Charitable_Donation_Meta_Boxes::get_instance(), 'maybe_block_donation_receipt_email' ), 10, 2 );
51
52 /**
53 * Save the donation.
54 *
55 * @see Charitable_Donation_Meta_Boxes::post_messages()
56 */
57 add_filter( 'post_updated_messages', array( Charitable_Donation_Meta_Boxes::get_instance(), 'post_messages' ) );
58
59 /**
60 * Set the table columns for donations.
61 *
62 * @see Charitable_Donation_List_Table::dashboard_columns()
63 */
64 add_filter( 'manage_edit-donation_columns', array( Charitable_Donation_List_Table::get_instance(), 'dashboard_columns' ), 11, 1 );
65
66 /**
67 * Set the content of each column item.
68 *
69 * @see Charitable_Donation_List_Table::dashboard_column_item()
70 */
71 add_filter( 'manage_donation_posts_custom_column', array( Charitable_Donation_List_Table::get_instance(), 'dashboard_column_item' ), 11, 2 );
72
73 /**
74 * Set which columns can be used to sort results.
75 *
76 * @see Charitable_Donation_List_Table::sortable_columns()
77 */
78 add_filter( 'manage_edit-donation_sortable_columns', array( Charitable_Donation_List_Table::get_instance(), 'sortable_columns' ) );
79
80 /**
81 * Set the primary table column.
82 *
83 * @see Charitable_Donation_List_Table::primary_column()
84 */
85 add_filter( 'list_table_primary_column', array( Charitable_Donation_List_Table::get_instance(), 'primary_column' ), 10, 2 );
86
87 /**
88 * Set the actions that can be taken for individual donations in the table.
89 *
90 * @see Charitable_Donation_List_Table::row_actions()
91 */
92 add_filter( 'post_row_actions', array( Charitable_Donation_List_Table::get_instance(), 'row_actions' ), 2, 100 );
93
94 /**
95 * Set the status views.
96 *
97 * @see Charitable_Donation_List_Table::set_status_views()
98 */
99 add_filter( 'views_edit-donation', array( Charitable_Donation_List_Table::get_instance(), 'set_status_views' ) );
100
101 /**
102 * Set up bulk actions. This changed in WordPress 4.7.
103 *
104 * >= 4.7
105 * @see Charitable_Donation_List_Table::custom_bulk_actions()
106 * @see Charitable_Donation_List_Table::bulk_action_handler()
107 *
108 * < 4.7
109 * @see Charitable_Donation_List_Table::remove_bulk_actions()
110 * @see Charitable_Donation_List_Table::bulk_admin_footer()
111 * @see Charitable_Donation_List_Table::process_bulk_action()
112 */
113 if ( version_compare( get_bloginfo( 'version' ), '4.7', '>=' ) ) {
114 add_filter( 'bulk_actions-edit-donation', array( Charitable_Donation_List_Table::get_instance(), 'custom_bulk_actions' ) );
115 add_filter( 'handle_bulk_actions-edit-donation', array( Charitable_Donation_List_Table::get_instance(), 'bulk_action_handler' ), 10, 3 );
116 } else {
117 add_filter( 'bulk_actions-edit-donation', array( Charitable_Donation_List_Table::get_instance(), 'remove_bulk_actions' ) );
118 add_action( 'admin_footer', array( Charitable_Donation_List_Table::get_instance(), 'bulk_admin_footer' ), 10 );
119 add_action( 'load-edit.php', array( Charitable_Donation_List_Table::get_instance(), 'process_bulk_action' ) );
120 }
121
122 /**
123 * Set up admin messages & notifications displayed based on actions taken.
124 *
125 * @see Charitable_Donation_List_Table::bulk_admin_notices()
126 * @see Charitable_Donation_List_Table::post_messages()
127 * @see Charitable_Donation_List_Table::bulk_messages()
128 */
129 add_action( 'admin_notices', array( Charitable_Donation_List_Table::get_instance(), 'bulk_admin_notices' ) );
130 add_filter( 'bulk_post_updated_messages', array( Charitable_Donation_List_Table::get_instance(), 'bulk_messages' ), 10, 2 );
131
132 /**
133 * Don't show the months dropdown option.
134 *
135 * @see Charitable_Donation_List_Table::disable_months_dropdown()
136 */
137 add_filter( 'disable_months_dropdown', array( Charitable_Donation_List_Table::get_instance(), 'disable_months_dropdown' ), 10, 2 );
138
139 /**
140 * Add date-based filters above the donations table.
141 *
142 * @see Charitable_Donation_List_Table::add_filters()
143 */
144 add_action( 'restrict_manage_posts', array( Charitable_Donation_List_Table::get_instance(), 'add_filters' ), 99 );
145
146 /**
147 * Add the export button above the donations table.
148 *
149 * @see Charitable_Donation_List_Table::add_export()
150 */
151 add_action( 'manage_posts_extra_tablenav', array( Charitable_Donation_List_Table::get_instance(), 'add_export' ) );
152
153 /**
154 * Insert modal forms in the footer.
155 *
156 * @see Charitable_Donation_List_Table::modal_forms()
157 */
158 add_action( 'admin_footer', array( Charitable_Donation_List_Table::get_instance(), 'modal_forms' ) );
159
160 /**
161 * Load scripts to include on the donation table.
162 *
163 * @see Charitable_Donation_List_Table::load_scripts()
164 */
165 add_action( 'admin_enqueue_scripts', array( Charitable_Donation_List_Table::get_instance(), 'load_scripts' ), 11 );
166
167 /**
168 * Add custom filters to the query that returns the donations to be displayed.
169 *
170 * @see Charitable_Donation_List_Table::filter_request_query()
171 */
172 add_filter( 'request', array( Charitable_Donation_List_Table::get_instance(), 'filter_request_query' ) );
173
174 /**
175 * Set up sorting for query results.
176 *
177 * @see Charitable_Donation_List_Table::sort_donations()
178 */
179 add_filter( 'posts_clauses', array( Charitable_Donation_List_Table::get_instance(), 'sort_donations' ) );
180