1 | <?php |
||
16 | class Plugin { |
||
17 | |||
18 | /** |
||
19 | * List of the keys allowed as arguments |
||
20 | * |
||
21 | * @var array |
||
22 | */ |
||
23 | private $arguments_whitelist = array( |
||
24 | 'url_info', |
||
25 | ); |
||
26 | |||
27 | /** |
||
28 | * Plugin slug. |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | private $slug; |
||
33 | |||
34 | /** |
||
35 | * Initialize the plugin manager. |
||
36 | * |
||
37 | * @param string $slug Plugin slug. |
||
38 | */ |
||
39 | public function __construct( $slug ) { |
||
42 | |||
43 | /** |
||
44 | * Add the plugin connection info into Jetpack. |
||
45 | * |
||
46 | * @param string $name Plugin name, required. |
||
47 | * @param array $args Plugin arguments, optional. |
||
48 | * |
||
49 | * @return $this |
||
50 | * @see $this->arguments_whitelist |
||
51 | */ |
||
52 | public function add( $name, array $args = array() ) { |
||
59 | |||
60 | /** |
||
61 | * Remove the plugin connection info from Jetpack. |
||
62 | * |
||
63 | * @return $this |
||
64 | */ |
||
65 | public function remove() { |
||
70 | |||
71 | /** |
||
72 | * Determine if this plugin connection is the only one active at the moment, if any. |
||
73 | * |
||
74 | * @return bool |
||
75 | */ |
||
76 | public function is_only() { |
||
81 | |||
82 | /** |
||
83 | * Add the plugin to the set of disconnected ones. |
||
84 | * |
||
85 | * @return bool |
||
86 | */ |
||
87 | public function disable() { |
||
88 | return Plugin_Storage::disable_plugin( $this->slug ); |
||
89 | } |
||
90 | |||
91 | /** |
||
92 | * Remove the plugin from the set of disconnected ones. |
||
93 | * |
||
94 | * @return bool |
||
95 | */ |
||
96 | public function enable() { |
||
97 | return Plugin_Storage::enable_plugin( $this->slug ); |
||
98 | } |
||
99 | |||
100 | /** |
||
101 | * Whether this plugin is allowed to use the connection. |
||
102 | * |
||
103 | * @return bool |
||
104 | */ |
||
105 | public function is_enabled() { |
||
108 | |||
109 | } |
||
110 |