| 1 |
<?php |
| 2 |
/** |
| 3 |
* Charitable Settings Hooks. |
| 4 |
* |
| 5 |
* Action/filter hooks used for Charitable Settings API. |
| 6 |
* |
| 7 |
* @package Charitable/Functions/Admin |
| 8 |
* @author Eric Daams |
| 9 |
* @copyright Copyright (c) 2019, Studio 164a |
| 10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 11 |
* @since 1.2.0 |
| 12 |
* @version 1.6.0 |
| 13 |
*/ |
| 14 |
|
| 15 |
// Exit if accessed directly. |
| 16 |
if ( ! defined( 'ABSPATH' ) ) { |
| 17 |
exit; |
| 18 |
} |
| 19 |
|
| 20 |
/** |
| 21 |
* Register Charitable settings. |
| 22 |
* |
| 23 |
* @see Charitable_Settings::register_settings() |
| 24 |
*/ |
| 25 |
add_action( 'admin_init', array( Charitable_Settings::get_instance(), 'register_settings' ) ); |
| 26 |
|
| 27 |
/** |
| 28 |
* Maybe add "Licenses" settings tab. |
| 29 |
* |
| 30 |
* @see Charitable_Settings::maybe_add_extensions_tab() |
| 31 |
*/ |
| 32 |
add_action( 'charitable_settings_tabs', array( Charitable_Licenses_Settings::get_instance(), 'maybe_add_licenses_tab' ), 1 ); |
| 33 |
|
| 34 |
/** |
| 35 |
* Maybe add "Extensions" settings tab. |
| 36 |
* |
| 37 |
* @see Charitable_Settings::maybe_add_extensions_tab() |
| 38 |
*/ |
| 39 |
add_action( 'charitable_settings_tabs', array( Charitable_Settings::get_instance(), 'maybe_add_extensions_tab' ), 2 ); |
| 40 |
|
| 41 |
/** |
| 42 |
* Add a hidden "extensions" field. |
| 43 |
* |
| 44 |
* @see Charitable_Settings::add_hidden_extensions_setting_field() |
| 45 |
*/ |
| 46 |
add_filter( 'charitable_settings_tab_fields', array( Charitable_Settings::get_instance(), 'add_hidden_extensions_setting_field' ) ); |
| 47 |
|
| 48 |
/** |
| 49 |
* Save the license when saving settings. |
| 50 |
* |
| 51 |
* @see Charitable_Licenses_Settings::save_license() |
| 52 |
*/ |
| 53 |
add_filter( 'charitable_save_settings', array( Charitable_Licenses_Settings::get_instance(), 'save_license' ), 10, 2 ); |
| 54 |
|
| 55 |
/** |
| 56 |
* Add dynamic settings groups. |
| 57 |
* |
| 58 |
* @see Charitable_Gateway_Settings::add_gateway_settings_dynamic_groups() |
| 59 |
* @see Charitable_Email_Settings::add_email_settings_dynamic_groups() |
| 60 |
* @see Charitable_Email_Settings::add_licenses_group() |
| 61 |
*/ |
| 62 |
add_filter( 'charitable_dynamic_groups', array( Charitable_Gateway_Settings::get_instance(), 'add_gateway_settings_dynamic_groups' ) ); |
| 63 |
add_filter( 'charitable_dynamic_groups', array( Charitable_Email_Settings::get_instance(), 'add_individual_email_fields' ) ); |
| 64 |
add_filter( 'charitable_dynamic_groups', array( Charitable_Licenses_Settings::get_instance(), 'add_licenses_group' ) ); |
| 65 |
|
| 66 |
/** |
| 67 |
* Add settings to the General tab. |
| 68 |
* |
| 69 |
* @see Charitable_General_Settings::add_general_fields() |
| 70 |
*/ |
| 71 |
add_filter( 'charitable_settings_tab_fields_general', array( Charitable_General_Settings::get_instance(), 'add_general_fields' ), 5 ); |
| 72 |
|
| 73 |
/** |
| 74 |
* Add settings to the Payment Gateways tab. |
| 75 |
* |
| 76 |
* @see Charitable_Gateway_Settings::add_gateway_fields() |
| 77 |
*/ |
| 78 |
add_filter( 'charitable_settings_tab_fields_gateways', array( Charitable_Gateway_Settings::get_instance(), 'add_gateway_fields' ), 5 ); |
| 79 |
|
| 80 |
/** |
| 81 |
* Add settings to the Email tab. |
| 82 |
* |
| 83 |
* @see Charitable_Email_Settings::add_email_fields() |
| 84 |
*/ |
| 85 |
add_filter( 'charitable_settings_tab_fields_emails', array( Charitable_Email_Settings::get_instance(), 'add_email_fields' ), 5 ); |
| 86 |
|
| 87 |
/** |
| 88 |
* Add settings for the Licenses tab. |
| 89 |
* |
| 90 |
* @see Charitable_Licenses_Settings::add_licenses_fields() |
| 91 |
*/ |
| 92 |
add_filter( 'charitable_settings_tab_fields_licenses', array( Charitable_Licenses_Settings::get_instance(), 'add_licenses_fields' ), 5 ); |
| 93 |
|
| 94 |
/** |
| 95 |
* Add extra button for the Licenses tab. |
| 96 |
* |
| 97 |
* @see Charitable_Licenses_Settings::add_license_recheck_button() |
| 98 |
*/ |
| 99 |
add_filter( 'charitable_settings_button_licenses', array( Charitable_Licenses_Settings::get_instance(), 'add_license_recheck_button' ) ); |
| 100 |
|
| 101 |
/** |
| 102 |
* Add settings to the Privacy tab. |
| 103 |
* |
| 104 |
* @see Charitable_Privacy_Settings::add_privacy_fields() |
| 105 |
*/ |
| 106 |
add_filter( 'charitable_settings_tab_fields_privacy', array( Charitable_Privacy_Settings::get_instance(), 'add_privacy_fields' ), 5 ); |
| 107 |
|
| 108 |
/** |
| 109 |
* Add settings to the Advanced tab. |
| 110 |
* |
| 111 |
* @see Charitable_Advanced_Settings::add_advanced_fields() |
| 112 |
*/ |
| 113 |
add_filter( 'charitable_settings_tab_fields_advanced', array( Charitable_Advanced_Settings::get_instance(), 'add_advanced_fields' ), 5 ); |
| 114 |
|
| 115 |
/** |
| 116 |
* Add extra settings for the individual gateways & emails tabs. |
| 117 |
* |
| 118 |
* @see Charitable_Gateway_Settings::add_individual_gateway_fields() |
| 119 |
* @see Charitable_Email_Settings::add_individual_email_fields() |
| 120 |
*/ |
| 121 |
add_filter( 'charitable_settings_tab_fields', array( Charitable_Gateway_Settings::get_instance(), 'add_individual_gateway_fields' ), 5 ); |
| 122 |
add_filter( 'charitable_settings_tab_fields', array( Charitable_Email_Settings::get_instance(), 'add_individual_email_fields' ), 5 ); |
| 123 |
|