set_basename( false, __FILE__ ); } else { if ( !function_exists( 'aet_fs' ) ) { // Create a helper function for easy SDK access. function aet_fs() { global $aet_fs; if ( !isset( $aet_fs ) ) { // Include Freemius SDK. require_once dirname( __FILE__ ) . '/freemius/start.php'; // @phpstan-ignore-next-line $aet_fs = fs_dynamic_init( array( 'id' => '3475', 'slug' => 'advance-ecommerce-tracking', 'type' => 'plugin', 'public_key' => 'pk_0dbe70558f17f7a0881498011f656', 'is_premium' => false, 'premium_suffix' => 'Premium', 'has_addons' => false, 'has_paid_plans' => true, 'has_affiliation' => 'selected', 'menu' => array( 'slug' => 'aet-et-settings', 'first-path' => 'admin.php?page=aet-et-settings', 'contact' => false, 'support' => false, 'network' => true, ), 'is_live' => true, 'is_org_compliant' => true, ) ); } return $aet_fs; } // Init Freemius. aet_fs(); // Signal that SDK was initiated. do_action( 'aet_fs_loaded' ); aet_fs()->get_upgrade_url(); aet_fs()->add_action( 'after_uninstall', 'aet_fs_uninstall_cleanup' ); } } /** * Currently plugin version. * Start at version 3.0 and use SemVer - https://semver.org * Rename this for your plugin and update it as you release new versions. */ if ( !defined( 'AET_VERSION' ) ) { define( 'AET_VERSION', '3.8.3' ); } if ( !defined( 'AET_PLUGIN_URL' ) ) { define( 'AET_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); } if ( !defined( 'AET_PLUGIN_DIR' ) ) { define( 'AET_PLUGIN_DIR', dirname( __FILE__ ) ); } if ( !defined( 'AET_PLUGIN_DIR_PATH' ) ) { define( 'AET_PLUGIN_DIR_PATH', plugin_dir_path( __FILE__ ) ); } if ( !defined( 'AET_PLUGIN_NAME' ) ) { define( 'AET_PLUGIN_NAME', 'Ecommerce Tracking' ); } if ( !defined( 'AET_VERSION_NAME' ) ) { define( 'AET_VERSION_NAME', 'Free Version' ); } if ( !defined( 'DEBUG_OPTION' ) ) { define( 'DEBUG_OPTION', false ); } // Define plugin basename constant if ( !defined( 'AET_PRO_PLUGIN_BASENAME' ) ) { define( 'AET_PRO_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); } if ( !defined( 'AET_STORE_URL' ) ) { define( 'AET_STORE_URL', 'https://www.thedotstore.com/' ); } /** * The code that runs during plugin activation. * This action is documented in includes/class-advance-ecommerce-tracking-activator.php */ if ( !function_exists( 'activate_advance_ecommerce_tracking' ) ) { function activate_advance_ecommerce_tracking() { require_once plugin_dir_path( __FILE__ ) . 'includes/class-advance-ecommerce-tracking-activator.php'; Advance_Ecommerce_Tracking_Activator::activate(); } } /** * The code that runs during plugin deactivation. * This action is documented in includes/class-advance-ecommerce-tracking-deactivator.php */ if ( !function_exists( 'deactivate_advance_ecommerce_tracking' ) ) { function deactivate_advance_ecommerce_tracking() { require_once plugin_dir_path( __FILE__ ) . 'includes/class-advance-ecommerce-tracking-deactivator.php'; Advance_Ecommerce_Tracking_Deactivator::deactivate(); } } register_activation_hook( __FILE__, 'activate_advance_ecommerce_tracking' ); register_deactivation_hook( __FILE__, 'deactivate_advance_ecommerce_tracking' ); /** * The core plugin class that is used to define internationalization, * admin-specific hooks, and public-facing site hooks. */ require plugin_dir_path( __FILE__ ) . 'includes/class-advance-ecommerce-tracking.php'; /** * Begins execution of the plugin. * * Since everything within the plugin is registered via hooks, * then kicking off the plugin from this point in the file does * not affect the page life cycle. * * @since 3.0 */ if ( !function_exists( 'run_advance_ecommerce_tracking' ) ) { function run_advance_ecommerce_tracking() { $plugin = new Advance_Ecommerce_Tracking(); $plugin->run(); } } add_action( 'plugins_loaded', 'aet_plugin_init' ); if ( !function_exists( 'aet_plugin_init' ) ) { function aet_plugin_init() { /* Check if WooCommerce is Active */ $active_plugins = get_option( 'active_plugins', array() ); /* If this is a multisite installation, consider network-wide plugins */ if ( is_multisite() ) { $network_active_plugins = get_site_option( 'active_sitewide_plugins', array() ); $active_plugins = array_merge( $active_plugins, array_keys( $network_active_plugins ) ); $active_plugins = array_unique( $active_plugins ); /* If WooCommerce is not active, display an admin notice and deactivate this plugin */ if ( !in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', $active_plugins ), true ) ) { add_action( 'admin_notices', 'aet_plugin_admin_notice' ); add_action( 'admin_init', 'aet_deactivate_plugin' ); } else { /* If WooCommerce is active, run advance eCommerce tracking */ run_advance_ecommerce_tracking(); } } else { /* For non-multisite installations, check if WooCommerce is active */ if ( !in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ), true ) ) { /* If WooCommerce is not active, display an admin notice and deactivate this plugin */ add_action( 'admin_notices', 'aet_plugin_admin_notice' ); add_action( 'admin_init', 'aet_deactivate_plugin' ); } else { /* If WooCommerce is active, run advance eCommerce tracking */ run_advance_ecommerce_tracking(); } } /* Load the plugin's text domain for localization */ load_plugin_textdomain( 'advance-ecommerce-tracking', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); } } /** * Show admin notice in case of WooCommerce plguin is missing */ if ( !function_exists( 'aet_plugin_admin_notice' ) ) { function aet_plugin_admin_notice() { $aet_plugin = AET_PLUGIN_NAME; $wc_plugin = 'WooCommerce'; echo '
' . sprintf( wp_kses_post( '%1$s is deactivated as it requires %2$s to be installed and active.' ), '' . esc_html( $aet_plugin ) . '', '' . esc_html( $wc_plugin ) . '' ) . '
'; echo '' . esc_html( $aet_plugin ) . ': '; echo sprintf( wp_kses_post( __( 'Same functionality plugin found: Google Site Kit is also active. It may conflict with analytics reports. We recommend disabling one of them.', 'advance-ecommerce-tracking' ) ), esc_url( $site_kit_url ) ); echo ' ' . esc_html__( 'Dismiss', 'advance-ecommerce-tracking' ) . ''; echo '