forked from bigcommerce/bigcommerce-for-wordpress
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbigcommerce.php
More file actions
66 lines (56 loc) · 1.84 KB
/
bigcommerce.php
File metadata and controls
66 lines (56 loc) · 1.84 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/*
Plugin Name: BigCommerce for WordPress
Description: Scale your ecommerce business with WordPress on the front-end and BigCommerce on the back end. Free up server resources from things like catalog management, processing payments, and managing fulfillment logistics.
Author: BigCommerce
Version: 3.12.0
Author URI: https://www.bigcommerce.com/wordpress
Requires PHP: 5.6.24
Text Domain: bigcommerce
License: GPLv2 or later
*/
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
require_once __DIR__ . '/vendor/autoload.php';
}
register_activation_hook( __FILE__, [ \BigCommerce\Plugin::class, 'activate' ] );
// Start the plugin
add_action( 'plugins_loaded', 'bigcommerce_init', 1, 0 );
/**
* @return \BigCommerce\Plugin
*/
function bigcommerce_init() {
$container = new \Pimple\Container( [ 'plugin_file' => __FILE__ ] );
$plugin = \BigCommerce\Plugin::instance( $container );
$plugin->init();
/**
* Fires after the plugin has initialized
*
* @param \BigCommerce\Plugin $plugin The global instance of the plugin controller
* @param \Pimple\Container $container The plugin's dependency injection container
*/
do_action( 'bigcommerce/init', $plugin, $container );
return $plugin;
}
function bigcommerce() {
try {
return \BigCommerce\Plugin::instance();
} catch ( \Exception $e ) {
return bigcommerce_init();
}
}
/**
* Look for a value in an environment variable, falling back
* to a constant. This allows configuration options to be set
* either in the environment or in wp-config.php.
*
* @param string $key The name of an environment variable or constant
*
* @return mixed The found value. false if not found.
*/
function bigcommerce_get_env( $key ) {
$value = getenv( $key, true ) ?: getenv( $key );
if ( $value === false && defined( $key ) ) {
$value = constant( $key );
}
return $value;
}