-
Notifications
You must be signed in to change notification settings - Fork 9
/
mantle.php
95 lines (84 loc) · 2.76 KB
/
mantle.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
/**
* Plugin Name: Mantle
* Plugin URI: https://github.com/alleyinteractive/mantle
* Description: A framework for powerful WordPress development
* Author: Alley
* Author URI: https://alley.com/
* Text Domain: mantle
* Domain Path: /languages
* Version: 0.1
*
* Mantle is a derivative work of Laravel by Taylor Otwell (licensed MIT).
*
* @package Mantle
*/
/**
* Mantle - A framework for powerful WordPress development.
*
* @link https://github.com/alleyinteractive/mantle/
*
* @author Alley Interactive
* @package Mantle
*/
namespace App;
use Mantle\Framework\Bootloader;
/*
|--------------------------------------------------------------------------
| Mantle Application Base Directory
|--------------------------------------------------------------------------
|
| This constant defines the base directory of the Mantle application. Mantle
| will use this location to base the storage and bootstrap paths for the
| application. By default, this will be `./storage/` and `./bootstrap/` but that
| can be configured.
|
*/
defined( 'MANTLE_BASE_DIR' ) || define( 'MANTLE_BASE_DIR', __DIR__ ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound
/*
|--------------------------------------------------------------------------
| Load Composer
|--------------------------------------------------------------------------
|
| Check if Composer has been installed and attempt to load it. You can remove
| this block of code if Composer is being loaded outside of the plugin.
|
*/
if ( ! class_exists( Bootloader::class ) ) {
if ( ! file_exists( __DIR__ . '/vendor/wordpress-autoload.php' ) ) {
add_action(
'admin_notices',
function () {
printf(
'<div class="notice notice-error"><p>%s</p></div>',
esc_html__( 'Mantle requires a `composer install` to run properly.', 'mantle' )
);
}
);
return;
} else {
require_once __DIR__ . '/vendor/wordpress-autoload.php';
}
}
/*
|--------------------------------------------------------------------------
| Load the Application
|--------------------------------------------------------------------------
|
| Load the Mantle application from the bootstrap file. This step is actually
| optional as Mantle can operate without any application kernel or configuration.
| This will allow you greater control over the application and make it feel more
| like a Laravel-esque application.
|
*/
$bootloader = require_once __DIR__ . '/bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Boot the Mantle Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can boot the application given the current
| context and let Mantle take it from here.
|
*/
$bootloader->boot();