PluginProbe
WooCommerce Analytics / 0.9.6
WooCommerce Analytics v0.9.6
0.9.16 0.9.15 trunk 0.9.10 0.9.11 0.9.12 0.9.13 0.9.14 0.9.3 0.9.4 0.9.5 0.9.6 0.9.7 0.9.8 0.9.9
woocommerce-analytics / woocommerce-analytics.php

woocommerce-analytics.php in WooCommerce Analytics 0.9.6, at woocommerce-analytics.php

92 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: WooCommerce Analytics
4 * Plugin URI: https://woocommerce.com
5 * Description: Unlock actionable insights to boost sales and maximize your marketing ROI with WooCommerce Analytics.
6 * Version: 0.9.6
7 * Author: WooCommerce
8 * Author URI: https://woocommerce.com/
9 * Text Domain: woocommerce-analytics
10 *
11 * Requires Plugins: woocommerce
12 * Requires PHP: 7.4
13 * Tested up to: 6.7
14 * Requires at least: 6.5
15 * WC tested up to: 9.6
16 * WC requires at least: 9.0
17 *
18 * License: GNU General Public License v3.0
19 * License URI: https://www.gnu.org/licenses/gpl-3.0.html
20 */
21
22 use Automattic\WooCommerce\Analytics\Autoloader;
23 use Automattic\WooCommerce\Analytics\Internal\Plugin;
24 use Automattic\WooCommerce\Utilities\FeaturesUtil;
25
26 defined( 'ABSPATH' ) || exit;
27
28 define( 'WC_ANALYTICS_VERSION', '0.9.6' ); // WRCS: DEFINED_VERSION.
29 define( 'WC_ANALYTICS_MIN_PHP_VER', '7.4' );
30 define( 'WC_ANALYTICS_MIN_WC_VER', '9.0.0' );
31 define( 'WC_ANALYTICS_FILE', __FILE__ );
32 define( 'WC_ANALYTICS_ABSPATH', plugin_dir_path( __FILE__ ) );
33
34 // Load and initialize the autoloader.
35 require_once __DIR__ . '/src/Autoloader.php';
36 if ( ! Autoloader::init() ) {
37 return;
38 }
39
40 // Declare compatibility with HPOS.
41 add_action(
42 'before_woocommerce_init',
43 function () {
44 if ( class_exists( FeaturesUtil::class ) ) {
45 FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__ );
46 }
47 }
48 );
49
50 /**
51 * Global function to get the plugin instance.
52 *
53 * @return Plugin
54 */
55 function woocommerce_analytics(): Plugin {
56 return Plugin::get_instance();
57 }
58
59 // Hook much of our plugin after WooCommerce is loaded.
60 add_action(
61 'woocommerce_loaded',
62 function () {
63 woocommerce_analytics()->register();
64 }
65 );
66
67 /**
68 * Check if WC_Site_Tracking exits and if not, create an alias for it.
69 * This is needed to avoid fatals when sending or opening email notes.
70 * See https://github.com/woocommerce/woocommerce/pull/51525 that is not yet released.
71 */
72 add_action(
73 'plugins_loaded',
74 function () {
75 if ( class_exists( 'WC_Site_Tracking' ) && ! class_exists( 'Automattic\WooCommerce\Admin\Notes\WC_Site_Tracking' ) ) {
76 class_alias( 'WC_Site_Tracking', 'Automattic\WooCommerce\Admin\Notes\WC_Site_Tracking' );
77 }
78 },
79 5
80 );
81
82
83 // Allow WooCommerce core to ask about translations updates for our plugin.
84 add_filter( 'woocommerce_translations_updates_for_woocommerce-analytics', '__return_true' );
85
86 register_activation_hook(
87 __FILE__,
88 function () {
89 woocommerce_analytics()->activate();
90 }
91 );
92