woocommerce
Last commit date
assets
5 years ago
i18n
5 years ago
includes
5 years ago
packages
5 years ago
sample-data
7 years ago
src
5 years ago
templates
5 years ago
vendor
5 years ago
license.txt
6 years ago
readme.txt
5 years ago
uninstall.php
6 years ago
woocommerce.php
5 years ago
woocommerce.php
62 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: WooCommerce |
| 4 | * Plugin URI: https://woocommerce.com/ |
| 5 | * Description: An eCommerce toolkit that helps you sell anything. Beautifully. |
| 6 | * Version: 4.7.1 |
| 7 | * Author: Automattic |
| 8 | * Author URI: https://woocommerce.com |
| 9 | * Text Domain: woocommerce |
| 10 | * Domain Path: /i18n/languages/ |
| 11 | * Requires at least: 5.3 |
| 12 | * Requires PHP: 7.0 |
| 13 | * |
| 14 | * @package WooCommerce |
| 15 | */ |
| 16 | |
| 17 | defined( 'ABSPATH' ) || exit; |
| 18 | |
| 19 | if ( ! defined( 'WC_PLUGIN_FILE' ) ) { |
| 20 | define( 'WC_PLUGIN_FILE', __FILE__ ); |
| 21 | } |
| 22 | |
| 23 | // Load core packages and the autoloader. |
| 24 | require __DIR__ . '/src/Autoloader.php'; |
| 25 | require __DIR__ . '/src/Packages.php'; |
| 26 | |
| 27 | if ( ! \Automattic\WooCommerce\Autoloader::init() ) { |
| 28 | return; |
| 29 | } |
| 30 | \Automattic\WooCommerce\Packages::init(); |
| 31 | |
| 32 | // Include the main WooCommerce class. |
| 33 | if ( ! class_exists( 'WooCommerce', false ) ) { |
| 34 | include_once dirname( WC_PLUGIN_FILE ) . '/includes/class-woocommerce.php'; |
| 35 | } |
| 36 | |
| 37 | // Initialize dependency injection. |
| 38 | $GLOBALS['wc_container'] = new Automattic\WooCommerce\Container(); |
| 39 | |
| 40 | /** |
| 41 | * Returns the main instance of WC. |
| 42 | * |
| 43 | * @since 2.1 |
| 44 | * @return WooCommerce |
| 45 | */ |
| 46 | function WC() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid |
| 47 | return WooCommerce::instance(); |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Returns the WooCommerce PSR11-compatible object container. |
| 52 | * Code in the `includes` directory should use the container to get instances of classes in the `src` directory. |
| 53 | * |
| 54 | * @return \Psr\Container\ContainerInterface The WooCommerce PSR11 container. |
| 55 | */ |
| 56 | function wc_get_container() : \Psr\Container\ContainerInterface { |
| 57 | return $GLOBALS['wc_container']; |
| 58 | } |
| 59 | |
| 60 | // Global for backwards compatibility. |
| 61 | $GLOBALS['woocommerce'] = WC(); |
| 62 |