-
Notifications
You must be signed in to change notification settings - Fork 1
/
load-package.php
48 lines (40 loc) · 1015 Bytes
/
load-package.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* This file is designed to be used to load as package NOT a WP plugin!
*
* @version 4.0.0-beta.3
* @package CoCart
*/
defined( 'ABSPATH' ) || exit;
if ( version_compare( PHP_VERSION, '7.3', '<' ) ) {
return;
}
if ( ! defined( 'COCART_FILE' ) ) {
define( 'COCART_FILE', __FILE__ );
}
// Load the autoloader.
require __DIR__ . '/src/autoloader.php';
if ( ! CoCart\Autoloader::init() ) {
return;
}
// Include the main CoCart class.
if ( ! class_exists( 'CoCart\Core', false ) ) {
include_once untrailingslashit( plugin_dir_path( COCART_FILE ) ) . '/includes/classes/class-cocart.php';
}
/**
* Returns the main instance of CoCart and only runs if it does not already exists.
*
* @since 2.1.0 Introduced.
* @since 4.0.0 Updated to Namespaces.
*
* @return CoCart
*/
if ( ! function_exists( 'CoCart' ) ) {
/**
* Initialize CoCart.
*/
function CoCart() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
return CoCart\Core::init();
}
CoCart();
}