-
Notifications
You must be signed in to change notification settings - Fork 2
/
init.php
66 lines (52 loc) · 1.32 KB
/
init.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
<?php
/**
* @noinspection PhpIncludeInspection
*/
namespace WP_Plugins\Boilerplate;
/**
* Plugin Name: WP Plugins Boilerplate
* Description: Plugin Description
* Version: 1.0.0
* Author: Nabeel Molham
* Author URI: http://nabeel.molham.me/
* Text Domain: wp-plugin-domain
* Domain Path: /languages
* License: GNU General Public License, version 3, http://www.gnu.org/licenses/gpl-3.0.en.html
*/
if ( ! defined( 'WPINC' ) ) {
// Exit if accessed directly
die();
}
/**
* Constants
*/
// plugin master file
if ( ! defined( 'WPPB_MAIN_FILE' ) ) {
define( 'WPPB_MAIN_FILE', __FILE__ );
}
// plugin DIR
if ( ! defined( 'WPPB_DIR' ) ) {
define( 'WPPB_DIR', plugin_dir_path( WPPB_MAIN_FILE ) );
}
// plugin URI
if ( ! defined( 'WPPB_URI' ) ) {
define( 'WPPB_URI', plugin_dir_url( WPPB_MAIN_FILE ) );
}
// plugin views DIR
if ( ! defined( 'WPPB_VIEWS_DIR' ) ) {
define( "WPPB_VIEWS_DIR", WPPB_DIR . 'views/' );
}
// localization text Domain
if ( ! defined( 'WPPB_DOMAIN' ) ) {
define( 'WPPB_DOMAIN', 'wp-plugin-domain' );
}
add_action( 'plugins_loaded', static function () {
// skip if plugin's main function already exists
if ( function_exists( 'wp_plugin_boilerplate' ) ) {
return;
}
// composer autoload
require_once __DIR__ . '/vendor/autoload.php';
// boot up the system
wp_plugin_boilerplate();
}, PHP_INT_MAX );