| 1 |
<?php |
| 2 |
/** |
| 3 |
* Charitable Onboarding Hooks. |
| 4 |
* |
| 5 |
* Action/filter hooks used for Charitable Onboarding. |
| 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.8.1.12 |
| 12 |
* @version 1.8.4 |
| 13 |
*/ |
| 14 |
|
| 15 |
// Exit if accessed directly. |
| 16 |
if ( ! defined( 'ABSPATH' ) ) { |
| 17 |
exit; |
| 18 |
} |
| 19 |
|
| 20 |
/** |
| 21 |
* Register Charitable onboarding scripts. |
| 22 |
* |
| 23 |
* @see Charitable_Onboarding::enqueue_scripts() |
| 24 |
*/ |
| 25 |
// add_action( 'admin_enqueue_scripts', array( Charitable_Onboarding::get_instance(), 'enqueue_scripts' ) ); |
| 26 |
|
| 27 |
/** |
| 28 |
* Register the custom scripts and styles. |
| 29 |
* |
| 30 |
* @see Charitable_Setup::enqueue_scripts() |
| 31 |
*/ |
| 32 |
add_action( 'admin_enqueue_scripts', array( Charitable_Setup::get_instance(), 'enqueue_scripts' ) ); |
| 33 |
|
| 34 |
/** |
| 35 |
* Process setup steps via ajax. |
| 36 |
* |
| 37 |
* @see Charitable_Setup::maybe_process_step() |
| 38 |
* @see Charitable_Setup::ajax_activate_feature() |
| 39 |
* @see Charitable_Setup::ajax_process_campaign() |
| 40 |
* @see Charitable_Setup::ajax_process_complete() |
| 41 |
* @see Charitable_Setup::ajax_process_tracking() |
| 42 |
*/ |
| 43 |
add_action( 'wp_ajax_charitable_setup_process_meta', array( Charitable_Setup::get_instance(), 'maybe_process_step' ) ); |
| 44 |
|
| 45 |
add_action( 'wp_ajax_charitable_activate_feature', array( Charitable_Setup::get_instance(), 'ajax_activate_feature' ) ); |
| 46 |
|
| 47 |
add_action( 'wp_ajax_charitable_setup_process_campaign', array( Charitable_Setup::get_instance(), 'ajax_process_campaign' ) ); |
| 48 |
|
| 49 |
add_action( 'wp_ajax_charitable_setup_process_complete', array( Charitable_Setup::get_instance(), 'ajax_process_complete' ) ); |
| 50 |
|
| 51 |
add_action( 'wp_ajax_charitable_setup_process_tracking', array( Charitable_Setup::get_instance(), 'ajax_process_tracking' ) ); |
| 52 |
|
| 53 |
|
| 54 |
/** |
| 55 |
* Register Charitable checklist scripts. |
| 56 |
* |
| 57 |
* @see Charitable_Checklist::enqueue_scripts() |
| 58 |
*/ |
| 59 |
add_action( 'admin_enqueue_scripts', array( Charitable_Checklist::get_instance(), 'enqueue_styles_and_scripts' ) ); |
| 60 |
|
| 61 |
/** |
| 62 |
* Add the checklist HTML to the footer. |
| 63 |
* |
| 64 |
* @see Charitable_Checklist::maybe_add_checklist_html() |
| 65 |
*/ |
| 66 |
add_action( 'admin_footer', array( Charitable_Checklist::get_instance(), 'maybe_add_checklist_widget_html' ) ); |
| 67 |
|
| 68 |
/** |
| 69 |
* Show a notice related to the checklist. |
| 70 |
* |
| 71 |
* @see Charitable_Checklist::get_dashboard_notices() |
| 72 |
*/ |
| 73 |
add_filter( 'charitable_admin_dashboard_init_end', array( Charitable_Checklist::get_instance(), 'get_dashboard_notices' ), 10 ); |
| 74 |
|
| 75 |
/** |
| 76 |
* Redirect from the notifications page if necessary. |
| 77 |
* |
| 78 |
* @see Charitable_Checklist::maybe_redirect_from_notifications_page() |
| 79 |
*/ |
| 80 |
add_action( 'init', array( Charitable_Checklist::get_instance(), 'maybe_redirect_from_checklist_page' ) ); |
| 81 |
|
| 82 |
/** |
| 83 |
* Register the admin page. |
| 84 |
* |
| 85 |
* @see Charitable_Setup::register_page() |
| 86 |
*/ |
| 87 |
add_action( 'admin_menu', array( Charitable_Setup::get_instance(), 'register_page' ) ); |
| 88 |
|
| 89 |
/** |
| 90 |
* Hide the admin page from the menu. |
| 91 |
* |
| 92 |
* @see Charitable_Setup::remove_page_from_menu() |
| 93 |
*/ |
| 94 |
add_action( 'admin_head', array( Charitable_Setup::get_instance(), 'remove_page_from_menu' ) ); |
| 95 |
|