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 / admin / donations / charitable-admin-donation-hooks.php

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

195 lines 7.1 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) 2023, 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, 1.8.9.1
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 * Add needed css classes to body HTML tag.
38 *
39 * @see Charitable_Donation_List_Table::add_body_class()
40 */
41 add_filter( 'admin_body_class', array( Charitable_Donation_Meta_Boxes::get_instance(), 'add_body_class' ), 50, 1 );
42
43 /**
44 * Save the donation.
45 *
46 * @see Charitable_Donation_Meta_Boxes::save_donation()
47 */
48 add_action( 'save_post_' . Charitable::DONATION_POST_TYPE, array( Charitable_Donation_Meta_Boxes::get_instance(), 'save_donation' ), 10, 2 );
49
50 /**
51 * Maybe prevent emails if we're saving a donation.
52 *
53 * @see Charitable_Donation_Meta_Boxes::maybe_block_new_donation_email()
54 * @see Charitable_Donation_Meta_Boxes::maybe_block_donation_receipt_email()
55 */
56 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 );
57 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 );
58
59 /**
60 * Save the donation.
61 *
62 * @see Charitable_Donation_Meta_Boxes::post_messages()
63 */
64 add_filter( 'post_updated_messages', array( Charitable_Donation_Meta_Boxes::get_instance(), 'post_messages' ) );
65
66 /**
67 * Set the table columns for donations.
68 *
69 * @see Charitable_Donation_List_Table::dashboard_columns()
70 */
71 add_filter( 'manage_edit-donation_columns', array( Charitable_Donation_List_Table::get_instance(), 'dashboard_columns' ), 11, 1 );
72
73 /**
74 * Set the content of each column item.
75 *
76 * @see Charitable_Donation_List_Table::dashboard_column_item()
77 */
78 add_filter( 'manage_donation_posts_custom_column', array( Charitable_Donation_List_Table::get_instance(), 'dashboard_column_item' ), 11, 2 );
79
80 /**
81 * Set which columns can be used to sort results.
82 *
83 * @see Charitable_Donation_List_Table::sortable_columns()
84 */
85 add_filter( 'manage_edit-donation_sortable_columns', array( Charitable_Donation_List_Table::get_instance(), 'sortable_columns' ) );
86
87 /**
88 * Set the primary table column.
89 *
90 * @see Charitable_Donation_List_Table::primary_column()
91 */
92 add_filter( 'list_table_primary_column', array( Charitable_Donation_List_Table::get_instance(), 'primary_column' ), 10, 2 );
93
94 /**
95 * Set the actions that can be taken for individual donations in the table.
96 *
97 * @see Charitable_Donation_List_Table::row_actions()
98 */
99 add_filter( 'post_row_actions', array( Charitable_Donation_List_Table::get_instance(), 'row_actions' ), 2, 100 );
100
101 /**
102 * Set the status views.
103 *
104 * @see Charitable_Donation_List_Table::set_status_views()
105 */
106 add_filter( 'views_edit-donation', array( Charitable_Donation_List_Table::get_instance(), 'set_status_views' ) );
107
108 /**
109 * Set up bulk actions. This changed in WordPress 4.7.
110 *
111 * >= 4.7
112 *
113 * @see Charitable_Donation_List_Table::custom_bulk_actions()
114 * @see Charitable_Donation_List_Table::bulk_action_handler()
115 *
116 * < 4.7
117 * @see Charitable_Donation_List_Table::remove_bulk_actions()
118 * @see Charitable_Donation_List_Table::bulk_admin_footer()
119 * @see Charitable_Donation_List_Table::process_bulk_action()
120 */
121 if ( version_compare( get_bloginfo( 'version' ), '4.7', '>=' ) ) {
122 add_filter( 'bulk_actions-edit-donation', array( Charitable_Donation_List_Table::get_instance(), 'custom_bulk_actions' ) );
123 add_filter( 'handle_bulk_actions-edit-donation', array( Charitable_Donation_List_Table::get_instance(), 'bulk_action_handler' ), 10, 3 );
124 } else {
125 add_filter( 'bulk_actions-edit-donation', array( Charitable_Donation_List_Table::get_instance(), 'remove_bulk_actions' ) );
126 add_action( 'admin_footer', array( Charitable_Donation_List_Table::get_instance(), 'bulk_admin_footer' ), 10 );
127 add_action( 'load-edit.php', array( Charitable_Donation_List_Table::get_instance(), 'process_bulk_action' ) );
128 }
129
130 /**
131 * Set up admin messages & notifications displayed based on actions taken.
132 *
133 * @see Charitable_Donation_List_Table::bulk_admin_notices()
134 * @see Charitable_Donation_List_Table::post_messages()
135 * @see Charitable_Donation_List_Table::bulk_messages()
136 */
137 add_action( 'admin_notices', array( Charitable_Donation_List_Table::get_instance(), 'bulk_admin_notices' ) );
138 add_filter( 'bulk_post_updated_messages', array( Charitable_Donation_List_Table::get_instance(), 'bulk_messages' ), 10, 2 );
139
140 /**
141 * Don't show the months dropdown option.
142 *
143 * @see Charitable_Donation_List_Table::disable_months_dropdown()
144 */
145 add_filter( 'disable_months_dropdown', array( Charitable_Donation_List_Table::get_instance(), 'disable_months_dropdown' ), 10, 2 );
146
147 /**
148 * Add date-based filters above the donations table.
149 *
150 * @see Charitable_Donation_List_Table::add_filters()
151 */
152 add_action( 'restrict_manage_posts', array( Charitable_Donation_List_Table::get_instance(), 'add_filters' ), 99 );
153
154 /**
155 * Add the export button above the donations table.
156 *
157 * @see Charitable_Donation_List_Table::add_export()
158 */
159 add_action( 'manage_posts_extra_tablenav', array( Charitable_Donation_List_Table::get_instance(), 'add_export' ) );
160
161 /**
162 * Insert modal forms in the footer.
163 *
164 * @see Charitable_Donation_List_Table::modal_forms()
165 */
166 add_action( 'admin_footer', array( Charitable_Donation_List_Table::get_instance(), 'modal_forms' ) );
167
168 /**
169 * Load scripts to include on the donation table.
170 *
171 * @see Charitable_Donation_List_Table::load_scripts()
172 */
173 add_action( 'admin_enqueue_scripts', array( Charitable_Donation_List_Table::get_instance(), 'load_scripts' ), 11 );
174
175 /**
176 * Add custom filters to the query that returns the donations to be displayed.
177 *
178 * @see Charitable_Donation_List_Table::filter_request_query()
179 */
180 add_filter( 'request', array( Charitable_Donation_List_Table::get_instance(), 'filter_request_query' ) );
181
182 /**
183 * Set up sorting for query results.
184 *
185 * @see Charitable_Donation_List_Table::sort_donations()
186 */
187 add_filter( 'posts_clauses', array( Charitable_Donation_List_Table::get_instance(), 'sort_donations' ) );
188
189 /**
190 * Render blank state when there are no donations.
191 *
192 * @see Charitable_Donation_List_Table::maybe_render_blank_state()
193 */
194 add_action( 'manage_posts_extra_tablenav', array( Charitable_Donation_List_Table::get_instance(), 'maybe_render_blank_state' ), 11, 2 );
195