-
Notifications
You must be signed in to change notification settings - Fork 6
/
wpemerge.php
57 lines (47 loc) 路 1.89 KB
/
wpemerge.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
<?php
/**
* Plugin Name: WP Emerge Starter Plugin
* Plugin URI: https://wpemerge.com/
* Description:
* Version: 0.17.0
* Requires at least: 4.7
* Requires PHP: 5.5.9
* Author: Atanas Angelov
* Author URI: https://atanas.dev/
* License: GPL-2.0-only
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: my_app
* Domain Path: /languages
*
* YOU SHOULD NORMALLY NOT NEED TO ADD ANYTHING HERE - any custom functionality unrelated
* to bootstrapping the theme should go into a service provider or a separate helper file
* (refer to the directory structure in README.md).
*
* @package MyApp
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Make sure we can load a compatible version of WP Emerge.
require_once __DIR__ . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'version.php';
$name = trim( get_file_data( __FILE__, [ 'Plugin Name' ] )[0] );
$load = my_app_should_load_wpemerge( $name, '0.17.0', '2.0.0' );
if ( ! $load ) {
// An incompatible WP Emerge version is already loaded - stop further execution.
// my_app_should_load_wpemerge() will automatically add an admin notice.
return;
}
define( 'MY_APP_PLUGIN_FILE', __FILE__ );
// Load composer dependencies.
$autoload = __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
if ( file_exists( $autoload ) ) {
require_once $autoload;
}
my_app_declare_loaded_wpemerge( $name, 'theme', __FILE__ );
// Load helpers.
require_once __DIR__ . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'MyApp.php';
require_once __DIR__ . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'helpers.php';
// Bootstrap plugin after all dependencies and helpers are loaded.
\MyApp::make()->bootstrap( require __DIR__ . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'config.php' );
// Register hooks.
require_once __DIR__ . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'hooks.php';