Passed
Push — master ( d406ab...3befbe )
by Benjamin
02:31
created

WP_Site_Monitor::activate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 1
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 1
ccs 0
cts 1
cp 0
rs 10
cc 1
eloc 0
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * The core plugin class.
4
 *
5
 * This is used to define internationalization, admin-specific hooks, and
6
 * public-facing site hooks.
7
 *
8
 * Also maintains the unique identifier of this plugin as well as the current
9
 * version of the plugin.
10
 *
11
 * @package WPSiteMonitor
12
 * @link https://github.com/BWibrew/WP-Site-Monitor/
13
 * @author Benjamin Wibrew <[email protected]>
14
 * @since 1.0.0
15
 */
16
17
namespace WPSiteMonitor;
18
19
/**
20
 * Class WP_Site_Monitor
21
 *
22
 * @package WPSiteMonitor
23
 */
24
class WP_Site_Monitor {
25
26
	/**
27
	 * The loader that's responsible for registering all hooks and filters.
28
	 *
29
	 * @var Hook_Loader $loader Maintains and registers all hooks for the plugin.
30
	 * @since 1.0.0
31
	 */
32
	protected $loader;
33
34
	/**
35
	 * Define the core functionality of the plugin.
36
	 *
37
	 * @since 1.0.0
38
	 */
39
	public function __construct() {
40
		$this->loader = new Hook_Loader();
41
42
		$this->init();
43
	}
44
45
	/**
46
	 * Initialise plugin files.
47
	 *
48
	 * @since 1.0.0
49
	 */
50
	public function init() {
51
		if ( is_admin() ) {
52
			new Settings_Menu();
53
		}
54
55
		$api = new API();
56
57
		$this->loader->add_action( 'rest_api_init', $api, 'register_routes' );
58
		$this->loader->run();
59
	}
60
61
	/**
62
	 * Fired during plugin deactivation,
63
	 *
64
	 * @since 1.0.0
65
	 */
66 1
	public static function deactivate() {
67 1
		unregister_setting( 'wp_site_monitor', 'wp_site_monitor_enable' );
68 1
	}
69
70
	/**
71
	 * Fired during plugin deletion.
72
	 *
73
	 * @since 1.0.0
74
	 */
75 1
	public static function uninstall() {
76 1
		delete_option( 'wp_site_monitor_enable' );
77 1
	}
78
}
79