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
|
<?php
namespace Objectiv\Plugins\Checkout\Features;
use Objectiv\Plugins\Checkout\Interfaces\SettingsGetterInterface;
/** * @link checkoutwc.com * @since 5.0.0 */ abstract class FeaturesAbstract { protected $enabled = false; protected $available = false; protected $required_plans_list;
/** * @var SettingsGetterInterface */ protected $settings_getter;
public function __construct( bool $enabled, bool $available, string $required_plans_list, SettingsGetterInterface $settings_getter ) { $this->enabled = $enabled; $this->available = $available; $this->required_plans_list = $required_plans_list; $this->settings_getter = $settings_getter; }
public function init() { if ( ! $this->is_active() ) { return; }
add_action( 'init', array( $this, 'check_if_cfw_is_enabled' ) ); }
public function check_if_cfw_is_enabled() { if ( ! cfw_is_enabled() ) { return; }
$this->run_if_cfw_is_enabled(); }
/** * @return bool */ public function is_active(): bool { return $this->available && $this->enabled; }
abstract protected function run_if_cfw_is_enabled(); }
|