deprecated-actions.php
7 years ago
deprecated-classes.php
8 years ago
deprecated-filters.php
8 years ago
deprecated-functions.php
7 years ago
deprecated-actions.php
148 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Handle renamed actions. |
| 4 | */ |
| 5 | $give_map_deprecated_actions = give_deprecated_actions(); |
| 6 | |
| 7 | foreach ( $give_map_deprecated_actions as $new => $old ) { |
| 8 | add_action( $new, 'give_deprecated_action_mapping', 10, 4 ); |
| 9 | } |
| 10 | |
| 11 | /** |
| 12 | * Deprecated actions. |
| 13 | * |
| 14 | * @return array An array of deprecated Give actions. |
| 15 | */ |
| 16 | function give_deprecated_actions() { |
| 17 | |
| 18 | $give_deprecated_actions = array( |
| 19 | // New action hook Old action hook. |
| 20 | 'give_donation_form_login_fields' => 'give_purchase_form_login_fields', |
| 21 | 'give_donation_form_register_login_fields' => 'give_purchase_form_register_login_fields', |
| 22 | 'give_donation_form_before_register_login' => 'give_purchase_form_before_register_login', |
| 23 | 'give_donation_form_before_cc_form' => 'give_purchase_form_before_cc_form', |
| 24 | 'give_donation_form_after_cc_form' => 'give_purchase_form_after_cc_form', |
| 25 | 'give_donation_form_no_access' => 'give_purchase_form_no_access', |
| 26 | 'give_donation_form_register_fields' => 'give_purchase_form_register_fields', |
| 27 | 'give_donation_form_after_user_info' => 'give_purchase_form_after_user_info', |
| 28 | 'give_donation_form_before_personal_info' => 'give_purchase_form_before_personal_info', |
| 29 | 'give_donation_form_before_email' => 'give_purchase_form_before_email', |
| 30 | 'give_donation_form_after_email' => 'give_purchase_form_after_email', |
| 31 | 'give_donation_form_user_info' => 'give_purchase_form_user_info', |
| 32 | 'give_donation_form_after_personal_info' => 'give_purchase_form_after_personal_info', |
| 33 | 'give_donation_form' => 'give_purchase_form', |
| 34 | 'give_donation_form_wrap_bottom' => 'give_purchase_form_wrap_bottom', |
| 35 | 'give_donation_form_before_submit' => 'give_purchase_form_before_submit', |
| 36 | 'give_donation_form_after_submit' => 'give_purchase_form_after_submit', |
| 37 | 'give_donation_history_header_before' => 'give_purchase_history_header_before', |
| 38 | 'give_donation_history_header_after' => 'give_purchase_history_header_after', |
| 39 | 'give_donation_history_row_start' => 'give_purchase_history_row_start', |
| 40 | 'give_donation_history_row_end' => 'give_purchase_history_row_end', |
| 41 | 'give_payment_form_top' => 'give_purchase_form_top', |
| 42 | 'give_payment_form_bottom' => 'give_purchase_form_bottom', |
| 43 | 'give_pre_process_donation' => 'give_pre_process_purchase', |
| 44 | 'give_complete_donation' => 'give_complete_purchase', |
| 45 | 'give_ajax_donation_errors' => 'give_ajax_checkout_errors', |
| 46 | 'give_admin_donation_email' => 'give_admin_sale_notice', |
| 47 | 'give_tools_tab_export_content_top' => 'give_reports_tab_export_content_top', |
| 48 | 'give_tools_tab_export_table_top' => 'give_reports_tab_export_table_top', |
| 49 | 'give_tools_tab_export_table_bottom' => 'give_reports_tab_export_table_bottom', |
| 50 | 'give_tools_tab_export_content_bottom' => 'give_report_tab_export_table_bottom', |
| 51 | 'give_pre_edit_donor' => 'give_pre_edit_customer', |
| 52 | 'give_post_edit_donor' => 'give_post_edit_customer', |
| 53 | 'give_pre_donor_disconnect_user_id' => 'give_pre_customer_disconnect_user_id', |
| 54 | 'give_post_donor_disconnect_user_id' => 'give_post_customer_disconnect_user_id', |
| 55 | 'give_update_donor_email_on_user_update' => 'give_update_customer_email_on_user_update', |
| 56 | 'give_pre_insert_donor' => 'give_pre_insert_customer', |
| 57 | 'give_post_insert_donor' => 'give_post_insert_customer', |
| 58 | 'give_donor_pre_create' => 'give_customer_pre_create', |
| 59 | 'give_donor_post_create' => 'give_customer_post_create', |
| 60 | 'give_donor_pre_update' => 'give_customer_pre_update', |
| 61 | 'give_donor_post_update' => 'give_customer_post_update', |
| 62 | 'give_donor_pre_attach_payment' => 'give_customer_pre_attach_payment', |
| 63 | 'give_donor_post_attach_payment' => 'give_customer_post_attach_payment', |
| 64 | 'give_donor_pre_remove_payment' => 'give_customer_pre_remove_payment', |
| 65 | 'give_donor_post_remove_payment' => 'give_customer_post_remove_payment', |
| 66 | 'give_donor_pre_increase_donation_count' => 'give_customer_pre_increase_purchase_count', |
| 67 | 'give_donor_post_increase_donation_count' => 'give_customer_post_increase_purchase_count', |
| 68 | 'give_donor_pre_decrease_donation_count' => 'give_customer_pre_decrease_purchase_count', |
| 69 | 'give_donor_post_decrease_donation_count' => 'give_customer_post_decrease_purchase_count', |
| 70 | 'give_donor_pre_increase_value' => 'give_customer_pre_increase_value', |
| 71 | 'give_donor_post_increase_value' => 'give_customer_post_increase_value', |
| 72 | 'give_donor_pre_decrease_value' => 'give_customer_pre_decrease_value', |
| 73 | 'give_donor_post_decrease_value' => 'give_customer_post_decrease_value', |
| 74 | 'give_donor_pre_add_note' => 'give_customer_pre_add_note', |
| 75 | 'give_donor_post_add_note' => 'give_customer_post_add_note', |
| 76 | 'give_donor_pre_add_email' => 'give_customer_pre_add_email', |
| 77 | 'give_donor_post_add_email' => 'give_customer_post_add_email', |
| 78 | 'give_donor_pre_remove_email' => 'give_customer_pre_remove_email', |
| 79 | 'give_donor_post_remove_email' => 'give_customer_post_remove_email', |
| 80 | 'give_donor_pre_set_primary_email' => 'give_customer_pre_set_primary_email', |
| 81 | 'give_donor_post_set_primary_email' => 'give_customer_post_set_primary_email', |
| 82 | 'give_donation_form_top' => 'give_checkout_form_top', |
| 83 | 'give_donation_form_bottom' => 'give_checkout_form_bottom', |
| 84 | 'give_donor_delete_top' => 'give_customer_delete_top', |
| 85 | 'give_donor_delete_bottom' => 'give_customer_delete_bottom', |
| 86 | 'give_donor_delete_inputs' => 'give_customer_delete_inputs', |
| 87 | 'give_pre_insert_donor_note' => 'give_pre_insert_customer_note', |
| 88 | 'give_pre_delete_donor' => 'give_pre_delete_customer', |
| 89 | 'give_post_add_donor_email' => 'give_post_add_customer_email', |
| 90 | 'give_update_edited_donation' => 'give_update_edited_purchase', |
| 91 | 'give_updated_edited_donation' => 'give_updated_edited_purchase', |
| 92 | 'give_pre_complete_donation' => 'give_pre_complete_purchase', |
| 93 | 'give_profile_editor_after_email' => 'give_profile_editor_address', |
| 94 | 'give_pre_refunded_payment' => 'give_pre_refund_payment', |
| 95 | 'give_post_refunded_payment' => 'give_post_refund_payment', |
| 96 | 'give_view_donation_details_billing_before' => 'give_view_order_details_billing_before', |
| 97 | 'give_view_donation_details_billing_after' => 'give_view_order_details_billing_after', |
| 98 | 'give_view_donation_details_main_before' => 'give_view_order_details_main_before', |
| 99 | 'give_view_donation_details_main_after' => 'give_view_order_details_main_after', |
| 100 | 'give_view_donation_details_form_top' => 'give_view_order_details_form_top', |
| 101 | 'give_view_donation_details_form_bottom' => 'give_view_order_details_form_bottom', |
| 102 | 'give_view_donation_details_before' => 'give_view_order_details_before', |
| 103 | 'give_view_donation_details_after' => 'give_view_order_details_after', |
| 104 | 'give_view_donation_details_donor_before' => 'give_view_order_details_files_after', |
| 105 | 'give_view_donation_details_sidebar_before' => 'give_view_order_details_sidebar_before', |
| 106 | 'give_view_donation_details_sidebar_after' => 'give_view_order_details_sidebar_after', |
| 107 | 'give_view_donation_details_totals_before' => 'give_view_order_details_totals_before', |
| 108 | 'give_view_donation_details_totals_after' => 'give_view_order_details_totals_after', |
| 109 | 'give_view_donation_details_update_before' => 'give_view_order_details_update_before', |
| 110 | 'give_view_donation_details_update_after' => 'give_view_order_details_update_after', |
| 111 | 'give_view_donation_details_payment_meta_before' => 'give_view_order_details_payment_meta_before', |
| 112 | 'give_view_donation_details_payment_meta_after' => 'give_view_order_details_payment_meta_after', |
| 113 | 'give_view_donation_details_update_inner' => 'give_view_order_details_update_inner', |
| 114 | 'give_donor_delete' => 'give_process_donor_deletion', |
| 115 | 'give_delete_donor' => 'give_process_donor_deletion', |
| 116 | 'give_checkout_login_fields_before' => 'give_donation_form_login_fields_before', |
| 117 | 'give_checkout_login_fields_after' => 'give_donation_form_login_fields_after', |
| 118 | ); |
| 119 | |
| 120 | return $give_deprecated_actions; |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * Deprecated action mapping. |
| 125 | * |
| 126 | * @param mixed $data |
| 127 | * @param string $arg_1 |
| 128 | * @param string $arg_2 |
| 129 | * @param string $arg_3 |
| 130 | * |
| 131 | * @return mixed|void |
| 132 | */ |
| 133 | function give_deprecated_action_mapping( $data, $arg_1 = '', $arg_2 = '', $arg_3 = '' ) { |
| 134 | $give_map_deprecated_actions = give_deprecated_actions(); |
| 135 | $action = current_filter(); |
| 136 | |
| 137 | if ( isset( $give_map_deprecated_actions[ $action ] ) ) { |
| 138 | if ( has_action( $give_map_deprecated_actions[ $action ] ) ) { |
| 139 | do_action( $give_map_deprecated_actions[ $action ], $data, $arg_1, $arg_2, $arg_3 ); |
| 140 | |
| 141 | if ( ! defined( 'DOING_AJAX' ) ) { |
| 142 | // translators: %s: action name. |
| 143 | _give_deprecated_function( sprintf( __( 'The %s action' ), $give_map_deprecated_actions[ $action ] ), '1.7', $action ); |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | } |
| 148 |