Completed
Branch master (e79d92)
by
unknown
06:11
created
core/domain/services/licensing/LicenseKeyFormInput.php 2 patches
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -9,78 +9,78 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
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(
Please login to merge, or discard this patch.
core/domain/services/licensing/AddonEddData.php 2 patches
Indentation   +179 added lines, -179 removed lines patch added patch discarded remove patch
@@ -12,187 +12,187 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -187,12 +187,12 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
core/domain/services/licensing/LicenseStatus.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
core/domain/services/licensing/ActivateLicenseButton.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -8,42 +8,42 @@  discard block
 block discarded – undo
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
 block discarded – undo
83 83
         >
84 84
             <span class='dashicons dashicons-trash'></span>
85 85
         </button>";
86
-    }
86
+	}
87 87
 }
Please login to merge, or discard this patch.
core/domain/services/licensing/LicenseKeyActivationRoute.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -22,53 +22,53 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
core/domain/services/licensing/LicenseDataEDD.php 2 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -15,53 +15,53 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
core/domain/services/licensing/LicenseData.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -9,52 +9,52 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
core/domain/services/licensing/LicenseDataStrategy.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,14 +4,14 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
core/domain/services/licensing/LicenseStatusDisplay.php 1 patch
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -4,90 +4,90 @@
 block discarded – undo
4 4
 
5 5
 class LicenseStatusDisplay
6 6
 {
7
-    public static function statusNotice(?string $license_status): string
8
-    {
9
-        if (empty($license_status)) {
10
-            return "<span class='ee-status-pill'></span>";
11
-        }
12
-        $class = self::statusClass($license_status);
13
-        $icon = self::statusIcon($license_status);
14
-        $notice = self::statusMessage($license_status);
15
-        return "<span class='ee-status-pill ee-status-bg--$class'><span class='ee-license-status'>$notice</span>&nbsp;&nbsp;<span class='dashicons dashicons-$icon'></span></span>";
16
-    }
7
+	public static function statusNotice(?string $license_status): string
8
+	{
9
+		if (empty($license_status)) {
10
+			return "<span class='ee-status-pill'></span>";
11
+		}
12
+		$class = self::statusClass($license_status);
13
+		$icon = self::statusIcon($license_status);
14
+		$notice = self::statusMessage($license_status);
15
+		return "<span class='ee-status-pill ee-status-bg--$class'><span class='ee-license-status'>$notice</span>&nbsp;&nbsp;<span class='dashicons dashicons-$icon'></span></span>";
16
+	}
17 17
 
18
-    public static function statusMessages(): array
19
-    {
20
-        return [
21
-            "deactivated"           => esc_html__("license key deactivated", 'event_espresso'),
22
-            "disabled"              => esc_html__("license key revoked", 'event_espresso'),
23
-            "expired"               => esc_html__("license has expired", 'event_espresso'),
24
-            "inactive"              => esc_html__("inactive license key", 'event_espresso'),
25
-            "invalid"               => esc_html__("invalid license key", 'event_espresso'),
26
-            "invalid_item_id"       => esc_html__("invalid item ID", 'event_espresso'),
27
-            "item_name_mismatch"    => esc_html__("invalid license for plugin", 'event_espresso'),
28
-            "key_mismatch"          => esc_html__("invalid license for plugin", 'event_espresso'),
29
-            "license_not_activable" => esc_html__("attempting to activate a bundle's parent license", 'event_espresso'),
30
-            "missing"               => esc_html__("no license found", 'event_espresso'),
31
-            "missing_url"           => esc_html__("site URL not found", 'event_espresso'),
32
-            "no_activations_left"   => esc_html__("no activations left", 'event_espresso'),
33
-            "site_inactive"         => esc_html__("site is not active for this license", 'event_espresso'),
34
-            "valid"                 => esc_html__("valid license key", 'event_espresso'),
35
-        ];
36
-    }
18
+	public static function statusMessages(): array
19
+	{
20
+		return [
21
+			"deactivated"           => esc_html__("license key deactivated", 'event_espresso'),
22
+			"disabled"              => esc_html__("license key revoked", 'event_espresso'),
23
+			"expired"               => esc_html__("license has expired", 'event_espresso'),
24
+			"inactive"              => esc_html__("inactive license key", 'event_espresso'),
25
+			"invalid"               => esc_html__("invalid license key", 'event_espresso'),
26
+			"invalid_item_id"       => esc_html__("invalid item ID", 'event_espresso'),
27
+			"item_name_mismatch"    => esc_html__("invalid license for plugin", 'event_espresso'),
28
+			"key_mismatch"          => esc_html__("invalid license for plugin", 'event_espresso'),
29
+			"license_not_activable" => esc_html__("attempting to activate a bundle's parent license", 'event_espresso'),
30
+			"missing"               => esc_html__("no license found", 'event_espresso'),
31
+			"missing_url"           => esc_html__("site URL not found", 'event_espresso'),
32
+			"no_activations_left"   => esc_html__("no activations left", 'event_espresso'),
33
+			"site_inactive"         => esc_html__("site is not active for this license", 'event_espresso'),
34
+			"valid"                 => esc_html__("valid license key", 'event_espresso'),
35
+		];
36
+	}
37 37
 
38
-    public static function statusMessage(?string $license_status): string
39
-    {
40
-        $license_statuses = self::statusMessages();
41
-        return $license_statuses[ $license_status ] ?? esc_html__("An unknown error occurred", 'event_espresso');
42
-    }
38
+	public static function statusMessage(?string $license_status): string
39
+	{
40
+		$license_statuses = self::statusMessages();
41
+		return $license_statuses[ $license_status ] ?? esc_html__("An unknown error occurred", 'event_espresso');
42
+	}
43 43
 
44 44
 
45
-    public static function statusClass(?string $license_status): string
46
-    {
47
-        switch ($license_status) {
48
-            case "valid":
49
-                return "active";
45
+	public static function statusClass(?string $license_status): string
46
+	{
47
+		switch ($license_status) {
48
+			case "valid":
49
+				return "active";
50 50
 
51
-            case "deactivated":
52
-            case "expired":
53
-            case "inactive":
54
-            case "site_inactive":
55
-                return "inactive";
51
+			case "deactivated":
52
+			case "expired":
53
+			case "inactive":
54
+			case "site_inactive":
55
+				return "inactive";
56 56
 
57
-            case "no_activations_left":
58
-                return "attention";
57
+			case "no_activations_left":
58
+				return "attention";
59 59
 
60
-            case "disabled":
61
-            case "revoked":
62
-            case "invalid":
63
-            case "item_name_mismatch":
64
-            case "missing":
65
-            default:
66
-                return "error";
67
-        }
68
-    }
60
+			case "disabled":
61
+			case "revoked":
62
+			case "invalid":
63
+			case "item_name_mismatch":
64
+			case "missing":
65
+			default:
66
+				return "error";
67
+		}
68
+	}
69 69
 
70 70
 
71
-    public static function statusIcon(?string $license_status): string
72
-    {
73
-        switch ($license_status) {
74
-            case "valid":
75
-                return "yes-alt";
71
+	public static function statusIcon(?string $license_status): string
72
+	{
73
+		switch ($license_status) {
74
+			case "valid":
75
+				return "yes-alt";
76 76
 
77
-            case "expired":
78
-            case "site_inactive":
79
-                return "clock";
77
+			case "expired":
78
+			case "site_inactive":
79
+				return "clock";
80 80
 
81
-            case "disabled":
82
-            case "revoked":
83
-            case "invalid":
84
-            case "item_name_mismatch":
85
-            case "no_activations_left":
86
-                return "warning";
81
+			case "disabled":
82
+			case "revoked":
83
+			case "invalid":
84
+			case "item_name_mismatch":
85
+			case "no_activations_left":
86
+				return "warning";
87 87
 
88
-            case "missing":
89
-            default:
90
-                return "editor-help";
91
-        }
92
-    }
88
+			case "missing":
89
+			default:
90
+				return "editor-help";
91
+		}
92
+	}
93 93
 }
Please login to merge, or discard this patch.