-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathload.php
103 lines (90 loc) · 2.38 KB
/
load.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
96
97
98
99
100
101
102
103
<?php
/**
* Plugin initialization.
*
* @package Bandstand
* @copyright Copyright (c) 2016, AudioTheme, LLC
* @license GPL-2.0+
* @link https://audiotheme.com/
* @since 1.0.0
*/
use Bandstand\AJAX;
use Bandstand\Plugin;
use Bandstand\Module;
use Bandstand\Provider;
use Bandstand\Screen;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Load the autoloader.
*/
if ( file_exists( plugin_dir_path( __FILE__ ) . 'vendor/autoload.php' ) ) {
require( plugin_dir_path( __FILE__ ) . 'vendor/autoload.php' );
}
/**
* Retrieve the Bandstand plugin instance.
*
* @since 1.0.0
*
* @return \Bandstand\Plugin
*/
function bandstand() {
static $instance;
if ( null === $instance ) {
$instance = new Plugin();
}
return $instance;
}
$bandstand = bandstand()
->set_basename( plugin_basename( __FILE__ ) )
->set_directory( plugin_dir_path( __FILE__ ) )
->set_file( __DIR__ . '/bandstand.php' )
->set_slug( 'bandstand' )
->set_url( plugin_dir_url( __FILE__ ) );
/**
* Load functions and libraries.
*/
require( $bandstand->get_path( 'includes/functions.php' ) );
require( $bandstand->get_path( 'includes/general-template.php' ) );
/**
* Load admin functionality.
*/
if ( is_admin() ) {
require( $bandstand->get_path( 'admin/functions.php' ) );
}
$bandstand
->register_hooks( new Provider\Setup() )
->register_hooks( new Provider\Widgets() )
->register_hooks( new Provider\Assets() )
->register_hooks( new Provider\GeneralHooks() )
->register_hooks( new Provider\MediaHooks() )
->register_hooks( new Provider\TemplateHooks() )
->modules
->register( new Module\ArchivesModule( $bandstand ) )
->register( new Module\GigsModule( $bandstand ) )
->register( new Module\DiscographyModule( $bandstand ) )
->register( new Module\VideosModule( $bandstand ) );
if ( is_admin() ) {
$bandstand
->register_hooks( new Provider\UpgradeManager() )
->register_hooks( new Provider\AdminHooks() )
->register_hooks( new AJAX\Admin() )
->register_hooks( new Provider\AdminAssets() )
->register_hooks( new Screen\Dashboard\Main() )
->register_hooks( new Screen\Settings() )
->register_hooks( new Provider\Setting\GoogleMaps() );
}
if ( is_network_admin() ) {
$bandstand->register_hooks( new Screen\Network\Settings() );
}
/**
* Load the plugin.
*
* @since 1.0.0
*/
function bandstand_load() {
bandstand()->load();
}
add_action( 'plugins_loaded', 'bandstand_load' );