forked from gruz0/remove-noreferrer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass-plugin.php
More file actions
73 lines (63 loc) · 1.32 KB
/
class-plugin.php
File metadata and controls
73 lines (63 loc) · 1.32 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
<?php
/**
* Plugin class
*
* @package Remove_Noreferrer
* @since 2.0.0
*/
namespace Remove_Noreferrer;
/**
* Plugin
*
* @since 2.0.0
*/
class Plugin extends Base\Plugin {
/**
* Core\Options instance
*
* @since 2.0.0
* @access private
* @var Core\Options $options
*/
private $options;
/**
* Core\Adapter instance
*
* @since 2.0.0
* @access private
* @var Core\Adapter $adapter
*/
private $adapter;
/**
* Constructor
*
* @since 2.0.0
* @access public
*
* @param Core\Options $options Options class.
* @param Core\Adapter $adapter Adapter class.
*/
public function __construct( Core\Options $options, Core\Adapter $adapter ) {
$this->options = $options;
$this->adapter = $adapter;
parent::__construct();
}
/**
* Executes part of the plugin depends on frontend or admin area
*
* @since 2.0.0
* @access public
*
* @return mixed
*/
public function run() {
if ( $this->adapter->is_admin() ) {
$options_migrator = new Admin\Options_Migrator( $this->options );
$options_migrator->call( GRN_VERSION );
$options_page = new Admin\Options_Page();
return new Admin\Plugin( $this->options, $this->adapter, $options_page );
}
$links_processor = new Frontend\Links_Processor();
return new Frontend\Plugin( $this->options, $links_processor, $this->adapter );
}
}