roles ) ) { return false; } // Make sure Jetpack is installed and active if ( ! Jetpack::is_active() ) { return false; } /** * Make sure WooCommerce is installed and active * * This action is documented in https://docs.woocommerce.com/document/create-a-plugin */ if ( ! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', Jetpack::get_active_plugins() ) ) ) { return false; } // Ensure the WooCommerce class exists and is a valid version $minimum_woocommerce_active = class_exists( 'WooCommerce' ) && version_compare( WC_VERSION, '3.0', '>=' ); if ( ! $minimum_woocommerce_active ) { return false; } return true; } /** * This is our constructor, which is private to force the use of get_instance() * * @return void */ private function __construct() { $analytics = new Jetpack_WooCommerce_Analytics_Universal(); } /** * Function to instantiate our class and make it a singleton */ public static function get_instance() { if ( ! Jetpack_WooCommerce_Analytics::shouldTrackStore() ) { return; } if ( ! self::$instance ) { self::$instance = new self(); } return self::$instance; } } global $jetpack_woocommerce_analytics; $jetpack_woocommerce_analytics = Jetpack_WooCommerce_Analytics::get_instance();