-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwme-sitebuilder.php
65 lines (54 loc) · 1.88 KB
/
wme-sitebuilder.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
* Plugin Name: WME Sitebuilder
* Plugin URI: https://stellarwp.com
* Description: Easily build and configure a site.
* Version: 2.0.0
* Author: Modern Tribe Incubator Team
* Author URI: https://tri.be/
* Text Domain: wme-sitebuilder
* Domain Path: /languages
* License: MIT
* License URI: https://opensource.org/licenses/MIT.
*/
namespace Tribe\WME\Sitebuilder;
use Tribe\WME\Sitebuilder\Exceptions\SitebuilderException;
use Tribe\WME\Sitebuilder\Services\Logger;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// At this time, the plugin doesn't need to do anything if WordPress is currently installing.
if ( defined( 'WP_INSTALLING' ) && WP_INSTALLING ) {
return;
}
// The version of the WME Sitebuilder Managed Apps plugin.
define( __NAMESPACE__ . '\PLUGIN_VERSION', '2.0.0' );
define( __NAMESPACE__ . '\PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( __NAMESPACE__ . '\PLUGIN_DIR', __DIR__ . '/wme-sitebuilder/' );
define( __NAMESPACE__ . '\VENDOR_DIR', __DIR__ . '/wme-sitebuilder/vendor/' );
// Initialize the plugin.
try {
// If the Container already exists, another package is including this
// as a composer dependency, and we don't need to require the autoload file.
if ( ! class_exists( Container::class ) ) {
require_once VENDOR_DIR . 'autoload.php';
}
/** @var Plugin $wme_sitebuilder */
$wme_sitebuilder = Container::getInstance()->get( Plugin::class );
$wme_sitebuilder->registerModules([
Modules\SiteBuilder::class,
Modules\StoreDetails::class,
]);
$wme_sitebuilder->init();
} catch ( \Exception $e ) {
$message = $e instanceof SitebuilderException
? 'WME Sitebuilder generated an error: %s'
: 'WME Sitebuilder caught the following error: %s';
/** @var Logger $logger */
$logger = Container::getInstance()
->get( Logger::class );
$logger->error(sprintf( $message, $e->getMessage() ), [
'exception' => $e,
]);
}