instance(); return; } // Attempt to avoid fatals in older ET versions. add_action( 'init', static function() { remove_all_filters( 'tribe_events_tickets_attendee_registration_modal_content' ); remove_filter( 'tribe_tickets_commerce_paypal_add_to_cart_args', tribe_callback( 'tickets.attendee_registration.meta', 'add_product_delete_to_paypal_url' ), 10, 1 ); } ); // if we have the plugin register the dependency check will handle the messages if ( class_exists( 'Tribe__Abstract_Plugin_Register' ) ) { new Tribe__Tickets_Plus__PUE( __FILE__ ); return; } add_action( 'admin_notices', 'event_tickets_plus_show_fail_message' ); add_action( 'network_admin_notices', 'event_tickets_plus_show_fail_message' ); } add_action( 'tribe_common_loaded', 'event_tickets_plus_init' ); /** * Sets up the textdomain stuff */ function event_tickets_plus_setup_textdomain() { if ( defined( 'EVENT_TICKETS_PLUS_TEXTDOMAIN_LOADED' ) && EVENT_TICKETS_PLUS_TEXTDOMAIN_LOADED ) { return; } $mopath = trailingslashit( basename( dirname( __FILE__ ) ) ) . 'lang/'; $domain = 'event-tickets-plus'; // If we don't have Common classes load the old fashioned way if ( ! class_exists( 'Tribe__Main' ) ) { load_plugin_textdomain( $domain, false, $mopath ); } else { // This will load `wp-content/languages/plugins` files first Tribe__Main::instance()->load_text_domain( $domain, $mopath ); } define( 'EVENT_TICKETS_PLUS_TEXTDOMAIN_LOADED', true ); } /** * Requires the autoloader class from the main plugin class and sets up autoloading. * * @since 4.12.1 Added support for namespaced classes to autoload. */ function tribe_init_tickets_plus_autoloading() { if ( ! class_exists( 'Tribe__Autoloader' ) ) { return; } $autoloader = Tribe__Autoloader::instance(); // For class names with `__` string separator. $autoloader->register_prefix( 'Tribe__Tickets_Plus__', __DIR__ . '/src/Tribe', 'event-tickets-plus' ); // For namespaced classes. $autoloader->register_prefix( '\\Tribe\\Tickets\\Plus\\', __DIR__ . '/src/Tribe', 'event-tickets-plus-ns' ); $autoloader->register_autoloader(); $plugin_path = trailingslashit( EVENT_TICKETS_PLUS_DIR ); require_once( $plugin_path . 'src/functions/template-tags.php' ); tribe_singleton( 'tickets-plus.main', 'Tribe__Tickets_Plus__Main' ); } /** * Shows an admin_notices message explaining why it couldn't be activated. */ function event_tickets_plus_show_fail_message() { event_tickets_plus_setup_textdomain(); if ( ! current_user_can( 'activate_plugins' ) ) return; $url = add_query_arg( array( 'tab' => 'plugin-information', 'plugin' => 'event-tickets', 'TB_iframe' => 'true', ), admin_url( 'plugin-install.php' ) ); $title = esc_html__( 'Event Tickets', 'event-tickets-plus' ); echo '

'; printf( esc_html__( 'To begin using Event Tickets Plus, please install and activate the latest version of %1$s%2$s%3$s and ensure its own requirements have been met.', 'event-tickets-plus' ), '', $title, '' ); echo '

'; } /** * Whether the current version is incompatible with the installed and active The Events Calendar * * @deprecated 4.10 * * @return bool */ function event_tickets_plus_is_incompatible_tickets_core_installed() { _deprecated_function( __FUNCTION__, '4.10', '' ); if ( ! class_exists( 'Tribe__Tickets__Main' ) ) { return true; } if ( ! class_exists( 'Tribe__Tickets_Plus__Main' ) ) { return true; } if ( ! version_compare( Tribe__Tickets__Main::VERSION, Tribe__Tickets_Plus__Main::REQUIRED_TICKETS_VERSION, '>=' ) ) { return true; } return false; } /** * Hooks up the failure message. * * @deprecated 4.10 */ function event_tickets_plus_setup_fail_message() { _deprecated_function( __FUNCTION__, '4.10', '' ); add_action( 'admin_notices', 'event_tickets_plus_show_fail_message' ); } /** * Last ditch effort to display an error message in the event that Event Tickets didn't even load * far enough to fire tribe_tickets_plugin_loaded or tribe_tickets_plugin_failed_to_load * * @deprecated 4.10 */ function event_tickets_plus_check_for_init_failure() { _deprecated_function( __FUNCTION__, '4.10', '' ); if ( defined( 'EVENT_TICKETS_PLUS_TEXTDOMAIN_LOADED' ) && EVENT_TICKETS_PLUS_TEXTDOMAIN_LOADED ) { return; } event_tickets_plus_setup_fail_message(); }