From b825eee471fbf54365ce81b3784f97d339912f53 Mon Sep 17 00:00:00 2001 From: Scott Kingsley Clark Date: Mon, 2 Oct 2023 13:20:37 -0500 Subject: [PATCH] Move tribe() compatibility into a file that loads during plugins_loaded and add additional checks to prevent loading during plugin activation --- classes/PodsInit.php | 2 ++ includes/compatibility.php | 35 +++++++++++++++++++++++++++++++++++ includes/general.php | 23 ----------------------- 3 files changed, 37 insertions(+), 23 deletions(-) create mode 100644 includes/compatibility.php diff --git a/classes/PodsInit.php b/classes/PodsInit.php index d2fd10aa73..cb1356707a 100644 --- a/classes/PodsInit.php +++ b/classes/PodsInit.php @@ -2438,6 +2438,8 @@ public function run() { // Compatibility for Query Monitor conditionals add_filter( 'query_monitor_conditionals', array( $this, 'filter_query_monitor_conditionals' ) ); + + require_once PODS_DIR . 'includes/compatibility.php'; } /** diff --git a/includes/compatibility.php b/includes/compatibility.php new file mode 100644 index 0000000000..cf55959251 --- /dev/null +++ b/includes/compatibility.php @@ -0,0 +1,35 @@ +register( $provider_class ); } - -// Add backwards compatibility for tribe() for old add-ons that may still call it. -if ( - ! function_exists( 'tribe_is_not_min_php_version' ) - && ! function_exists( 'tribe' ) -) { - /** - * Compatibility function for Pods 2.x add-ons that may still call tribe(). - * - * @since 3.0.5 - * - * @param string|null $slug_or_class Either the slug of a binding previously registered using singleton or - * register or the full class name that should be automagically created or - * `null` to get the container instance itself. - * - * @return mixed|null The pods_container() object or null if the function does not exist yet. - */ - function tribe( $slug_or_class = null ) { - _doing_it_wrong( 'tribe', 'tribe() is no longer included in Pods Framework directly. Please use pods_container() instead.', '3.0' ); - - return pods_container( $slug_or_class ); - } -}