-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathPlugin.php
More file actions
118 lines (104 loc) · 2.13 KB
/
Plugin.php
File metadata and controls
118 lines (104 loc) · 2.13 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
namespace Plausible\Analytics\WP;
/**
* Loads and registers plugin functionality through WordPress hooks.
*
* @since 1.0.0
*/
final class Plugin {
/**
* Load @see Integrations()
*
* @return void
*
* @codeCoverageIgnore
*/
public function load_integrations() {
new Integrations();
}
/**
* Loads the plugin's translated strings.
*
* @since 1.0.0
* @access public
* @return void
*
* @codeCoverageIgnore
*/
public function load_plugin_textdomain() {
load_plugin_textdomain(
'plausible-analytics',
false,
dirname( plugin_basename( PLAUSIBLE_ANALYTICS_PLUGIN_FILE ) ) . '/languages/'
);
}
/**
* Load @see Admin\Provisioning()
*
* @return void
*
* @codeCoverageIgnore
*/
public function load_provisioning() {
new Admin\Provisioning();
new Admin\Provisioning\Integrations();
}
/**
* Load @see Admin\Settings\Page()
*
* @return void
*
* @codeCoverageIgnore
*/
public function load_settings() {
new Admin\Settings\Page();
}
/**
* Registers functionality with WordPress hooks.
*
* @since 1.0.0
* @access public
* @return void
*/
public function register() {
$this->setup();
// Register services used throughout the plugin. (WP Rocket runs at priority 10)
add_action( 'plugins_loaded', [ $this, 'register_services' ], 9 );
// Load text domain.
add_action( 'init', [ $this, 'load_plugin_textdomain' ], 1000 );
}
/**
* Register plugin (de)activation hooks and cron job.
*
* @return void
*/
public function setup() {
new Setup();
}
/**
* Registers the individual services of the plugin.
*
* @since 1.0.0
* @access public
* @return void
*/
public function register_services() {
if ( is_admin() ) {
add_action( 'init', [ $this, 'load_settings' ] );
add_action( 'init', [ $this, 'load_provisioning' ] );
new Admin\Upgrades();
new Admin\Filters();
new Admin\Actions();
new Admin\Module();
new Admin\PrivacyPolicy();
}
add_action( 'init', [ $this, 'load_integrations' ] );
new AdminBar();
new Assets();
new Ajax();
new Compatibility();
new InitOptions();
new Proxy();
new Verification();
}
}