| 1 |
<?php |
| 2 |
/** |
| 3 |
* Charitable Upgrade Hooks. |
| 4 |
* |
| 5 |
* Action/filter hooks used for Charitable Upgrades. |
| 6 |
* |
| 7 |
* @package Charitable/Functions/Upgrades |
| 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.3.0 |
| 12 |
* @version 1.5.0 |
| 13 |
*/ |
| 14 |
|
| 15 |
// Exit if accessed directly. |
| 16 |
if ( ! defined( 'ABSPATH' ) ) { |
| 17 |
exit; |
| 18 |
} |
| 19 |
|
| 20 |
/** |
| 21 |
* Check if there is an upgrade that needs to happen and if so, display a notice to begin upgrading. |
| 22 |
* |
| 23 |
* @see Charitable_Upgrade::add_upgrade_notice() |
| 24 |
*/ |
| 25 |
add_action( 'admin_notices', array( Charitable_Upgrade::get_instance(), 'add_upgrade_notice' ) ); |
| 26 |
|
| 27 |
/** |
| 28 |
* Perform upgrades that don't require a prompt. |
| 29 |
* |
| 30 |
* @see Charitable_Upgrade::do_immediate_upgrades() |
| 31 |
*/ |
| 32 |
add_action( 'init', array( Charitable_Upgrade::get_instance(), 'do_immediate_upgrades' ), 5 ); |
| 33 |
|
| 34 |
/** |
| 35 |
* Register the admin page. |
| 36 |
* |
| 37 |
* @see Charitable_Upgrade_Page::register_page() |
| 38 |
*/ |
| 39 |
add_action( 'admin_menu', array( Charitable_Upgrade_Page::get_instance(), 'register_page' ) ); |
| 40 |
|
| 41 |
/** |
| 42 |
* Hide the admin page from the menu. |
| 43 |
* |
| 44 |
* @see Charitable_Upgrade_Page::remove_page_from_menu() |
| 45 |
*/ |
| 46 |
add_action( 'admin_head', array( Charitable_Upgrade_Page::get_instance(), 'remove_page_from_menu' ) ); |
| 47 |
|
| 48 |
/** |
| 49 |
* Update the upgrade system. |
| 50 |
* |
| 51 |
* @see Charitable_Upgrade::update_upgrade_system() |
| 52 |
*/ |
| 53 |
add_action( 'charitable_update_upgrade_system', array( Charitable_Upgrade::get_instance(), 'update_upgrade_system' ) ); |
| 54 |
|
| 55 |
/** |
| 56 |
* Run the upgrade for 1.3.0. |
| 57 |
* |
| 58 |
* @see Charitable_Upgrade::upgrade_1_3_0_fix_gmt_dates() |
| 59 |
*/ |
| 60 |
add_action( 'charitable_fix_donation_dates', array( Charitable_Upgrade::get_instance(), 'fix_donation_dates' ) ); |
| 61 |
|
| 62 |
/** |
| 63 |
* Remove duplicate donors. |
| 64 |
* |
| 65 |
* @see Charitable_Upgrade::remove_duplicate_donors() |
| 66 |
*/ |
| 67 |
add_action( 'charitable_remove_duplicate_donors', array( Charitable_Upgrade::get_instance(), 'remove_duplicate_donors' ) ); |
| 68 |
|
| 69 |
/** |
| 70 |
* Upgrade the database tables. |
| 71 |
* |
| 72 |
* @see Charitable_Upgrade::upgrade_donor_tables() |
| 73 |
*/ |
| 74 |
add_action( 'charitable_upgrade_donor_tables', array( Charitable_Upgrade::get_instance(), 'upgrade_donor_tables' ) ); |
| 75 |
|
| 76 |
/** |
| 77 |
* Fix up donations missing donor IDs. |
| 78 |
* |
| 79 |
* @see Charitable_Upgrade::fix_empty_donor_ids() |
| 80 |
*/ |
| 81 |
add_action( 'charitable_fix_empty_donor_ids', array( Charitable_Upgrade::get_instance(), 'fix_empty_donor_ids' ) ); |
| 82 |
|