| @@ -87,4 +87,39 @@ | ||
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | // phpcs:enable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound |
| 91 | + | |
| 92 | +// --------------------------------------------------------------------------- | |
| 93 | +// Legacy filters (deprecated hook names bridged onto canonical ones) | |
| 94 | +// --------------------------------------------------------------------------- | |
| 95 | + | |
| 96 | +if ( ! function_exists( 'subscrpt_legacy_split_payment_next_due_date' ) ) { | |
| 97 | + /** | |
| 98 | + * Bridge the deprecated `subscrpt_split_payment_next_due_date` filter. | |
| 99 | + * | |
| 100 | + * The split-payment-scoped hook was replaced by the general-purpose | |
| 101 | + * `subscrpt_subscription_next_date`. Any code still hooking the old name keeps | |
| 102 | + * working (with a deprecation notice) via this bridge. | |
| 103 | + * | |
| 104 | + * @deprecated 1.11.0 Use the `subscrpt_subscription_next_date` filter instead. | |
| 105 | + * | |
| 106 | + * @param int|null $next_date Computed next payment timestamp, or null. | |
| 107 | + * @param int $subscription_id Subscription ID. | |
| 108 | + * @param string $recurr_timing Recurring timing string. | |
| 109 | + * @param string $type Subscription history type. | |
| 110 | + * | |
| 111 | + * @return int|null | |
| 112 | + */ | |
| 113 | + function subscrpt_legacy_split_payment_next_due_date( $next_date, $subscription_id, $recurr_timing, $type ) { | |
| 114 | + if ( has_filter( 'subscrpt_split_payment_next_due_date' ) ) { | |
| 115 | + $next_date = apply_filters_deprecated( | |
| 116 | + 'subscrpt_split_payment_next_due_date', | |
| 117 | + [ $next_date, $subscription_id, $recurr_timing, $type ], | |
| 118 | + '1.11.0', | |
| 119 | + 'subscrpt_subscription_next_date' | |
| 120 | + ); | |
| 121 | + } | |
| 122 | + return $next_date; | |
| 123 | + } | |
| 124 | +} | |
| 125 | +add_filter( 'subscrpt_subscription_next_date', 'subscrpt_legacy_split_payment_next_due_date', 5, 4 ); | |