| 1 |
<?php |
| 2 |
/** |
| 3 |
* Legacy Compatibility Layer |
| 4 |
* |
| 5 |
* Re-declares old WP_SUBSCRIPTION_* constants and wp_-prefixed function names |
| 6 |
* as thin wrappers around the canonical SUBSCRPT_* equivalents. |
| 7 |
* |
| 8 |
* This file is loaded immediately after the canonical constants and functions |
| 9 |
* are defined, so Pro plugin and any third-party code that depends on the old |
| 10 |
* names continues to work without modification. |
| 11 |
* |
| 12 |
* @package Subscription |
| 13 |
*/ |
| 14 |
|
| 15 |
// don't call the file directly. |
| 16 |
if ( ! defined( 'ABSPATH' ) ) { |
| 17 |
exit; |
| 18 |
} |
| 19 |
|
| 20 |
// --------------------------------------------------------------------------- |
| 21 |
// Legacy constants (WP_SUBSCRIPTION_* → SUBSCRPT_*) |
| 22 |
// --------------------------------------------------------------------------- |
| 23 |
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound |
| 24 |
$subscrpt_legacy_constants = array( |
| 25 |
'WP_SUBSCRIPTION_VERSION' => SUBSCRPT_VERSION, |
| 26 |
'WP_SUBSCRIPTION_FILE' => SUBSCRPT_FILE, |
| 27 |
'WP_SUBSCRIPTION_PATH' => SUBSCRPT_PATH, |
| 28 |
'WP_SUBSCRIPTION_INCLUDES' => SUBSCRPT_INCLUDES, |
| 29 |
'WP_SUBSCRIPTION_TEMPLATES' => SUBSCRPT_TEMPLATES, |
| 30 |
'WP_SUBSCRIPTION_URL' => SUBSCRPT_URL, |
| 31 |
'WP_SUBSCRIPTION_ASSETS' => SUBSCRPT_ASSETS, |
| 32 |
); |
| 33 |
|
| 34 |
foreach ( $subscrpt_legacy_constants as $subscrpt_old_name => $subscrpt_new_value ) { |
| 35 |
if ( ! defined( $subscrpt_old_name ) ) { |
| 36 |
define( $subscrpt_old_name, $subscrpt_new_value ); |
| 37 |
} |
| 38 |
} |
| 39 |
unset( $subscrpt_legacy_constants, $subscrpt_old_name, $subscrpt_new_value ); |
| 40 |
// phpcs:enable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound |
| 41 |
|
| 42 |
// --------------------------------------------------------------------------- |
| 43 |
// Legacy functions (wp_-prefixed → subscrpt_-prefixed) |
| 44 |
// --------------------------------------------------------------------------- |
| 45 |
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound |
| 46 |
|
| 47 |
if ( ! function_exists( 'wp_subscrpt_write_log' ) ) { |
| 48 |
/** |
| 49 |
* @deprecated Use subscrpt_write_log() instead. |
| 50 |
*/ |
| 51 |
function wp_subscrpt_write_log( $message, bool $should_print = false ): void { |
| 52 |
_deprecated_function( 'wp_subscrpt_write_log', '1.9.2', 'subscrpt_write_log' ); |
| 53 |
subscrpt_write_log( $message, $should_print ); |
| 54 |
} |
| 55 |
} |
| 56 |
|
| 57 |
if ( ! function_exists( 'wp_subscrpt_write_debug_log' ) ) { |
| 58 |
/** |
| 59 |
* @deprecated Use subscrpt_write_debug_log() instead. |
| 60 |
*/ |
| 61 |
function wp_subscrpt_write_debug_log( $log ): void { |
| 62 |
_deprecated_function( 'wp_subscrpt_write_debug_log', '1.9.2', 'subscrpt_write_debug_log' ); |
| 63 |
|
| 64 |
subscrpt_write_debug_log( $log ); |
| 65 |
} |
| 66 |
} |
| 67 |
|
| 68 |
if ( ! function_exists( 'wp_subs_multiselect_field' ) ) { |
| 69 |
/** |
| 70 |
* @deprecated Use subscrpt_multiselect_field() instead. |
| 71 |
*/ |
| 72 |
function wp_subs_multiselect_field( $field ) { |
| 73 |
_deprecated_function( 'wp_subs_multiselect_field', '1.9.2', 'subscrpt_multiselect_field' ); |
| 74 |
|
| 75 |
subscrpt_multiselect_field( $field ); |
| 76 |
} |
| 77 |
} |
| 78 |
|
| 79 |
if ( ! function_exists( 'wp_subscription_register_paypal_block' ) ) { |
| 80 |
/** |
| 81 |
* @deprecated Use subscrpt_register_paypal_block() instead. |
| 82 |
*/ |
| 83 |
function wp_subscription_register_paypal_block() { |
| 84 |
_deprecated_function( 'wp_subscription_register_paypal_block', '1.9.2', 'subscrpt_register_paypal_block' ); |
| 85 |
|
| 86 |
subscrpt_register_paypal_block(); |
| 87 |
} |
| 88 |
} |
| 89 |
|
| 90 |
// phpcs:enable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound |
| 91 |
|