PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
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 1.7.0.9 All 211 releases
← All changes | includes/admin/charitable-admin-hooks.php +272 -6 1.6.8 → 1.8.13 View file →
@@ -1,13 +1,14 @@
1 1 <?php
2 2 /**
3 3 * Charitable Admin Hooks.
4 4 *
5 - * @package Charitable/Functions/Admin
6 - * @version 1.3.0
7 - * @author Eric Daams
8 - * @copyright Copyright (c) 2019, Studio 164a
9 - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
5 + * @package Charitable/Functions/Admin
6 + * @author David Bisset
7 + * @copyright Copyright (c) 2023, WP Charitable LLC
8 + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 + * @since 1.3.0
10 + * @version 1.6.40
10 11 */
11 12
12 13 // Exit if accessed directly.
13 14 if ( ! defined( 'ABSPATH' ) ) {
@@ -26,8 +27,9 @@
26 27 *
27 28 * @see Charitable_Admin::set_body_class()
28 29 */
29 30 add_filter( 'admin_body_class', array( Charitable_Admin::get_instance(), 'set_body_class' ) );
31 +add_filter( 'admin_body_class', array( Charitable_User_Onboarding::get_instance(), 'add_body_class' ) );
30 32
31 33 /**
32 34 * Do an admin action.
33 35 *
@@ -49,8 +51,30 @@
49 51 */
50 52 add_action( 'wp_ajax_charitable_dismiss_notice', array( Charitable_Admin::get_instance(), 'dismiss_notice' ) );
51 53
52 54 /**
55 + * Dismiss a banner.
56 + *
57 + * @see Charitable_Admin::dismiss_banner()
58 + */
59 +add_action( 'wp_ajax_charitable_dismiss_admin_banner', array( Charitable_Admin::get_instance(), 'dismiss_banner' ) );
60 +
61 +/**
62 + * Dismiss a list banner.
63 + *
64 + * @see Charitable_Admin::dismiss_banner()
65 + */
66 +add_action( 'wp_ajax_charitable_dismiss_admin_list_banner', array( Charitable_Admin::get_instance(), 'dismiss_list_banner' ) );
67 +
68 +
69 +/**
70 + * Dismiss a five star rating request.
71 + *
72 + * @see Charitable_Admin::dismiss_five_star_rating()
73 + */
74 +add_action( 'wp_ajax_charitable_dismiss_admin_five_star_rating', array( Charitable_Admin::get_instance(), 'dismiss_five_star_rating' ) );
75 +
76 +/**
53 77 * Add a generic body class to donations page
54 78 *
55 79 * @see Charitable_Admin::add_admin_body_class()
56 80 */
@@ -60,9 +84,9 @@
60 84 * Remove jQuery UI styles added by Ninja Forms.
61 85 *
62 86 * @see Charitable_Admin::remove_jquery_ui_styles_nf()
63 87 */
64 -add_filter( 'media_buttons_context', array( Charitable_Admin::get_instance(), 'remove_jquery_ui_styles_nf' ), 20 );
88 +// add_filter( 'media_buttons_context', array( Charitable_Admin::get_instance(), 'remove_jquery_ui_styles_nf' ), 20 );
65 89
66 90 /**
67 91 * Add action links to the Charitable plugin block.
68 92 *
@@ -91,8 +115,9 @@
91 115 *
92 116 * @see Charitable_Admin_Pages::add_menu()
93 117 */
94 118 add_action( 'admin_menu', array( Charitable_Admin_Pages::get_instance(), 'add_menu' ), 5 );
119 +add_action( 'parent_file', array( Charitable_Admin_Pages::get_instance(), 'menu_highlight' ), 10 );
95 120
96 121 /**
97 122 * Redirect to welcome page after install.
98 123 *
@@ -105,4 +130,245 @@
105 130 *
106 131 * @see Charitable_Admin_Notices::shutdown()
107 132 */
108 133 add_action( 'shutdown', array( charitable_get_admin_notices(), 'shutdown' ) );
134 +
135 +/**
136 + * Stash any notices that haven't been displayed.
137 + *
138 + * @see Charitable_Admin_Support::maybe_do_charitable_support_query()
139 + */
140 +add_action( 'admin_init', array( Charitable_Admin_Support::get_instance(), 'maybe_do_charitable_support_query' ), 100 );
141 +
142 +/**
143 + * Enqueue Charitable's campaign builder related scripts & styles.
144 + *
145 + * @see Charitable_Campaign_Builder::add_page()
146 + */
147 +add_action( 'admin_menu', array( Charitable_Campaign_Builder::get_instance(), 'add_page' ), 5 );
148 +
149 +/**
150 + * Enqueue Charitable's campaign builder related scripts & styles.
151 + *
152 + * @see Charitable_Campaign_Builder::init()
153 + */
154 +add_action( 'admin_init', array( Charitable_Campaign_Builder::get_instance(), 'init' ), 100 );
155 +
156 +/**
157 + * Enqueue Charitable's campaign builder embed related scripts & styles.
158 + *
159 + * @see Charitable_Campaign_Embed_Wizard::init()
160 + */
161 +add_action( 'admin_init', array( Charitable_Campaign_Embed_Wizard::get_instance(), 'init' ), 100 );
162 +
163 +/**
164 + * Enqueue Charitable's block releated scripts & styles.
165 + *
166 + * @see Charitable_Admin_Blocks::admin_enqueue_scripts()
167 + */
168 +add_action( 'admin_enqueue_scripts', array( Charitable_Admin_Blocks::get_instance(), 'admin_enqueue_scripts' ) );
169 +
170 +/**
171 + * Enqueue Charitable's styles for the block editor canvas (the editor iframe).
172 + *
173 + * Must be on `enqueue_block_assets` rather than `admin_enqueue_scripts` — that is the hook
174 + * core collects when building the iframe's assets.
175 + *
176 + * @see Charitable_Admin_Blocks::enqueue_block_editor_canvas_styles()
177 + */
178 +add_action( 'enqueue_block_assets', array( Charitable_Admin_Blocks::get_instance(), 'enqueue_block_editor_canvas_styles' ) );
179 +
180 +/**
181 + * Enqueue Charitable's campaign builder congrats wizard related scripts & styles.
182 + *
183 + * @see Charitable_Campaign_Congrats_Wizard::init()
184 + */
185 +add_action( 'admin_init', array( Charitable_Campaign_Congrats_Wizard::get_instance(), 'init' ), 120 );
186 +
187 +/**
188 + * Dismiss dashboard notices.
189 + *
190 + * @see Charitable_Admin::dismiss_dashboard_notice()
191 + */
192 +add_action( 'wp_ajax_charitable_dismiss_dashboard_notice', array( Charitable_Admin::get_instance(), 'dismiss_dashboard_notices' ) );
193 +
194 +/**
195 + * Dismiss guide tool related notices.
196 + *
197 + * @see Charitable_Admin::dismiss_growth_tools_notices()
198 + */
199 +add_action( 'wp_ajax_charitable_dismiss_growth_tools_dashboard_notice', array( Charitable_Admin::get_instance(), 'dismiss_growth_tools_notices' ) );
200 +
201 +/**
202 + * Do an admin action.
203 + *
204 + * @see Charitable_Admin::maybe_do_admin_action()
205 + */
206 +add_action( 'plugins_loaded', array( Charitable_Admin_Getting_Started::get_instance(), 'init' ), 999 );
207 +
208 +/**
209 + * Insert HTML into the footer that can be used later by onboarding.
210 + *
211 + * @see Charitable_Campaign_Builder::render_onboarding_html()
212 + */
213 +add_action( 'admin_footer', array( Charitable_Campaign_Builder::get_instance(), 'render_onboarding_html' ), 5 );
214 +
215 +/**
216 + * Save an onboarding options via AJAX.
217 + *
218 + * @see Charitable_Campaign_Builder::save_onboarding_option_ajax()
219 + */
220 +add_action( 'wp_ajax_charitable_onboarding_save_option', array( Charitable_Campaign_Builder::get_instance(), 'save_onboarding_option_ajax' ), 5 );
221 +add_action( 'wp_ajax_charitable_onboarding_tour_save_option', array( Charitable_Campaign_Builder::get_instance(), 'save_tour_option_ajax' ), 5 );
222 +add_action( 'wp_ajax_charitable_onboarding_checklist_save_option', array( Charitable_Checklist::get_instance(), 'save_checklist_option_ajax' ), 5 );
223 +
224 +/**
225 + * Checklist: check to mark step as completed.
226 + *
227 + * @see Charitable_Checklist::check_step_first_donation()
228 + */
229 +add_action( 'admin_init', array( Charitable_Checklist::get_instance(), 'maybe_redirect_to_next_step' ), 999 );
230 +
231 +/**
232 + * Plugin notifications, added mostly in 1.8.3.
233 + *
234 + * @see Charitable_Notifications::add_notifications_to_menu()
235 + * @see Charitable_Notifications::dismiss()
236 + * @see Charitable_Notifications::dismiss_multiple()
237 + * @see Charitable_Notifications::maybe_redirect_from_notifications()
238 + */
239 +add_filter( 'admin_init', array( Charitable_Notifications::get_instance(), 'init' ), 9 );
240 +add_filter( 'charitable_submenu_pages', array( Charitable_Notifications::get_instance(), 'add_notifications_to_menu' ), 2 );
241 +add_filter( 'wp_ajax_charitable_notification_dismiss', array( Charitable_Notifications::get_instance(), 'dismiss' ), 10 );
242 +add_filter( 'wp_ajax_charitable_notification_dismiss_multiple', array( Charitable_Notifications::get_instance(), 'dismiss_multiple' ), 10 );
243 +add_action( 'admin_init', array( Charitable_Notifications::get_instance(), 'maybe_redirect_from_notifications' ), 10 );
244 +
245 +/**
246 + * Notifications v2 — Settings must init before Local Notifications and Cron
247 + * so is_category_enabled() is available to both.
248 + *
249 + * @since 1.8.12
250 + */
251 +Charitable_Notification_Settings::get_instance()->init();
252 +
253 +/**
254 + * Local Notifications — manages locally-generated notifications.
255 + *
256 + * @since 1.8.12
257 + */
258 +Charitable_Local_Notifications::get_instance()->init();
259 +
260 +/**
261 + * Notification Cron — schedules and runs periodic checks.
262 + *
263 + * @since 1.8.12
264 + */
265 +Charitable_Notification_Cron::get_instance()->init();
266 +
267 +/**
268 + * Notification Triggers — hook-based milestone and lifecycle events.
269 + *
270 + * @since 1.8.12
271 + */
272 +Charitable_Notification_Triggers::get_instance()->init();
273 +
274 +/**
275 + * Notifications V2 onboarding tour.
276 + *
277 + * @since 1.8.12
278 + */
279 +// Charitable_Notification_Onboarding::get_instance()->init(); // TODO: re-enable before release
280 +
281 +/**
282 + * New Announcement Feed.
283 + *
284 + * @since 1.8.12
285 + */
286 +Charitable_New_Feed::get_instance()->init();
287 +
288 +/**
289 + * Notifications V2 test helper (admin-only). Triggered by ?charitable_notif_test=<action>.
290 + *
291 + * This is a development-only QA harness that seeds/clears notification state and
292 + * fires cron jobs on demand. It is a state-changing GET handler with no nonce, so
293 + * it must never be wired up in a production build. It is gated behind both WP_DEBUG
294 + * and an explicit opt-in constant; to enable it locally, define both in wp-config.php:
295 + *
296 + * define( 'WP_DEBUG', true );
297 + * define( 'CHARITABLE_NOTIFICATION_TEST_HELPER', true );
298 + *
299 + * @since 1.8.12
300 + */
301 +if ( defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'CHARITABLE_NOTIFICATION_TEST_HELPER' ) && CHARITABLE_NOTIFICATION_TEST_HELPER ) {
302 + Charitable_Notification_Test_Helper::get_instance()->init();
303 + add_action( 'admin_notices', array( Charitable_Notification_Test_Helper::get_instance(), 'maybe_show_notice' ) );
304 +}
305 +
306 +/**
307 + * Event Driven notifications and items, added mostly in 1.8.3.
308 + *
309 + * @see Charitable_EventDriven::init()
310 + * @see Charitable_EventDriven::update_events()
311 + */
312 +add_action( 'plugins_loaded', array( Charitable_EventDriven::get_instance(), 'init' ), 999 );
313 +add_filter( 'charitable_admin_notifications_update_data', array( Charitable_EventDriven::get_instance(), 'update_events' ), 9 );
314 +
315 +/**
316 + * License checks.
317 + *
318 + * @see Charitable_Admin_Pages::add_menu()
319 + */
320 +add_action( 'admin_init', array( Charitable_Licenses_Settings::get_instance(), 'maybe_check_if_license_expired' ), 9999 );
321 +add_action( 'admin_init', array( Charitable_Licenses_Settings::get_instance(), 'maybe_check_if_license_expiring' ), 9998 );
322 +add_action( 'admin_init', array( Charitable_Licenses_Settings::get_instance(), 'activate_pro_plugin_after_license_activation' ), 1 );
323 +
324 +/**
325 + * Connect for upgrade.wpcharitable.com.
326 + *
327 + * @see Charitable_Admin_Connect::settings_enqueues()
328 + * @see Charitable_Admin_Connect::generate_url()
329 + * @see Charitable_Admin_Connect::process()
330 + */
331 +add_action( 'after_charitable_admin_enqueue_scripts', array( Charitable_Admin_Connect::get_instance(), 'settings_enqueues' ), 10, 3 );
332 +add_action( 'wp_ajax_charitable_connect_url', array( Charitable_Admin_Connect::get_instance(), 'generate_url' ) );
333 +add_filter( 'charitable_license_verify_success_data', array( Charitable_Admin_Connect::get_instance(), 'add_upgrade_url_to_license_response' ), 10, 2 );
334 +add_action( 'wp_ajax_nopriv_charitable_connect_process', array( Charitable_Admin_Connect::get_instance(), 'process' ) );
335 +add_action( 'wp_ajax_charitable_download_pro', array( Charitable_Admin_Connect::get_instance(), 'download_pro_plugin' ) );
336 +add_action( 'wp_ajax_charitable_activate_pro', array( Charitable_Admin_Connect::get_instance(), 'activate_pro_plugin' ) );
337 +
338 +/**
339 + * Initialize splash data.
340 + *
341 + * @see Charitable_Admin_Splash::initialize_splash_data()
342 + */
343 +add_action( 'admin_init', [ Charitable_Admin_Splash::get_instance(), 'initialize_splash_data' ], 15 );
344 +add_action( 'admin_enqueue_scripts', [ Charitable_Admin_Splash::get_instance(), 'admin_enqueue_scripts' ] );
345 +add_action( 'admin_footer', [ Charitable_Admin_Splash::get_instance(), 'admin_footer' ] );
346 +
347 +/**
348 + * Show a notice if GiveWP is detected.
349 + *
350 + * @see Charitable_GiveWP_Notice::get_dashboard_notices()
351 + */
352 +add_filter( 'charitable_admin_dashboard_init_end', array( Charitable_GiveWP_Notice::get_instance(), 'get_dashboard_notices' ), 10 );
353 +
354 +/**
355 + * Display Charitable banners on external (non-Charitable) admin screens.
356 + *
357 + * @see Charitable_External_Banner
358 + */
359 +Charitable_External_Banner::get_instance();
360 +
361 +/**
362 + * Dashboard AJAX handlers.
363 + *
364 + * @see Charitable_Dashboard::ajax_activate_addon()
365 + * @see Charitable_Dashboard::ajax_approve_comment()
366 + * @see Charitable_Dashboard::ajax_delete_comment()
367 + * @see Charitable_Dashboard::ajax_install_charitable_addon()
368 + * @see Charitable_Dashboard::ajax_activate_charitable_addon()
369 + */
370 +add_action( 'wp_ajax_charitable_activate_addon', array( Charitable_Dashboard::get_instance(), 'ajax_activate_addon' ) );
371 +add_action( 'wp_ajax_charitable_approve_comment', array( Charitable_Dashboard::get_instance(), 'ajax_approve_comment' ) );
372 +add_action( 'wp_ajax_charitable_delete_comment', array( Charitable_Dashboard::get_instance(), 'ajax_delete_comment' ) );
373 +add_action( 'wp_ajax_charitable_install_charitable_addon', array( Charitable_Dashboard::get_instance(), 'ajax_install_charitable_addon' ) );
374 +add_action( 'wp_ajax_charitable_activate_charitable_addon', array( Charitable_Dashboard::get_instance(), 'ajax_activate_charitable_addon' ) );