-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.php
71 lines (61 loc) · 1.48 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
67
68
69
70
71
<?php
/**
* Initialize plugin functionality
*
* Loads the text domain for translation and
* instantiates various classes.
*
* @package Dashboard_Summary
* @subpackage Init
* @category Core
* @since 1.0.0
*/
namespace Dashboard_Summary;
// Alias namespaces.
use Dashboard_Summary\Classes as Classes;
// Restrict direct access.
if ( ! defined( 'ABSPATH' ) ) {
die;
}
// Load required files.
foreach ( glob( DS_PATH . 'includes/core/*.php' ) as $filename ) {
require $filename;
}
foreach ( glob( DS_PATH . 'includes/vendor/*.php' ) as $filename ) {
require $filename;
}
foreach ( glob( DS_PATH . 'includes/users/*.php' ) as $filename ) {
require $filename;
}
foreach ( glob( DS_PATH . 'includes/widgets/*.php' ) as $filename ) {
require $filename;
}
Settings\setup();
Assets\setup();
/**
* Admin initialization function
*
* Instantiates various classes.
*
* @since 1.0.0
* @access public
* @global $pagenow Get the current admin screen.
* @return void
*/
function admin_init() {
// Access current admin page.
global $pagenow;
// Site dashboard.
if ( is_admin() && ! is_network_admin() && 'index.php' === $pagenow ) {
Site_Widget\setup();
Core_Widget\setup();
ACF\setup();
}
// Network dashboard.
if ( is_network_admin() && 'index.php' === $pagenow ) {
Network_Widget\setup();
Core_Network_Widget\setup();
}
add_filter( 'gettext', '\Dashboard_Summary\Core\plugin_modal_button_text', 20, 3 );
}
add_action( 'admin_init', __NAMESPACE__ . '\admin_init' );