@@ -10,211 +10,211 @@ |
||
10 | 10 | */ |
11 | 11 | class FeatureFlag |
12 | 12 | { |
13 | - /** |
|
14 | - * Whether to use the New Event Editor (EDTR) or continue using the legacy Event Editor |
|
15 | - * deafult: Enabled for Caffeinated sites, disabled for Decaf or Multisite installs |
|
16 | - */ |
|
17 | - public const USE_ADVANCED_EVENT_EDITOR = 'ee_advanced_event_editor'; |
|
13 | + /** |
|
14 | + * Whether to use the New Event Editor (EDTR) or continue using the legacy Event Editor |
|
15 | + * deafult: Enabled for Caffeinated sites, disabled for Decaf or Multisite installs |
|
16 | + */ |
|
17 | + public const USE_ADVANCED_EVENT_EDITOR = 'ee_advanced_event_editor'; |
|
18 | 18 | |
19 | - /** |
|
20 | - * Whether to enable the Bulk Edit feature in the Advanced Event Editor (EDTR) |
|
21 | - * default: Enabled for Caffeinated sites, disabled for Decaf or Multisite installs |
|
22 | - */ |
|
23 | - public const USE_EVENT_EDITOR_BULK_EDIT = 'ee_event_editor_bulk_edit'; |
|
19 | + /** |
|
20 | + * Whether to enable the Bulk Edit feature in the Advanced Event Editor (EDTR) |
|
21 | + * default: Enabled for Caffeinated sites, disabled for Decaf or Multisite installs |
|
22 | + */ |
|
23 | + public const USE_EVENT_EDITOR_BULK_EDIT = 'ee_event_editor_bulk_edit'; |
|
24 | 24 | |
25 | - /** |
|
26 | - * Whether to enable the new Default Ticket Manager in the EDTR |
|
27 | - * default: Enabled |
|
28 | - */ |
|
29 | - public const USE_DEFAULT_TICKET_MANAGER = 'use_default_ticket_manager'; |
|
25 | + /** |
|
26 | + * Whether to enable the new Default Ticket Manager in the EDTR |
|
27 | + * default: Enabled |
|
28 | + */ |
|
29 | + public const USE_DEFAULT_TICKET_MANAGER = 'use_default_ticket_manager'; |
|
30 | 30 | |
31 | - /** |
|
32 | - * Whether to enable the Rich Text Editor for the Event Description field in the EDTR or use tinymce |
|
33 | - * default: Disabled |
|
34 | - */ |
|
35 | - public const USE_EVENT_DESCRIPTION_RTE = 'use_event_description_rte'; |
|
31 | + /** |
|
32 | + * Whether to enable the Rich Text Editor for the Event Description field in the EDTR or use tinymce |
|
33 | + * default: Disabled |
|
34 | + */ |
|
35 | + public const USE_EVENT_DESCRIPTION_RTE = 'use_event_description_rte'; |
|
36 | 36 | |
37 | - /** |
|
38 | - * Whether to enable the Rich Text Editor for all other RTE fields in the EDTR |
|
39 | - * default: Disabled |
|
40 | - */ |
|
41 | - public const USE_EXPERIMENTAL_RTE = 'use_experimental_rte'; |
|
37 | + /** |
|
38 | + * Whether to enable the Rich Text Editor for all other RTE fields in the EDTR |
|
39 | + * default: Disabled |
|
40 | + */ |
|
41 | + public const USE_EXPERIMENTAL_RTE = 'use_experimental_rte'; |
|
42 | 42 | |
43 | - /** |
|
44 | - * Whether to enable the new Registration Form Builder in the EDTR |
|
45 | - * or continue using the legacy Question Groups and Registration Form admin pages |
|
46 | - * default: Disabled |
|
47 | - */ |
|
48 | - public const USE_REG_FORM_BUILDER = 'use_reg_form_builder'; |
|
43 | + /** |
|
44 | + * Whether to enable the new Registration Form Builder in the EDTR |
|
45 | + * or continue using the legacy Question Groups and Registration Form admin pages |
|
46 | + * default: Disabled |
|
47 | + */ |
|
48 | + public const USE_REG_FORM_BUILDER = 'use_reg_form_builder'; |
|
49 | 49 | |
50 | - /** |
|
51 | - * Whether to enable the new Registration Options meta box in the EDTR |
|
52 | - * or continue using the legacy Event Registration Options |
|
53 | - * default: Disabled |
|
54 | - */ |
|
55 | - public const USE_REG_OPTIONS_META_BOX = 'use_reg_options_meta_box'; |
|
50 | + /** |
|
51 | + * Whether to enable the new Registration Options meta box in the EDTR |
|
52 | + * or continue using the legacy Event Registration Options |
|
53 | + * default: Disabled |
|
54 | + */ |
|
55 | + public const USE_REG_OPTIONS_META_BOX = 'use_reg_options_meta_box'; |
|
56 | 56 | |
57 | - /** |
|
58 | - * Whether to enable the new Single Page Checkout form refactor changes |
|
59 | - * default: Disabled |
|
60 | - * |
|
61 | - * @since 5.0.18.p |
|
62 | - */ |
|
63 | - public const USE_SPCO_FORM_REFACTOR = 'use_spco_form_refactor'; |
|
57 | + /** |
|
58 | + * Whether to enable the new Single Page Checkout form refactor changes |
|
59 | + * default: Disabled |
|
60 | + * |
|
61 | + * @since 5.0.18.p |
|
62 | + */ |
|
63 | + public const USE_SPCO_FORM_REFACTOR = 'use_spco_form_refactor'; |
|
64 | 64 | |
65 | - /** |
|
66 | - * Whether to enable the new Reg Form Ticket Questions functionality |
|
67 | - * default: Disabled |
|
68 | - */ |
|
69 | - public const USE_REG_FORM_TICKET_QUESTIONS = 'use_reg_form_ticket_questions'; |
|
65 | + /** |
|
66 | + * Whether to enable the new Reg Form Ticket Questions functionality |
|
67 | + * default: Disabled |
|
68 | + */ |
|
69 | + public const USE_REG_FORM_TICKET_QUESTIONS = 'use_reg_form_ticket_questions'; |
|
70 | 70 | |
71 | - /** |
|
72 | - * Whether to use the EDD Plugin Licensing system to manage licenses for the EE plugins |
|
73 | - * default: Disabled |
|
74 | - */ |
|
75 | - public const USE_EDD_PLUGIN_LICENSING = 'use_edd_plugin_licensing'; |
|
71 | + /** |
|
72 | + * Whether to use the EDD Plugin Licensing system to manage licenses for the EE plugins |
|
73 | + * default: Disabled |
|
74 | + */ |
|
75 | + public const USE_EDD_PLUGIN_LICENSING = 'use_edd_plugin_licensing'; |
|
76 | 76 | |
77 | - /** |
|
78 | - * Whether to use the new Datetime Status Controls in the EDTR |
|
79 | - * default: Disabled |
|
80 | - */ |
|
81 | - public const USE_DATETIME_STATUS_CONTROLS = 'use_datetime_status_controls'; |
|
77 | + /** |
|
78 | + * Whether to use the new Datetime Status Controls in the EDTR |
|
79 | + * default: Disabled |
|
80 | + */ |
|
81 | + public const USE_DATETIME_STATUS_CONTROLS = 'use_datetime_status_controls'; |
|
82 | 82 | |
83 | - /** |
|
84 | - * Whether to apply Gateway Partner fees to transactions |
|
85 | - * default: Disabled |
|
86 | - */ |
|
87 | - public const USE_PAYMENT_PROCESSOR_FEES = 'use_payment_processor_fees'; |
|
83 | + /** |
|
84 | + * Whether to apply Gateway Partner fees to transactions |
|
85 | + * default: Disabled |
|
86 | + */ |
|
87 | + public const USE_PAYMENT_PROCESSOR_FEES = 'use_payment_processor_fees'; |
|
88 | 88 | |
89 | 89 | |
90 | - public static function getFormOptions(): array |
|
91 | - { |
|
92 | - return [ |
|
93 | - FeatureFlag::USE_EVENT_EDITOR_BULK_EDIT => [ |
|
94 | - 'name' => esc_html__('Event Editor Bulk Edit', 'event_espresso'), |
|
95 | - 'html_label_text' => esc_html__('Use Event Editor Bulk Edit', 'event_espresso'), |
|
96 | - 'help_text' => sprintf( |
|
97 | - esc_html__( |
|
98 | - 'Whether to enable the Bulk Edit feature in the Advanced Event Editor (EDTR).%1$s%2$sPLEASE NOTE: Bulk Editing is ALWAYS enabled if the Recurring Events Manager add-on is active.%3$s%1$s default: Enabled for Caffeinated sites, disabled for Decaf or Multisite installs', |
|
99 | - 'event_espresso' |
|
100 | - ), |
|
101 | - '<br/>', |
|
102 | - '<strong>', |
|
103 | - '</strong>' |
|
104 | - ), |
|
105 | - 'overridden' => false, |
|
106 | - 'overridden_by' => '', |
|
107 | - ], |
|
108 | - FeatureFlag::USE_DEFAULT_TICKET_MANAGER => [ |
|
109 | - 'name' => esc_html__('Default Ticket Manager', 'event_espresso'), |
|
110 | - 'html_label_text' => esc_html__('Use Default Ticket Manager', 'event_espresso'), |
|
111 | - 'help_text' => esc_html__( |
|
112 | - 'Whether to enable the new Default Ticket Manager in the EDTR. default: Enabled', |
|
113 | - 'event_espresso' |
|
114 | - ), |
|
115 | - 'overridden' => false, |
|
116 | - 'overridden_by' => '', |
|
117 | - ], |
|
118 | - FeatureFlag::USE_EVENT_DESCRIPTION_RTE => [ |
|
119 | - 'name' => esc_html__('Event Description RTE', 'event_espresso'), |
|
120 | - 'html_label_text' => esc_html__('Use Rich Text Editor for Event Description', 'event_espresso'), |
|
121 | - 'help_text' => esc_html__( |
|
122 | - 'Whether to enable the Rich Text Editor for the Event Description field in the EDTR or use tinymce. default: Disabled', |
|
123 | - 'event_espresso' |
|
124 | - ), |
|
125 | - 'overridden' => false, |
|
126 | - 'overridden_by' => '', |
|
127 | - ], |
|
128 | - FeatureFlag::USE_EXPERIMENTAL_RTE => [ |
|
129 | - 'name' => esc_html__('Rich Text Editor', 'event_espresso'), |
|
130 | - 'html_label_text' => esc_html__('Use Rich Text Editor for other RTE fields', 'event_espresso'), |
|
131 | - 'help_text' => esc_html__( |
|
132 | - 'Whether to enable the Rich Text Editor for all other RTE fields in the EDTR. default: Disabled', |
|
133 | - 'event_espresso' |
|
134 | - ), |
|
135 | - 'overridden' => false, |
|
136 | - 'overridden_by' => '', |
|
137 | - ], |
|
138 | - FeatureFlag::USE_REG_FORM_BUILDER => [ |
|
139 | - 'name' => esc_html__('Registration Form Builder', 'event_espresso'), |
|
140 | - 'html_label_text' => esc_html__('Use Registration Form Builder', 'event_espresso'), |
|
141 | - 'help_text' => esc_html__( |
|
142 | - 'Whether to enable the new Registration Form Builder in the EDTR or continue using the legacy Question Groups and Registration Form admin pages. default: Disabled', |
|
143 | - 'event_espresso' |
|
144 | - ), |
|
145 | - 'overridden' => false, |
|
146 | - 'overridden_by' => '', |
|
147 | - ], |
|
148 | - FeatureFlag::USE_REG_OPTIONS_META_BOX => [ |
|
149 | - 'name' => esc_html__('Registration Options', 'event_espresso'), |
|
150 | - 'html_label_text' => esc_html__('Use Registration Options', 'event_espresso'), |
|
151 | - 'help_text' => esc_html__( |
|
152 | - 'Whether to enable the new Registration Options meta box in the EDTR or continue using the legacy Event Registration Options. default: Disabled', |
|
153 | - 'event_espresso' |
|
154 | - ), |
|
155 | - 'overridden' => false, |
|
156 | - 'overridden_by' => '', |
|
157 | - ], |
|
158 | - FeatureFlag::USE_SPCO_FORM_REFACTOR => [ |
|
159 | - 'name' => esc_html__('SPCO Form Refactor', 'event_espresso'), |
|
160 | - 'html_label_text' => esc_html__('Use SPCO Form Refactor', 'event_espresso'), |
|
161 | - 'help_text' => esc_html__( |
|
162 | - 'Whether to enable the new Single Page Checkout form refactor changes or continue using the legacy Single Page Checkout form. default: Disabled', |
|
163 | - 'event_espresso' |
|
164 | - ), |
|
165 | - 'overridden' => false, |
|
166 | - 'overridden_by' => '', |
|
167 | - ], |
|
168 | - FeatureFlag::USE_REG_FORM_TICKET_QUESTIONS => [ |
|
169 | - 'name' => esc_html__('Reg Form Ticket Questions', 'event_espresso'), |
|
170 | - 'html_label_text' => esc_html__('Use Reg Form Ticket Questions', 'event_espresso'), |
|
171 | - 'help_text' => esc_html__( |
|
172 | - 'Whether to enable the new Reg Form Ticket Questions functionality. default: Disabled', |
|
173 | - 'event_espresso' |
|
174 | - ), |
|
175 | - 'overridden' => false, |
|
176 | - 'overridden_by' => '', |
|
177 | - ], |
|
178 | - FeatureFlag::USE_EDD_PLUGIN_LICENSING => [ |
|
179 | - 'name' => esc_html__('EDD Plugin Licensing', 'event_espresso'), |
|
180 | - 'html_label_text' => esc_html__('Use EDD Plugin Licensing', 'event_espresso'), |
|
181 | - 'help_text' => esc_html__( |
|
182 | - 'Whether to use the EDD Plugin Licensing system to manage licenses for the EE plugins. default: Enabled', |
|
183 | - 'event_espresso' |
|
184 | - ), |
|
185 | - 'overridden' => defined('EE_USE_EDD_PLUGIN_LICENSING'), |
|
186 | - 'overridden_by' => defined('EE_USE_EDD_PLUGIN_LICENSING') |
|
187 | - ? sprintf( |
|
188 | - esc_html__( |
|
189 | - '%1$sCurrently overriden by the %2$s constant in wp-config.php%3$s', |
|
190 | - 'event_espresso' |
|
191 | - ), |
|
192 | - '<br><span class="ee-status--warning">', |
|
193 | - 'EE_USE_EDD_PLUGIN_LICENSING', |
|
194 | - '</span>' |
|
195 | - ) |
|
196 | - : '', |
|
197 | - ], |
|
198 | - FeatureFlag::USE_DATETIME_STATUS_CONTROLS => [ |
|
199 | - 'name' => esc_html__('Datetime Status Controls', 'event_espresso'), |
|
200 | - 'html_label_text' => esc_html__('Use Datetime Status Controls', 'event_espresso'), |
|
201 | - 'help_text' => esc_html__( |
|
202 | - 'Whether to use the new Datetime Status Controls in the EDTR. default: Disabled', |
|
203 | - 'event_espresso' |
|
204 | - ), |
|
205 | - 'overridden' => false, |
|
206 | - 'overridden_by' => '', |
|
207 | - ], |
|
208 | - FeatureFlag::USE_PAYMENT_PROCESSOR_FEES => [ |
|
209 | - 'name' => esc_html__('Gateway Partner Fees', 'event_espresso'), |
|
210 | - 'html_label_text' => esc_html__('Apply Payment Processor Fees', 'event_espresso'), |
|
211 | - 'help_text' => esc_html__( |
|
212 | - 'Whether to apply Gateway Partner fees to transactions. default: Disabled', |
|
213 | - 'event_espresso' |
|
214 | - ), |
|
215 | - 'overridden' => false, |
|
216 | - 'overridden_by' => '', |
|
217 | - ], |
|
218 | - ]; |
|
219 | - } |
|
90 | + public static function getFormOptions(): array |
|
91 | + { |
|
92 | + return [ |
|
93 | + FeatureFlag::USE_EVENT_EDITOR_BULK_EDIT => [ |
|
94 | + 'name' => esc_html__('Event Editor Bulk Edit', 'event_espresso'), |
|
95 | + 'html_label_text' => esc_html__('Use Event Editor Bulk Edit', 'event_espresso'), |
|
96 | + 'help_text' => sprintf( |
|
97 | + esc_html__( |
|
98 | + 'Whether to enable the Bulk Edit feature in the Advanced Event Editor (EDTR).%1$s%2$sPLEASE NOTE: Bulk Editing is ALWAYS enabled if the Recurring Events Manager add-on is active.%3$s%1$s default: Enabled for Caffeinated sites, disabled for Decaf or Multisite installs', |
|
99 | + 'event_espresso' |
|
100 | + ), |
|
101 | + '<br/>', |
|
102 | + '<strong>', |
|
103 | + '</strong>' |
|
104 | + ), |
|
105 | + 'overridden' => false, |
|
106 | + 'overridden_by' => '', |
|
107 | + ], |
|
108 | + FeatureFlag::USE_DEFAULT_TICKET_MANAGER => [ |
|
109 | + 'name' => esc_html__('Default Ticket Manager', 'event_espresso'), |
|
110 | + 'html_label_text' => esc_html__('Use Default Ticket Manager', 'event_espresso'), |
|
111 | + 'help_text' => esc_html__( |
|
112 | + 'Whether to enable the new Default Ticket Manager in the EDTR. default: Enabled', |
|
113 | + 'event_espresso' |
|
114 | + ), |
|
115 | + 'overridden' => false, |
|
116 | + 'overridden_by' => '', |
|
117 | + ], |
|
118 | + FeatureFlag::USE_EVENT_DESCRIPTION_RTE => [ |
|
119 | + 'name' => esc_html__('Event Description RTE', 'event_espresso'), |
|
120 | + 'html_label_text' => esc_html__('Use Rich Text Editor for Event Description', 'event_espresso'), |
|
121 | + 'help_text' => esc_html__( |
|
122 | + 'Whether to enable the Rich Text Editor for the Event Description field in the EDTR or use tinymce. default: Disabled', |
|
123 | + 'event_espresso' |
|
124 | + ), |
|
125 | + 'overridden' => false, |
|
126 | + 'overridden_by' => '', |
|
127 | + ], |
|
128 | + FeatureFlag::USE_EXPERIMENTAL_RTE => [ |
|
129 | + 'name' => esc_html__('Rich Text Editor', 'event_espresso'), |
|
130 | + 'html_label_text' => esc_html__('Use Rich Text Editor for other RTE fields', 'event_espresso'), |
|
131 | + 'help_text' => esc_html__( |
|
132 | + 'Whether to enable the Rich Text Editor for all other RTE fields in the EDTR. default: Disabled', |
|
133 | + 'event_espresso' |
|
134 | + ), |
|
135 | + 'overridden' => false, |
|
136 | + 'overridden_by' => '', |
|
137 | + ], |
|
138 | + FeatureFlag::USE_REG_FORM_BUILDER => [ |
|
139 | + 'name' => esc_html__('Registration Form Builder', 'event_espresso'), |
|
140 | + 'html_label_text' => esc_html__('Use Registration Form Builder', 'event_espresso'), |
|
141 | + 'help_text' => esc_html__( |
|
142 | + 'Whether to enable the new Registration Form Builder in the EDTR or continue using the legacy Question Groups and Registration Form admin pages. default: Disabled', |
|
143 | + 'event_espresso' |
|
144 | + ), |
|
145 | + 'overridden' => false, |
|
146 | + 'overridden_by' => '', |
|
147 | + ], |
|
148 | + FeatureFlag::USE_REG_OPTIONS_META_BOX => [ |
|
149 | + 'name' => esc_html__('Registration Options', 'event_espresso'), |
|
150 | + 'html_label_text' => esc_html__('Use Registration Options', 'event_espresso'), |
|
151 | + 'help_text' => esc_html__( |
|
152 | + 'Whether to enable the new Registration Options meta box in the EDTR or continue using the legacy Event Registration Options. default: Disabled', |
|
153 | + 'event_espresso' |
|
154 | + ), |
|
155 | + 'overridden' => false, |
|
156 | + 'overridden_by' => '', |
|
157 | + ], |
|
158 | + FeatureFlag::USE_SPCO_FORM_REFACTOR => [ |
|
159 | + 'name' => esc_html__('SPCO Form Refactor', 'event_espresso'), |
|
160 | + 'html_label_text' => esc_html__('Use SPCO Form Refactor', 'event_espresso'), |
|
161 | + 'help_text' => esc_html__( |
|
162 | + 'Whether to enable the new Single Page Checkout form refactor changes or continue using the legacy Single Page Checkout form. default: Disabled', |
|
163 | + 'event_espresso' |
|
164 | + ), |
|
165 | + 'overridden' => false, |
|
166 | + 'overridden_by' => '', |
|
167 | + ], |
|
168 | + FeatureFlag::USE_REG_FORM_TICKET_QUESTIONS => [ |
|
169 | + 'name' => esc_html__('Reg Form Ticket Questions', 'event_espresso'), |
|
170 | + 'html_label_text' => esc_html__('Use Reg Form Ticket Questions', 'event_espresso'), |
|
171 | + 'help_text' => esc_html__( |
|
172 | + 'Whether to enable the new Reg Form Ticket Questions functionality. default: Disabled', |
|
173 | + 'event_espresso' |
|
174 | + ), |
|
175 | + 'overridden' => false, |
|
176 | + 'overridden_by' => '', |
|
177 | + ], |
|
178 | + FeatureFlag::USE_EDD_PLUGIN_LICENSING => [ |
|
179 | + 'name' => esc_html__('EDD Plugin Licensing', 'event_espresso'), |
|
180 | + 'html_label_text' => esc_html__('Use EDD Plugin Licensing', 'event_espresso'), |
|
181 | + 'help_text' => esc_html__( |
|
182 | + 'Whether to use the EDD Plugin Licensing system to manage licenses for the EE plugins. default: Enabled', |
|
183 | + 'event_espresso' |
|
184 | + ), |
|
185 | + 'overridden' => defined('EE_USE_EDD_PLUGIN_LICENSING'), |
|
186 | + 'overridden_by' => defined('EE_USE_EDD_PLUGIN_LICENSING') |
|
187 | + ? sprintf( |
|
188 | + esc_html__( |
|
189 | + '%1$sCurrently overriden by the %2$s constant in wp-config.php%3$s', |
|
190 | + 'event_espresso' |
|
191 | + ), |
|
192 | + '<br><span class="ee-status--warning">', |
|
193 | + 'EE_USE_EDD_PLUGIN_LICENSING', |
|
194 | + '</span>' |
|
195 | + ) |
|
196 | + : '', |
|
197 | + ], |
|
198 | + FeatureFlag::USE_DATETIME_STATUS_CONTROLS => [ |
|
199 | + 'name' => esc_html__('Datetime Status Controls', 'event_espresso'), |
|
200 | + 'html_label_text' => esc_html__('Use Datetime Status Controls', 'event_espresso'), |
|
201 | + 'help_text' => esc_html__( |
|
202 | + 'Whether to use the new Datetime Status Controls in the EDTR. default: Disabled', |
|
203 | + 'event_espresso' |
|
204 | + ), |
|
205 | + 'overridden' => false, |
|
206 | + 'overridden_by' => '', |
|
207 | + ], |
|
208 | + FeatureFlag::USE_PAYMENT_PROCESSOR_FEES => [ |
|
209 | + 'name' => esc_html__('Gateway Partner Fees', 'event_espresso'), |
|
210 | + 'html_label_text' => esc_html__('Apply Payment Processor Fees', 'event_espresso'), |
|
211 | + 'help_text' => esc_html__( |
|
212 | + 'Whether to apply Gateway Partner fees to transactions. default: Disabled', |
|
213 | + 'event_espresso' |
|
214 | + ), |
|
215 | + 'overridden' => false, |
|
216 | + 'overridden_by' => '', |
|
217 | + ], |
|
218 | + ]; |
|
219 | + } |
|
220 | 220 | } |
@@ -9,78 +9,78 @@ |
||
9 | 9 | |
10 | 10 | class LicenseKeyFormInput extends EE_Text_Input |
11 | 11 | { |
12 | - public function __construct(PluginLicense $plugin_license, LicenseManager $licence_manager) |
|
13 | - { |
|
14 | - $plugin_slug = $plugin_license->pluginSlug(); |
|
15 | - $item_ID = $plugin_license->itemID(); |
|
16 | - $item_name = $plugin_license->itemName(); |
|
17 | - $license_key = $plugin_license->licenseKey(); |
|
18 | - $plugin_version = $plugin_license->version(); |
|
19 | - $license_status = $plugin_license->status(); |
|
20 | - $license_data = $licence_manager->checkLicense( |
|
21 | - $license_key, |
|
22 | - $item_ID, |
|
23 | - $item_name, |
|
24 | - $plugin_slug, |
|
25 | - $plugin_version, |
|
26 | - $plugin_license->minCoreVersion(), |
|
27 | - $license_status |
|
28 | - ); |
|
12 | + public function __construct(PluginLicense $plugin_license, LicenseManager $licence_manager) |
|
13 | + { |
|
14 | + $plugin_slug = $plugin_license->pluginSlug(); |
|
15 | + $item_ID = $plugin_license->itemID(); |
|
16 | + $item_name = $plugin_license->itemName(); |
|
17 | + $license_key = $plugin_license->licenseKey(); |
|
18 | + $plugin_version = $plugin_license->version(); |
|
19 | + $license_status = $plugin_license->status(); |
|
20 | + $license_data = $licence_manager->checkLicense( |
|
21 | + $license_key, |
|
22 | + $item_ID, |
|
23 | + $item_name, |
|
24 | + $plugin_slug, |
|
25 | + $plugin_version, |
|
26 | + $plugin_license->minCoreVersion(), |
|
27 | + $license_status |
|
28 | + ); |
|
29 | 29 | |
30 | - $license_expires = $license_data->expires ?? ''; |
|
31 | - $license_status = $license_data->license ?? $license_status; |
|
32 | - $activations_left = $license_data->activations_left ?? '?'; |
|
33 | - $license_status = $license_key !== '' ? $license_status : ''; |
|
30 | + $license_expires = $license_data->expires ?? ''; |
|
31 | + $license_status = $license_data->license ?? $license_status; |
|
32 | + $activations_left = $license_data->activations_left ?? '?'; |
|
33 | + $license_status = $license_key !== '' ? $license_status : ''; |
|
34 | 34 | |
35 | - $help_text = ''; |
|
36 | - $license_status_for_notice = ''; |
|
37 | - $input_status_class = "ee-license-key__input ee-input-width--reg ee-status-outline"; |
|
35 | + $help_text = ''; |
|
36 | + $license_status_for_notice = ''; |
|
37 | + $input_status_class = "ee-license-key__input ee-input-width--reg ee-status-outline"; |
|
38 | 38 | |
39 | - if ($license_key !== '') { |
|
40 | - $license_status_for_notice = $license_status; |
|
41 | - $status_class = LicenseStatusDisplay::statusClass($license_status); |
|
42 | - $input_status_class .= $license_status !== 'valid' ? " ee-status-outline--$status_class" : ''; |
|
39 | + if ($license_key !== '') { |
|
40 | + $license_status_for_notice = $license_status; |
|
41 | + $status_class = LicenseStatusDisplay::statusClass($license_status); |
|
42 | + $input_status_class .= $license_status !== 'valid' ? " ee-status-outline--$status_class" : ''; |
|
43 | 43 | |
44 | - if ($license_status === 'valid' && $license_expires !== '') { |
|
45 | - $help_text = sprintf( |
|
46 | - /* translators: 1: date 2: divider ( | ) 3: number */ |
|
47 | - esc_html__('license valid until: %1$s %2$s activations remaining: %3$s', 'event_espresso'), |
|
48 | - date('F jS Y', strtotime($license_expires)), |
|
49 | - ' | ', |
|
50 | - $activations_left |
|
51 | - ); |
|
52 | - } |
|
53 | - } |
|
44 | + if ($license_status === 'valid' && $license_expires !== '') { |
|
45 | + $help_text = sprintf( |
|
46 | + /* translators: 1: date 2: divider ( | ) 3: number */ |
|
47 | + esc_html__('license valid until: %1$s %2$s activations remaining: %3$s', 'event_espresso'), |
|
48 | + date('F jS Y', strtotime($license_expires)), |
|
49 | + ' | ', |
|
50 | + $activations_left |
|
51 | + ); |
|
52 | + } |
|
53 | + } |
|
54 | 54 | |
55 | - parent::__construct( |
|
56 | - [ |
|
57 | - 'html_name' => "$plugin_slug-license-key", |
|
58 | - 'html_id' => "$plugin_slug-license-key", |
|
59 | - 'html_label_text' => $plugin_license->itemName(), |
|
60 | - 'html_help_text' => $help_text, |
|
61 | - 'html_class' => $input_status_class, |
|
62 | - 'default' => $license_data->license_key ?? '', |
|
63 | - 'data_attributes' => [ |
|
64 | - 'plugin_slug' => $plugin_slug, |
|
65 | - 'plugin_version' => $plugin_version, |
|
66 | - 'item_id' => $item_ID, |
|
67 | - 'item_name' => $item_name, |
|
68 | - 'license_status' => $license_status === 'valid' ? 'valid' : 'invalid', |
|
69 | - 'license_expires' => $license_expires, |
|
70 | - 'activations_left' => $activations_left, |
|
71 | - ], |
|
72 | - 'required' => false, |
|
73 | - 'form_html_filter' => new VsprintfFilter( |
|
74 | - '%1$s %5$s %2$s %3$s %4$s', |
|
75 | - [ |
|
76 | - '<div class="ee-license-status__wrapper ee-layout-row--fixed">', |
|
77 | - ActivateLicenseButton::html($plugin_license, $license_data), |
|
78 | - LicenseStatusDisplay::statusNotice($license_status_for_notice), |
|
79 | - '</div>', |
|
80 | - // %5$s is the form input |
|
81 | - ] |
|
82 | - ), |
|
83 | - ] |
|
84 | - ); |
|
85 | - } |
|
55 | + parent::__construct( |
|
56 | + [ |
|
57 | + 'html_name' => "$plugin_slug-license-key", |
|
58 | + 'html_id' => "$plugin_slug-license-key", |
|
59 | + 'html_label_text' => $plugin_license->itemName(), |
|
60 | + 'html_help_text' => $help_text, |
|
61 | + 'html_class' => $input_status_class, |
|
62 | + 'default' => $license_data->license_key ?? '', |
|
63 | + 'data_attributes' => [ |
|
64 | + 'plugin_slug' => $plugin_slug, |
|
65 | + 'plugin_version' => $plugin_version, |
|
66 | + 'item_id' => $item_ID, |
|
67 | + 'item_name' => $item_name, |
|
68 | + 'license_status' => $license_status === 'valid' ? 'valid' : 'invalid', |
|
69 | + 'license_expires' => $license_expires, |
|
70 | + 'activations_left' => $activations_left, |
|
71 | + ], |
|
72 | + 'required' => false, |
|
73 | + 'form_html_filter' => new VsprintfFilter( |
|
74 | + '%1$s %5$s %2$s %3$s %4$s', |
|
75 | + [ |
|
76 | + '<div class="ee-license-status__wrapper ee-layout-row--fixed">', |
|
77 | + ActivateLicenseButton::html($plugin_license, $license_data), |
|
78 | + LicenseStatusDisplay::statusNotice($license_status_for_notice), |
|
79 | + '</div>', |
|
80 | + // %5$s is the form input |
|
81 | + ] |
|
82 | + ), |
|
83 | + ] |
|
84 | + ); |
|
85 | + } |
|
86 | 86 | } |
@@ -39,7 +39,7 @@ |
||
39 | 39 | if ($license_key !== '') { |
40 | 40 | $license_status_for_notice = $license_status; |
41 | 41 | $status_class = LicenseStatusDisplay::statusClass($license_status); |
42 | - $input_status_class .= $license_status !== 'valid' ? " ee-status-outline--$status_class" : ''; |
|
42 | + $input_status_class .= $license_status !== 'valid' ? " ee-status-outline--$status_class" : ''; |
|
43 | 43 | |
44 | 44 | if ($license_status === 'valid' && $license_expires !== '') { |
45 | 45 | $help_text = sprintf( |
@@ -12,187 +12,187 @@ |
||
12 | 12 | */ |
13 | 13 | class AddonEddData |
14 | 14 | { |
15 | - /** |
|
16 | - * Add-on IDs and names indexed by plugin slug. |
|
17 | - * Duplicates are because the plugin slugs used in the license data |
|
18 | - * sometimes differ from those used in the register add-on API |
|
19 | - * |
|
20 | - * @var array|string[] |
|
21 | - */ |
|
22 | - private static array $data_map = [ |
|
23 | - // Add-ons |
|
24 | - 'eea-affiliate-wp' => [ |
|
25 | - 'item_id' => 277, |
|
26 | - 'item_name' => 'AffiliateWP Integration', |
|
27 | - ], |
|
28 | - 'eea-attendee-mover' => [ |
|
29 | - 'item_id' => 285, |
|
30 | - 'item_name' => 'Attendee Mover', |
|
31 | - ], |
|
32 | - 'eea-automated-upcoming-event-notification' => [ |
|
33 | - 'item_id' => 289, |
|
34 | - 'item_name' => 'Automatic Event Notifications', |
|
35 | - ], |
|
36 | - 'espresso-barcode-scanner' => [ |
|
37 | - 'item_id' => 299, |
|
38 | - 'item_name' => 'Barcode Scanner', |
|
39 | - ], |
|
40 | - 'espresso_calendar' => [ |
|
41 | - 'item_id' => 304, |
|
42 | - 'item_name' => 'Calendar', |
|
43 | - ], |
|
44 | - 'eea-event-app-customization' => [ |
|
45 | - 'item_id' => 313, |
|
46 | - 'item_name' => 'Event Mobile App Customization', |
|
47 | - ], |
|
48 | - 'espresso-grid-template' => [ |
|
49 | - 'item_id' => 322, |
|
50 | - 'item_name' => 'Events List Grid Template', |
|
51 | - ], |
|
52 | - 'espresso-events-table-template' => [ |
|
53 | - 'item_id' => 380, |
|
54 | - 'item_name' => 'Events List Table Template', |
|
55 | - ], |
|
56 | - 'eea-importer' => [ |
|
57 | - 'item_id' => 325, |
|
58 | - 'item_name' => 'Importer', |
|
59 | - ], |
|
60 | - 'espresso_importer' => [ |
|
61 | - 'item_id' => 325, |
|
62 | - 'item_name' => 'Importer', |
|
63 | - ], |
|
64 | - 'espresso-infusionsoft' => [ |
|
65 | - 'item_id' => 328, |
|
66 | - 'item_name' => 'Keap Integration (Infusionsoft)', |
|
67 | - ], |
|
68 | - 'ee4-mailchimp' => [ |
|
69 | - 'item_id' => 334, |
|
70 | - 'item_name' => 'MailChimp Integration', |
|
71 | - ], |
|
72 | - 'eea-multi-event-registration' => [ |
|
73 | - 'item_id' => 337, |
|
74 | - 'item_name' => 'Event Cart (Multi Event Registration)', |
|
75 | - ], |
|
76 | - 'eea-people-addon' => [ |
|
77 | - 'item_id' => 356, |
|
78 | - 'item_name' => 'People Manager', |
|
79 | - ], |
|
80 | - 'eea-promotions' => [ |
|
81 | - 'item_id' => 359, |
|
82 | - 'item_name' => 'Promotion and Discount Codes', |
|
83 | - ], |
|
84 | - 'eea-recurring-events-manager' => [ |
|
85 | - 'item_id' => 365, |
|
86 | - 'item_name' => 'Recurring Events', |
|
87 | - ], |
|
88 | - 'eea-events-social-sharing' => [ |
|
89 | - 'item_id' => 371, |
|
90 | - 'item_name' => 'Social Sharing', |
|
91 | - ], |
|
92 | - 'eea-ticketing' => [ |
|
93 | - 'item_id' => 383, |
|
94 | - 'item_name' => 'Scannable Tickets', |
|
95 | - ], |
|
96 | - 'eea-utf8-variation' => [ |
|
97 | - 'item_id' => 0, |
|
98 | - 'item_name' => 'Font Pack for DOMPDF', |
|
99 | - ], |
|
100 | - 'eea-wait-lists' => [ |
|
101 | - 'item_id' => 392, |
|
102 | - 'item_name' => 'Wait Lists Manager', |
|
103 | - ], |
|
104 | - 'eea-wpuser-integration' => [ |
|
105 | - 'item_id' => 395, |
|
106 | - 'item_name' => 'WordPress User Integration', |
|
107 | - ], |
|
108 | - 'eea-payment-methods-pro' => [ |
|
109 | - 'item_id' => 349, |
|
110 | - 'item_name' => 'Payment Methods Manager', |
|
111 | - ], |
|
112 | - // Payment Methods |
|
113 | - 'eea-authnet-accept' => [ |
|
114 | - 'item_id' => 292, |
|
115 | - 'item_name' => 'Authorize.net Accept Integration', |
|
116 | - ], |
|
117 | - 'eea-aim-echeck' => [ |
|
118 | - 'item_id' => 295, |
|
119 | - 'item_name' => 'Authorize.net eCheck Integration', |
|
120 | - ], |
|
121 | - 'eea-braintree-gateway' => [ |
|
122 | - 'item_id' => 298, |
|
123 | - 'item_name' => 'Braintree Integration', |
|
124 | - ], |
|
125 | - 'eea-chase-orbital' => [ |
|
126 | - 'item_id' => 307, |
|
127 | - 'item_name' => 'Chase Paymentech Orbital Integration', |
|
128 | - ], |
|
129 | - 'eea-cybersource-gateway' => [ |
|
130 | - 'item_id' => 310, |
|
131 | - 'item_name' => 'CyberSource Gateway Integration', |
|
132 | - ], |
|
133 | - 'eea-payeezy' => [ |
|
134 | - 'item_id' => 316, |
|
135 | - 'item_name' => 'First Data Payeezy Gateway Integration', |
|
136 | - ], |
|
137 | - 'eea-flexible-payment-method' => [ |
|
138 | - 'item_id' => 319, |
|
139 | - 'item_name' => 'Flexible Payment Method', |
|
140 | - ], |
|
141 | - 'eea-ipay88-gateway' => [ |
|
142 | - 'item_id' => 331, |
|
143 | - 'item_name' => 'iPay88 Payment Gateway Integration', |
|
144 | - ], |
|
145 | - 'eea-migs-payment-method' => [ |
|
146 | - 'item_id' => 340, |
|
147 | - 'item_name' => 'Mastercard Gateway Integration', |
|
148 | - ], |
|
149 | - 'eea-ideal-mollie-gateway' => [ |
|
150 | - 'item_id' => 343, |
|
151 | - 'item_name' => 'Mollie Payment Gateway Integration', |
|
152 | - ], |
|
153 | - 'eea-payflow-pro-gateway' => [ |
|
154 | - 'item_id' => 346, |
|
155 | - 'item_name' => 'PayPal Payflow Pro Gateway Integration', |
|
156 | - ], |
|
157 | - 'eea-paypal-smart-buttons' => [ |
|
158 | - 'item_id' => 352, |
|
159 | - 'item_name' => 'PayPal Smart Buttons Gateway Integration', |
|
160 | - ], |
|
161 | - 'eea-quickbooks-gateway' => [ |
|
162 | - 'item_id' => 362, |
|
163 | - 'item_name' => 'QuickBooks Payment Gateway Integration', |
|
164 | - ], |
|
165 | - 'eea-sage-pay-gateway' => [ |
|
166 | - 'item_id' => 368, |
|
167 | - 'item_name' => 'Opayo Payment Gateway Integration (Sage Pay)', |
|
168 | - ], |
|
169 | - 'eea-square-gateway' => [ |
|
170 | - 'item_id' => 374, |
|
171 | - 'item_name' => 'Square Payment Gateway Integration', |
|
172 | - ], |
|
173 | - 'eea-stripe-gateway' => [ |
|
174 | - 'item_id' => 377, |
|
175 | - 'item_name' => 'Stripe Payment Gateway Integration', |
|
176 | - ], |
|
177 | - 'espresso-transfirst' => [ |
|
178 | - 'item_id' => 386, |
|
179 | - 'item_name' => 'TSYS TransFirst Integration', |
|
180 | - ], |
|
181 | - 'eea-vanco-payment-method' => [ |
|
182 | - 'item_id' => 389, |
|
183 | - 'item_name' => 'Vanco Payment Gateway Integration', |
|
184 | - ], |
|
185 | - ]; |
|
15 | + /** |
|
16 | + * Add-on IDs and names indexed by plugin slug. |
|
17 | + * Duplicates are because the plugin slugs used in the license data |
|
18 | + * sometimes differ from those used in the register add-on API |
|
19 | + * |
|
20 | + * @var array|string[] |
|
21 | + */ |
|
22 | + private static array $data_map = [ |
|
23 | + // Add-ons |
|
24 | + 'eea-affiliate-wp' => [ |
|
25 | + 'item_id' => 277, |
|
26 | + 'item_name' => 'AffiliateWP Integration', |
|
27 | + ], |
|
28 | + 'eea-attendee-mover' => [ |
|
29 | + 'item_id' => 285, |
|
30 | + 'item_name' => 'Attendee Mover', |
|
31 | + ], |
|
32 | + 'eea-automated-upcoming-event-notification' => [ |
|
33 | + 'item_id' => 289, |
|
34 | + 'item_name' => 'Automatic Event Notifications', |
|
35 | + ], |
|
36 | + 'espresso-barcode-scanner' => [ |
|
37 | + 'item_id' => 299, |
|
38 | + 'item_name' => 'Barcode Scanner', |
|
39 | + ], |
|
40 | + 'espresso_calendar' => [ |
|
41 | + 'item_id' => 304, |
|
42 | + 'item_name' => 'Calendar', |
|
43 | + ], |
|
44 | + 'eea-event-app-customization' => [ |
|
45 | + 'item_id' => 313, |
|
46 | + 'item_name' => 'Event Mobile App Customization', |
|
47 | + ], |
|
48 | + 'espresso-grid-template' => [ |
|
49 | + 'item_id' => 322, |
|
50 | + 'item_name' => 'Events List Grid Template', |
|
51 | + ], |
|
52 | + 'espresso-events-table-template' => [ |
|
53 | + 'item_id' => 380, |
|
54 | + 'item_name' => 'Events List Table Template', |
|
55 | + ], |
|
56 | + 'eea-importer' => [ |
|
57 | + 'item_id' => 325, |
|
58 | + 'item_name' => 'Importer', |
|
59 | + ], |
|
60 | + 'espresso_importer' => [ |
|
61 | + 'item_id' => 325, |
|
62 | + 'item_name' => 'Importer', |
|
63 | + ], |
|
64 | + 'espresso-infusionsoft' => [ |
|
65 | + 'item_id' => 328, |
|
66 | + 'item_name' => 'Keap Integration (Infusionsoft)', |
|
67 | + ], |
|
68 | + 'ee4-mailchimp' => [ |
|
69 | + 'item_id' => 334, |
|
70 | + 'item_name' => 'MailChimp Integration', |
|
71 | + ], |
|
72 | + 'eea-multi-event-registration' => [ |
|
73 | + 'item_id' => 337, |
|
74 | + 'item_name' => 'Event Cart (Multi Event Registration)', |
|
75 | + ], |
|
76 | + 'eea-people-addon' => [ |
|
77 | + 'item_id' => 356, |
|
78 | + 'item_name' => 'People Manager', |
|
79 | + ], |
|
80 | + 'eea-promotions' => [ |
|
81 | + 'item_id' => 359, |
|
82 | + 'item_name' => 'Promotion and Discount Codes', |
|
83 | + ], |
|
84 | + 'eea-recurring-events-manager' => [ |
|
85 | + 'item_id' => 365, |
|
86 | + 'item_name' => 'Recurring Events', |
|
87 | + ], |
|
88 | + 'eea-events-social-sharing' => [ |
|
89 | + 'item_id' => 371, |
|
90 | + 'item_name' => 'Social Sharing', |
|
91 | + ], |
|
92 | + 'eea-ticketing' => [ |
|
93 | + 'item_id' => 383, |
|
94 | + 'item_name' => 'Scannable Tickets', |
|
95 | + ], |
|
96 | + 'eea-utf8-variation' => [ |
|
97 | + 'item_id' => 0, |
|
98 | + 'item_name' => 'Font Pack for DOMPDF', |
|
99 | + ], |
|
100 | + 'eea-wait-lists' => [ |
|
101 | + 'item_id' => 392, |
|
102 | + 'item_name' => 'Wait Lists Manager', |
|
103 | + ], |
|
104 | + 'eea-wpuser-integration' => [ |
|
105 | + 'item_id' => 395, |
|
106 | + 'item_name' => 'WordPress User Integration', |
|
107 | + ], |
|
108 | + 'eea-payment-methods-pro' => [ |
|
109 | + 'item_id' => 349, |
|
110 | + 'item_name' => 'Payment Methods Manager', |
|
111 | + ], |
|
112 | + // Payment Methods |
|
113 | + 'eea-authnet-accept' => [ |
|
114 | + 'item_id' => 292, |
|
115 | + 'item_name' => 'Authorize.net Accept Integration', |
|
116 | + ], |
|
117 | + 'eea-aim-echeck' => [ |
|
118 | + 'item_id' => 295, |
|
119 | + 'item_name' => 'Authorize.net eCheck Integration', |
|
120 | + ], |
|
121 | + 'eea-braintree-gateway' => [ |
|
122 | + 'item_id' => 298, |
|
123 | + 'item_name' => 'Braintree Integration', |
|
124 | + ], |
|
125 | + 'eea-chase-orbital' => [ |
|
126 | + 'item_id' => 307, |
|
127 | + 'item_name' => 'Chase Paymentech Orbital Integration', |
|
128 | + ], |
|
129 | + 'eea-cybersource-gateway' => [ |
|
130 | + 'item_id' => 310, |
|
131 | + 'item_name' => 'CyberSource Gateway Integration', |
|
132 | + ], |
|
133 | + 'eea-payeezy' => [ |
|
134 | + 'item_id' => 316, |
|
135 | + 'item_name' => 'First Data Payeezy Gateway Integration', |
|
136 | + ], |
|
137 | + 'eea-flexible-payment-method' => [ |
|
138 | + 'item_id' => 319, |
|
139 | + 'item_name' => 'Flexible Payment Method', |
|
140 | + ], |
|
141 | + 'eea-ipay88-gateway' => [ |
|
142 | + 'item_id' => 331, |
|
143 | + 'item_name' => 'iPay88 Payment Gateway Integration', |
|
144 | + ], |
|
145 | + 'eea-migs-payment-method' => [ |
|
146 | + 'item_id' => 340, |
|
147 | + 'item_name' => 'Mastercard Gateway Integration', |
|
148 | + ], |
|
149 | + 'eea-ideal-mollie-gateway' => [ |
|
150 | + 'item_id' => 343, |
|
151 | + 'item_name' => 'Mollie Payment Gateway Integration', |
|
152 | + ], |
|
153 | + 'eea-payflow-pro-gateway' => [ |
|
154 | + 'item_id' => 346, |
|
155 | + 'item_name' => 'PayPal Payflow Pro Gateway Integration', |
|
156 | + ], |
|
157 | + 'eea-paypal-smart-buttons' => [ |
|
158 | + 'item_id' => 352, |
|
159 | + 'item_name' => 'PayPal Smart Buttons Gateway Integration', |
|
160 | + ], |
|
161 | + 'eea-quickbooks-gateway' => [ |
|
162 | + 'item_id' => 362, |
|
163 | + 'item_name' => 'QuickBooks Payment Gateway Integration', |
|
164 | + ], |
|
165 | + 'eea-sage-pay-gateway' => [ |
|
166 | + 'item_id' => 368, |
|
167 | + 'item_name' => 'Opayo Payment Gateway Integration (Sage Pay)', |
|
168 | + ], |
|
169 | + 'eea-square-gateway' => [ |
|
170 | + 'item_id' => 374, |
|
171 | + 'item_name' => 'Square Payment Gateway Integration', |
|
172 | + ], |
|
173 | + 'eea-stripe-gateway' => [ |
|
174 | + 'item_id' => 377, |
|
175 | + 'item_name' => 'Stripe Payment Gateway Integration', |
|
176 | + ], |
|
177 | + 'espresso-transfirst' => [ |
|
178 | + 'item_id' => 386, |
|
179 | + 'item_name' => 'TSYS TransFirst Integration', |
|
180 | + ], |
|
181 | + 'eea-vanco-payment-method' => [ |
|
182 | + 'item_id' => 389, |
|
183 | + 'item_name' => 'Vanco Payment Gateway Integration', |
|
184 | + ], |
|
185 | + ]; |
|
186 | 186 | |
187 | 187 | |
188 | - public static function getPluginItemID($plugin_slug): int |
|
189 | - { |
|
190 | - return self::$data_map[ $plugin_slug ]['item_id'] ?? 0; |
|
191 | - } |
|
188 | + public static function getPluginItemID($plugin_slug): int |
|
189 | + { |
|
190 | + return self::$data_map[ $plugin_slug ]['item_id'] ?? 0; |
|
191 | + } |
|
192 | 192 | |
193 | 193 | |
194 | - public static function getPluginItemName($plugin_slug): string |
|
195 | - { |
|
196 | - return self::$data_map[ $plugin_slug ]['item_name'] ?? ''; |
|
197 | - } |
|
194 | + public static function getPluginItemName($plugin_slug): string |
|
195 | + { |
|
196 | + return self::$data_map[ $plugin_slug ]['item_name'] ?? ''; |
|
197 | + } |
|
198 | 198 | } |
@@ -187,12 +187,12 @@ |
||
187 | 187 | |
188 | 188 | public static function getPluginItemID($plugin_slug): int |
189 | 189 | { |
190 | - return self::$data_map[ $plugin_slug ]['item_id'] ?? 0; |
|
190 | + return self::$data_map[$plugin_slug]['item_id'] ?? 0; |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
194 | 194 | public static function getPluginItemName($plugin_slug): string |
195 | 195 | { |
196 | - return self::$data_map[ $plugin_slug ]['item_name'] ?? ''; |
|
196 | + return self::$data_map[$plugin_slug]['item_name'] ?? ''; |
|
197 | 197 | } |
198 | 198 | } |
@@ -12,11 +12,11 @@ |
||
12 | 12 | */ |
13 | 13 | class LicenseStatus |
14 | 14 | { |
15 | - public const ACTIVE = 'active'; |
|
15 | + public const ACTIVE = 'active'; |
|
16 | 16 | |
17 | - public const DECAF = 'decaf'; |
|
17 | + public const DECAF = 'decaf'; |
|
18 | 18 | |
19 | - public const EXPIRED = 'expired'; |
|
19 | + public const EXPIRED = 'expired'; |
|
20 | 20 | |
21 | - public const VALID = 'valid'; |
|
21 | + public const VALID = 'valid'; |
|
22 | 22 | } |
@@ -8,42 +8,42 @@ discard block |
||
8 | 8 | |
9 | 9 | class ActivateLicenseButton |
10 | 10 | { |
11 | - /** |
|
12 | - * @param PluginLicense $plugin_license |
|
13 | - * @param stdClass|null $license_data |
|
14 | - * @return string |
|
15 | - */ |
|
16 | - public static function html(PluginLicense $plugin_license, ?stdClass $license_data): string |
|
17 | - { |
|
18 | - // actions |
|
19 | - $activate_action = LicenseAPI::ACTION_ACTIVATE; |
|
20 | - $deactivate_action = LicenseAPI::ACTION_DEACTIVATE; |
|
21 | - $reset_action = LicenseAPI::ACTION_RESET; |
|
11 | + /** |
|
12 | + * @param PluginLicense $plugin_license |
|
13 | + * @param stdClass|null $license_data |
|
14 | + * @return string |
|
15 | + */ |
|
16 | + public static function html(PluginLicense $plugin_license, ?stdClass $license_data): string |
|
17 | + { |
|
18 | + // actions |
|
19 | + $activate_action = LicenseAPI::ACTION_ACTIVATE; |
|
20 | + $deactivate_action = LicenseAPI::ACTION_DEACTIVATE; |
|
21 | + $reset_action = LicenseAPI::ACTION_RESET; |
|
22 | 22 | |
23 | - // action labels |
|
24 | - $activate_btn_label = esc_html__('activate', 'event_espresso'); |
|
25 | - $deactivate_btn_label = esc_html__('deactivate', 'event_espresso'); |
|
26 | - $reset_btn_label = esc_html__('reset/clear this license key', 'event_espresso'); |
|
23 | + // action labels |
|
24 | + $activate_btn_label = esc_html__('activate', 'event_espresso'); |
|
25 | + $deactivate_btn_label = esc_html__('deactivate', 'event_espresso'); |
|
26 | + $reset_btn_label = esc_html__('reset/clear this license key', 'event_espresso'); |
|
27 | 27 | |
28 | - // plugin license data |
|
29 | - $item_id = $plugin_license->itemID(); |
|
30 | - $item_name = $plugin_license->itemName(); |
|
31 | - $plugin_slug = $plugin_license->pluginSlug(); |
|
32 | - $min_core_ver = $plugin_license->minCoreVersion(); |
|
33 | - $plugin_version = $plugin_license->version(); |
|
34 | - $license_status = $license_data->license ?? ''; |
|
28 | + // plugin license data |
|
29 | + $item_id = $plugin_license->itemID(); |
|
30 | + $item_name = $plugin_license->itemName(); |
|
31 | + $plugin_slug = $plugin_license->pluginSlug(); |
|
32 | + $min_core_ver = $plugin_license->minCoreVersion(); |
|
33 | + $plugin_version = $plugin_license->version(); |
|
34 | + $license_status = $license_data->license ?? ''; |
|
35 | 35 | |
36 | - // button attributes |
|
37 | - $activate_btn_class = ''; |
|
38 | - $deactivate_btn_class = ''; |
|
39 | - if ($license_status !== 'valid') { |
|
40 | - $deactivate_btn_class = ' ee-license-action-btn--hidden'; |
|
41 | - } else { |
|
42 | - $activate_btn_class = ' ee-license-action-btn--hidden'; |
|
43 | - } |
|
44 | - $disabled = empty($license_data->license_key) ? 'disabled' : ''; |
|
36 | + // button attributes |
|
37 | + $activate_btn_class = ''; |
|
38 | + $deactivate_btn_class = ''; |
|
39 | + if ($license_status !== 'valid') { |
|
40 | + $deactivate_btn_class = ' ee-license-action-btn--hidden'; |
|
41 | + } else { |
|
42 | + $activate_btn_class = ' ee-license-action-btn--hidden'; |
|
43 | + } |
|
44 | + $disabled = empty($license_data->license_key) ? 'disabled' : ''; |
|
45 | 45 | |
46 | - return " |
|
46 | + return " |
|
47 | 47 | <button id='activate-$plugin_slug' |
48 | 48 | class='ee-license-action-btn ee-license-action-btn__activate$activate_btn_class button button--primary' |
49 | 49 | data-action='$activate_action' |
@@ -83,5 +83,5 @@ discard block |
||
83 | 83 | > |
84 | 84 | <span class='dashicons dashicons-trash'></span> |
85 | 85 | </button>"; |
86 | - } |
|
86 | + } |
|
87 | 87 | } |
@@ -22,53 +22,53 @@ |
||
22 | 22 | */ |
23 | 23 | class LicenseKeyActivationRoute extends Route |
24 | 24 | { |
25 | - private ?EE_Network_Config $network_config = null; |
|
25 | + private ?EE_Network_Config $network_config = null; |
|
26 | 26 | |
27 | - private ?PluginLicense $core_license = null; |
|
27 | + private ?PluginLicense $core_license = null; |
|
28 | 28 | |
29 | 29 | |
30 | - public function matchesCurrentRequest(): bool |
|
31 | - { |
|
32 | - /** @var FeatureFlags $feature */ |
|
33 | - $feature = $this->loader->getShared(FeatureFlags::class); |
|
34 | - return $this->request->isActivation() |
|
35 | - && $feature instanceof FeatureFlags |
|
36 | - && $feature->allowed(FeatureFlag::USE_EDD_PLUGIN_LICENSING); |
|
37 | - } |
|
30 | + public function matchesCurrentRequest(): bool |
|
31 | + { |
|
32 | + /** @var FeatureFlags $feature */ |
|
33 | + $feature = $this->loader->getShared(FeatureFlags::class); |
|
34 | + return $this->request->isActivation() |
|
35 | + && $feature instanceof FeatureFlags |
|
36 | + && $feature->allowed(FeatureFlag::USE_EDD_PLUGIN_LICENSING); |
|
37 | + } |
|
38 | 38 | |
39 | 39 | |
40 | - /** |
|
41 | - * @return void |
|
42 | - */ |
|
43 | - protected function registerDependencies() |
|
44 | - { |
|
45 | - $this->core_license = $this->loader->getShared(PluginLicense::class); |
|
46 | - $this->network_config = $this->loader->getShared(EE_Network_Config::class); |
|
47 | - } |
|
40 | + /** |
|
41 | + * @return void |
|
42 | + */ |
|
43 | + protected function registerDependencies() |
|
44 | + { |
|
45 | + $this->core_license = $this->loader->getShared(PluginLicense::class); |
|
46 | + $this->network_config = $this->loader->getShared(EE_Network_Config::class); |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | - protected function requestHandler(): bool |
|
51 | - { |
|
52 | - // use old PUE license key if new one is not set |
|
53 | - if ( |
|
54 | - $this->core_license instanceof PluginLicense |
|
55 | - && $this->core_license->isMissingLicenseKey() |
|
56 | - && ! empty($this->network_config->core->site_license_key) |
|
57 | - ) { |
|
58 | - // save the old PUE license key as the new EDD license key |
|
59 | - $this->core_license->setLicenseKey($this->network_config->core->site_license_key); |
|
60 | - // and now try activating the new EDD license key |
|
61 | - /** @var LicenseManager $licence_manager */ |
|
62 | - $licence_manager = LoaderFactory::getShared(LicenseManager::class); |
|
63 | - $licence_manager->activateLicense( |
|
64 | - $this->core_license->licenseKey(), |
|
65 | - $this->core_license->itemID(), |
|
66 | - $this->core_license->itemName(), |
|
67 | - $this->core_license->pluginSlug(), |
|
68 | - $this->core_license->version(), |
|
69 | - $this->core_license->minCoreVersion() |
|
70 | - ); |
|
71 | - } |
|
72 | - return true; |
|
73 | - } |
|
50 | + protected function requestHandler(): bool |
|
51 | + { |
|
52 | + // use old PUE license key if new one is not set |
|
53 | + if ( |
|
54 | + $this->core_license instanceof PluginLicense |
|
55 | + && $this->core_license->isMissingLicenseKey() |
|
56 | + && ! empty($this->network_config->core->site_license_key) |
|
57 | + ) { |
|
58 | + // save the old PUE license key as the new EDD license key |
|
59 | + $this->core_license->setLicenseKey($this->network_config->core->site_license_key); |
|
60 | + // and now try activating the new EDD license key |
|
61 | + /** @var LicenseManager $licence_manager */ |
|
62 | + $licence_manager = LoaderFactory::getShared(LicenseManager::class); |
|
63 | + $licence_manager->activateLicense( |
|
64 | + $this->core_license->licenseKey(), |
|
65 | + $this->core_license->itemID(), |
|
66 | + $this->core_license->itemName(), |
|
67 | + $this->core_license->pluginSlug(), |
|
68 | + $this->core_license->version(), |
|
69 | + $this->core_license->minCoreVersion() |
|
70 | + ); |
|
71 | + } |
|
72 | + return true; |
|
73 | + } |
|
74 | 74 | } |
@@ -15,53 +15,53 @@ |
||
15 | 15 | */ |
16 | 16 | class LicenseDataEDD implements LicenseDataStrategy |
17 | 17 | { |
18 | - private LicenseKeyData $license_key_data; |
|
18 | + private LicenseKeyData $license_key_data; |
|
19 | 19 | |
20 | - private string $license_key = ''; |
|
20 | + private string $license_key = ''; |
|
21 | 21 | |
22 | - private string $status = LicenseStatus::EXPIRED; |
|
22 | + private string $status = LicenseStatus::EXPIRED; |
|
23 | 23 | |
24 | - private string $expiry = ''; |
|
24 | + private string $expiry = ''; |
|
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * @param LicenseKeyData $license_key_data |
|
29 | - */ |
|
30 | - public function __construct(LicenseKeyData $license_key_data) |
|
31 | - { |
|
32 | - $this->license_key_data = $license_key_data; |
|
33 | - } |
|
27 | + /** |
|
28 | + * @param LicenseKeyData $license_key_data |
|
29 | + */ |
|
30 | + public function __construct(LicenseKeyData $license_key_data) |
|
31 | + { |
|
32 | + $this->license_key_data = $license_key_data; |
|
33 | + } |
|
34 | 34 | |
35 | 35 | |
36 | - public function loadLicenseData() |
|
37 | - { |
|
38 | - $license_data = $this->license_key_data->getLicenseDataForPlugin(Domain::pluginSlug()); |
|
39 | - if (! isset($license_data->license) || ! isset($license_data->license_key)) { |
|
40 | - $this->status = LicenseStatus::EXPIRED; |
|
41 | - return; |
|
42 | - } |
|
43 | - $this->license_key = $license_data->license_key; |
|
44 | - $this->status = $license_data->license_key && $license_data->license === LicenseStatus::VALID |
|
45 | - ? LicenseStatus::ACTIVE |
|
46 | - : LicenseStatus::EXPIRED; |
|
47 | - $this->expiry = $license_data->expires ?? ''; |
|
48 | - } |
|
36 | + public function loadLicenseData() |
|
37 | + { |
|
38 | + $license_data = $this->license_key_data->getLicenseDataForPlugin(Domain::pluginSlug()); |
|
39 | + if (! isset($license_data->license) || ! isset($license_data->license_key)) { |
|
40 | + $this->status = LicenseStatus::EXPIRED; |
|
41 | + return; |
|
42 | + } |
|
43 | + $this->license_key = $license_data->license_key; |
|
44 | + $this->status = $license_data->license_key && $license_data->license === LicenseStatus::VALID |
|
45 | + ? LicenseStatus::ACTIVE |
|
46 | + : LicenseStatus::EXPIRED; |
|
47 | + $this->expiry = $license_data->expires ?? ''; |
|
48 | + } |
|
49 | 49 | |
50 | 50 | |
51 | - public function getLicenseKey(): string |
|
52 | - { |
|
53 | - return $this->license_key; |
|
54 | - } |
|
51 | + public function getLicenseKey(): string |
|
52 | + { |
|
53 | + return $this->license_key; |
|
54 | + } |
|
55 | 55 | |
56 | 56 | |
57 | - public function getLicenseStatus(): string |
|
58 | - { |
|
59 | - return $this->status; |
|
60 | - } |
|
57 | + public function getLicenseStatus(): string |
|
58 | + { |
|
59 | + return $this->status; |
|
60 | + } |
|
61 | 61 | |
62 | 62 | |
63 | - public function getLicenseExpiry(): string |
|
64 | - { |
|
65 | - return $this->expiry; |
|
66 | - } |
|
63 | + public function getLicenseExpiry(): string |
|
64 | + { |
|
65 | + return $this->expiry; |
|
66 | + } |
|
67 | 67 | } |
@@ -36,7 +36,7 @@ |
||
36 | 36 | public function loadLicenseData() |
37 | 37 | { |
38 | 38 | $license_data = $this->license_key_data->getLicenseDataForPlugin(Domain::pluginSlug()); |
39 | - if (! isset($license_data->license) || ! isset($license_data->license_key)) { |
|
39 | + if ( ! isset($license_data->license) || ! isset($license_data->license_key)) { |
|
40 | 40 | $this->status = LicenseStatus::EXPIRED; |
41 | 41 | return; |
42 | 42 | } |
@@ -9,52 +9,52 @@ |
||
9 | 9 | |
10 | 10 | class LicenseData |
11 | 11 | { |
12 | - private Domain $domain; |
|
12 | + private Domain $domain; |
|
13 | 13 | |
14 | - private FeatureFlags $feature; |
|
14 | + private FeatureFlags $feature; |
|
15 | 15 | |
16 | - private LicenseDataStrategy $license_data; |
|
16 | + private LicenseDataStrategy $license_data; |
|
17 | 17 | |
18 | 18 | |
19 | - /** |
|
20 | - * @param Domain $domain |
|
21 | - * @param FeatureFlags $feature |
|
22 | - */ |
|
23 | - public function __construct(Domain $domain, FeatureFlags $feature) |
|
24 | - { |
|
25 | - $this->domain = $domain; |
|
26 | - $this->feature = $feature; |
|
27 | - $this->license_data = $this->feature->allowed(FeatureFlag::USE_EDD_PLUGIN_LICENSING) |
|
28 | - ? LoaderFactory::getShared(LicenseDataEDD::class) |
|
29 | - : LoaderFactory::getShared(LicenseDataPue::class); |
|
30 | - $this->license_data->loadLicenseData(); |
|
31 | - } |
|
19 | + /** |
|
20 | + * @param Domain $domain |
|
21 | + * @param FeatureFlags $feature |
|
22 | + */ |
|
23 | + public function __construct(Domain $domain, FeatureFlags $feature) |
|
24 | + { |
|
25 | + $this->domain = $domain; |
|
26 | + $this->feature = $feature; |
|
27 | + $this->license_data = $this->feature->allowed(FeatureFlag::USE_EDD_PLUGIN_LICENSING) |
|
28 | + ? LoaderFactory::getShared(LicenseDataEDD::class) |
|
29 | + : LoaderFactory::getShared(LicenseDataPue::class); |
|
30 | + $this->license_data->loadLicenseData(); |
|
31 | + } |
|
32 | 32 | |
33 | 33 | |
34 | - /** |
|
35 | - * @return bool |
|
36 | - * @since 5.0.22.p |
|
37 | - */ |
|
38 | - protected function isDecaf(): bool |
|
39 | - { |
|
40 | - return ! $this->domain->isDecaf(); |
|
41 | - } |
|
34 | + /** |
|
35 | + * @return bool |
|
36 | + * @since 5.0.22.p |
|
37 | + */ |
|
38 | + protected function isDecaf(): bool |
|
39 | + { |
|
40 | + return ! $this->domain->isDecaf(); |
|
41 | + } |
|
42 | 42 | |
43 | 43 | |
44 | - public function licenseKey(): string |
|
45 | - { |
|
46 | - return $this->license_data->getLicenseKey(); |
|
47 | - } |
|
44 | + public function licenseKey(): string |
|
45 | + { |
|
46 | + return $this->license_data->getLicenseKey(); |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | - public function licenseStatus(): string |
|
51 | - { |
|
52 | - return ! $this->domain->isDecaf() ? $this->license_data->getLicenseStatus() : LicenseStatus::DECAF; |
|
53 | - } |
|
50 | + public function licenseStatus(): string |
|
51 | + { |
|
52 | + return ! $this->domain->isDecaf() ? $this->license_data->getLicenseStatus() : LicenseStatus::DECAF; |
|
53 | + } |
|
54 | 54 | |
55 | 55 | |
56 | - public function licenseExpiry(): string |
|
57 | - { |
|
58 | - return ! $this->isDecaf() ? $this->license_data->getLicenseExpiry() : ''; |
|
59 | - } |
|
56 | + public function licenseExpiry(): string |
|
57 | + { |
|
58 | + return ! $this->isDecaf() ? $this->license_data->getLicenseExpiry() : ''; |
|
59 | + } |
|
60 | 60 | } |
@@ -4,14 +4,14 @@ |
||
4 | 4 | |
5 | 5 | interface LicenseDataStrategy |
6 | 6 | { |
7 | - public function loadLicenseData(); |
|
7 | + public function loadLicenseData(); |
|
8 | 8 | |
9 | 9 | |
10 | - public function getLicenseKey(): string; |
|
10 | + public function getLicenseKey(): string; |
|
11 | 11 | |
12 | 12 | |
13 | - public function getLicenseStatus(): string; |
|
13 | + public function getLicenseStatus(): string; |
|
14 | 14 | |
15 | 15 | |
16 | - public function getLicenseExpiry(): string; |
|
16 | + public function getLicenseExpiry(): string; |
|
17 | 17 | } |