-
Notifications
You must be signed in to change notification settings - Fork 1
/
basic-composer.php
48 lines (40 loc) · 1.21 KB
/
basic-composer.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
<?php
/**
* Plugin Name: Basic Composer
* Plugin URI:https://github.com/surrealwebs/basic-composer
* Description: Plugin built to demonstrate Composer in a WordPress Plugin.
* Version: 1.0.0
* Author: Adam Richards <[email protected]>
* Author URI: https://adamhasawebsite.com/
* License: GPL-3.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Text Domain: basic-composer
* Domain Path: /languages
*
* @package Surrealwebs\BasicComposer
*/
namespace Surrealwebs\BasicComposer;
use Surrealwebs\BasicComposer\Framework\Autoload;
use Surrealwebs\BasicComposer\Framework\Plugin;
require_once __DIR__ . '/src/app/framework/class-autoload.php';
$autoload = new Autoload();
$autoload->add( __NAMESPACE__, sprintf( '%s/src/app', __DIR__ ) );
/**
* Get an instance of the plugin object. Instantiate it if it doesn't exist.
*
* @return Plugin
*/
function get_plugin_instance(): Plugin {
static $basic_composer_plugin;
if ( is_null( $basic_composer_plugin ) ) {
$basic_composer_plugin = new Plugin( __FILE__ );
$basic_composer_plugin->init();
}
return $basic_composer_plugin;
}
// Start the plugin.
\add_action(
'after_setup_theme',
__NAMESPACE__ . '\\get_plugin_instance',
PHP_INT_MAX
);