|
1
|
|
|
<?php namespace EmailLog\Addon\License; |
|
2
|
|
|
|
|
3
|
|
|
defined( 'ABSPATH' ) || exit; // Exit if accessed directly. |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* BundleLicense Object. |
|
7
|
|
|
* There can be only one BundleLicence for all the add-ons. |
|
8
|
|
|
* |
|
9
|
|
|
* @since 2.0.0 |
|
10
|
|
|
*/ |
|
11
|
|
|
class BundleLicense extends BaseLicense { |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* For Bundle the add-on name is hardcoded. |
|
15
|
|
|
* |
|
16
|
|
|
* @var string Add-on name. |
|
17
|
|
|
*/ |
|
18
|
|
|
protected $addon_name = 'Email Log Bundle'; |
|
19
|
|
|
|
|
20
|
|
|
public function get_renewal_link() { |
|
21
|
|
|
$renewal_link = parent::get_renewal_link(); |
|
22
|
|
|
|
|
23
|
|
|
return $renewal_link . '&utm_content=BL'; |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Return bundle license key. |
|
28
|
|
|
* |
|
29
|
|
|
* @return string Bundle License key, if found. |
|
30
|
|
|
*/ |
|
31
|
|
|
public function get_license_key() { |
|
32
|
|
|
if ( empty( $this->license_data ) ) { |
|
33
|
|
|
return parent::get_license_key(); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
return $this->license_data->bundle_license_key; |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* The option name in which the bundle license data will be stored. |
|
41
|
|
|
* |
|
42
|
|
|
* @return string Option name. |
|
43
|
|
|
*/ |
|
44
|
|
|
protected function get_option_name() { |
|
45
|
|
|
return 'el_bundle_license'; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* Get the license key of an add-on from Bundle. |
|
50
|
|
|
* |
|
51
|
|
|
* @param string $addon_name Add-on name. |
|
52
|
|
|
* |
|
53
|
|
|
* @return bool|string False if no license key is found, otherwise license key. |
|
54
|
|
|
*/ |
|
55
|
|
|
public function get_addon_license_key( $addon_name ) { |
|
56
|
|
|
if ( empty( $this->license_data ) ) { |
|
57
|
|
|
return false; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
if ( ! isset( $this->license_data->bundled_licenses->{$addon_name} ) ) { |
|
61
|
|
|
return false; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
return $this->license_data->bundled_licenses->{$addon_name}->license_key; |
|
65
|
|
|
} |
|
66
|
|
|
} |
|
67
|
|
|
|