暫無描述

woocommerce.php 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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: 5.7.2
  7. * Author: Automattic
  8. * Author URI: https://woocommerce.com
  9. * Text Domain: woocommerce
  10. * Domain Path: /i18n/languages/
  11. * Requires at least: 5.6
  12. * Requires PHP: 7.0
  13. *
  14. * @package WooCommerce
  15. */
  16. defined( 'ABSPATH' ) || exit;
  17. if ( ! defined( 'WC_PLUGIN_FILE' ) ) {
  18. define( 'WC_PLUGIN_FILE', __FILE__ );
  19. }
  20. // Load core packages and the autoloader.
  21. require __DIR__ . '/src/Autoloader.php';
  22. require __DIR__ . '/src/Packages.php';
  23. if ( ! \Automattic\WooCommerce\Autoloader::init() ) {
  24. return;
  25. }
  26. \Automattic\WooCommerce\Packages::init();
  27. // Include the main WooCommerce class.
  28. if ( ! class_exists( 'WooCommerce', false ) ) {
  29. include_once dirname( WC_PLUGIN_FILE ) . '/includes/class-woocommerce.php';
  30. }
  31. // Initialize dependency injection.
  32. $GLOBALS['wc_container'] = new Automattic\WooCommerce\Container();
  33. /**
  34. * Returns the main instance of WC.
  35. *
  36. * @since 2.1
  37. * @return WooCommerce
  38. */
  39. function WC() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
  40. return WooCommerce::instance();
  41. }
  42. /**
  43. * Returns the WooCommerce PSR11-compatible object container.
  44. * Code in the `includes` directory should use the container to get instances of classes in the `src` directory.
  45. *
  46. * @since 4.4.0
  47. * @return \Psr\Container\ContainerInterface The WooCommerce PSR11 container.
  48. */
  49. function wc_get_container() : \Psr\Container\ContainerInterface {
  50. return $GLOBALS['wc_container'];
  51. }
  52. // Global for backwards compatibility.
  53. $GLOBALS['woocommerce'] = WC();