swissChili | f0cbdc3 | 2023-01-05 17:21:38 -0500 | [diff] [blame^] | 1 | <?php |
| 2 | |
| 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | exit; // Exit if accessed directly. |
| 5 | } |
| 6 | |
| 7 | use Automattic\WooCommerce\Admin\Notes\Note; |
| 8 | use Automattic\WooCommerce\Admin\Notes\Notes; |
| 9 | use Automattic\WooCommerce\Admin\Notes\WC_Admin_Note; |
| 10 | use Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes; |
| 11 | |
| 12 | /** |
| 13 | * Util class for handling compatibilities with different versions of WooCommerce core. |
| 14 | */ |
| 15 | class WC_Stripe_Woo_Compat_Utils { |
| 16 | /** |
| 17 | * Return non-deprecated class for instantiating WC-Admin notes. |
| 18 | * |
| 19 | * @return string |
| 20 | */ |
| 21 | public static function get_note_class() { |
| 22 | if ( class_exists( 'Automattic\WooCommerce\Admin\Notes\Note' ) ) { |
| 23 | return Note::class; |
| 24 | } |
| 25 | |
| 26 | return WC_Admin_Note::class; |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * Return non-deprecated class for instantiating WC-Admin notes. |
| 31 | * |
| 32 | * @return string |
| 33 | */ |
| 34 | public static function get_notes_class() { |
| 35 | if ( class_exists( 'Automattic\WooCommerce\Admin\Notes\Notes' ) ) { |
| 36 | return Notes::class; |
| 37 | } |
| 38 | |
| 39 | return WC_Admin_Notes::class; |
| 40 | } |
| 41 | } |