woocommerce/woocommerce.php

78 lines
2.4 KiB
PHP
Raw Normal View History

2011-08-10 17:11:11 +00:00
<?php
2012-03-20 13:22:35 +00:00
/**
* Plugin Name: WooCommerce
2016-07-05 22:52:16 +00:00
* Plugin URI: https://woocommerce.com/
* Description: An eCommerce toolkit that helps you sell anything. Beautifully.
2019-03-28 21:29:05 +00:00
* Version: 3.7.0-dev
2017-02-09 17:08:39 +00:00
* Author: Automattic
* Author URI: https://woocommerce.com
2012-03-20 13:22:35 +00:00
* Text Domain: woocommerce
* Domain Path: /i18n/languages/
2012-08-07 08:38:08 +00:00
*
2012-03-20 13:22:35 +00:00
* @package WooCommerce
*/
2019-01-23 16:19:40 +00:00
defined( 'ABSPATH' ) || exit;
2011-08-10 17:11:11 +00:00
if ( ! defined( 'WC_PLUGIN_FILE' ) ) {
define( 'WC_PLUGIN_FILE', __FILE__ );
}
/**
* Load all the packages.
*
* We want to fail gracefully if `composer install` has not been executed yet, so we are checking for the autoloader.
* If the autoloader is not present, let's log the failure and display a nice admin notice.
*/
$autoloader = dirname( __FILE__ ) . '/vendor/autoload_packages.php';
if ( is_readable( $autoloader ) ) {
require $autoloader;
} else {
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
error_log( // phpcs:ignore
esc_html__( 'Your installation of WooCommerce is incomplete. If you installed WooCommerce from GitHub, please refer to this document to set up your development environment: https://github.com/woocommerce/woocommerce/wiki/How-to-set-up-WooCommerce-development-environment', 'woocommerce' )
);
}
/**
* Outputs an admin notice for folks running WooCommerce without having run composer install.
*/
add_action(
'admin_notices',
function() {
?>
<div class="notice notice-error">
<p>
<?php
printf(
/* translators: 1: is a link to a support document. 2: closing link */
esc_html__( 'Your installation of WooCommerce is incomplete. If you installed WooCommerce from GitHub, %1$splease refer to this document%2$s to set up your development environment.', 'woocommerce' ),
'<a href="' . esc_url( 'https://github.com/woocommerce/woocommerce/wiki/How-to-set-up-WooCommerce-development-environment' ) . '" target="_blank" rel="noopener noreferrer">',
'</a>'
);
?>
</p>
</div>
<?php
}
);
return;
}
// Include the main WooCommerce class.
if ( ! class_exists( 'WooCommerce' ) ) {
include_once dirname( __FILE__ ) . '/includes/class-woocommerce.php';
}
/**
2019-01-23 16:19:40 +00:00
* Returns the main instance of WC.
*
* @since 2.1
2013-09-25 13:10:40 +00:00
* @return WooCommerce
*/
2019-02-18 11:55:36 +00:00
function WC() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
return WooCommerce::instance();
}
2011-12-08 12:50:50 +00:00
// Global for backwards compatibility.
2018-11-08 10:59:07 +00:00
$GLOBALS['woocommerce'] = WC();