Completed
Branch master (465a38)
by
unknown
27:45 queued 22:40
created
PaymentMethods/PayPalCommerce/modules/EED_PayPalOnboard.module.php 1 patch
Indentation   +689 added lines, -689 removed lines patch added patch discarded remove patch
@@ -17,693 +17,693 @@
 block discarded – undo
17 17
  */
18 18
 class EED_PayPalOnboard extends EED_Module
19 19
 {
20
-    /**
21
-     * @return EED_Module
22
-     * @throws EE_Error
23
-     * @throws ReflectionException
24
-     */
25
-    public static function instance(): EED_Module
26
-    {
27
-        return parent::get_instance(__CLASS__);
28
-    }
29
-
30
-
31
-    /**
32
-     * Run - initial module setup.
33
-     *
34
-     * @param WP $WP
35
-     * @return void
36
-     */
37
-    public function run($WP)
38
-    {
39
-        // TODO: Implement run() method.
40
-    }
41
-
42
-
43
-    /**
44
-     * For hooking into EE Core, other modules, etc.
45
-     *
46
-     * @return void
47
-     */
48
-    public static function set_hooks()
49
-    {
50
-    }
51
-
52
-
53
-    /**
54
-     * For hooking into EE Admin Core, other modules, etc.
55
-     *
56
-     * @return void
57
-     */
58
-    public static function set_hooks_admin()
59
-    {
60
-        if (DbStatus::isOnline()) {
61
-            // Get onboarding URL.
62
-            add_action('wp_ajax_eeaPpGetOnboardingUrl', [__CLASS__, 'getOnboardingUrl']);
63
-            // Get the seller access token.
64
-            add_action('wp_ajax_eeaPpGetSellerAccessToken', [__CLASS__, 'getSellerAccessToken']);
65
-            // Return the connection/onboard status.
66
-            add_action('wp_ajax_eeaPpGetOnboardStatus', [__CLASS__, 'getOnboardStatus']);
67
-            // Revoke access.
68
-            add_action('wp_ajax_eeaPpOffboard', [__CLASS__, 'offboard']);
69
-        }
70
-    }
71
-
72
-
73
-    /**
74
-     * Get the onboarding URL.
75
-     * (AJAX)
76
-     *
77
-     * @return void
78
-     */
79
-    public static function getOnboardingUrl()
80
-    {
81
-        $signup_link = '';
82
-        try {
83
-            $paypal_pm = EED_PayPalCommerce::getPaymentMethod();
84
-            if (! $paypal_pm instanceof EE_Payment_Method) {
85
-                PayPalLogger::errorLogAndExit(
86
-                    esc_html__('No payment method.', 'event_espresso'),
87
-                    EED_Module::getRequest()->postParams(),
88
-                    $paypal_pm
89
-                );
90
-            }
91
-            PayPalExtraMetaManager::updateDebugMode($paypal_pm, EED_Module::getRequest()->postParams());
92
-            $signup_link = self::getSignUpLink($paypal_pm);
93
-        } catch (Exception $exception) {
94
-            self::exitWithError($exception->getMessage());
95
-        }
96
-        // Is it empty (can happen if we didn't get the URL through the API).
97
-        $signup_link = $signup_link ? $signup_link . '?&displayMode=minibrowser' : '#';
98
-        echo json_encode(
99
-            [
100
-                'signup_link' => $signup_link,
101
-            ]
102
-        );
103
-        exit();
104
-    }
105
-
106
-
107
-    /**
108
-     * Get the URL to redirect the seller to and start the onboarding.
109
-     *
110
-     * @param EE_Payment_Method $paypal_pm
111
-     * @return string
112
-     * @throws EE_Error
113
-     * @throws Exception
114
-     */
115
-    public static function getSignUpLink(EE_Payment_Method $paypal_pm): string
116
-    {
117
-        $signup_link   = PayPalExtraMetaManager::getPmOption($paypal_pm, Domain::META_KEY_ONBOARDING_URL);
118
-        $token_expired = self::partnerAccessTokenExpired($paypal_pm);
119
-        if (! $signup_link || $token_expired) {
120
-            // Generate sign-up link and save.
121
-            $signup_link = self::requestOnboardingUrl($paypal_pm);
122
-            if (! $signup_link) {
123
-                $err_msg = esc_html__('Error! Could not generate a sign-up link.', 'event_espresso');
124
-                PayPalLogger::errorLog($err_msg, ['signup_link' => $signup_link], $paypal_pm);
125
-                return '';
126
-            }
127
-            PayPalExtraMetaManager::savePmOption($paypal_pm, Domain::META_KEY_ONBOARDING_URL, $signup_link);
128
-        }
129
-        return $signup_link;
130
-    }
131
-
132
-
133
-    /**
134
-     * Request the sign-up link from PayPal.
135
-     *
136
-     * @param EE_Payment_Method $paypal_pm
137
-     * @return string
138
-     * @throws EE_Error
139
-     * @throws Exception
140
-     */
141
-    public static function requestOnboardingUrl(EE_Payment_Method $paypal_pm): string
142
-    {
143
-        $signup_link = '';
144
-        // Get the access token.
145
-        $access_token = self::getPartnerAccessToken($paypal_pm);
146
-        if (! $access_token) {
147
-            $err_msg = esc_html__('Error! No access token.', 'event_espresso');
148
-            PayPalLogger::errorLog($err_msg, ['access_token' => $access_token], $paypal_pm);
149
-            return $signup_link;
150
-        }
151
-        $identifier_string = new OneTimeString($paypal_pm->debug_mode());
152
-        $seller_nonce      = $identifier_string->value();
153
-        // Save the identifier for future use.
154
-        PayPalExtraMetaManager::savePmOption($paypal_pm, Domain::META_KEY_SELLER_NONCE, $seller_nonce);
155
-        // Request the access token.
156
-        $body_params = json_encode(
157
-            [
158
-                'products'       => ['EXPRESS_CHECKOUT'],
159
-                'legal_consents' => [
160
-                    [
161
-                        'type'    => 'SHARE_DATA_CONSENT',
162
-                        'granted' => true,
163
-                    ],
164
-                ],
165
-                'operations'     => [
166
-                    [
167
-                        'operation'                  => 'API_INTEGRATION',
168
-                        'api_integration_preference' => [
169
-                            'rest_api_integration' => [
170
-                                'integration_method'  => 'PAYPAL',
171
-                                'integration_type'    => 'FIRST_PARTY',
172
-                                'first_party_details' => [
173
-                                    'features'     => ['PAYMENT', 'REFUND', 'PARTNER_FEE'],
174
-                                    'seller_nonce' => $seller_nonce,
175
-                                ],
176
-                            ],
177
-                        ],
178
-                    ],
179
-                ],
180
-            ]
181
-        );
182
-        $bn_code     = PayPalExtraMetaManager::getPmOption($paypal_pm, Domain::META_KEY_BN_CODE);
183
-        $post_args   = [
184
-            'method'  => 'POST',
185
-            'headers' => [
186
-                'User-Agent'                    => sanitize_text_field($_SERVER['HTTP_USER_AGENT']),
187
-                'Content-Type'                  => 'application/json',
188
-                'Authorization'                 => 'Bearer ' . $access_token,
189
-                'PayPal-Partner-Attribution-Id' => $bn_code,
190
-            ],
191
-            'body'    => $body_params,
192
-        ];
193
-        $request_url = self::getPayPalApiUrl($paypal_pm) . '/v2/customer/partner-referrals';
194
-        $response    = self::sendRequest($paypal_pm, $request_url, $post_args);
195
-        if (isset($response['error'])) {
196
-            return '';
197
-        }
198
-        // Check the data we received.
199
-        if (empty($response['links'])) {
200
-            $err_msg = esc_html__('Incoming sign-up link parameter validation failed.', 'event_espresso');
201
-            PayPalLogger::errorLog($err_msg, $response, $paypal_pm);
202
-            return '';
203
-        }
204
-        // Now retrieve that sign-up link.
205
-        foreach ($response['links'] as $link) {
206
-            if ($link['rel'] === 'action_url') {
207
-                return $link['href'] ?? '';
208
-            }
209
-        }
210
-        return $signup_link;
211
-    }
212
-
213
-
214
-    /**
215
-     * Get partner access token.
216
-     *
217
-     * @param EE_Payment_Method $paypal_pm
218
-     * @return string
219
-     * @throws EE_Error
220
-     * @throws Exception
221
-     */
222
-    public static function getPartnerAccessToken(EE_Payment_Method $paypal_pm): string
223
-    {
224
-        // Do we have it saved ?
225
-        $access_token = PayPalExtraMetaManager::getPmOption($paypal_pm, Domain::META_KEY_ACCESS_TOKEN);
226
-        $expired      = self::partnerAccessTokenExpired($paypal_pm);
227
-        // If we don't have it, request/update it.
228
-        if (! $access_token || $expired) {
229
-            return self::requestPartnerAccessToken($paypal_pm);
230
-        }
231
-        // Access token is saved as encrypted, so return decrypted.
232
-        return $access_token;
233
-    }
234
-
235
-
236
-    /**
237
-     * Get partner access token.
238
-     *
239
-     * @param EE_Payment_Method $paypal_pm
240
-     * @return bool
241
-     * @throws Exception
242
-     */
243
-    public static function partnerAccessTokenExpired(EE_Payment_Method $paypal_pm): bool
244
-    {
245
-        $expires_at = (int) PayPalExtraMetaManager::getPmOption($paypal_pm, Domain::META_KEY_EXPIRES_IN);
246
-        if (! $expires_at) {
247
-            return true;
248
-        }
249
-        // Validate the token. Do a health check.
250
-        $now          = time();
251
-        $minutes_left = round(($expires_at - $now) / 60);
252
-        // Count as expired if less than 60 minutes till expiration left.
253
-        if ($minutes_left <= 60) {
254
-            return true;
255
-        }
256
-        return false;
257
-    }
258
-
259
-
260
-    /**
261
-     * Request the partner access token from PayPal and save/update it.
262
-     *
263
-     * @param EE_Payment_Method $paypal_pm
264
-     * @return string
265
-     * @throws EE_Error
266
-     */
267
-    public static function requestPartnerAccessToken(EE_Payment_Method $paypal_pm): string
268
-    {
269
-        $nonce = wp_create_nonce('eea_pp_commerce_get_access_token');
270
-        // Request the access token.
271
-        $post_args = [
272
-            'method' => 'POST',
273
-            'body'   => [
274
-                'nonce'                       => $nonce,
275
-                'api_version'                 => 'v1',
276
-                Domain::META_KEY_SANDBOX_MODE => $paypal_pm->debug_mode() ? '1' : '0',
277
-            ],
278
-        ];
279
-        if (defined('LOCAL_MIDDLEMAN_SERVER')) {
280
-            $post_args['sslverify'] = false;
281
-        }
282
-        $post_url = self::getMiddlemanBaseUrl($paypal_pm) . 'get_token';
283
-        $response = self::sendRequest($paypal_pm, $post_url, $post_args);
284
-        if (isset($response['error'])) {
285
-            return '';
286
-        }
287
-        // Check the data we received.
288
-        if (! self::partnerTokenResponseValid($response, $paypal_pm)) {
289
-            return '';
290
-        }
291
-        // If we are here all seems to be ok. Save the token and it's data.
292
-        $saved = PayPalExtraMetaManager::savePartnerAccessToken($paypal_pm, $response);
293
-        if (! $saved) {
294
-            return '';
295
-        }
296
-        return $response['access_token'];
297
-    }
298
-
299
-
300
-    /**
301
-     * Get the seller access token.
302
-     * (AJAX)
303
-     *
304
-     * @return void
305
-     * @throws Exception
306
-     */
307
-    public static function getSellerAccessToken()
308
-    {
309
-        $paypal_pm   = EED_PayPalCommerce::getPaymentMethod();
310
-        $post_params = EED_Module::getRequest()->postParams();
311
-        $bn_code     = PayPalExtraMetaManager::getPmOption($paypal_pm, Domain::META_KEY_BN_CODE);
312
-        if (! $paypal_pm instanceof EE_Payment_Method) {
313
-            PayPalLogger::errorLogAndExit(
314
-                esc_html__('No payment method.', 'event_espresso'),
315
-                $post_params,
316
-                $paypal_pm
317
-            );
318
-        }
319
-        $seller_nonce = PayPalExtraMetaManager::getPmOption($paypal_pm, Domain::META_KEY_SELLER_NONCE);
320
-        // Look for mandatory parameters.
321
-        if (
322
-            empty($post_params[ Domain::API_KEY_AUTH_CODE ])
323
-            || empty($post_params[ Domain::API_KEY_SHARED_ID ])
324
-            || ! $seller_nonce
325
-            || ! $bn_code
326
-        ) {
327
-            $error_message = esc_html__('Missing authCode and sharedId.', 'event_espresso');
328
-            PayPalLogger::errorLogAndExit($error_message, $post_params, $paypal_pm);
329
-        }
330
-        $nonce = wp_create_nonce('eea_pp_commerce_get_seller_access_token');
331
-        // Request the access token.
332
-        $post_args = [
333
-            'method'  => 'POST',
334
-            'headers' => [
335
-                'User-Agent'                    => sanitize_text_field($_SERVER['HTTP_USER_AGENT']),
336
-                'Content-Type'                  => 'application/json',
337
-                'Authorization'                 => 'Basic ' . base64_encode($post_params[ Domain::API_KEY_SHARED_ID ]),
338
-                'PayPal-Partner-Attribution-Id' => $bn_code,
339
-            ],
340
-            'body'    => [
341
-                'nonce'         => $nonce,
342
-                'grant_type'    => 'authorization_code',
343
-                'code'          => $post_params[ Domain::API_KEY_AUTH_CODE ],
344
-                'code_verifier' => $seller_nonce,
345
-            ],
346
-        ];
347
-        $post_url  = self::getPayPalApiUrl($paypal_pm) . '/v1/oauth2/token';
348
-        $response  = self::sendRequest($paypal_pm, $post_url, $post_args);
349
-        if (isset($response['error'])) {
350
-            self::exitWithError($response['message']);
351
-        }
352
-        // Check the data we received.
353
-        if (
354
-            empty($response['access_token'])
355
-            || empty($response['expires_in'])
356
-            || empty($response['refresh_token'])
357
-        ) {
358
-            // This is an error.
359
-            $err_msg = esc_html__('Incoming parameter validation failed.', 'event_espresso');
360
-            PayPalLogger::errorLogAndExit($err_msg, $response, $paypal_pm);
361
-        }
362
-        // Now we can request the seller API credentials.
363
-        $credentials_saved = self::requestApiCredentials($paypal_pm, $response['access_token']);
364
-        if (isset($credentials_saved['error'])) {
365
-            echo json_encode(
366
-                [
367
-                    'error'   => $credentials_saved['error'],
368
-                    'message' => $credentials_saved['message'],
369
-                ]
370
-            );
371
-        } else {
372
-            echo json_encode(
373
-                [
374
-                    'success'  => true,
375
-                    'on_board' => true,
376
-                ]
377
-            );
378
-        }
379
-        exit();
380
-    }
381
-
382
-
383
-    /**
384
-     * Get the seller API credentials.
385
-     *
386
-     * @param EE_Payment_Method $paypal_pm
387
-     * @param string            $seller_token
388
-     * @return array
389
-     * @throws EE_Error
390
-     * @throws Exception
391
-     */
392
-    public static function requestApiCredentials(EE_Payment_Method $paypal_pm, string $seller_token): array
393
-    {
394
-        $partner_merchant_id = PayPalExtraMetaManager::getPmOption($paypal_pm, Domain::META_KEY_PARTNER_MERCHANT_ID);
395
-        $bn_code             = PayPalExtraMetaManager::getPmOption($paypal_pm, Domain::META_KEY_BN_CODE);
396
-        $get_params          = [
397
-            'method'  => 'GET',
398
-            'headers' => [
399
-                'User-Agent'                    => sanitize_text_field($_SERVER['HTTP_USER_AGENT']),
400
-                'Content-Type'                  => 'application/json',
401
-                'Authorization'                 => 'Bearer ' . $seller_token,
402
-                'PayPal-Partner-Attribution-Id' => $bn_code,
403
-            ],
404
-        ];
405
-        $request_url = self::getPayPalApiUrl($paypal_pm)
406
-                        . '/v1/customer/partners/'
407
-                        . $partner_merchant_id
408
-                        . '/merchant-integrations/credentials/';
409
-        $response = self::sendRequest($paypal_pm, $request_url, $get_params);
410
-        // Check the data we received.
411
-        if (empty($response['client_id']) || empty($response['client_secret'])) {
412
-            // This is an error.
413
-            if (isset($response['message'])) {
414
-                $err_msg  = $response['message'];
415
-                $err_name = $response['name'] ?? 'UNRECOGNIZED_ERROR';
416
-            } else {
417
-                $err_msg  = esc_html__('Incoming parameter validation failed.', 'event_espresso');
418
-                $err_name = 'INCOMING_PARAMETER_INVALID';
419
-            }
420
-            PayPalLogger::errorLog($err_msg, $response, $paypal_pm);
421
-            return ['error' => $err_name, 'message' => $err_msg];
422
-        }
423
-        // Finally, track seller onboarding status.
424
-        $onboarding_status = self::trackSellerOnboarding(
425
-            $paypal_pm,
426
-            $partner_merchant_id,
427
-            $response[ Domain::META_KEY_PAYER_ID ],
428
-            $response[ Domain::META_KEY_CLIENT_ID ],
429
-            $response[ Domain::META_KEY_CLIENT_SECRET ]
430
-        );
431
-        if (isset($onboarding_status['error'])) {
432
-            return $onboarding_status;
433
-        }
434
-        // If onboarded successfully, remove the onetime onboarding URL.
435
-        if (PayPalExtraMetaManager::saveSellerApiCredentials($paypal_pm, $response)) {
436
-            PayPalExtraMetaManager::deletePmOption($paypal_pm, Domain::META_KEY_ONBOARDING_URL);
437
-            return ['success' => true];
438
-        } else {
439
-            return [
440
-                'error'   => 'SELLER_CREDENTIALS_NOT_SAVED',
441
-                'message' => esc_html__('Seller credentials were not saved.', 'event_espresso'),
442
-            ];
443
-        }
444
-    }
445
-
446
-
447
-    /**
448
-     * Request seller onboarding status from PayPal.
449
-     *
450
-     * @param EE_Payment_Method $paypal_pm
451
-     * @param string            $partner_id
452
-     * @param                   $seller_id
453
-     * @param string            $client_id
454
-     * @param string            $client_secret
455
-     * @return array
456
-     * @throws EE_Error
457
-     * @throws Exception
458
-     */
459
-    public static function trackSellerOnboarding(
460
-        EE_Payment_Method $paypal_pm,
461
-        string $partner_id,
462
-        $seller_id,
463
-        string $client_id,
464
-        string $client_secret
465
-    ): array {
466
-        $track_onboarding = self::getTrackOnboardingApi(
467
-            $paypal_pm,
468
-            $partner_id,
469
-            $seller_id,
470
-            $client_id,
471
-            $client_secret
472
-        );
473
-        return $track_onboarding->isValid();
474
-    }
475
-
476
-
477
-    /**
478
-     * Returns the Track Seller Onboarding API.
479
-     *
480
-     * @param EE_Payment_Method $paypal_pm
481
-     * @param string            $partner_id
482
-     * @param string            $seller_id
483
-     * @param string            $client_id
484
-     * @param string            $client_secret
485
-     * @return TrackSellerOnboarding|null
486
-     * @throws Exception
487
-     */
488
-    public static function getTrackOnboardingApi(
489
-        EE_Payment_Method $paypal_pm,
490
-        string $partner_id,
491
-        string $seller_id,
492
-        string $client_id,
493
-        string $client_secret
494
-    ): ?TrackSellerOnboarding {
495
-        $paypal_api = self::getPayPalApi($paypal_pm, $client_id, $client_secret);
496
-        if (! $paypal_api) {
497
-            return null;
498
-        }
499
-        return new TrackSellerOnboarding($paypal_api, $partner_id, $seller_id, $paypal_pm->debug_mode());
500
-    }
501
-
502
-
503
-    /**
504
-     * Return a PayPal API object, or false on failure.
505
-     *
506
-     * @param EE_Payment_Method $paypal_pm
507
-     * @param string            $client_id
508
-     * @param string            $client_secret
509
-     * @return PayPalApi|null
510
-     * @throws Exception
511
-     */
512
-    public static function getPayPalApi(
513
-        EE_Payment_Method $paypal_pm,
514
-        string $client_id,
515
-        string $client_secret
516
-    ): ?PayPalApi {
517
-        $bn_code = PayPalExtraMetaManager::getPmOption($paypal_pm, Domain::META_KEY_BN_CODE);
518
-        if (! $client_id || ! $client_secret || ! $bn_code) {
519
-            return null;
520
-        }
521
-        return new PayPalApi($client_id, $client_secret, $bn_code, $paypal_pm->debug_mode());
522
-    }
523
-
524
-
525
-    /**
526
-     * Check the onboard status and return the result.
527
-     * (AJAX)
528
-     *
529
-     * @return void
530
-     * @throws EE_Error
531
-     */
532
-    public static function getOnboardStatus()
533
-    {
534
-        $paypal_pm = EED_PayPalCommerce::getPaymentMethod();
535
-        if (! $paypal_pm instanceof EE_Payment_Method) {
536
-            $err_msg = esc_html__('Could not specify the payment method.', 'event_espresso');
537
-            PayPalLogger::errorLog($err_msg, EED_Module::getRequest()->postParams(), $paypal_pm);
538
-            echo json_encode(['on_board' => false]);
539
-            exit();
540
-        }
541
-        try {
542
-            $seller_id = PayPalExtraMetaManager::getPmOption($paypal_pm, Domain::META_KEY_PAYER_ID) ?? '--';
543
-        } catch (Exception $e) {
544
-            $seller_id = '--';
545
-        }
546
-        echo json_encode(
547
-            [
548
-                'on_board'  => self::isOnboard($paypal_pm),
549
-                'seller_id' => $seller_id,
550
-            ]
551
-        );
552
-        exit();
553
-    }
554
-
555
-
556
-    /**
557
-     * Deauthorize the seller. Remove all API credentials.
558
-     * (AJAX)
559
-     *
560
-     * @return void
561
-     */
562
-    public static function offboard()
563
-    {
564
-        $paypal_pm = EED_PayPalCommerce::getPaymentMethod();
565
-        PayPalExtraMetaManager::deleteAllData($paypal_pm);
566
-        echo json_encode(
567
-            [
568
-                'success' => true,
569
-            ]
570
-        );
571
-        exit();
572
-    }
573
-
574
-
575
-    /**
576
-     * Send a request and return a decoded response body.
577
-     *
578
-     * @param EE_Payment_Method $paypal_pm
579
-     * @param string            $request_url
580
-     * @param array             $request_args
581
-     * @return array
582
-     * @throws EE_Error
583
-     */
584
-    public static function sendRequest(EE_Payment_Method $paypal_pm, string $request_url, array $request_args): array
585
-    {
586
-        $error_return = ['error' => true];
587
-        $response     = wp_remote_request($request_url, $request_args);
588
-        if (is_wp_error($response)) {
589
-            $message = $response->get_error_message();
590
-            PayPalLogger::errorLog($message, [$request_url, $request_args, $response], $paypal_pm);
591
-            $error_return['message'] = $message;
592
-            return $error_return;
593
-        }
594
-        $response_body = (isset($response['body']) && $response['body']) ? json_decode($response['body'], true) : [];
595
-        if (empty($response_body) || isset($response_body['error'])) {
596
-            $message = $response_body['error_description']
597
-                ?? sprintf(
598
-                    esc_html__('Unknown response received while sending a request to: %1$s', 'event_espresso'),
599
-                    $request_url
600
-                );
601
-            PayPalLogger::errorLog($message, [$request_url, $request_args, $response], $paypal_pm);
602
-            $error_return['message'] = $message;
603
-            return $error_return;
604
-        }
605
-        return $response_body;
606
-    }
607
-
608
-
609
-    /**
610
-     * Check the response for a partner token request.
611
-     *
612
-     * @param                   $response
613
-     * @param EE_Payment_Method $paypal_pm
614
-     * @return bool
615
-     * @throws EE_Error
616
-     */
617
-    public static function partnerTokenResponseValid($response, EE_Payment_Method $paypal_pm): bool
618
-    {
619
-        // Check the data we received.
620
-        if (
621
-            empty($response['nonce'])
622
-            || ! wp_verify_nonce($response['nonce'], 'eea_pp_commerce_get_access_token')
623
-            || empty($response['access_token'])
624
-            || empty($response['app_id'])
625
-            || empty($response['expires_in'])
626
-            || empty($response['partner_client_id'])
627
-            || empty($response['partner_merchant_id'])
628
-        ) {
629
-            // This is an error.
630
-            $err_msg = esc_html__('Incoming parameter validation failed.', 'event_espresso');
631
-            PayPalLogger::errorLog($err_msg, (array) $response, $paypal_pm);
632
-            return false;
633
-        }
634
-        return true;
635
-    }
636
-
637
-
638
-    /**
639
-     * Returns the base URL to the middleman server.
640
-     * If LOCAL_MIDDLEMAN_SERVER is defined, requests will be sent to connect.eventespresso.test
641
-     *
642
-     * @param EE_Payment_Method $payment_method
643
-     * @return string
644
-     */
645
-    public static function getMiddlemanBaseUrl(EE_Payment_Method $payment_method): string
646
-    {
647
-        $target = defined('LOCAL_MIDDLEMAN_SERVER') ? 'test' : 'com';
648
-        // If this PM is used under different provider accounts, you might need an account indicator.
649
-        $account = defined('EE_PAYPAL_COMMERCE_ACCOUNT_INDICATOR') ? EE_PAYPAL_COMMERCE_ACCOUNT_INDICATOR : '';
650
-        $postfix = $payment_method->debug_mode() ? '_sandbox' : '';
651
-        $path    = 'paypal_commerce' . $account . $postfix;
652
-        return 'https://connect.eventespresso.' . $target . '/' . $path . '/';
653
-    }
654
-
655
-
656
-    /**
657
-     * Returns the base PayPal API URL.
658
-     *
659
-     * @param EE_Payment_Method $payment_method
660
-     * @return string
661
-     */
662
-    public static function getPayPalApiUrl(EE_Payment_Method $payment_method): string
663
-    {
664
-        return $payment_method->debug_mode() ? 'https://api-m.sandbox.paypal.com' : 'https://api-m.paypal.com';
665
-    }
666
-
667
-
668
-    /**
669
-     * Checks if already onboard.
670
-     *
671
-     * @param EE_Payment_Method $payment_method
672
-     * @return boolean
673
-     * @throws EE_Error
674
-     */
675
-    public static function isOnboard(EE_Payment_Method $payment_method): bool
676
-    {
677
-        $pp_meta_data = PayPalExtraMetaManager::getAllData($payment_method);
678
-        if (
679
-            $pp_meta_data
680
-            && isset($pp_meta_data[ Domain::META_KEY_CLIENT_ID ])
681
-            && $pp_meta_data[ Domain::META_KEY_CLIENT_ID ]
682
-            && isset($pp_meta_data[ Domain::META_KEY_CLIENT_SECRET ])
683
-            && $pp_meta_data[ Domain::META_KEY_CLIENT_SECRET ]
684
-        ) {
685
-            return true;
686
-        }
687
-        return false;
688
-    }
689
-
690
-
691
-    /**
692
-     * Return error message as json allowing to show an alert on the front-end.
693
-     *
694
-     * @param string $error_message
695
-     * @param bool   $show_alert
696
-     * @return void
697
-     */
698
-    public static function exitWithError(string $error_message = '', bool $show_alert = false)
699
-    {
700
-        echo json_encode(
701
-            [
702
-                'error'   => $error_message,
703
-                'message' => $error_message,
704
-                'alert'   => $show_alert,
705
-            ]
706
-        );
707
-        exit();
708
-    }
20
+	/**
21
+	 * @return EED_Module
22
+	 * @throws EE_Error
23
+	 * @throws ReflectionException
24
+	 */
25
+	public static function instance(): EED_Module
26
+	{
27
+		return parent::get_instance(__CLASS__);
28
+	}
29
+
30
+
31
+	/**
32
+	 * Run - initial module setup.
33
+	 *
34
+	 * @param WP $WP
35
+	 * @return void
36
+	 */
37
+	public function run($WP)
38
+	{
39
+		// TODO: Implement run() method.
40
+	}
41
+
42
+
43
+	/**
44
+	 * For hooking into EE Core, other modules, etc.
45
+	 *
46
+	 * @return void
47
+	 */
48
+	public static function set_hooks()
49
+	{
50
+	}
51
+
52
+
53
+	/**
54
+	 * For hooking into EE Admin Core, other modules, etc.
55
+	 *
56
+	 * @return void
57
+	 */
58
+	public static function set_hooks_admin()
59
+	{
60
+		if (DbStatus::isOnline()) {
61
+			// Get onboarding URL.
62
+			add_action('wp_ajax_eeaPpGetOnboardingUrl', [__CLASS__, 'getOnboardingUrl']);
63
+			// Get the seller access token.
64
+			add_action('wp_ajax_eeaPpGetSellerAccessToken', [__CLASS__, 'getSellerAccessToken']);
65
+			// Return the connection/onboard status.
66
+			add_action('wp_ajax_eeaPpGetOnboardStatus', [__CLASS__, 'getOnboardStatus']);
67
+			// Revoke access.
68
+			add_action('wp_ajax_eeaPpOffboard', [__CLASS__, 'offboard']);
69
+		}
70
+	}
71
+
72
+
73
+	/**
74
+	 * Get the onboarding URL.
75
+	 * (AJAX)
76
+	 *
77
+	 * @return void
78
+	 */
79
+	public static function getOnboardingUrl()
80
+	{
81
+		$signup_link = '';
82
+		try {
83
+			$paypal_pm = EED_PayPalCommerce::getPaymentMethod();
84
+			if (! $paypal_pm instanceof EE_Payment_Method) {
85
+				PayPalLogger::errorLogAndExit(
86
+					esc_html__('No payment method.', 'event_espresso'),
87
+					EED_Module::getRequest()->postParams(),
88
+					$paypal_pm
89
+				);
90
+			}
91
+			PayPalExtraMetaManager::updateDebugMode($paypal_pm, EED_Module::getRequest()->postParams());
92
+			$signup_link = self::getSignUpLink($paypal_pm);
93
+		} catch (Exception $exception) {
94
+			self::exitWithError($exception->getMessage());
95
+		}
96
+		// Is it empty (can happen if we didn't get the URL through the API).
97
+		$signup_link = $signup_link ? $signup_link . '?&displayMode=minibrowser' : '#';
98
+		echo json_encode(
99
+			[
100
+				'signup_link' => $signup_link,
101
+			]
102
+		);
103
+		exit();
104
+	}
105
+
106
+
107
+	/**
108
+	 * Get the URL to redirect the seller to and start the onboarding.
109
+	 *
110
+	 * @param EE_Payment_Method $paypal_pm
111
+	 * @return string
112
+	 * @throws EE_Error
113
+	 * @throws Exception
114
+	 */
115
+	public static function getSignUpLink(EE_Payment_Method $paypal_pm): string
116
+	{
117
+		$signup_link   = PayPalExtraMetaManager::getPmOption($paypal_pm, Domain::META_KEY_ONBOARDING_URL);
118
+		$token_expired = self::partnerAccessTokenExpired($paypal_pm);
119
+		if (! $signup_link || $token_expired) {
120
+			// Generate sign-up link and save.
121
+			$signup_link = self::requestOnboardingUrl($paypal_pm);
122
+			if (! $signup_link) {
123
+				$err_msg = esc_html__('Error! Could not generate a sign-up link.', 'event_espresso');
124
+				PayPalLogger::errorLog($err_msg, ['signup_link' => $signup_link], $paypal_pm);
125
+				return '';
126
+			}
127
+			PayPalExtraMetaManager::savePmOption($paypal_pm, Domain::META_KEY_ONBOARDING_URL, $signup_link);
128
+		}
129
+		return $signup_link;
130
+	}
131
+
132
+
133
+	/**
134
+	 * Request the sign-up link from PayPal.
135
+	 *
136
+	 * @param EE_Payment_Method $paypal_pm
137
+	 * @return string
138
+	 * @throws EE_Error
139
+	 * @throws Exception
140
+	 */
141
+	public static function requestOnboardingUrl(EE_Payment_Method $paypal_pm): string
142
+	{
143
+		$signup_link = '';
144
+		// Get the access token.
145
+		$access_token = self::getPartnerAccessToken($paypal_pm);
146
+		if (! $access_token) {
147
+			$err_msg = esc_html__('Error! No access token.', 'event_espresso');
148
+			PayPalLogger::errorLog($err_msg, ['access_token' => $access_token], $paypal_pm);
149
+			return $signup_link;
150
+		}
151
+		$identifier_string = new OneTimeString($paypal_pm->debug_mode());
152
+		$seller_nonce      = $identifier_string->value();
153
+		// Save the identifier for future use.
154
+		PayPalExtraMetaManager::savePmOption($paypal_pm, Domain::META_KEY_SELLER_NONCE, $seller_nonce);
155
+		// Request the access token.
156
+		$body_params = json_encode(
157
+			[
158
+				'products'       => ['EXPRESS_CHECKOUT'],
159
+				'legal_consents' => [
160
+					[
161
+						'type'    => 'SHARE_DATA_CONSENT',
162
+						'granted' => true,
163
+					],
164
+				],
165
+				'operations'     => [
166
+					[
167
+						'operation'                  => 'API_INTEGRATION',
168
+						'api_integration_preference' => [
169
+							'rest_api_integration' => [
170
+								'integration_method'  => 'PAYPAL',
171
+								'integration_type'    => 'FIRST_PARTY',
172
+								'first_party_details' => [
173
+									'features'     => ['PAYMENT', 'REFUND', 'PARTNER_FEE'],
174
+									'seller_nonce' => $seller_nonce,
175
+								],
176
+							],
177
+						],
178
+					],
179
+				],
180
+			]
181
+		);
182
+		$bn_code     = PayPalExtraMetaManager::getPmOption($paypal_pm, Domain::META_KEY_BN_CODE);
183
+		$post_args   = [
184
+			'method'  => 'POST',
185
+			'headers' => [
186
+				'User-Agent'                    => sanitize_text_field($_SERVER['HTTP_USER_AGENT']),
187
+				'Content-Type'                  => 'application/json',
188
+				'Authorization'                 => 'Bearer ' . $access_token,
189
+				'PayPal-Partner-Attribution-Id' => $bn_code,
190
+			],
191
+			'body'    => $body_params,
192
+		];
193
+		$request_url = self::getPayPalApiUrl($paypal_pm) . '/v2/customer/partner-referrals';
194
+		$response    = self::sendRequest($paypal_pm, $request_url, $post_args);
195
+		if (isset($response['error'])) {
196
+			return '';
197
+		}
198
+		// Check the data we received.
199
+		if (empty($response['links'])) {
200
+			$err_msg = esc_html__('Incoming sign-up link parameter validation failed.', 'event_espresso');
201
+			PayPalLogger::errorLog($err_msg, $response, $paypal_pm);
202
+			return '';
203
+		}
204
+		// Now retrieve that sign-up link.
205
+		foreach ($response['links'] as $link) {
206
+			if ($link['rel'] === 'action_url') {
207
+				return $link['href'] ?? '';
208
+			}
209
+		}
210
+		return $signup_link;
211
+	}
212
+
213
+
214
+	/**
215
+	 * Get partner access token.
216
+	 *
217
+	 * @param EE_Payment_Method $paypal_pm
218
+	 * @return string
219
+	 * @throws EE_Error
220
+	 * @throws Exception
221
+	 */
222
+	public static function getPartnerAccessToken(EE_Payment_Method $paypal_pm): string
223
+	{
224
+		// Do we have it saved ?
225
+		$access_token = PayPalExtraMetaManager::getPmOption($paypal_pm, Domain::META_KEY_ACCESS_TOKEN);
226
+		$expired      = self::partnerAccessTokenExpired($paypal_pm);
227
+		// If we don't have it, request/update it.
228
+		if (! $access_token || $expired) {
229
+			return self::requestPartnerAccessToken($paypal_pm);
230
+		}
231
+		// Access token is saved as encrypted, so return decrypted.
232
+		return $access_token;
233
+	}
234
+
235
+
236
+	/**
237
+	 * Get partner access token.
238
+	 *
239
+	 * @param EE_Payment_Method $paypal_pm
240
+	 * @return bool
241
+	 * @throws Exception
242
+	 */
243
+	public static function partnerAccessTokenExpired(EE_Payment_Method $paypal_pm): bool
244
+	{
245
+		$expires_at = (int) PayPalExtraMetaManager::getPmOption($paypal_pm, Domain::META_KEY_EXPIRES_IN);
246
+		if (! $expires_at) {
247
+			return true;
248
+		}
249
+		// Validate the token. Do a health check.
250
+		$now          = time();
251
+		$minutes_left = round(($expires_at - $now) / 60);
252
+		// Count as expired if less than 60 minutes till expiration left.
253
+		if ($minutes_left <= 60) {
254
+			return true;
255
+		}
256
+		return false;
257
+	}
258
+
259
+
260
+	/**
261
+	 * Request the partner access token from PayPal and save/update it.
262
+	 *
263
+	 * @param EE_Payment_Method $paypal_pm
264
+	 * @return string
265
+	 * @throws EE_Error
266
+	 */
267
+	public static function requestPartnerAccessToken(EE_Payment_Method $paypal_pm): string
268
+	{
269
+		$nonce = wp_create_nonce('eea_pp_commerce_get_access_token');
270
+		// Request the access token.
271
+		$post_args = [
272
+			'method' => 'POST',
273
+			'body'   => [
274
+				'nonce'                       => $nonce,
275
+				'api_version'                 => 'v1',
276
+				Domain::META_KEY_SANDBOX_MODE => $paypal_pm->debug_mode() ? '1' : '0',
277
+			],
278
+		];
279
+		if (defined('LOCAL_MIDDLEMAN_SERVER')) {
280
+			$post_args['sslverify'] = false;
281
+		}
282
+		$post_url = self::getMiddlemanBaseUrl($paypal_pm) . 'get_token';
283
+		$response = self::sendRequest($paypal_pm, $post_url, $post_args);
284
+		if (isset($response['error'])) {
285
+			return '';
286
+		}
287
+		// Check the data we received.
288
+		if (! self::partnerTokenResponseValid($response, $paypal_pm)) {
289
+			return '';
290
+		}
291
+		// If we are here all seems to be ok. Save the token and it's data.
292
+		$saved = PayPalExtraMetaManager::savePartnerAccessToken($paypal_pm, $response);
293
+		if (! $saved) {
294
+			return '';
295
+		}
296
+		return $response['access_token'];
297
+	}
298
+
299
+
300
+	/**
301
+	 * Get the seller access token.
302
+	 * (AJAX)
303
+	 *
304
+	 * @return void
305
+	 * @throws Exception
306
+	 */
307
+	public static function getSellerAccessToken()
308
+	{
309
+		$paypal_pm   = EED_PayPalCommerce::getPaymentMethod();
310
+		$post_params = EED_Module::getRequest()->postParams();
311
+		$bn_code     = PayPalExtraMetaManager::getPmOption($paypal_pm, Domain::META_KEY_BN_CODE);
312
+		if (! $paypal_pm instanceof EE_Payment_Method) {
313
+			PayPalLogger::errorLogAndExit(
314
+				esc_html__('No payment method.', 'event_espresso'),
315
+				$post_params,
316
+				$paypal_pm
317
+			);
318
+		}
319
+		$seller_nonce = PayPalExtraMetaManager::getPmOption($paypal_pm, Domain::META_KEY_SELLER_NONCE);
320
+		// Look for mandatory parameters.
321
+		if (
322
+			empty($post_params[ Domain::API_KEY_AUTH_CODE ])
323
+			|| empty($post_params[ Domain::API_KEY_SHARED_ID ])
324
+			|| ! $seller_nonce
325
+			|| ! $bn_code
326
+		) {
327
+			$error_message = esc_html__('Missing authCode and sharedId.', 'event_espresso');
328
+			PayPalLogger::errorLogAndExit($error_message, $post_params, $paypal_pm);
329
+		}
330
+		$nonce = wp_create_nonce('eea_pp_commerce_get_seller_access_token');
331
+		// Request the access token.
332
+		$post_args = [
333
+			'method'  => 'POST',
334
+			'headers' => [
335
+				'User-Agent'                    => sanitize_text_field($_SERVER['HTTP_USER_AGENT']),
336
+				'Content-Type'                  => 'application/json',
337
+				'Authorization'                 => 'Basic ' . base64_encode($post_params[ Domain::API_KEY_SHARED_ID ]),
338
+				'PayPal-Partner-Attribution-Id' => $bn_code,
339
+			],
340
+			'body'    => [
341
+				'nonce'         => $nonce,
342
+				'grant_type'    => 'authorization_code',
343
+				'code'          => $post_params[ Domain::API_KEY_AUTH_CODE ],
344
+				'code_verifier' => $seller_nonce,
345
+			],
346
+		];
347
+		$post_url  = self::getPayPalApiUrl($paypal_pm) . '/v1/oauth2/token';
348
+		$response  = self::sendRequest($paypal_pm, $post_url, $post_args);
349
+		if (isset($response['error'])) {
350
+			self::exitWithError($response['message']);
351
+		}
352
+		// Check the data we received.
353
+		if (
354
+			empty($response['access_token'])
355
+			|| empty($response['expires_in'])
356
+			|| empty($response['refresh_token'])
357
+		) {
358
+			// This is an error.
359
+			$err_msg = esc_html__('Incoming parameter validation failed.', 'event_espresso');
360
+			PayPalLogger::errorLogAndExit($err_msg, $response, $paypal_pm);
361
+		}
362
+		// Now we can request the seller API credentials.
363
+		$credentials_saved = self::requestApiCredentials($paypal_pm, $response['access_token']);
364
+		if (isset($credentials_saved['error'])) {
365
+			echo json_encode(
366
+				[
367
+					'error'   => $credentials_saved['error'],
368
+					'message' => $credentials_saved['message'],
369
+				]
370
+			);
371
+		} else {
372
+			echo json_encode(
373
+				[
374
+					'success'  => true,
375
+					'on_board' => true,
376
+				]
377
+			);
378
+		}
379
+		exit();
380
+	}
381
+
382
+
383
+	/**
384
+	 * Get the seller API credentials.
385
+	 *
386
+	 * @param EE_Payment_Method $paypal_pm
387
+	 * @param string            $seller_token
388
+	 * @return array
389
+	 * @throws EE_Error
390
+	 * @throws Exception
391
+	 */
392
+	public static function requestApiCredentials(EE_Payment_Method $paypal_pm, string $seller_token): array
393
+	{
394
+		$partner_merchant_id = PayPalExtraMetaManager::getPmOption($paypal_pm, Domain::META_KEY_PARTNER_MERCHANT_ID);
395
+		$bn_code             = PayPalExtraMetaManager::getPmOption($paypal_pm, Domain::META_KEY_BN_CODE);
396
+		$get_params          = [
397
+			'method'  => 'GET',
398
+			'headers' => [
399
+				'User-Agent'                    => sanitize_text_field($_SERVER['HTTP_USER_AGENT']),
400
+				'Content-Type'                  => 'application/json',
401
+				'Authorization'                 => 'Bearer ' . $seller_token,
402
+				'PayPal-Partner-Attribution-Id' => $bn_code,
403
+			],
404
+		];
405
+		$request_url = self::getPayPalApiUrl($paypal_pm)
406
+						. '/v1/customer/partners/'
407
+						. $partner_merchant_id
408
+						. '/merchant-integrations/credentials/';
409
+		$response = self::sendRequest($paypal_pm, $request_url, $get_params);
410
+		// Check the data we received.
411
+		if (empty($response['client_id']) || empty($response['client_secret'])) {
412
+			// This is an error.
413
+			if (isset($response['message'])) {
414
+				$err_msg  = $response['message'];
415
+				$err_name = $response['name'] ?? 'UNRECOGNIZED_ERROR';
416
+			} else {
417
+				$err_msg  = esc_html__('Incoming parameter validation failed.', 'event_espresso');
418
+				$err_name = 'INCOMING_PARAMETER_INVALID';
419
+			}
420
+			PayPalLogger::errorLog($err_msg, $response, $paypal_pm);
421
+			return ['error' => $err_name, 'message' => $err_msg];
422
+		}
423
+		// Finally, track seller onboarding status.
424
+		$onboarding_status = self::trackSellerOnboarding(
425
+			$paypal_pm,
426
+			$partner_merchant_id,
427
+			$response[ Domain::META_KEY_PAYER_ID ],
428
+			$response[ Domain::META_KEY_CLIENT_ID ],
429
+			$response[ Domain::META_KEY_CLIENT_SECRET ]
430
+		);
431
+		if (isset($onboarding_status['error'])) {
432
+			return $onboarding_status;
433
+		}
434
+		// If onboarded successfully, remove the onetime onboarding URL.
435
+		if (PayPalExtraMetaManager::saveSellerApiCredentials($paypal_pm, $response)) {
436
+			PayPalExtraMetaManager::deletePmOption($paypal_pm, Domain::META_KEY_ONBOARDING_URL);
437
+			return ['success' => true];
438
+		} else {
439
+			return [
440
+				'error'   => 'SELLER_CREDENTIALS_NOT_SAVED',
441
+				'message' => esc_html__('Seller credentials were not saved.', 'event_espresso'),
442
+			];
443
+		}
444
+	}
445
+
446
+
447
+	/**
448
+	 * Request seller onboarding status from PayPal.
449
+	 *
450
+	 * @param EE_Payment_Method $paypal_pm
451
+	 * @param string            $partner_id
452
+	 * @param                   $seller_id
453
+	 * @param string            $client_id
454
+	 * @param string            $client_secret
455
+	 * @return array
456
+	 * @throws EE_Error
457
+	 * @throws Exception
458
+	 */
459
+	public static function trackSellerOnboarding(
460
+		EE_Payment_Method $paypal_pm,
461
+		string $partner_id,
462
+		$seller_id,
463
+		string $client_id,
464
+		string $client_secret
465
+	): array {
466
+		$track_onboarding = self::getTrackOnboardingApi(
467
+			$paypal_pm,
468
+			$partner_id,
469
+			$seller_id,
470
+			$client_id,
471
+			$client_secret
472
+		);
473
+		return $track_onboarding->isValid();
474
+	}
475
+
476
+
477
+	/**
478
+	 * Returns the Track Seller Onboarding API.
479
+	 *
480
+	 * @param EE_Payment_Method $paypal_pm
481
+	 * @param string            $partner_id
482
+	 * @param string            $seller_id
483
+	 * @param string            $client_id
484
+	 * @param string            $client_secret
485
+	 * @return TrackSellerOnboarding|null
486
+	 * @throws Exception
487
+	 */
488
+	public static function getTrackOnboardingApi(
489
+		EE_Payment_Method $paypal_pm,
490
+		string $partner_id,
491
+		string $seller_id,
492
+		string $client_id,
493
+		string $client_secret
494
+	): ?TrackSellerOnboarding {
495
+		$paypal_api = self::getPayPalApi($paypal_pm, $client_id, $client_secret);
496
+		if (! $paypal_api) {
497
+			return null;
498
+		}
499
+		return new TrackSellerOnboarding($paypal_api, $partner_id, $seller_id, $paypal_pm->debug_mode());
500
+	}
501
+
502
+
503
+	/**
504
+	 * Return a PayPal API object, or false on failure.
505
+	 *
506
+	 * @param EE_Payment_Method $paypal_pm
507
+	 * @param string            $client_id
508
+	 * @param string            $client_secret
509
+	 * @return PayPalApi|null
510
+	 * @throws Exception
511
+	 */
512
+	public static function getPayPalApi(
513
+		EE_Payment_Method $paypal_pm,
514
+		string $client_id,
515
+		string $client_secret
516
+	): ?PayPalApi {
517
+		$bn_code = PayPalExtraMetaManager::getPmOption($paypal_pm, Domain::META_KEY_BN_CODE);
518
+		if (! $client_id || ! $client_secret || ! $bn_code) {
519
+			return null;
520
+		}
521
+		return new PayPalApi($client_id, $client_secret, $bn_code, $paypal_pm->debug_mode());
522
+	}
523
+
524
+
525
+	/**
526
+	 * Check the onboard status and return the result.
527
+	 * (AJAX)
528
+	 *
529
+	 * @return void
530
+	 * @throws EE_Error
531
+	 */
532
+	public static function getOnboardStatus()
533
+	{
534
+		$paypal_pm = EED_PayPalCommerce::getPaymentMethod();
535
+		if (! $paypal_pm instanceof EE_Payment_Method) {
536
+			$err_msg = esc_html__('Could not specify the payment method.', 'event_espresso');
537
+			PayPalLogger::errorLog($err_msg, EED_Module::getRequest()->postParams(), $paypal_pm);
538
+			echo json_encode(['on_board' => false]);
539
+			exit();
540
+		}
541
+		try {
542
+			$seller_id = PayPalExtraMetaManager::getPmOption($paypal_pm, Domain::META_KEY_PAYER_ID) ?? '--';
543
+		} catch (Exception $e) {
544
+			$seller_id = '--';
545
+		}
546
+		echo json_encode(
547
+			[
548
+				'on_board'  => self::isOnboard($paypal_pm),
549
+				'seller_id' => $seller_id,
550
+			]
551
+		);
552
+		exit();
553
+	}
554
+
555
+
556
+	/**
557
+	 * Deauthorize the seller. Remove all API credentials.
558
+	 * (AJAX)
559
+	 *
560
+	 * @return void
561
+	 */
562
+	public static function offboard()
563
+	{
564
+		$paypal_pm = EED_PayPalCommerce::getPaymentMethod();
565
+		PayPalExtraMetaManager::deleteAllData($paypal_pm);
566
+		echo json_encode(
567
+			[
568
+				'success' => true,
569
+			]
570
+		);
571
+		exit();
572
+	}
573
+
574
+
575
+	/**
576
+	 * Send a request and return a decoded response body.
577
+	 *
578
+	 * @param EE_Payment_Method $paypal_pm
579
+	 * @param string            $request_url
580
+	 * @param array             $request_args
581
+	 * @return array
582
+	 * @throws EE_Error
583
+	 */
584
+	public static function sendRequest(EE_Payment_Method $paypal_pm, string $request_url, array $request_args): array
585
+	{
586
+		$error_return = ['error' => true];
587
+		$response     = wp_remote_request($request_url, $request_args);
588
+		if (is_wp_error($response)) {
589
+			$message = $response->get_error_message();
590
+			PayPalLogger::errorLog($message, [$request_url, $request_args, $response], $paypal_pm);
591
+			$error_return['message'] = $message;
592
+			return $error_return;
593
+		}
594
+		$response_body = (isset($response['body']) && $response['body']) ? json_decode($response['body'], true) : [];
595
+		if (empty($response_body) || isset($response_body['error'])) {
596
+			$message = $response_body['error_description']
597
+				?? sprintf(
598
+					esc_html__('Unknown response received while sending a request to: %1$s', 'event_espresso'),
599
+					$request_url
600
+				);
601
+			PayPalLogger::errorLog($message, [$request_url, $request_args, $response], $paypal_pm);
602
+			$error_return['message'] = $message;
603
+			return $error_return;
604
+		}
605
+		return $response_body;
606
+	}
607
+
608
+
609
+	/**
610
+	 * Check the response for a partner token request.
611
+	 *
612
+	 * @param                   $response
613
+	 * @param EE_Payment_Method $paypal_pm
614
+	 * @return bool
615
+	 * @throws EE_Error
616
+	 */
617
+	public static function partnerTokenResponseValid($response, EE_Payment_Method $paypal_pm): bool
618
+	{
619
+		// Check the data we received.
620
+		if (
621
+			empty($response['nonce'])
622
+			|| ! wp_verify_nonce($response['nonce'], 'eea_pp_commerce_get_access_token')
623
+			|| empty($response['access_token'])
624
+			|| empty($response['app_id'])
625
+			|| empty($response['expires_in'])
626
+			|| empty($response['partner_client_id'])
627
+			|| empty($response['partner_merchant_id'])
628
+		) {
629
+			// This is an error.
630
+			$err_msg = esc_html__('Incoming parameter validation failed.', 'event_espresso');
631
+			PayPalLogger::errorLog($err_msg, (array) $response, $paypal_pm);
632
+			return false;
633
+		}
634
+		return true;
635
+	}
636
+
637
+
638
+	/**
639
+	 * Returns the base URL to the middleman server.
640
+	 * If LOCAL_MIDDLEMAN_SERVER is defined, requests will be sent to connect.eventespresso.test
641
+	 *
642
+	 * @param EE_Payment_Method $payment_method
643
+	 * @return string
644
+	 */
645
+	public static function getMiddlemanBaseUrl(EE_Payment_Method $payment_method): string
646
+	{
647
+		$target = defined('LOCAL_MIDDLEMAN_SERVER') ? 'test' : 'com';
648
+		// If this PM is used under different provider accounts, you might need an account indicator.
649
+		$account = defined('EE_PAYPAL_COMMERCE_ACCOUNT_INDICATOR') ? EE_PAYPAL_COMMERCE_ACCOUNT_INDICATOR : '';
650
+		$postfix = $payment_method->debug_mode() ? '_sandbox' : '';
651
+		$path    = 'paypal_commerce' . $account . $postfix;
652
+		return 'https://connect.eventespresso.' . $target . '/' . $path . '/';
653
+	}
654
+
655
+
656
+	/**
657
+	 * Returns the base PayPal API URL.
658
+	 *
659
+	 * @param EE_Payment_Method $payment_method
660
+	 * @return string
661
+	 */
662
+	public static function getPayPalApiUrl(EE_Payment_Method $payment_method): string
663
+	{
664
+		return $payment_method->debug_mode() ? 'https://api-m.sandbox.paypal.com' : 'https://api-m.paypal.com';
665
+	}
666
+
667
+
668
+	/**
669
+	 * Checks if already onboard.
670
+	 *
671
+	 * @param EE_Payment_Method $payment_method
672
+	 * @return boolean
673
+	 * @throws EE_Error
674
+	 */
675
+	public static function isOnboard(EE_Payment_Method $payment_method): bool
676
+	{
677
+		$pp_meta_data = PayPalExtraMetaManager::getAllData($payment_method);
678
+		if (
679
+			$pp_meta_data
680
+			&& isset($pp_meta_data[ Domain::META_KEY_CLIENT_ID ])
681
+			&& $pp_meta_data[ Domain::META_KEY_CLIENT_ID ]
682
+			&& isset($pp_meta_data[ Domain::META_KEY_CLIENT_SECRET ])
683
+			&& $pp_meta_data[ Domain::META_KEY_CLIENT_SECRET ]
684
+		) {
685
+			return true;
686
+		}
687
+		return false;
688
+	}
689
+
690
+
691
+	/**
692
+	 * Return error message as json allowing to show an alert on the front-end.
693
+	 *
694
+	 * @param string $error_message
695
+	 * @param bool   $show_alert
696
+	 * @return void
697
+	 */
698
+	public static function exitWithError(string $error_message = '', bool $show_alert = false)
699
+	{
700
+		echo json_encode(
701
+			[
702
+				'error'   => $error_message,
703
+				'message' => $error_message,
704
+				'alert'   => $show_alert,
705
+			]
706
+		);
707
+		exit();
708
+	}
709 709
 }
Please login to merge, or discard this patch.
languages/event_espresso-translations-js.php 1 patch
Spacing   +710 added lines, -710 removed lines patch added patch discarded remove patch
@@ -2,137 +2,137 @@  discard block
 block discarded – undo
2 2
 /* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */
3 3
 $generated_i18n_strings = array(
4 4
 	// Reference: packages/ui-components/src/Pagination/constants.ts:6
5
-	__( '2', 'event_espresso' ),
5
+	__('2', 'event_espresso'),
6 6
 
7 7
 	// Reference: packages/ui-components/src/Pagination/constants.ts:7
8
-	__( '6', 'event_espresso' ),
8
+	__('6', 'event_espresso'),
9 9
 
10 10
 	// Reference: packages/ui-components/src/Pagination/constants.ts:8
11
-	__( '12', 'event_espresso' ),
11
+	__('12', 'event_espresso'),
12 12
 
13 13
 	// Reference: packages/ui-components/src/Pagination/constants.ts:9
14
-	__( '24', 'event_espresso' ),
14
+	__('24', 'event_espresso'),
15 15
 
16 16
 	// Reference: packages/ui-components/src/Pagination/constants.ts:10
17
-	__( '48', 'event_espresso' ),
17
+	__('48', 'event_espresso'),
18 18
 
19 19
 	// Reference: domains/core/admin/blocks/src/components/AvatarImage.tsx:27
20
-	__( 'contact avatar', 'event_espresso' ),
20
+	__('contact avatar', 'event_espresso'),
21 21
 
22 22
 	// Reference: domains/core/admin/blocks/src/components/OrderByControl.tsx:12
23
-	__( 'Order by', 'event_espresso' ),
23
+	__('Order by', 'event_espresso'),
24 24
 
25 25
 	// Reference: domains/core/admin/blocks/src/components/RegStatusControl.tsx:17
26 26
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectStatus.tsx:13
27
-	__( 'Select Registration Status', 'event_espresso' ),
27
+	__('Select Registration Status', 'event_espresso'),
28 28
 
29 29
 	// Reference: domains/core/admin/blocks/src/components/SortOrderControl.tsx:14
30
-	__( 'Ascending', 'event_espresso' ),
30
+	__('Ascending', 'event_espresso'),
31 31
 
32 32
 	// Reference: domains/core/admin/blocks/src/components/SortOrderControl.tsx:18
33
-	__( 'Descending', 'event_espresso' ),
33
+	__('Descending', 'event_espresso'),
34 34
 
35 35
 	// Reference: domains/core/admin/blocks/src/components/SortOrderControl.tsx:24
36
-	__( 'Sort order:', 'event_espresso' ),
36
+	__('Sort order:', 'event_espresso'),
37 37
 
38 38
 	// Reference: domains/core/admin/blocks/src/event-attendees/AttendeesDisplay.tsx:41
39
-	__( 'There was some error fetching attendees list', 'event_espresso' ),
39
+	__('There was some error fetching attendees list', 'event_espresso'),
40 40
 
41 41
 	// Reference: domains/core/admin/blocks/src/event-attendees/AttendeesDisplay.tsx:47
42
-	__( 'To get started, select what event you want to show attendees from in the block settings.', 'event_espresso' ),
42
+	__('To get started, select what event you want to show attendees from in the block settings.', 'event_espresso'),
43 43
 
44 44
 	// Reference: domains/core/admin/blocks/src/event-attendees/AttendeesDisplay.tsx:53
45
-	__( 'There are no attendees for selected options.', 'event_espresso' ),
45
+	__('There are no attendees for selected options.', 'event_espresso'),
46 46
 
47 47
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/ArchiveSettings.tsx:12
48
-	__( 'Display on Archives', 'event_espresso' ),
48
+	__('Display on Archives', 'event_espresso'),
49 49
 
50 50
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/ArchiveSettings.tsx:17
51
-	__( 'Attendees are shown whenever this post is listed in an archive view.', 'event_espresso' ),
51
+	__('Attendees are shown whenever this post is listed in an archive view.', 'event_espresso'),
52 52
 
53 53
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/ArchiveSettings.tsx:18
54
-	__( 'Attendees are hidden whenever this post is listed in an archive view.', 'event_espresso' ),
54
+	__('Attendees are hidden whenever this post is listed in an archive view.', 'event_espresso'),
55 55
 
56 56
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/AttendeeLimit.tsx:29
57
-	__( 'Number of Attendees to Display:', 'event_espresso' ),
57
+	__('Number of Attendees to Display:', 'event_espresso'),
58 58
 
59 59
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/AttendeeLimit.tsx:34
60 60
 	/* translators: %d attendees count */
61
-	_n_noop( 'Used to adjust the number of attendees displayed (There is %d total attendee for the current filter settings).', 'Used to adjust the number of attendees displayed (There are %d total attendees for the current filter settings).', 'event_espresso' ),
61
+	_n_noop('Used to adjust the number of attendees displayed (There is %d total attendee for the current filter settings).', 'Used to adjust the number of attendees displayed (There are %d total attendees for the current filter settings).', 'event_espresso'),
62 62
 
63 63
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/GravatarSettings.tsx:27
64
-	__( 'Display Gravatar', 'event_espresso' ),
64
+	__('Display Gravatar', 'event_espresso'),
65 65
 
66 66
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/GravatarSettings.tsx:32
67
-	__( 'Gravatar images are shown for each attendee.', 'event_espresso' ),
67
+	__('Gravatar images are shown for each attendee.', 'event_espresso'),
68 68
 
69 69
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/GravatarSettings.tsx:33
70
-	__( 'No gravatar images are shown for each attendee.', 'event_espresso' ),
70
+	__('No gravatar images are shown for each attendee.', 'event_espresso'),
71 71
 
72 72
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/GravatarSettings.tsx:38
73
-	__( 'Size of Gravatar', 'event_espresso' ),
73
+	__('Size of Gravatar', 'event_espresso'),
74 74
 
75 75
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectDatetime.tsx:22
76
-	__( 'Select Datetime', 'event_espresso' ),
76
+	__('Select Datetime', 'event_espresso'),
77 77
 
78 78
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectEvent.tsx:22
79 79
 	// Reference: domains/core/admin/blocks/src/event/controls/SelectEvent.tsx:22
80
-	__( 'Select Event', 'event_espresso' ),
80
+	__('Select Event', 'event_espresso'),
81 81
 
82 82
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectOrderBy.tsx:11
83
-	__( 'Attendee id', 'event_espresso' ),
83
+	__('Attendee id', 'event_espresso'),
84 84
 
85 85
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectOrderBy.tsx:15
86
-	__( 'Last name only', 'event_espresso' ),
86
+	__('Last name only', 'event_espresso'),
87 87
 
88 88
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectOrderBy.tsx:19
89
-	__( 'First name only', 'event_espresso' ),
89
+	__('First name only', 'event_espresso'),
90 90
 
91 91
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectOrderBy.tsx:23
92
-	__( 'First, then Last name', 'event_espresso' ),
92
+	__('First, then Last name', 'event_espresso'),
93 93
 
94 94
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectOrderBy.tsx:27
95
-	__( 'Last, then First name', 'event_espresso' ),
95
+	__('Last, then First name', 'event_espresso'),
96 96
 
97 97
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectOrderBy.tsx:41
98
-	__( 'Order Attendees by:', 'event_espresso' ),
98
+	__('Order Attendees by:', 'event_espresso'),
99 99
 
100 100
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/SelectTicket.tsx:22
101
-	__( 'Select Ticket', 'event_espresso' ),
101
+	__('Select Ticket', 'event_espresso'),
102 102
 
103 103
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/index.tsx:21
104
-	__( 'Filter By Settings', 'event_espresso' ),
104
+	__('Filter By Settings', 'event_espresso'),
105 105
 
106 106
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/index.tsx:36
107
-	__( 'Gravatar Setttings', 'event_espresso' ),
107
+	__('Gravatar Setttings', 'event_espresso'),
108 108
 
109 109
 	// Reference: domains/core/admin/blocks/src/event-attendees/controls/index.tsx:39
110
-	__( 'Archive Settings', 'event_espresso' ),
110
+	__('Archive Settings', 'event_espresso'),
111 111
 
112 112
 	// Reference: domains/core/admin/blocks/src/event-attendees/index.tsx:10
113
-	__( 'Event Attendees', 'event_espresso' ),
113
+	__('Event Attendees', 'event_espresso'),
114 114
 
115 115
 	// Reference: domains/core/admin/blocks/src/event-attendees/index.tsx:11
116
-	__( 'Displays a list of people that have registered for the specified event', 'event_espresso' ),
116
+	__('Displays a list of people that have registered for the specified event', 'event_espresso'),
117 117
 
118 118
 	// Reference: domains/core/admin/blocks/src/event-attendees/index.tsx:14
119 119
 	// Reference: domains/core/admin/blocks/src/event/index.tsx:12
120 120
 	// Reference: packages/edtr-services/src/constants.ts:25
121
-	__( 'event', 'event_espresso' ),
121
+	__('event', 'event_espresso'),
122 122
 
123 123
 	// Reference: domains/core/admin/blocks/src/event-attendees/index.tsx:14
124
-	__( 'attendees', 'event_espresso' ),
124
+	__('attendees', 'event_espresso'),
125 125
 
126 126
 	// Reference: domains/core/admin/blocks/src/event-attendees/index.tsx:14
127
-	__( 'list', 'event_espresso' ),
127
+	__('list', 'event_espresso'),
128 128
 
129 129
 	// Reference: domains/core/admin/blocks/src/event/DisplayField.tsx:41
130
-	__( 'An unknown error occurred while fetching event details.', 'event_espresso' ),
130
+	__('An unknown error occurred while fetching event details.', 'event_espresso'),
131 131
 
132 132
 	// Reference: domains/core/admin/blocks/src/event/controls/SelectField.tsx:10
133 133
 	// Reference: domains/core/admin/blocks/src/services/utils.ts:24
134 134
 	// Reference: packages/utils/src/list/index.ts:14
135
-	__( 'Select…', 'event_espresso' ),
135
+	__('Select…', 'event_espresso'),
136 136
 
137 137
 	// Reference: domains/core/admin/blocks/src/event/controls/SelectField.tsx:15
138 138
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:75
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:198
142 142
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:48
143 143
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:42
144
-	__( 'Name', 'event_espresso' ),
144
+	__('Name', 'event_espresso'),
145 145
 
146 146
 	// Reference: domains/core/admin/blocks/src/event/controls/SelectField.tsx:19
147 147
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:80
@@ -149,407 +149,407 @@  discard block
 block discarded – undo
149 149
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:203
150 150
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:54
151 151
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:47
152
-	__( 'Description', 'event_espresso' ),
152
+	__('Description', 'event_espresso'),
153 153
 
154 154
 	// Reference: domains/core/admin/blocks/src/event/controls/SelectField.tsx:23
155
-	__( 'Short description', 'event_espresso' ),
155
+	__('Short description', 'event_espresso'),
156 156
 
157 157
 	// Reference: domains/core/admin/blocks/src/event/controls/SelectField.tsx:35
158
-	__( 'Select Field', 'event_espresso' ),
158
+	__('Select Field', 'event_espresso'),
159 159
 
160 160
 	// Reference: domains/core/admin/blocks/src/event/controls/index.tsx:27
161
-	__( 'Text Color', 'event_espresso' ),
161
+	__('Text Color', 'event_espresso'),
162 162
 
163 163
 	// Reference: domains/core/admin/blocks/src/event/controls/index.tsx:32
164
-	__( 'Background Color', 'event_espresso' ),
164
+	__('Background Color', 'event_espresso'),
165 165
 
166 166
 	// Reference: domains/core/admin/blocks/src/event/controls/index.tsx:41
167 167
 	// Reference: packages/form-builder/src/FormElement/Tabs/FormElementTabs.tsx:22
168 168
 	// Reference: packages/form-builder/src/FormSection/Tabs/FormSectionTabs.tsx:21
169
-	__( 'Settings', 'event_espresso' ),
169
+	__('Settings', 'event_espresso'),
170 170
 
171 171
 	// Reference: domains/core/admin/blocks/src/event/controls/index.tsx:45
172
-	__( 'Typography', 'event_espresso' ),
172
+	__('Typography', 'event_espresso'),
173 173
 
174 174
 	// Reference: domains/core/admin/blocks/src/event/controls/index.tsx:48
175
-	__( 'Color', 'event_espresso' ),
175
+	__('Color', 'event_espresso'),
176 176
 
177 177
 	// Reference: domains/core/admin/blocks/src/event/index.tsx:12
178
-	__( 'field', 'event_espresso' ),
178
+	__('field', 'event_espresso'),
179 179
 
180 180
 	// Reference: domains/core/admin/blocks/src/event/index.tsx:8
181
-	__( 'Event Field', 'event_espresso' ),
181
+	__('Event Field', 'event_espresso'),
182 182
 
183 183
 	// Reference: domains/core/admin/blocks/src/event/index.tsx:9
184
-	__( 'Displays the selected field of an event', 'event_espresso' ),
184
+	__('Displays the selected field of an event', 'event_espresso'),
185 185
 
186 186
 	// Reference: domains/core/admin/blocks/src/services/utils.ts:17
187
-	__( 'Error', 'event_espresso' ),
187
+	__('Error', 'event_espresso'),
188 188
 
189 189
 	// Reference: domains/core/admin/blocks/src/services/utils.ts:9
190
-	__( 'Loading…', 'event_espresso' ),
190
+	__('Loading…', 'event_espresso'),
191 191
 
192 192
 	// Reference: domains/core/admin/eventEditor/src/ui/EventDescription.tsx:33
193
-	__( 'Event Description', 'event_espresso' ),
193
+	__('Event Description', 'event_espresso'),
194 194
 
195 195
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/ActiveStatus.tsx:28
196
-	__( 'Active status', 'event_espresso' ),
196
+	__('Active status', 'event_espresso'),
197 197
 
198 198
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/AltRegPage.tsx:12
199
-	__( 'Alternative Registration Page', 'event_espresso' ),
199
+	__('Alternative Registration Page', 'event_espresso'),
200 200
 
201 201
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/DefaultRegistrationStatus.tsx:25
202
-	__( 'Default Registration Status', 'event_espresso' ),
202
+	__('Default Registration Status', 'event_espresso'),
203 203
 
204 204
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/Donations.tsx:8
205
-	__( 'Donations Enabled', 'event_espresso' ),
205
+	__('Donations Enabled', 'event_espresso'),
206 206
 
207 207
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/Donations.tsx:8
208
-	__( 'Donations Disabled', 'event_espresso' ),
208
+	__('Donations Disabled', 'event_espresso'),
209 209
 
210 210
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/EventManager.tsx:16
211
-	__( 'Event Manager', 'event_espresso' ),
211
+	__('Event Manager', 'event_espresso'),
212 212
 
213 213
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/EventPhoneNumber.tsx:15
214
-	__( 'Event Phone Number', 'event_espresso' ),
214
+	__('Event Phone Number', 'event_espresso'),
215 215
 
216 216
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/MaxRegistrations.tsx:13
217
-	__( 'Max Registrations per Transaction', 'event_espresso' ),
217
+	__('Max Registrations per Transaction', 'event_espresso'),
218 218
 
219 219
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/TicketSelector.tsx:8
220
-	__( 'Ticket Selector Enabled', 'event_espresso' ),
220
+	__('Ticket Selector Enabled', 'event_espresso'),
221 221
 
222 222
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/TicketSelector.tsx:8
223
-	__( 'Ticket Selector Disabled', 'event_espresso' ),
223
+	__('Ticket Selector Disabled', 'event_espresso'),
224 224
 
225 225
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/index.tsx:41
226
-	__( 'Event Details', 'event_espresso' ),
226
+	__('Event Details', 'event_espresso'),
227 227
 
228 228
 	// Reference: domains/core/admin/eventEditor/src/ui/EventRegistrationOptions/index.tsx:47
229
-	__( 'Registration Options', 'event_espresso' ),
229
+	__('Registration Options', 'event_espresso'),
230 230
 
231 231
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/DateFormSteps.tsx:10
232
-	__( 'primary information about the date', 'event_espresso' ),
232
+	__('primary information about the date', 'event_espresso'),
233 233
 
234 234
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/DateFormSteps.tsx:10
235
-	__( 'Date Details', 'event_espresso' ),
235
+	__('Date Details', 'event_espresso'),
236 236
 
237 237
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/DateFormSteps.tsx:11
238 238
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/TicketFormSteps.tsx:16
239 239
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:16
240
-	__( 'relations between tickets and dates', 'event_espresso' ),
240
+	__('relations between tickets and dates', 'event_espresso'),
241 241
 
242 242
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/DateFormSteps.tsx:11
243
-	__( 'Assign Tickets', 'event_espresso' ),
243
+	__('Assign Tickets', 'event_espresso'),
244 244
 
245 245
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/FooterButtons.tsx:22
246
-	__( 'Save and assign tickets', 'event_espresso' ),
246
+	__('Save and assign tickets', 'event_espresso'),
247 247
 
248 248
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/Modal.tsx:30
249 249
 	/* translators: %d database id */
250
-	__( 'Edit datetime %s', 'event_espresso' ),
250
+	__('Edit datetime %s', 'event_espresso'),
251 251
 
252 252
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/Modal.tsx:33
253
-	__( 'New Datetime', 'event_espresso' ),
253
+	__('New Datetime', 'event_espresso'),
254 254
 
255 255
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/multiStep/Modal.tsx:43
256
-	__( 'modal for datetime', 'event_espresso' ),
256
+	__('modal for datetime', 'event_espresso'),
257 257
 
258 258
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:110
259 259
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:107
260 260
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:233
261 261
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:106
262
-	__( 'Details', 'event_espresso' ),
262
+	__('Details', 'event_espresso'),
263 263
 
264 264
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:114
265 265
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:111
266 266
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:83
267
-	__( 'Capacity', 'event_espresso' ),
267
+	__('Capacity', 'event_espresso'),
268 268
 
269 269
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:119
270
-	__( 'The maximum number of registrants that can attend the event at this particular date.', 'event_espresso' ),
270
+	__('The maximum number of registrants that can attend the event at this particular date.', 'event_espresso'),
271 271
 
272 272
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:123
273
-	__( 'Set to 0 to close registration or leave blank for no limit.', 'event_espresso' ),
273
+	__('Set to 0 to close registration or leave blank for no limit.', 'event_espresso'),
274 274
 
275 275
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:129
276 276
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:171
277
-	__( 'Trash', 'event_espresso' ),
277
+	__('Trash', 'event_espresso'),
278 278
 
279 279
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:71
280 280
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:44
281 281
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:194
282 282
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:44
283
-	__( 'Basics', 'event_espresso' ),
283
+	__('Basics', 'event_espresso'),
284 284
 
285 285
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:88
286 286
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:62
287 287
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:62
288
-	__( 'Dates', 'event_espresso' ),
288
+	__('Dates', 'event_espresso'),
289 289
 
290 290
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:92
291 291
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:53
292 292
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:215
293
-	__( 'Start Date', 'event_espresso' ),
293
+	__('Start Date', 'event_espresso'),
294 294
 
295 295
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:99
296 296
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:67
297 297
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:222
298
-	__( 'End Date', 'event_espresso' ),
298
+	__('End Date', 'event_espresso'),
299 299
 
300 300
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/DateRegistrationsLink.tsx:13
301
-	__( 'view ALL registrations for this date.', 'event_espresso' ),
301
+	__('view ALL registrations for this date.', 'event_espresso'),
302 302
 
303 303
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/DateSoldLink.tsx:13
304
-	__( 'view approved registrations for this date.', 'event_espresso' ),
304
+	__('view approved registrations for this date.', 'event_espresso'),
305 305
 
306 306
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/DatesList.tsx:35
307 307
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/TableView.tsx:33
308
-	__( 'Event Dates', 'event_espresso' ),
308
+	__('Event Dates', 'event_espresso'),
309 309
 
310 310
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/DatesList.tsx:38
311
-	__( 'loading event dates…', 'event_espresso' ),
311
+	__('loading event dates…', 'event_espresso'),
312 312
 
313 313
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/DatesListButtons.tsx:22
314
-	__( 'Add a date or a ticket in order to use Ticket Assignment Manager', 'event_espresso' ),
314
+	__('Add a date or a ticket in order to use Ticket Assignment Manager', 'event_espresso'),
315 315
 
316 316
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/DatesListButtons.tsx:32
317
-	__( 'Ticket Assignments', 'event_espresso' ),
317
+	__('Ticket Assignments', 'event_espresso'),
318 318
 
319 319
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/AssignTicketsButton.tsx:25
320
-	__( 'Number of related tickets', 'event_espresso' ),
320
+	__('Number of related tickets', 'event_espresso'),
321 321
 
322 322
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/AssignTicketsButton.tsx:26
323
-	__( 'There are no tickets assigned to this datetime. Please click the ticket icon to update the assignments.', 'event_espresso' ),
323
+	__('There are no tickets assigned to this datetime. Please click the ticket icon to update the assignments.', 'event_espresso'),
324 324
 
325 325
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/AssignTicketsButton.tsx:34
326
-	__( 'assign tickets', 'event_espresso' ),
326
+	__('assign tickets', 'event_espresso'),
327 327
 
328 328
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:21
329
-	__( 'event datetime main menu', 'event_espresso' ),
329
+	__('event datetime main menu', 'event_espresso'),
330 330
 
331 331
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:33
332
-	__( 'edit datetime', 'event_espresso' ),
332
+	__('edit datetime', 'event_espresso'),
333 333
 
334 334
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:34
335
-	__( 'copy datetime', 'event_espresso' ),
335
+	__('copy datetime', 'event_espresso'),
336 336
 
337 337
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DeleteDatetime.tsx:15
338 338
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/DeleteTicket.tsx:48
339
-	__( 'delete permanently', 'event_espresso' ),
339
+	__('delete permanently', 'event_espresso'),
340 340
 
341 341
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DeleteDatetime.tsx:15
342
-	__( 'trash datetime', 'event_espresso' ),
342
+	__('trash datetime', 'event_espresso'),
343 343
 
344 344
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DeleteDatetime.tsx:18
345
-	__( 'Permanently Delete Datetime?', 'event_espresso' ),
345
+	__('Permanently Delete Datetime?', 'event_espresso'),
346 346
 
347 347
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DeleteDatetime.tsx:18
348
-	__( 'Move Datetime to Trash?', 'event_espresso' ),
348
+	__('Move Datetime to Trash?', 'event_espresso'),
349 349
 
350 350
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DeleteDatetime.tsx:20
351
-	__( 'Are you sure you want to permanently delete this datetime? This action is permanent and can not be undone.', 'event_espresso' ),
351
+	__('Are you sure you want to permanently delete this datetime? This action is permanent and can not be undone.', 'event_espresso'),
352 352
 
353 353
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DeleteDatetime.tsx:23
354
-	__( 'Are you sure you want to move this datetime to the trash? You can "untrash" this datetime later if you need to.', 'event_espresso' ),
354
+	__('Are you sure you want to move this datetime to the trash? You can "untrash" this datetime later if you need to.', 'event_espresso'),
355 355
 
356 356
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DeleteDatetime.tsx:33
357
-	__( 'delete', 'event_espresso' ),
357
+	__('delete', 'event_espresso'),
358 358
 
359 359
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/actions/Actions.tsx:36
360 360
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:42
361 361
 	// Reference: packages/ui-components/src/bulkEdit/BulkActions.tsx:43
362
-	__( 'bulk actions', 'event_espresso' ),
362
+	__('bulk actions', 'event_espresso'),
363 363
 
364 364
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/actions/Actions.tsx:40
365
-	__( 'edit datetime details', 'event_espresso' ),
365
+	__('edit datetime details', 'event_espresso'),
366 366
 
367 367
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/actions/Actions.tsx:44
368
-	__( 'delete datetimes', 'event_espresso' ),
368
+	__('delete datetimes', 'event_espresso'),
369 369
 
370 370
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/actions/Actions.tsx:44
371
-	__( 'trash datetimes', 'event_espresso' ),
371
+	__('trash datetimes', 'event_espresso'),
372 372
 
373 373
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/delete/Delete.tsx:14
374
-	__( 'Are you sure you want to permanently delete these datetimes? This action can NOT be undone!', 'event_espresso' ),
374
+	__('Are you sure you want to permanently delete these datetimes? This action can NOT be undone!', 'event_espresso'),
375 375
 
376 376
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/delete/Delete.tsx:15
377
-	__( 'Are you sure you want to trash these datetimes?', 'event_espresso' ),
377
+	__('Are you sure you want to trash these datetimes?', 'event_espresso'),
378 378
 
379 379
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/delete/Delete.tsx:16
380
-	__( 'Delete datetimes permanently', 'event_espresso' ),
380
+	__('Delete datetimes permanently', 'event_espresso'),
381 381
 
382 382
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/delete/Delete.tsx:16
383
-	__( 'Trash datetimes', 'event_espresso' ),
383
+	__('Trash datetimes', 'event_espresso'),
384 384
 
385 385
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/EditDetails.tsx:21
386
-	__( 'Bulk edit date details', 'event_espresso' ),
386
+	__('Bulk edit date details', 'event_espresso'),
387 387
 
388 388
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/EditDetails.tsx:22
389
-	__( 'any changes will be applied to ALL of the selected dates.', 'event_espresso' ),
389
+	__('any changes will be applied to ALL of the selected dates.', 'event_espresso'),
390 390
 
391 391
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/formValidation.ts:12
392 392
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/formValidation.ts:12
393
-	__( 'Name must be at least three characters', 'event_espresso' ),
393
+	__('Name must be at least three characters', 'event_espresso'),
394 394
 
395 395
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:66
396 396
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:66
397
-	__( 'Shift dates', 'event_espresso' ),
397
+	__('Shift dates', 'event_espresso'),
398 398
 
399 399
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:91
400 400
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:90
401
-	__( 'earlier', 'event_espresso' ),
401
+	__('earlier', 'event_espresso'),
402 402
 
403 403
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:95
404 404
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:94
405
-	__( 'later', 'event_espresso' ),
405
+	__('later', 'event_espresso'),
406 406
 
407 407
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCapacity.tsx:31
408 408
 	/* translators: click to edit capacity<linebreak>(registration limit)… */
409
-	__( 'click to edit capacity%s(registration limit)…', 'event_espresso' ),
409
+	__('click to edit capacity%s(registration limit)…', 'event_espresso'),
410 410
 
411 411
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:31
412 412
 	// Reference: packages/ee-components/src/SimpleTicketCard/SimpleTicketCard.tsx:27
413 413
 	// Reference: packages/ui-components/src/CalendarDateSwitcher/CalendarDateSwitcher.tsx:34
414
-	__( 'starts', 'event_espresso' ),
414
+	__('starts', 'event_espresso'),
415 415
 
416 416
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:32
417 417
 	// Reference: packages/ee-components/src/SimpleTicketCard/SimpleTicketCard.tsx:34
418 418
 	// Reference: packages/ui-components/src/CalendarDateSwitcher/CalendarDateSwitcher.tsx:47
419
-	__( 'ends', 'event_espresso' ),
419
+	__('ends', 'event_espresso'),
420 420
 
421 421
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:32
422
-	__( 'started', 'event_espresso' ),
422
+	__('started', 'event_espresso'),
423 423
 
424 424
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:32
425
-	__( 'ended', 'event_espresso' ),
425
+	__('ended', 'event_espresso'),
426 426
 
427 427
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:46
428
-	__( 'Edit Event Date', 'event_espresso' ),
428
+	__('Edit Event Date', 'event_espresso'),
429 429
 
430 430
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:50
431
-	__( 'edit start and end dates', 'event_espresso' ),
431
+	__('edit start and end dates', 'event_espresso'),
432 432
 
433 433
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateDetailsPanel.tsx:16
434 434
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketDetailsPanel.tsx:16
435
-	__( 'sold', 'event_espresso' ),
435
+	__('sold', 'event_espresso'),
436 436
 
437 437
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateDetailsPanel.tsx:21
438
-	__( 'capacity', 'event_espresso' ),
438
+	__('capacity', 'event_espresso'),
439 439
 
440 440
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/DateDetailsPanel.tsx:27
441 441
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketDetailsPanel.tsx:26
442
-	__( 'reg list', 'event_espresso' ),
442
+	__('reg list', 'event_espresso'),
443 443
 
444 444
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/Details.tsx:43
445 445
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/Details.tsx:35
446
-	__( 'add description…', 'event_espresso' ),
446
+	__('add description…', 'event_espresso'),
447 447
 
448 448
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/Details.tsx:44
449 449
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/Details.tsx:36
450
-	__( 'Edit description', 'event_espresso' ),
450
+	__('Edit description', 'event_espresso'),
451 451
 
452 452
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/cardView/Details.tsx:45
453 453
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/Details.tsx:37
454
-	__( 'click to edit description…', 'event_espresso' ),
454
+	__('click to edit description…', 'event_espresso'),
455 455
 
456 456
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:10
457
-	__( 'Move Date to Trash', 'event_espresso' ),
457
+	__('Move Date to Trash', 'event_espresso'),
458 458
 
459 459
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:13
460 460
 	// Reference: packages/constants/src/datetime.ts:6
461
-	__( 'Active', 'event_espresso' ),
461
+	__('Active', 'event_espresso'),
462 462
 
463 463
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:14
464 464
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:13
465
-	__( 'Trashed', 'event_espresso' ),
465
+	__('Trashed', 'event_espresso'),
466 466
 
467 467
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:15
468 468
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:14
469 469
 	// Reference: packages/constants/src/datetime.ts:8
470
-	__( 'Expired', 'event_espresso' ),
470
+	__('Expired', 'event_espresso'),
471 471
 
472 472
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:16
473 473
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:16
474
-	__( 'Sold Out', 'event_espresso' ),
474
+	__('Sold Out', 'event_espresso'),
475 475
 
476 476
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:17
477 477
 	// Reference: packages/constants/src/datetime.ts:12
478
-	__( 'Upcoming', 'event_espresso' ),
478
+	__('Upcoming', 'event_espresso'),
479 479
 
480 480
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:7
481
-	__( 'Edit Event Date Details', 'event_espresso' ),
481
+	__('Edit Event Date Details', 'event_espresso'),
482 482
 
483 483
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:8
484
-	__( 'View Registrations for this Date', 'event_espresso' ),
484
+	__('View Registrations for this Date', 'event_espresso'),
485 485
 
486 486
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/config.ts:9
487
-	__( 'Manage Ticket Assignments', 'event_espresso' ),
487
+	__('Manage Ticket Assignments', 'event_espresso'),
488 488
 
489 489
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/editable/EditableName.tsx:41
490 490
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/editable/EditableName.tsx:41
491
-	__( 'click to edit title…', 'event_espresso' ),
491
+	__('click to edit title…', 'event_espresso'),
492 492
 
493 493
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/editable/EditableName.tsx:42
494 494
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/editable/EditableName.tsx:42
495
-	__( 'add title…', 'event_espresso' ),
495
+	__('add title…', 'event_espresso'),
496 496
 
497 497
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/ActiveDatesFilters.tsx:17
498 498
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/ActiveTicketsFilters.tsx:17
499
-	__( 'ON', 'event_espresso' ),
499
+	__('ON', 'event_espresso'),
500 500
 
501 501
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:10
502
-	__( 'end dates only', 'event_espresso' ),
502
+	__('end dates only', 'event_espresso'),
503 503
 
504 504
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:11
505
-	__( 'start and end dates', 'event_espresso' ),
505
+	__('start and end dates', 'event_espresso'),
506 506
 
507 507
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:16
508
-	__( 'dates above 90% capacity', 'event_espresso' ),
508
+	__('dates above 90% capacity', 'event_espresso'),
509 509
 
510 510
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:17
511
-	__( 'dates above 75% capacity', 'event_espresso' ),
511
+	__('dates above 75% capacity', 'event_espresso'),
512 512
 
513 513
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:18
514
-	__( 'dates above 50% capacity', 'event_espresso' ),
514
+	__('dates above 50% capacity', 'event_espresso'),
515 515
 
516 516
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:19
517
-	__( 'dates below 50% capacity', 'event_espresso' ),
517
+	__('dates below 50% capacity', 'event_espresso'),
518 518
 
519 519
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:23
520
-	__( 'all dates', 'event_espresso' ),
520
+	__('all dates', 'event_espresso'),
521 521
 
522 522
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:24
523
-	__( 'all active and upcoming', 'event_espresso' ),
523
+	__('all active and upcoming', 'event_espresso'),
524 524
 
525 525
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:25
526
-	__( 'active dates only', 'event_espresso' ),
526
+	__('active dates only', 'event_espresso'),
527 527
 
528 528
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:26
529
-	__( 'upcoming dates only', 'event_espresso' ),
529
+	__('upcoming dates only', 'event_espresso'),
530 530
 
531 531
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:27
532
-	__( 'next active or upcoming only', 'event_espresso' ),
532
+	__('next active or upcoming only', 'event_espresso'),
533 533
 
534 534
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:28
535
-	__( 'sold out dates only', 'event_espresso' ),
535
+	__('sold out dates only', 'event_espresso'),
536 536
 
537 537
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:29
538
-	__( 'recently expired dates', 'event_espresso' ),
538
+	__('recently expired dates', 'event_espresso'),
539 539
 
540 540
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:30
541
-	__( 'all expired dates', 'event_espresso' ),
541
+	__('all expired dates', 'event_espresso'),
542 542
 
543 543
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:31
544
-	__( 'trashed dates only', 'event_espresso' ),
544
+	__('trashed dates only', 'event_espresso'),
545 545
 
546 546
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:35
547 547
 	// Reference: packages/dates/src/components/DateRangePicker/DateRangePickerLegend.tsx:9
548 548
 	// Reference: packages/dates/src/components/DateRangePicker/index.tsx:61
549
-	__( 'start date', 'event_espresso' ),
549
+	__('start date', 'event_espresso'),
550 550
 
551 551
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:36
552
-	__( 'name', 'event_espresso' ),
552
+	__('name', 'event_espresso'),
553 553
 
554 554
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:37
555 555
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:33
@@ -557,176 +557,176 @@  discard block
 block discarded – undo
557 557
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/table/HeaderCell.tsx:27
558 558
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:33
559 559
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:23
560
-	__( 'ID', 'event_espresso' ),
560
+	__('ID', 'event_espresso'),
561 561
 
562 562
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:38
563 563
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:47
564
-	__( 'custom order', 'event_espresso' ),
564
+	__('custom order', 'event_espresso'),
565 565
 
566 566
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:42
567 567
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:51
568
-	__( 'display', 'event_espresso' ),
568
+	__('display', 'event_espresso'),
569 569
 
570 570
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:43
571
-	__( 'recurrence', 'event_espresso' ),
571
+	__('recurrence', 'event_espresso'),
572 572
 
573 573
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:44
574 574
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:53
575
-	__( 'sales', 'event_espresso' ),
575
+	__('sales', 'event_espresso'),
576 576
 
577 577
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:45
578 578
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:55
579
-	__( 'sort by', 'event_espresso' ),
579
+	__('sort by', 'event_espresso'),
580 580
 
581 581
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:46
582 582
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:54
583 583
 	// Reference: packages/ee-components/src/EntityList/EntityListFilterBar.tsx:38
584
-	__( 'search', 'event_espresso' ),
584
+	__('search', 'event_espresso'),
585 585
 
586 586
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:47
587 587
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:56
588
-	__( 'status', 'event_espresso' ),
588
+	__('status', 'event_espresso'),
589 589
 
590 590
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:9
591
-	__( 'start dates only', 'event_espresso' ),
591
+	__('start dates only', 'event_espresso'),
592 592
 
593 593
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/newDateOptions/AddSingleDate.tsx:26
594 594
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/newDateOptions/NewDateModal.tsx:12
595 595
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/newDateOptions/OptionsModalButton.tsx:18
596
-	__( 'Add New Date', 'event_espresso' ),
596
+	__('Add New Date', 'event_espresso'),
597 597
 
598 598
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/newDateOptions/AddSingleDate.tsx:26
599
-	__( 'Add Single Date', 'event_espresso' ),
599
+	__('Add Single Date', 'event_espresso'),
600 600
 
601 601
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/newDateOptions/AddSingleDate.tsx:44
602
-	__( 'Add a single date that only occurs once', 'event_espresso' ),
602
+	__('Add a single date that only occurs once', 'event_espresso'),
603 603
 
604 604
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/newDateOptions/AddSingleDate.tsx:46
605
-	__( 'Single Date', 'event_espresso' ),
605
+	__('Single Date', 'event_espresso'),
606 606
 
607 607
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:108
608
-	__( 'Reg list', 'event_espresso' ),
608
+	__('Reg list', 'event_espresso'),
609 609
 
610 610
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:109
611
-	__( 'Regs', 'event_espresso' ),
611
+	__('Regs', 'event_espresso'),
612 612
 
613 613
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:124
614 614
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:123
615 615
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:59
616
-	__( 'Actions', 'event_espresso' ),
616
+	__('Actions', 'event_espresso'),
617 617
 
618 618
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:54
619
-	__( 'Start', 'event_espresso' ),
619
+	__('Start', 'event_espresso'),
620 620
 
621 621
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:68
622
-	__( 'End', 'event_espresso' ),
622
+	__('End', 'event_espresso'),
623 623
 
624 624
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:84
625
-	__( 'Cap', 'event_espresso' ),
625
+	__('Cap', 'event_espresso'),
626 626
 
627 627
 	// Reference: domains/core/admin/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:96
628 628
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:100
629
-	__( 'Sold', 'event_espresso' ),
629
+	__('Sold', 'event_espresso'),
630 630
 
631 631
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/ErrorMessage.tsx:33
632 632
 	// Reference: packages/form-builder/src/constants.ts:67
633
-	__( 'Text Input', 'event_espresso' ),
633
+	__('Text Input', 'event_espresso'),
634 634
 
635 635
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/ErrorMessage.tsx:34
636 636
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:32
637
-	__( 'Attendee First Name', 'event_espresso' ),
637
+	__('Attendee First Name', 'event_espresso'),
638 638
 
639 639
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/ErrorMessage.tsx:39
640 640
 	/* translators: field name */
641
-	__( 'Registration form must have a field of type "%1$s" which maps to "%2$s"', 'event_espresso' ),
641
+	__('Registration form must have a field of type "%1$s" which maps to "%2$s"', 'event_espresso'),
642 642
 
643 643
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/ErrorMessage.tsx:40
644 644
 	// Reference: packages/form-builder/src/constants.ts:82
645
-	__( 'Email Address', 'event_espresso' ),
645
+	__('Email Address', 'event_espresso'),
646 646
 
647 647
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/ErrorMessage.tsx:41
648 648
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:40
649
-	__( 'Attendee Email Address', 'event_espresso' ),
649
+	__('Attendee Email Address', 'event_espresso'),
650 650
 
651 651
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/ErrorMessage.tsx:49
652
-	__( 'Please add the required fields', 'event_espresso' ),
652
+	__('Please add the required fields', 'event_espresso'),
653 653
 
654 654
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/RegistrationForm.tsx:12
655
-	__( 'Registration Form', 'event_espresso' ),
655
+	__('Registration Form', 'event_espresso'),
656 656
 
657 657
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:13
658
-	__( 'primary registrant', 'event_espresso' ),
658
+	__('primary registrant', 'event_espresso'),
659 659
 
660 660
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:17
661
-	__( 'purchaser', 'event_espresso' ),
661
+	__('purchaser', 'event_espresso'),
662 662
 
663 663
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:21
664
-	__( 'registrants', 'event_espresso' ),
664
+	__('registrants', 'event_espresso'),
665 665
 
666 666
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:36
667
-	__( 'Attendee Last Name', 'event_espresso' ),
667
+	__('Attendee Last Name', 'event_espresso'),
668 668
 
669 669
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:44
670
-	__( 'Attendee Address', 'event_espresso' ),
670
+	__('Attendee Address', 'event_espresso'),
671 671
 
672 672
 	// Reference: domains/core/admin/eventEditor/src/ui/registrationForm/constants.ts:9
673
-	__( 'all', 'event_espresso' ),
673
+	__('all', 'event_espresso'),
674 674
 
675 675
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ErrorMessage.tsx:18
676
-	__( 'Tickets must always have at least one date assigned to them but one or more of the tickets below does not have any. 
677
-Please correct the assignments for the highlighted cells.', 'event_espresso' ),
676
+	__('Tickets must always have at least one date assigned to them but one or more of the tickets below does not have any. 
677
+Please correct the assignments for the highlighted cells.', 'event_espresso'),
678 678
 
679 679
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ErrorMessage.tsx:22
680
-	__( 'Event Dates must always have at least one Ticket assigned to them but one or more of the Event Dates below does not have any. 
681
-Please correct the assignments for the highlighted cells.', 'event_espresso' ),
680
+	__('Event Dates must always have at least one Ticket assigned to them but one or more of the Event Dates below does not have any. 
681
+Please correct the assignments for the highlighted cells.', 'event_espresso'),
682 682
 
683 683
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ErrorMessage.tsx:32
684
-	__( 'Please Update Assignments', 'event_espresso' ),
684
+	__('Please Update Assignments', 'event_espresso'),
685 685
 
686 686
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ModalContainer.tsx:26
687
-	__( 'There seem to be some dates/tickets which have no tickets/dates assigned. Do you want to fix them now?', 'event_espresso' ),
687
+	__('There seem to be some dates/tickets which have no tickets/dates assigned. Do you want to fix them now?', 'event_espresso'),
688 688
 
689 689
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ModalContainer.tsx:29
690
-	__( 'Alert!', 'event_espresso' ),
690
+	__('Alert!', 'event_espresso'),
691 691
 
692 692
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ModalContainer.tsx:42
693 693
 	/* translators: 1 entity id, 2 entity name */
694
-	__( 'Ticket Assignment Manager for Datetime: %1$s - %2$s', 'event_espresso' ),
694
+	__('Ticket Assignment Manager for Datetime: %1$s - %2$s', 'event_espresso'),
695 695
 
696 696
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/ModalContainer.tsx:49
697 697
 	/* translators: 1 entity id, 2 entity name */
698
-	__( 'Ticket Assignment Manager for Ticket: %1$s - %2$s', 'event_espresso' ),
698
+	__('Ticket Assignment Manager for Ticket: %1$s - %2$s', 'event_espresso'),
699 699
 
700 700
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/TicketAssignmentsManagerModal.tsx:45
701 701
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/table/Table.tsx:13
702
-	__( 'Ticket Assignment Manager', 'event_espresso' ),
702
+	__('Ticket Assignment Manager', 'event_espresso'),
703 703
 
704 704
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/config.ts:10
705
-	__( 'existing relation', 'event_espresso' ),
705
+	__('existing relation', 'event_espresso'),
706 706
 
707 707
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/config.ts:15
708
-	__( 'remove existing relation', 'event_espresso' ),
708
+	__('remove existing relation', 'event_espresso'),
709 709
 
710 710
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/config.ts:20
711
-	__( 'add new relation', 'event_espresso' ),
711
+	__('add new relation', 'event_espresso'),
712 712
 
713 713
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/config.ts:25
714
-	__( 'invalid relation', 'event_espresso' ),
714
+	__('invalid relation', 'event_espresso'),
715 715
 
716 716
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/config.ts:29
717
-	__( 'no relation', 'event_espresso' ),
717
+	__('no relation', 'event_espresso'),
718 718
 
719 719
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/table/useGetHeaderRows.tsx:15
720
-	__( 'Assignments', 'event_espresso' ),
720
+	__('Assignments', 'event_espresso'),
721 721
 
722 722
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/table/useGetHeaderRows.tsx:16
723
-	__( 'Event Dates are listed below', 'event_espresso' ),
723
+	__('Event Dates are listed below', 'event_espresso'),
724 724
 
725 725
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/table/useGetHeaderRows.tsx:17
726
-	__( 'Tickets are listed along the top', 'event_espresso' ),
726
+	__('Tickets are listed along the top', 'event_espresso'),
727 727
 
728 728
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/table/useGetHeaderRows.tsx:18
729
-	__( 'Click the cell buttons to toggle assigments', 'event_espresso' ),
729
+	__('Click the cell buttons to toggle assigments', 'event_espresso'),
730 730
 
731 731
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/components/useSubmitButtonProps.ts:29
732 732
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/FooterButtons.tsx:16
@@ -735,1566 +735,1566 @@  discard block
 block discarded – undo
735 735
 	// Reference: packages/tpc/src/buttons/useSubmitButtonProps.tsx:29
736 736
 	// Reference: packages/ui-components/src/Modal/useSubmitButtonProps.tsx:13
737 737
 	// Reference: packages/ui-components/src/Stepper/buttons/Submit.tsx:7
738
-	__( 'Submit', 'event_espresso' ),
738
+	__('Submit', 'event_espresso'),
739 739
 
740 740
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/DatesByMonthControl.tsx:20
741
-	__( 'All Dates', 'event_espresso' ),
741
+	__('All Dates', 'event_espresso'),
742 742
 
743 743
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/DatesByMonthControl.tsx:27
744
-	__( 'dates by month', 'event_espresso' ),
744
+	__('dates by month', 'event_espresso'),
745 745
 
746 746
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/ShowExpiredTicketsControl.tsx:16
747
-	__( 'show expired tickets', 'event_espresso' ),
747
+	__('show expired tickets', 'event_espresso'),
748 748
 
749 749
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/ShowTrashedDatesControl.tsx:13
750
-	__( 'show trashed dates', 'event_espresso' ),
750
+	__('show trashed dates', 'event_espresso'),
751 751
 
752 752
 	// Reference: domains/core/admin/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/ShowTrashedTicketsControl.tsx:16
753
-	__( 'show trashed tickets', 'event_espresso' ),
753
+	__('show trashed tickets', 'event_espresso'),
754 754
 
755 755
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/Container.tsx:38
756 756
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actions/Actions.tsx:25
757
-	__( 'Default tickets', 'event_espresso' ),
757
+	__('Default tickets', 'event_espresso'),
758 758
 
759 759
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/ModalBody.tsx:63
760 760
 	// Reference: packages/edtr-services/src/constants.ts:26
761
-	__( 'ticket', 'event_espresso' ),
761
+	__('ticket', 'event_espresso'),
762 762
 
763 763
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/FooterButtons.tsx:26
764 764
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/FooterButtons.tsx:33
765
-	__( 'Set ticket prices', 'event_espresso' ),
765
+	__('Set ticket prices', 'event_espresso'),
766 766
 
767 767
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/FooterButtons.tsx:31
768
-	__( 'Skip prices - Save', 'event_espresso' ),
768
+	__('Skip prices - Save', 'event_espresso'),
769 769
 
770 770
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/FooterButtons.tsx:37
771 771
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/FooterButtons.tsx:57
772
-	__( 'Ticket details', 'event_espresso' ),
772
+	__('Ticket details', 'event_espresso'),
773 773
 
774 774
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/FooterButtons.tsx:38
775
-	__( 'Save', 'event_espresso' ),
775
+	__('Save', 'event_espresso'),
776 776
 
777 777
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/Modal.tsx:22
778 778
 	/* translators: %s ticket id */
779
-	__( 'Edit ticket %s', 'event_espresso' ),
779
+	__('Edit ticket %s', 'event_espresso'),
780 780
 
781 781
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/Modal.tsx:25
782 782
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/Modal.tsx:33
783
-	__( 'New Ticket Details', 'event_espresso' ),
783
+	__('New Ticket Details', 'event_espresso'),
784 784
 
785 785
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/TicketFormSteps.tsx:10
786 786
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:10
787
-	__( 'primary information about the ticket', 'event_espresso' ),
787
+	__('primary information about the ticket', 'event_espresso'),
788 788
 
789 789
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/TicketFormSteps.tsx:10
790 790
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:10
791
-	__( 'Ticket Details', 'event_espresso' ),
791
+	__('Ticket Details', 'event_espresso'),
792 792
 
793 793
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/TicketFormSteps.tsx:12
794 794
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:12
795
-	__( 'apply ticket price modifiers and taxes', 'event_espresso' ),
795
+	__('apply ticket price modifiers and taxes', 'event_espresso'),
796 796
 
797 797
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/TicketFormSteps.tsx:14
798 798
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:14
799
-	__( 'Price Calculator', 'event_espresso' ),
799
+	__('Price Calculator', 'event_espresso'),
800 800
 
801 801
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/defaultTickets/multiStep/TicketFormSteps.tsx:16
802 802
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:16
803
-	__( 'Assign Dates', 'event_espresso' ),
803
+	__('Assign Dates', 'event_espresso'),
804 804
 
805 805
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/FooterButtons.tsx:39
806
-	__( 'Skip prices - assign dates', 'event_espresso' ),
806
+	__('Skip prices - assign dates', 'event_espresso'),
807 807
 
808 808
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/FooterButtons.tsx:50
809
-	__( 'Save and assign dates', 'event_espresso' ),
809
+	__('Save and assign dates', 'event_espresso'),
810 810
 
811 811
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/Modal.tsx:29
812 812
 	/* translators: %1$s ticket name, %2$s ticket id */
813
-	__( 'Edit ticket "%1$s" - %2$s', 'event_espresso' ),
813
+	__('Edit ticket "%1$s" - %2$s', 'event_espresso'),
814 814
 
815 815
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/multiStep/Modal.tsx:43
816
-	__( 'modal for ticket', 'event_espresso' ),
816
+	__('modal for ticket', 'event_espresso'),
817 817
 
818 818
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:101
819
-	__( 'The maximum number of this ticket available for sale.', 'event_espresso' ),
819
+	__('The maximum number of this ticket available for sale.', 'event_espresso'),
820 820
 
821 821
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:103
822
-	__( 'Set to 0 to stop sales, or leave blank for no limit.', 'event_espresso' ),
822
+	__('Set to 0 to stop sales, or leave blank for no limit.', 'event_espresso'),
823 823
 
824 824
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:114
825 825
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:119
826
-	__( 'Number of Uses', 'event_espresso' ),
826
+	__('Number of Uses', 'event_espresso'),
827 827
 
828 828
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:120
829
-	__( 'Controls the total number of times this ticket can be used, regardless of the number of dates it is assigned to.', 'event_espresso' ),
829
+	__('Controls the total number of times this ticket can be used, regardless of the number of dates it is assigned to.', 'event_espresso'),
830 830
 
831 831
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:124
832
-	__( 'Example: A ticket might have access to 4 different dates, but setting this field to 2 would mean that the ticket could only be used twice. Leave blank for no limit.', 'event_espresso' ),
832
+	__('Example: A ticket might have access to 4 different dates, but setting this field to 2 would mean that the ticket could only be used twice. Leave blank for no limit.', 'event_espresso'),
833 833
 
834 834
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:132
835 835
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:127
836
-	__( 'Minimum Quantity', 'event_espresso' ),
836
+	__('Minimum Quantity', 'event_espresso'),
837 837
 
838 838
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:137
839
-	__( 'The minimum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso' ),
839
+	__('The minimum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso'),
840 840
 
841 841
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:141
842
-	__( 'Leave blank for no minimum.', 'event_espresso' ),
842
+	__('Leave blank for no minimum.', 'event_espresso'),
843 843
 
844 844
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:147
845 845
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:135
846
-	__( 'Maximum Quantity', 'event_espresso' ),
846
+	__('Maximum Quantity', 'event_espresso'),
847 847
 
848 848
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:153
849
-	__( 'The maximum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso' ),
849
+	__('The maximum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso'),
850 850
 
851 851
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:157
852
-	__( 'Leave blank for no maximum.', 'event_espresso' ),
852
+	__('Leave blank for no maximum.', 'event_espresso'),
853 853
 
854 854
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:163
855 855
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:144
856
-	__( 'Required Ticket', 'event_espresso' ),
856
+	__('Required Ticket', 'event_espresso'),
857 857
 
858 858
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:165
859
-	__( 'If enabled, the ticket must be selected and will appear first in ticket lists.', 'event_espresso' ),
859
+	__('If enabled, the ticket must be selected and will appear first in ticket lists.', 'event_espresso'),
860 860
 
861 861
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:177
862
-	__( 'Visibility', 'event_espresso' ),
862
+	__('Visibility', 'event_espresso'),
863 863
 
864 864
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:211
865
-	__( 'Ticket Sales', 'event_espresso' ),
865
+	__('Ticket Sales', 'event_espresso'),
866 866
 
867 867
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.ts:95
868 868
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:110
869
-	__( 'Quantity For Sale', 'event_espresso' ),
869
+	__('Quantity For Sale', 'event_espresso'),
870 870
 
871 871
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/TicketRegistrationsLink.tsx:13
872
-	__( 'total registrations.', 'event_espresso' ),
872
+	__('total registrations.', 'event_espresso'),
873 873
 
874 874
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/TicketRegistrationsLink.tsx:14
875
-	__( 'view ALL registrations for this ticket.', 'event_espresso' ),
875
+	__('view ALL registrations for this ticket.', 'event_espresso'),
876 876
 
877 877
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/TicketSoldLink.tsx:13
878
-	__( 'view approved registrations for this ticket.', 'event_espresso' ),
878
+	__('view approved registrations for this ticket.', 'event_espresso'),
879 879
 
880 880
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/TicketsList.tsx:36
881
-	__( 'Available Tickets', 'event_espresso' ),
881
+	__('Available Tickets', 'event_espresso'),
882 882
 
883 883
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/TicketsList.tsx:39
884
-	__( 'loading tickets…', 'event_espresso' ),
884
+	__('loading tickets…', 'event_espresso'),
885 885
 
886 886
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/AssignDatesButton.tsx:26
887
-	__( 'Number of related dates', 'event_espresso' ),
887
+	__('Number of related dates', 'event_espresso'),
888 888
 
889 889
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/AssignDatesButton.tsx:27
890
-	__( 'There are no event dates assigned to this ticket. Please click the calendar icon to update the assignments.', 'event_espresso' ),
890
+	__('There are no event dates assigned to this ticket. Please click the calendar icon to update the assignments.', 'event_espresso'),
891 891
 
892 892
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/AssignDatesButton.tsx:37
893
-	__( 'assign dates', 'event_espresso' ),
893
+	__('assign dates', 'event_espresso'),
894 894
 
895 895
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/DeleteTicket.tsx:19
896
-	__( 'Permanently Delete Ticket?', 'event_espresso' ),
896
+	__('Permanently Delete Ticket?', 'event_espresso'),
897 897
 
898 898
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/DeleteTicket.tsx:19
899
-	__( 'Move Ticket to Trash?', 'event_espresso' ),
899
+	__('Move Ticket to Trash?', 'event_espresso'),
900 900
 
901 901
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/DeleteTicket.tsx:22
902
-	__( 'Are you sure you want to permanently delete this ticket? This action is permanent and can not be undone.', 'event_espresso' ),
902
+	__('Are you sure you want to permanently delete this ticket? This action is permanent and can not be undone.', 'event_espresso'),
903 903
 
904 904
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/DeleteTicket.tsx:48
905 905
 	// Reference: packages/ee-components/src/SimpleTicketCard/actions/Trash.tsx:6
906
-	__( 'trash ticket', 'event_espresso' ),
906
+	__('trash ticket', 'event_espresso'),
907 907
 
908 908
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:25
909
-	__( 'ticket main menu', 'event_espresso' ),
909
+	__('ticket main menu', 'event_espresso'),
910 910
 
911 911
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:38
912 912
 	// Reference: packages/ee-components/src/SimpleTicketCard/actions/Edit.tsx:15
913
-	__( 'edit ticket', 'event_espresso' ),
913
+	__('edit ticket', 'event_espresso'),
914 914
 
915 915
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:39
916
-	__( 'copy ticket', 'event_espresso' ),
916
+	__('copy ticket', 'event_espresso'),
917 917
 
918 918
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:46
919
-	__( 'edit ticket details', 'event_espresso' ),
919
+	__('edit ticket details', 'event_espresso'),
920 920
 
921 921
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:50
922
-	__( 'delete tickets', 'event_espresso' ),
922
+	__('delete tickets', 'event_espresso'),
923 923
 
924 924
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:50
925
-	__( 'trash tickets', 'event_espresso' ),
925
+	__('trash tickets', 'event_espresso'),
926 926
 
927 927
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:54
928
-	__( 'edit ticket prices', 'event_espresso' ),
928
+	__('edit ticket prices', 'event_espresso'),
929 929
 
930 930
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/delete/Delete.tsx:14
931
-	__( 'Are you sure you want to permanently delete these tickets? This action can NOT be undone!', 'event_espresso' ),
931
+	__('Are you sure you want to permanently delete these tickets? This action can NOT be undone!', 'event_espresso'),
932 932
 
933 933
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/delete/Delete.tsx:15
934
-	__( 'Are you sure you want to trash these tickets?', 'event_espresso' ),
934
+	__('Are you sure you want to trash these tickets?', 'event_espresso'),
935 935
 
936 936
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/delete/Delete.tsx:16
937
-	__( 'Delete tickets permanently', 'event_espresso' ),
937
+	__('Delete tickets permanently', 'event_espresso'),
938 938
 
939 939
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/delete/Delete.tsx:16
940
-	__( 'Trash tickets', 'event_espresso' ),
940
+	__('Trash tickets', 'event_espresso'),
941 941
 
942 942
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/EditDetails.tsx:21
943
-	__( 'Bulk edit ticket details', 'event_espresso' ),
943
+	__('Bulk edit ticket details', 'event_espresso'),
944 944
 
945 945
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/EditDetails.tsx:22
946
-	__( 'any changes will be applied to ALL of the selected tickets.', 'event_espresso' ),
946
+	__('any changes will be applied to ALL of the selected tickets.', 'event_espresso'),
947 947
 
948 948
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/EditPrices.tsx:19
949
-	__( 'Bulk edit ticket prices', 'event_espresso' ),
949
+	__('Bulk edit ticket prices', 'event_espresso'),
950 950
 
951 951
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/EditModeButtons.tsx:20
952
-	__( 'Edit all prices together', 'event_espresso' ),
952
+	__('Edit all prices together', 'event_espresso'),
953 953
 
954 954
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/EditModeButtons.tsx:21
955
-	__( 'Edit all the selected ticket prices dynamically', 'event_espresso' ),
955
+	__('Edit all the selected ticket prices dynamically', 'event_espresso'),
956 956
 
957 957
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/EditModeButtons.tsx:25
958
-	__( 'Edit prices individually', 'event_espresso' ),
958
+	__('Edit prices individually', 'event_espresso'),
959 959
 
960 960
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/EditModeButtons.tsx:26
961
-	__( 'Edit prices for each ticket individually', 'event_espresso' ),
961
+	__('Edit prices for each ticket individually', 'event_espresso'),
962 962
 
963 963
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/FooterButtons.tsx:14
964 964
 	// Reference: packages/ee-components/src/bulkEdit/details/Submit.tsx:34
965 965
 	// Reference: packages/form/src/ResetButton.tsx:18
966 966
 	// Reference: packages/tpc/src/buttons/useResetButtonProps.tsx:12
967
-	__( 'Reset', 'event_espresso' ),
967
+	__('Reset', 'event_espresso'),
968 968
 
969 969
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/FooterButtons.tsx:15
970 970
 	// Reference: packages/tpc/src/hooks/useLockedTicketAction.ts:76
971 971
 	// Reference: packages/ui-components/src/Modal/useCancelButtonProps.tsx:10
972
-	__( 'Cancel', 'event_espresso' ),
972
+	__('Cancel', 'event_espresso'),
973 973
 
974 974
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/editSeparately/TPCInstance.tsx:26
975 975
 	/* translators: %s ticket name */
976
-	__( 'Edit prices for Ticket: %s', 'event_espresso' ),
976
+	__('Edit prices for Ticket: %s', 'event_espresso'),
977 977
 
978 978
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:30
979
-	__( 'sales start', 'event_espresso' ),
979
+	__('sales start', 'event_espresso'),
980 980
 
981 981
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:33
982
-	__( 'sales began', 'event_espresso' ),
982
+	__('sales began', 'event_espresso'),
983 983
 
984 984
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:35
985
-	__( 'sales ended', 'event_espresso' ),
985
+	__('sales ended', 'event_espresso'),
986 986
 
987 987
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:36
988
-	__( 'sales end', 'event_espresso' ),
988
+	__('sales end', 'event_espresso'),
989 989
 
990 990
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:50
991
-	__( 'Edit Ticket Sale Dates', 'event_espresso' ),
991
+	__('Edit Ticket Sale Dates', 'event_espresso'),
992 992
 
993 993
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:54
994
-	__( 'edit ticket sales start and end dates', 'event_espresso' ),
994
+	__('edit ticket sales start and end dates', 'event_espresso'),
995 995
 
996 996
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketDetailsPanel.tsx:21
997
-	__( 'quantity', 'event_espresso' ),
997
+	__('quantity', 'event_espresso'),
998 998
 
999 999
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketQuantity.tsx:28
1000 1000
 	// Reference: packages/edtr-services/src/apollo/mutations/tickets/useUpdateTicketQtyByCapacity.ts:78
1001
-	__( 'Ticket quantity has been adjusted because it cannot be more than the related event date capacity.', 'event_espresso' ),
1001
+	__('Ticket quantity has been adjusted because it cannot be more than the related event date capacity.', 'event_espresso'),
1002 1002
 
1003 1003
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/cardView/TicketQuantity.tsx:51
1004
-	__( 'edit quantity of tickets available…', 'event_espresso' ),
1004
+	__('edit quantity of tickets available…', 'event_espresso'),
1005 1005
 
1006 1006
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:10
1007
-	__( 'Move Ticket to Trash', 'event_espresso' ),
1007
+	__('Move Ticket to Trash', 'event_espresso'),
1008 1008
 
1009 1009
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:15
1010 1010
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:54
1011
-	__( 'On Sale', 'event_espresso' ),
1011
+	__('On Sale', 'event_espresso'),
1012 1012
 
1013 1013
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:17
1014
-	__( 'Pending', 'event_espresso' ),
1014
+	__('Pending', 'event_espresso'),
1015 1015
 
1016 1016
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:7
1017
-	__( 'Edit Ticket Details', 'event_espresso' ),
1017
+	__('Edit Ticket Details', 'event_espresso'),
1018 1018
 
1019 1019
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:8
1020
-	__( 'Manage Date Assignments', 'event_espresso' ),
1020
+	__('Manage Date Assignments', 'event_espresso'),
1021 1021
 
1022 1022
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/config.ts:9
1023 1023
 	// Reference: packages/tpc/src/components/table/Table.tsx:43
1024
-	__( 'Ticket Price Calculator', 'event_espresso' ),
1024
+	__('Ticket Price Calculator', 'event_espresso'),
1025 1025
 
1026 1026
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/editable/EditablePrice.tsx:39
1027
-	__( 'edit ticket total…', 'event_espresso' ),
1027
+	__('edit ticket total…', 'event_espresso'),
1028 1028
 
1029 1029
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/editable/EditablePrice.tsx:53
1030
-	__( 'set price…', 'event_espresso' ),
1030
+	__('set price…', 'event_espresso'),
1031 1031
 
1032 1032
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/IsChainedButton.tsx:23
1033
-	__( 'tickets list is linked to dates list and is showing tickets for above dates only', 'event_espresso' ),
1033
+	__('tickets list is linked to dates list and is showing tickets for above dates only', 'event_espresso'),
1034 1034
 
1035 1035
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/IsChainedButton.tsx:24
1036
-	__( 'tickets list is unlinked and is showing tickets for all event dates', 'event_espresso' ),
1036
+	__('tickets list is unlinked and is showing tickets for all event dates', 'event_espresso'),
1037 1037
 
1038 1038
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:10
1039
-	__( 'ticket sales start and end dates', 'event_espresso' ),
1039
+	__('ticket sales start and end dates', 'event_espresso'),
1040 1040
 
1041 1041
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:15
1042
-	__( 'tickets with 90% or more sold', 'event_espresso' ),
1042
+	__('tickets with 90% or more sold', 'event_espresso'),
1043 1043
 
1044 1044
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:16
1045
-	__( 'tickets with 75% or more sold', 'event_espresso' ),
1045
+	__('tickets with 75% or more sold', 'event_espresso'),
1046 1046
 
1047 1047
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:17
1048
-	__( 'tickets with 50% or more sold', 'event_espresso' ),
1048
+	__('tickets with 50% or more sold', 'event_espresso'),
1049 1049
 
1050 1050
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:19
1051
-	__( 'tickets with less than 50% sold', 'event_espresso' ),
1051
+	__('tickets with less than 50% sold', 'event_espresso'),
1052 1052
 
1053 1053
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:28
1054
-	__( 'all tickets for all dates', 'event_espresso' ),
1054
+	__('all tickets for all dates', 'event_espresso'),
1055 1055
 
1056 1056
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:29
1057
-	__( 'all on sale and sale pending', 'event_espresso' ),
1057
+	__('all on sale and sale pending', 'event_espresso'),
1058 1058
 
1059 1059
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:30
1060
-	__( 'on sale tickets only', 'event_espresso' ),
1060
+	__('on sale tickets only', 'event_espresso'),
1061 1061
 
1062 1062
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:31
1063
-	__( 'sale pending tickets only', 'event_espresso' ),
1063
+	__('sale pending tickets only', 'event_espresso'),
1064 1064
 
1065 1065
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:32
1066
-	__( 'next on sale or sale pending only', 'event_espresso' ),
1066
+	__('next on sale or sale pending only', 'event_espresso'),
1067 1067
 
1068 1068
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:33
1069
-	__( 'sold out tickets only', 'event_espresso' ),
1069
+	__('sold out tickets only', 'event_espresso'),
1070 1070
 
1071 1071
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:34
1072
-	__( 'expired tickets only', 'event_espresso' ),
1072
+	__('expired tickets only', 'event_espresso'),
1073 1073
 
1074 1074
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:35
1075
-	__( 'trashed tickets only', 'event_espresso' ),
1075
+	__('trashed tickets only', 'event_espresso'),
1076 1076
 
1077 1077
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:40
1078
-	__( 'all tickets for above dates', 'event_espresso' ),
1078
+	__('all tickets for above dates', 'event_espresso'),
1079 1079
 
1080 1080
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:44
1081
-	__( 'ticket sale date', 'event_espresso' ),
1081
+	__('ticket sale date', 'event_espresso'),
1082 1082
 
1083 1083
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:45
1084
-	__( 'ticket name', 'event_espresso' ),
1084
+	__('ticket name', 'event_espresso'),
1085 1085
 
1086 1086
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:46
1087
-	__( 'ticket ID', 'event_espresso' ),
1087
+	__('ticket ID', 'event_espresso'),
1088 1088
 
1089 1089
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:52
1090
-	__( 'linked', 'event_espresso' ),
1090
+	__('linked', 'event_espresso'),
1091 1091
 
1092 1092
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:8
1093
-	__( 'ticket sales start date only', 'event_espresso' ),
1093
+	__('ticket sales start date only', 'event_espresso'),
1094 1094
 
1095 1095
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:9
1096
-	__( 'ticket sales end date only', 'event_espresso' ),
1096
+	__('ticket sales end date only', 'event_espresso'),
1097 1097
 
1098 1098
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/newTicketOptions/AddSingleTicket.tsx:18
1099
-	__( 'Add New Ticket', 'event_espresso' ),
1099
+	__('Add New Ticket', 'event_espresso'),
1100 1100
 
1101 1101
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/newTicketOptions/AddSingleTicket.tsx:32
1102
-	__( 'Add a single ticket and assign the dates to it', 'event_espresso' ),
1102
+	__('Add a single ticket and assign the dates to it', 'event_espresso'),
1103 1103
 
1104 1104
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/newTicketOptions/AddSingleTicket.tsx:34
1105
-	__( 'Single Ticket', 'event_espresso' ),
1105
+	__('Single Ticket', 'event_espresso'),
1106 1106
 
1107 1107
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/TableView.tsx:39
1108
-	__( 'Tickets', 'event_espresso' ),
1108
+	__('Tickets', 'event_espresso'),
1109 1109
 
1110 1110
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:110
1111
-	__( 'Reg List', 'event_espresso' ),
1111
+	__('Reg List', 'event_espresso'),
1112 1112
 
1113 1113
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:53
1114
-	__( 'Goes on Sale', 'event_espresso' ),
1114
+	__('Goes on Sale', 'event_espresso'),
1115 1115
 
1116 1116
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:67
1117
-	__( 'Sale Ends', 'event_espresso' ),
1117
+	__('Sale Ends', 'event_espresso'),
1118 1118
 
1119 1119
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:68
1120
-	__( 'Ends', 'event_espresso' ),
1120
+	__('Ends', 'event_espresso'),
1121 1121
 
1122 1122
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:80
1123
-	__( 'Price', 'event_espresso' ),
1123
+	__('Price', 'event_espresso'),
1124 1124
 
1125 1125
 	// Reference: domains/core/admin/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:90
1126
-	__( 'Qty', 'event_espresso' ),
1126
+	__('Qty', 'event_espresso'),
1127 1127
 
1128 1128
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:104
1129
-	__( 'Venue capacity', 'event_espresso' ),
1129
+	__('Venue capacity', 'event_espresso'),
1130 1130
 
1131 1131
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:112
1132
-	__( 'Venue telephone', 'event_espresso' ),
1132
+	__('Venue telephone', 'event_espresso'),
1133 1133
 
1134 1134
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:119
1135
-	__( 'Edit this Venue', 'event_espresso' ),
1135
+	__('Edit this Venue', 'event_espresso'),
1136 1136
 
1137 1137
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:128
1138
-	__( 'Select a Venue for the Event', 'event_espresso' ),
1138
+	__('Select a Venue for the Event', 'event_espresso'),
1139 1139
 
1140 1140
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:21
1141
-	__( 'Venue Details', 'event_espresso' ),
1141
+	__('Venue Details', 'event_espresso'),
1142 1142
 
1143 1143
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:47
1144
-	__( 'unlimited space', 'event_espresso' ),
1144
+	__('unlimited space', 'event_espresso'),
1145 1145
 
1146 1146
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:50
1147 1147
 	/* translators: %d venue capacity */
1148
-	__( 'Space for up to %d people', 'event_espresso' ),
1148
+	__('Space for up to %d people', 'event_espresso'),
1149 1149
 
1150 1150
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:61
1151
-	__( 'Venue address', 'event_espresso' ),
1151
+	__('Venue address', 'event_espresso'),
1152 1152
 
1153 1153
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:67
1154
-	__( 'Venue Details card', 'event_espresso' ),
1154
+	__('Venue Details card', 'event_espresso'),
1155 1155
 
1156 1156
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:76
1157
-	__( 'no image', 'event_espresso' ),
1157
+	__('no image', 'event_espresso'),
1158 1158
 
1159 1159
 	// Reference: domains/core/admin/eventEditor/src/ui/venue/VenueDetails.tsx:80
1160
-	__( 'Venue name', 'event_espresso' ),
1160
+	__('Venue name', 'event_espresso'),
1161 1161
 
1162 1162
 	// Reference: domains/core/admin/wpPluginsPage/src/exitSurvey/Popup.tsx:29
1163
-	__( 'Do you have a moment to share why you are deactivating Event Espresso?', 'event_espresso' ),
1163
+	__('Do you have a moment to share why you are deactivating Event Espresso?', 'event_espresso'),
1164 1164
 
1165 1165
 	// Reference: domains/core/admin/wpPluginsPage/src/exitSurvey/Popup.tsx:40
1166
-	__( 'Skip', 'event_espresso' ),
1166
+	__('Skip', 'event_espresso'),
1167 1167
 
1168 1168
 	// Reference: domains/core/admin/wpPluginsPage/src/exitSurvey/Popup.tsx:42
1169
-	__( 'Sure I\'ll help', 'event_espresso' ),
1169
+	__('Sure I\'ll help', 'event_espresso'),
1170 1170
 
1171 1171
 	// Reference: packages/adapters/src/Pagination/Pagination.tsx:23
1172
-	__( 'pagination', 'event_espresso' ),
1172
+	__('pagination', 'event_espresso'),
1173 1173
 
1174 1174
 	// Reference: packages/adapters/src/TagSelector/TagSelector.tsx:113
1175
-	__( 'toggle menu', 'event_espresso' ),
1175
+	__('toggle menu', 'event_espresso'),
1176 1176
 
1177 1177
 	// Reference: packages/constants/src/datetime.ts:10
1178
-	__( 'Postponed', 'event_espresso' ),
1178
+	__('Postponed', 'event_espresso'),
1179 1179
 
1180 1180
 	// Reference: packages/constants/src/datetime.ts:11
1181
-	__( 'SoldOut', 'event_espresso' ),
1181
+	__('SoldOut', 'event_espresso'),
1182 1182
 
1183 1183
 	// Reference: packages/constants/src/datetime.ts:7
1184 1184
 	// Reference: packages/predicates/src/registration/statusOptions.ts:11
1185
-	__( 'Cancelled', 'event_espresso' ),
1185
+	__('Cancelled', 'event_espresso'),
1186 1186
 
1187 1187
 	// Reference: packages/constants/src/datetime.ts:9
1188
-	__( 'Inactive', 'event_espresso' ),
1188
+	__('Inactive', 'event_espresso'),
1189 1189
 
1190 1190
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:25
1191
-	__( 'error creating %s', 'event_espresso' ),
1191
+	__('error creating %s', 'event_espresso'),
1192 1192
 
1193 1193
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:26
1194
-	__( 'error deleting %s', 'event_espresso' ),
1194
+	__('error deleting %s', 'event_espresso'),
1195 1195
 
1196 1196
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:27
1197
-	__( 'error updating %s', 'event_espresso' ),
1197
+	__('error updating %s', 'event_espresso'),
1198 1198
 
1199 1199
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:28
1200
-	__( 'creating %s', 'event_espresso' ),
1200
+	__('creating %s', 'event_espresso'),
1201 1201
 
1202 1202
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:29
1203
-	__( 'deleting %s', 'event_espresso' ),
1203
+	__('deleting %s', 'event_espresso'),
1204 1204
 
1205 1205
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:30
1206
-	__( 'updating %s', 'event_espresso' ),
1206
+	__('updating %s', 'event_espresso'),
1207 1207
 
1208 1208
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:31
1209
-	__( 'successfully created %s', 'event_espresso' ),
1209
+	__('successfully created %s', 'event_espresso'),
1210 1210
 
1211 1211
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:32
1212
-	__( 'successfully deleted %s', 'event_espresso' ),
1212
+	__('successfully deleted %s', 'event_espresso'),
1213 1213
 
1214 1214
 	// Reference: packages/data/src/mutations/useMutationWithFeedback.ts:33
1215
-	__( 'successfully updated %s', 'event_espresso' ),
1215
+	__('successfully updated %s', 'event_espresso'),
1216 1216
 
1217 1217
 	// Reference: packages/dates/src/components/DateRangePicker/DateRangePickerLegend.tsx:13
1218
-	__( 'day in range', 'event_espresso' ),
1218
+	__('day in range', 'event_espresso'),
1219 1219
 
1220 1220
 	// Reference: packages/dates/src/components/DateRangePicker/DateRangePickerLegend.tsx:17
1221 1221
 	// Reference: packages/dates/src/components/DateRangePicker/index.tsx:79
1222
-	__( 'end date', 'event_espresso' ),
1222
+	__('end date', 'event_espresso'),
1223 1223
 
1224 1224
 	// Reference: packages/dates/src/components/DateTimePicker.tsx:17
1225 1225
 	// Reference: packages/dates/src/components/TimePicker.tsx:17
1226 1226
 	// Reference: packages/form-builder/src/state/utils.ts:433
1227
-	__( 'time', 'event_espresso' ),
1227
+	__('time', 'event_espresso'),
1228 1228
 
1229 1229
 	// Reference: packages/dates/src/constants.ts:7
1230
-	__( 'End Date & Time must be set later than the Start Date & Time', 'event_espresso' ),
1230
+	__('End Date & Time must be set later than the Start Date & Time', 'event_espresso'),
1231 1231
 
1232 1232
 	// Reference: packages/dates/src/constants.ts:9
1233
-	__( 'Start Date & Time must be set before the End Date & Time', 'event_espresso' ),
1233
+	__('Start Date & Time must be set before the End Date & Time', 'event_espresso'),
1234 1234
 
1235 1235
 	// Reference: packages/dates/src/utils/misc.ts:16
1236
-	__( 'month(s)', 'event_espresso' ),
1236
+	__('month(s)', 'event_espresso'),
1237 1237
 
1238 1238
 	// Reference: packages/dates/src/utils/misc.ts:17
1239
-	__( 'week(s)', 'event_espresso' ),
1239
+	__('week(s)', 'event_espresso'),
1240 1240
 
1241 1241
 	// Reference: packages/dates/src/utils/misc.ts:18
1242
-	__( 'day(s)', 'event_espresso' ),
1242
+	__('day(s)', 'event_espresso'),
1243 1243
 
1244 1244
 	// Reference: packages/dates/src/utils/misc.ts:19
1245
-	__( 'hour(s)', 'event_espresso' ),
1245
+	__('hour(s)', 'event_espresso'),
1246 1246
 
1247 1247
 	// Reference: packages/dates/src/utils/misc.ts:20
1248
-	__( 'minute(s)', 'event_espresso' ),
1248
+	__('minute(s)', 'event_espresso'),
1249 1249
 
1250 1250
 	// Reference: packages/edtr-services/src/apollo/mutations/useReorderEntities.ts:63
1251
-	__( 'order updated', 'event_espresso' ),
1251
+	__('order updated', 'event_espresso'),
1252 1252
 
1253 1253
 	// Reference: packages/edtr-services/src/constants.ts:24
1254
-	__( 'datetime', 'event_espresso' ),
1254
+	__('datetime', 'event_espresso'),
1255 1255
 
1256 1256
 	// Reference: packages/edtr-services/src/constants.ts:27
1257
-	__( 'price', 'event_espresso' ),
1257
+	__('price', 'event_espresso'),
1258 1258
 
1259 1259
 	// Reference: packages/edtr-services/src/constants.ts:28
1260 1260
 	// Reference: packages/tpc/src/inputs/PriceTypeInput.tsx:20
1261
-	__( 'price type', 'event_espresso' ),
1261
+	__('price type', 'event_espresso'),
1262 1262
 
1263 1263
 	// Reference: packages/edtr-services/src/utils/dateAndTime.ts:38
1264 1264
 	// Reference: packages/ui-components/src/EditDateRangeButton/EditDateRangeButton.tsx:39
1265
-	__( 'End date has been adjusted', 'event_espresso' ),
1265
+	__('End date has been adjusted', 'event_espresso'),
1266 1266
 
1267 1267
 	// Reference: packages/edtr-services/src/utils/dateAndTime.ts:59
1268
-	__( 'Required', 'event_espresso' ),
1268
+	__('Required', 'event_espresso'),
1269 1269
 
1270 1270
 	// Reference: packages/edtr-services/src/utils/dateAndTime.ts:64
1271
-	__( 'Start Date is required', 'event_espresso' ),
1271
+	__('Start Date is required', 'event_espresso'),
1272 1272
 
1273 1273
 	// Reference: packages/edtr-services/src/utils/dateAndTime.ts:68
1274
-	__( 'End Date is required', 'event_espresso' ),
1274
+	__('End Date is required', 'event_espresso'),
1275 1275
 
1276 1276
 	// Reference: packages/ee-components/src/EntityList/EntityList.tsx:30
1277
-	__( 'no results found', 'event_espresso' ),
1277
+	__('no results found', 'event_espresso'),
1278 1278
 
1279 1279
 	// Reference: packages/ee-components/src/EntityList/EntityList.tsx:31
1280
-	__( 'try changing filter settings', 'event_espresso' ),
1280
+	__('try changing filter settings', 'event_espresso'),
1281 1281
 
1282 1282
 	// Reference: packages/ee-components/src/bulkEdit/ActionCheckbox.tsx:38
1283 1283
 	/* translators: %d entity id */
1284
-	__( 'select entity with id %d', 'event_espresso' ),
1284
+	__('select entity with id %d', 'event_espresso'),
1285 1285
 
1286 1286
 	// Reference: packages/ee-components/src/bulkEdit/ActionCheckbox.tsx:41
1287
-	__( 'select all entities', 'event_espresso' ),
1287
+	__('select all entities', 'event_espresso'),
1288 1288
 
1289 1289
 	// Reference: packages/ee-components/src/bulkEdit/details/BulkEditDetails.tsx:20
1290
-	__( 'Note: ', 'event_espresso' ),
1290
+	__('Note: ', 'event_espresso'),
1291 1291
 
1292 1292
 	// Reference: packages/ee-components/src/bulkEdit/details/BulkEditDetails.tsx:20
1293
-	__( 'any changes will be applied to ALL of the selected entities.', 'event_espresso' ),
1293
+	__('any changes will be applied to ALL of the selected entities.', 'event_espresso'),
1294 1294
 
1295 1295
 	// Reference: packages/ee-components/src/bulkEdit/details/BulkEditDetails.tsx:27
1296
-	__( 'Bulk edit details', 'event_espresso' ),
1296
+	__('Bulk edit details', 'event_espresso'),
1297 1297
 
1298 1298
 	// Reference: packages/ee-components/src/bulkEdit/details/Submit.tsx:17
1299
-	__( 'Are you sure you want to bulk update the details?', 'event_espresso' ),
1299
+	__('Are you sure you want to bulk update the details?', 'event_espresso'),
1300 1300
 
1301 1301
 	// Reference: packages/ee-components/src/bulkEdit/details/Submit.tsx:18
1302
-	__( 'Bulk update details', 'event_espresso' ),
1302
+	__('Bulk update details', 'event_espresso'),
1303 1303
 
1304 1304
 	// Reference: packages/ee-components/src/filterBar/SortByControl/index.tsx:26
1305
-	__( 'set order', 'event_espresso' ),
1305
+	__('set order', 'event_espresso'),
1306 1306
 
1307 1307
 	// Reference: packages/ee-components/src/filterBar/SortByControl/index.tsx:28
1308
-	__( 'Set Custom Dates Order - this is how dates are ordered on the frontend', 'event_espresso' ),
1308
+	__('Set Custom Dates Order - this is how dates are ordered on the frontend', 'event_espresso'),
1309 1309
 
1310 1310
 	// Reference: packages/ee-components/src/filterBar/SortByControl/index.tsx:29
1311
-	__( 'Set Custom Tickets Order - this is how tickets are ordered on the frontend', 'event_espresso' ),
1311
+	__('Set Custom Tickets Order - this is how tickets are ordered on the frontend', 'event_espresso'),
1312 1312
 
1313 1313
 	// Reference: packages/form-builder/src/FormElement/FormElementToolbar.tsx:32
1314
-	__( 'delete form element', 'event_espresso' ),
1314
+	__('delete form element', 'event_espresso'),
1315 1315
 
1316 1316
 	// Reference: packages/form-builder/src/FormElement/FormElementToolbar.tsx:49
1317
-	__( 'form element settings', 'event_espresso' ),
1317
+	__('form element settings', 'event_espresso'),
1318 1318
 
1319 1319
 	// Reference: packages/form-builder/src/FormElement/FormElementToolbar.tsx:59
1320
-	__( 'copy form element', 'event_espresso' ),
1320
+	__('copy form element', 'event_espresso'),
1321 1321
 
1322 1322
 	// Reference: packages/form-builder/src/FormElement/FormElementToolbar.tsx:69
1323
-	__( 'click, hold, and drag to reorder form element', 'event_espresso' ),
1323
+	__('click, hold, and drag to reorder form element', 'event_espresso'),
1324 1324
 
1325 1325
 	// Reference: packages/form-builder/src/FormElement/Tabs/FieldOption.tsx:20
1326
-	__( 'remove option', 'event_espresso' ),
1326
+	__('remove option', 'event_espresso'),
1327 1327
 
1328 1328
 	// Reference: packages/form-builder/src/FormElement/Tabs/FieldOption.tsx:42
1329
-	__( 'value', 'event_espresso' ),
1329
+	__('value', 'event_espresso'),
1330 1330
 
1331 1331
 	// Reference: packages/form-builder/src/FormElement/Tabs/FieldOption.tsx:52
1332
-	__( 'label', 'event_espresso' ),
1332
+	__('label', 'event_espresso'),
1333 1333
 
1334 1334
 	// Reference: packages/form-builder/src/FormElement/Tabs/FieldOption.tsx:63
1335
-	__( 'click, hold, and drag to reorder field option', 'event_espresso' ),
1335
+	__('click, hold, and drag to reorder field option', 'event_espresso'),
1336 1336
 
1337 1337
 	// Reference: packages/form-builder/src/FormElement/Tabs/FieldOptions.tsx:61
1338
-	__( 'Options are the choices you give people to select from.', 'event_espresso' ),
1338
+	__('Options are the choices you give people to select from.', 'event_espresso'),
1339 1339
 
1340 1340
 	// Reference: packages/form-builder/src/FormElement/Tabs/FieldOptions.tsx:63
1341
-	__( 'The value is a simple key that will be saved to the database and the label is what is shown to the user.', 'event_espresso' ),
1341
+	__('The value is a simple key that will be saved to the database and the label is what is shown to the user.', 'event_espresso'),
1342 1342
 
1343 1343
 	// Reference: packages/form-builder/src/FormElement/Tabs/FieldOptions.tsx:96
1344
-	__( 'add new option', 'event_espresso' ),
1344
+	__('add new option', 'event_espresso'),
1345 1345
 
1346 1346
 	// Reference: packages/form-builder/src/FormElement/Tabs/FormElementTabs.tsx:26
1347 1347
 	// Reference: packages/form-builder/src/FormSection/Tabs/FormSectionTabs.tsx:25
1348
-	__( 'Styles', 'event_espresso' ),
1348
+	__('Styles', 'event_espresso'),
1349 1349
 
1350 1350
 	// Reference: packages/form-builder/src/FormElement/Tabs/FormElementTabs.tsx:30
1351
-	__( 'Validation', 'event_espresso' ),
1351
+	__('Validation', 'event_espresso'),
1352 1352
 
1353 1353
 	// Reference: packages/form-builder/src/FormElement/Tabs/InputType.tsx:18
1354
-	__( 'Change input type', 'event_espresso' ),
1354
+	__('Change input type', 'event_espresso'),
1355 1355
 
1356 1356
 	// Reference: packages/form-builder/src/FormElement/Tabs/InputType.tsx:19
1357
-	__( 'Some configurations might be lost. Are you sure you want to change the input type?', 'event_espresso' ),
1357
+	__('Some configurations might be lost. Are you sure you want to change the input type?', 'event_espresso'),
1358 1358
 
1359 1359
 	// Reference: packages/form-builder/src/FormElement/Tabs/InputType.tsx:40
1360
-	__( 'type', 'event_espresso' ),
1360
+	__('type', 'event_espresso'),
1361 1361
 
1362 1362
 	// Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:26
1363 1363
 	// Reference: packages/form-builder/src/FormSection/Tabs/Settings.tsx:17
1364
-	__( 'public label', 'event_espresso' ),
1364
+	__('public label', 'event_espresso'),
1365 1365
 
1366 1366
 	// Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:33
1367 1367
 	// Reference: packages/form-builder/src/FormSection/Tabs/Settings.tsx:22
1368
-	__( 'admin label', 'event_espresso' ),
1368
+	__('admin label', 'event_espresso'),
1369 1369
 
1370 1370
 	// Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:40
1371
-	__( 'content', 'event_espresso' ),
1371
+	__('content', 'event_espresso'),
1372 1372
 
1373 1373
 	// Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:48
1374
-	__( 'options', 'event_espresso' ),
1374
+	__('options', 'event_espresso'),
1375 1375
 
1376 1376
 	// Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:51
1377
-	__( 'placeholder', 'event_espresso' ),
1377
+	__('placeholder', 'event_espresso'),
1378 1378
 
1379 1379
 	// Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:57
1380
-	__( 'admin only', 'event_espresso' ),
1380
+	__('admin only', 'event_espresso'),
1381 1381
 
1382 1382
 	// Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:62
1383
-	__( 'help text', 'event_espresso' ),
1383
+	__('help text', 'event_espresso'),
1384 1384
 
1385 1385
 	// Reference: packages/form-builder/src/FormElement/Tabs/Settings.tsx:71
1386
-	__( 'maps to', 'event_espresso' ),
1386
+	__('maps to', 'event_espresso'),
1387 1387
 
1388 1388
 	// Reference: packages/form-builder/src/FormElement/Tabs/Styles.tsx:15
1389 1389
 	// Reference: packages/form-builder/src/FormSection/Tabs/Styles.tsx:13
1390
-	__( 'css class', 'event_espresso' ),
1390
+	__('css class', 'event_espresso'),
1391 1391
 
1392 1392
 	// Reference: packages/form-builder/src/FormElement/Tabs/Styles.tsx:20
1393
-	__( 'help text css class', 'event_espresso' ),
1393
+	__('help text css class', 'event_espresso'),
1394 1394
 
1395 1395
 	// Reference: packages/form-builder/src/FormElement/Tabs/Styles.tsx:27
1396
-	__( 'size', 'event_espresso' ),
1396
+	__('size', 'event_espresso'),
1397 1397
 
1398 1398
 	// Reference: packages/form-builder/src/FormElement/Tabs/Styles.tsx:35
1399
-	__( 'step', 'event_espresso' ),
1399
+	__('step', 'event_espresso'),
1400 1400
 
1401 1401
 	// Reference: packages/form-builder/src/FormElement/Tabs/Styles.tsx:41
1402
-	__( 'maxlength', 'event_espresso' ),
1402
+	__('maxlength', 'event_espresso'),
1403 1403
 
1404 1404
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:123
1405
-	__( 'min', 'event_espresso' ),
1405
+	__('min', 'event_espresso'),
1406 1406
 
1407 1407
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:128
1408
-	__( 'max', 'event_espresso' ),
1408
+	__('max', 'event_espresso'),
1409 1409
 
1410 1410
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:28
1411
-	__( 'Germany', 'event_espresso' ),
1411
+	__('Germany', 'event_espresso'),
1412 1412
 
1413 1413
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:32
1414
-	__( 'France', 'event_espresso' ),
1414
+	__('France', 'event_espresso'),
1415 1415
 
1416 1416
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:36
1417
-	__( 'United Kingdom', 'event_espresso' ),
1417
+	__('United Kingdom', 'event_espresso'),
1418 1418
 
1419 1419
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:40
1420
-	__( 'United States', 'event_espresso' ),
1420
+	__('United States', 'event_espresso'),
1421 1421
 
1422 1422
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:44
1423
-	__( 'Custom', 'event_espresso' ),
1423
+	__('Custom', 'event_espresso'),
1424 1424
 
1425 1425
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:54
1426
-	__( 'required', 'event_espresso' ),
1426
+	__('required', 'event_espresso'),
1427 1427
 
1428 1428
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:59
1429
-	__( 'required text', 'event_espresso' ),
1429
+	__('required text', 'event_espresso'),
1430 1430
 
1431 1431
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:66
1432
-	__( 'autocomplete', 'event_espresso' ),
1432
+	__('autocomplete', 'event_espresso'),
1433 1433
 
1434 1434
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:74
1435
-	__( 'custom format', 'event_espresso' ),
1435
+	__('custom format', 'event_espresso'),
1436 1436
 
1437 1437
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:75
1438
-	__( 'format', 'event_espresso' ),
1438
+	__('format', 'event_espresso'),
1439 1439
 
1440 1440
 	// Reference: packages/form-builder/src/FormElement/Tabs/Validation.tsx:83
1441
-	__( 'pattern', 'event_espresso' ),
1441
+	__('pattern', 'event_espresso'),
1442 1442
 
1443 1443
 	// Reference: packages/form-builder/src/FormSection/AddFormElementPopover.tsx:110
1444
-	__( 'add new form element', 'event_espresso' ),
1444
+	__('add new form element', 'event_espresso'),
1445 1445
 
1446 1446
 	// Reference: packages/form-builder/src/FormSection/AddFormElementPopover.tsx:117
1447 1447
 	// Reference: packages/form/src/renderers/RepeatableRenderer.tsx:52
1448
-	__( 'Add', 'event_espresso' ),
1448
+	__('Add', 'event_espresso'),
1449 1449
 
1450 1450
 	// Reference: packages/form-builder/src/FormSection/AddFormElementPopover.tsx:76
1451
-	__( 'Add Form Element', 'event_espresso' ),
1451
+	__('Add Form Element', 'event_espresso'),
1452 1452
 
1453 1453
 	// Reference: packages/form-builder/src/FormSection/AddFormElementPopover.tsx:85
1454
-	__( 'form element order can be changed after adding by using the drag handles in the form element toolbar', 'event_espresso' ),
1454
+	__('form element order can be changed after adding by using the drag handles in the form element toolbar', 'event_espresso'),
1455 1455
 
1456 1456
 	// Reference: packages/form-builder/src/FormSection/AddFormElementPopover.tsx:92
1457
-	__( 'load existing form section', 'event_espresso' ),
1457
+	__('load existing form section', 'event_espresso'),
1458 1458
 
1459 1459
 	// Reference: packages/form-builder/src/FormSection/FormSectionToolbar.tsx:32
1460
-	__( 'delete form section', 'event_espresso' ),
1460
+	__('delete form section', 'event_espresso'),
1461 1461
 
1462 1462
 	// Reference: packages/form-builder/src/FormSection/FormSectionToolbar.tsx:47
1463
-	__( 'form section settings', 'event_espresso' ),
1463
+	__('form section settings', 'event_espresso'),
1464 1464
 
1465 1465
 	// Reference: packages/form-builder/src/FormSection/FormSectionToolbar.tsx:57
1466
-	__( 'copy form section', 'event_espresso' ),
1466
+	__('copy form section', 'event_espresso'),
1467 1467
 
1468 1468
 	// Reference: packages/form-builder/src/FormSection/FormSectionToolbar.tsx:74
1469
-	__( 'click, hold, and drag to reorder form section', 'event_espresso' ),
1469
+	__('click, hold, and drag to reorder form section', 'event_espresso'),
1470 1470
 
1471 1471
 	// Reference: packages/form-builder/src/FormSection/FormSections.tsx:26
1472
-	__( 'Add Form Section', 'event_espresso' ),
1472
+	__('Add Form Section', 'event_espresso'),
1473 1473
 
1474 1474
 	// Reference: packages/form-builder/src/FormSection/SaveSection.tsx:47
1475
-	__( 'save form section for use in other forms', 'event_espresso' ),
1475
+	__('save form section for use in other forms', 'event_espresso'),
1476 1476
 
1477 1477
 	// Reference: packages/form-builder/src/FormSection/SaveSection.tsx:51
1478
-	__( 'save as', 'event_espresso' ),
1478
+	__('save as', 'event_espresso'),
1479 1479
 
1480 1480
 	// Reference: packages/form-builder/src/FormSection/SaveSection.tsx:55
1481
-	__( 'default', 'event_espresso' ),
1481
+	__('default', 'event_espresso'),
1482 1482
 
1483 1483
 	// Reference: packages/form-builder/src/FormSection/SaveSection.tsx:58
1484
-	__( ' a copy of this form section will be automatically added to ALL new events', 'event_espresso' ),
1484
+	__(' a copy of this form section will be automatically added to ALL new events', 'event_espresso'),
1485 1485
 
1486 1486
 	// Reference: packages/form-builder/src/FormSection/SaveSection.tsx:61
1487
-	__( 'shared', 'event_espresso' ),
1487
+	__('shared', 'event_espresso'),
1488 1488
 
1489 1489
 	// Reference: packages/form-builder/src/FormSection/SaveSection.tsx:64
1490
-	__( 'a copy of this form section will be saved for use in other events but not loaded by default', 'event_espresso' ),
1490
+	__('a copy of this form section will be saved for use in other events but not loaded by default', 'event_espresso'),
1491 1491
 
1492 1492
 	// Reference: packages/form-builder/src/FormSection/Tabs/Settings.tsx:27
1493
-	__( 'show label', 'event_espresso' ),
1493
+	__('show label', 'event_espresso'),
1494 1494
 
1495 1495
 	// Reference: packages/form-builder/src/FormSection/Tabs/Settings.tsx:33
1496
-	__( 'applies to', 'event_espresso' ),
1496
+	__('applies to', 'event_espresso'),
1497 1497
 
1498 1498
 	// Reference: packages/form-builder/src/constants.ts:102
1499 1499
 	// Reference: packages/form-builder/src/state/utils.ts:436
1500
-	__( 'URL', 'event_espresso' ),
1500
+	__('URL', 'event_espresso'),
1501 1501
 
1502 1502
 	// Reference: packages/form-builder/src/constants.ts:104
1503
-	__( 'adds a text input for entering a URL address', 'event_espresso' ),
1503
+	__('adds a text input for entering a URL address', 'event_espresso'),
1504 1504
 
1505 1505
 	// Reference: packages/form-builder/src/constants.ts:107
1506
-	__( 'Date', 'event_espresso' ),
1506
+	__('Date', 'event_espresso'),
1507 1507
 
1508 1508
 	// Reference: packages/form-builder/src/constants.ts:109
1509
-	__( 'adds a text input that allows users to enter a date directly via keyboard or a datepicker', 'event_espresso' ),
1509
+	__('adds a text input that allows users to enter a date directly via keyboard or a datepicker', 'event_espresso'),
1510 1510
 
1511 1511
 	// Reference: packages/form-builder/src/constants.ts:112
1512 1512
 	// Reference: packages/form-builder/src/state/utils.ts:369
1513
-	__( 'Local Date', 'event_espresso' ),
1513
+	__('Local Date', 'event_espresso'),
1514 1514
 
1515 1515
 	// Reference: packages/form-builder/src/constants.ts:117
1516
-	__( 'Month', 'event_espresso' ),
1516
+	__('Month', 'event_espresso'),
1517 1517
 
1518 1518
 	// Reference: packages/form-builder/src/constants.ts:119
1519
-	__( 'adds a text input that allows users to enter a month and year directly via keyboard or a datepicker', 'event_espresso' ),
1519
+	__('adds a text input that allows users to enter a month and year directly via keyboard or a datepicker', 'event_espresso'),
1520 1520
 
1521 1521
 	// Reference: packages/form-builder/src/constants.ts:122
1522
-	__( 'Time', 'event_espresso' ),
1522
+	__('Time', 'event_espresso'),
1523 1523
 
1524 1524
 	// Reference: packages/form-builder/src/constants.ts:124
1525
-	__( 'adds a text input that allows users to enter a time directly via keyboard or a timepicker', 'event_espresso' ),
1525
+	__('adds a text input that allows users to enter a time directly via keyboard or a timepicker', 'event_espresso'),
1526 1526
 
1527 1527
 	// Reference: packages/form-builder/src/constants.ts:127
1528
-	__( 'Week', 'event_espresso' ),
1528
+	__('Week', 'event_espresso'),
1529 1529
 
1530 1530
 	// Reference: packages/form-builder/src/constants.ts:129
1531
-	__( 'adds a text input that allows users to enter a week and year directly via keyboard or a datepicker', 'event_espresso' ),
1531
+	__('adds a text input that allows users to enter a week and year directly via keyboard or a datepicker', 'event_espresso'),
1532 1532
 
1533 1533
 	// Reference: packages/form-builder/src/constants.ts:132
1534
-	__( 'Day Selector', 'event_espresso' ),
1534
+	__('Day Selector', 'event_espresso'),
1535 1535
 
1536 1536
 	// Reference: packages/form-builder/src/constants.ts:134
1537
-	__( 'adds a dropdown selector that allows users to select the day of the month (01 to 31)', 'event_espresso' ),
1537
+	__('adds a dropdown selector that allows users to select the day of the month (01 to 31)', 'event_espresso'),
1538 1538
 
1539 1539
 	// Reference: packages/form-builder/src/constants.ts:137
1540
-	__( 'Month Selector', 'event_espresso' ),
1540
+	__('Month Selector', 'event_espresso'),
1541 1541
 
1542 1542
 	// Reference: packages/form-builder/src/constants.ts:139
1543
-	__( 'adds a dropdown selector that allows users to select the month of the year (01 to 12)', 'event_espresso' ),
1543
+	__('adds a dropdown selector that allows users to select the month of the year (01 to 12)', 'event_espresso'),
1544 1544
 
1545 1545
 	// Reference: packages/form-builder/src/constants.ts:142
1546
-	__( 'Year Selector', 'event_espresso' ),
1546
+	__('Year Selector', 'event_espresso'),
1547 1547
 
1548 1548
 	// Reference: packages/form-builder/src/constants.ts:144
1549
-	__( 'adds a dropdown selector that allows users to select the year from a configurable range', 'event_espresso' ),
1549
+	__('adds a dropdown selector that allows users to select the year from a configurable range', 'event_espresso'),
1550 1550
 
1551 1551
 	// Reference: packages/form-builder/src/constants.ts:147
1552
-	__( 'Radio Buttons', 'event_espresso' ),
1552
+	__('Radio Buttons', 'event_espresso'),
1553 1553
 
1554 1554
 	// Reference: packages/form-builder/src/constants.ts:149
1555
-	__( 'adds one or more radio buttons that allow users to only select one option from those provided', 'event_espresso' ),
1555
+	__('adds one or more radio buttons that allow users to only select one option from those provided', 'event_espresso'),
1556 1556
 
1557 1557
 	// Reference: packages/form-builder/src/constants.ts:152
1558 1558
 	// Reference: packages/form-builder/src/state/utils.ts:375
1559
-	__( 'Decimal Number', 'event_espresso' ),
1559
+	__('Decimal Number', 'event_espresso'),
1560 1560
 
1561 1561
 	// Reference: packages/form-builder/src/constants.ts:154
1562
-	__( 'adds a text input that only accepts numbers whose value is a decimal (float)', 'event_espresso' ),
1562
+	__('adds a text input that only accepts numbers whose value is a decimal (float)', 'event_espresso'),
1563 1563
 
1564 1564
 	// Reference: packages/form-builder/src/constants.ts:157
1565 1565
 	// Reference: packages/form-builder/src/state/utils.ts:378
1566
-	__( 'Whole Number', 'event_espresso' ),
1566
+	__('Whole Number', 'event_espresso'),
1567 1567
 
1568 1568
 	// Reference: packages/form-builder/src/constants.ts:159
1569
-	__( 'adds a text input that only accepts numbers whose value is an integer (whole number)', 'event_espresso' ),
1569
+	__('adds a text input that only accepts numbers whose value is an integer (whole number)', 'event_espresso'),
1570 1570
 
1571 1571
 	// Reference: packages/form-builder/src/constants.ts:162
1572
-	__( 'Number Range', 'event_espresso' ),
1572
+	__('Number Range', 'event_espresso'),
1573 1573
 
1574 1574
 	// Reference: packages/form-builder/src/constants.ts:167
1575
-	__( 'Phone Number', 'event_espresso' ),
1575
+	__('Phone Number', 'event_espresso'),
1576 1576
 
1577 1577
 	// Reference: packages/form-builder/src/constants.ts:172
1578
-	__( 'Dropdown', 'event_espresso' ),
1578
+	__('Dropdown', 'event_espresso'),
1579 1579
 
1580 1580
 	// Reference: packages/form-builder/src/constants.ts:174
1581
-	__( 'adds a dropdown selector that accepts a single value', 'event_espresso' ),
1581
+	__('adds a dropdown selector that accepts a single value', 'event_espresso'),
1582 1582
 
1583 1583
 	// Reference: packages/form-builder/src/constants.ts:177
1584
-	__( 'Multi Select', 'event_espresso' ),
1584
+	__('Multi Select', 'event_espresso'),
1585 1585
 
1586 1586
 	// Reference: packages/form-builder/src/constants.ts:179
1587
-	__( 'adds a dropdown selector that accepts multiple values', 'event_espresso' ),
1587
+	__('adds a dropdown selector that accepts multiple values', 'event_espresso'),
1588 1588
 
1589 1589
 	// Reference: packages/form-builder/src/constants.ts:182
1590
-	__( 'Toggle/Switch', 'event_espresso' ),
1590
+	__('Toggle/Switch', 'event_espresso'),
1591 1591
 
1592 1592
 	// Reference: packages/form-builder/src/constants.ts:184
1593
-	__( 'adds a toggle or a switch to accept true or false value', 'event_espresso' ),
1593
+	__('adds a toggle or a switch to accept true or false value', 'event_espresso'),
1594 1594
 
1595 1595
 	// Reference: packages/form-builder/src/constants.ts:187
1596
-	__( 'Multi Checkbox', 'event_espresso' ),
1596
+	__('Multi Checkbox', 'event_espresso'),
1597 1597
 
1598 1598
 	// Reference: packages/form-builder/src/constants.ts:189
1599
-	__( 'adds checkboxes that allow users to select zero or more options from those provided', 'event_espresso' ),
1599
+	__('adds checkboxes that allow users to select zero or more options from those provided', 'event_espresso'),
1600 1600
 
1601 1601
 	// Reference: packages/form-builder/src/constants.ts:192
1602
-	__( 'Country Selector', 'event_espresso' ),
1602
+	__('Country Selector', 'event_espresso'),
1603 1603
 
1604 1604
 	// Reference: packages/form-builder/src/constants.ts:194
1605
-	__( 'adds a dropdown selector populated with names of countries that are enabled for the site', 'event_espresso' ),
1605
+	__('adds a dropdown selector populated with names of countries that are enabled for the site', 'event_espresso'),
1606 1606
 
1607 1607
 	// Reference: packages/form-builder/src/constants.ts:197
1608
-	__( 'State Selector', 'event_espresso' ),
1608
+	__('State Selector', 'event_espresso'),
1609 1609
 
1610 1610
 	// Reference: packages/form-builder/src/constants.ts:202
1611
-	__( 'Button', 'event_espresso' ),
1611
+	__('Button', 'event_espresso'),
1612 1612
 
1613 1613
 	// Reference: packages/form-builder/src/constants.ts:204
1614
-	__( 'adds a button to the form that can be used for triggering fucntionality (requires custom coding)', 'event_espresso' ),
1614
+	__('adds a button to the form that can be used for triggering fucntionality (requires custom coding)', 'event_espresso'),
1615 1615
 
1616 1616
 	// Reference: packages/form-builder/src/constants.ts:207
1617
-	__( 'Reset Button', 'event_espresso' ),
1617
+	__('Reset Button', 'event_espresso'),
1618 1618
 
1619 1619
 	// Reference: packages/form-builder/src/constants.ts:209
1620
-	__( 'adds a button that will reset the form back to its original state.', 'event_espresso' ),
1620
+	__('adds a button that will reset the form back to its original state.', 'event_espresso'),
1621 1621
 
1622 1622
 	// Reference: packages/form-builder/src/constants.ts:55
1623
-	__( 'Form Section', 'event_espresso' ),
1623
+	__('Form Section', 'event_espresso'),
1624 1624
 
1625 1625
 	// Reference: packages/form-builder/src/constants.ts:57
1626
-	__( 'Used for creating logical groupings for questions and form elements. Need to add a heading or description? Use the HTML form element.', 'event_espresso' ),
1626
+	__('Used for creating logical groupings for questions and form elements. Need to add a heading or description? Use the HTML form element.', 'event_espresso'),
1627 1627
 
1628 1628
 	// Reference: packages/form-builder/src/constants.ts:62
1629
-	__( 'HTML Block', 'event_espresso' ),
1629
+	__('HTML Block', 'event_espresso'),
1630 1630
 
1631 1631
 	// Reference: packages/form-builder/src/constants.ts:64
1632
-	__( 'allows you to add HTML like headings or text paragraphs to your form', 'event_espresso' ),
1632
+	__('allows you to add HTML like headings or text paragraphs to your form', 'event_espresso'),
1633 1633
 
1634 1634
 	// Reference: packages/form-builder/src/constants.ts:69
1635
-	__( 'adds a text input that only accepts plain text', 'event_espresso' ),
1635
+	__('adds a text input that only accepts plain text', 'event_espresso'),
1636 1636
 
1637 1637
 	// Reference: packages/form-builder/src/constants.ts:72
1638
-	__( 'Plain Text Area', 'event_espresso' ),
1638
+	__('Plain Text Area', 'event_espresso'),
1639 1639
 
1640 1640
 	// Reference: packages/form-builder/src/constants.ts:74
1641
-	__( 'adds a textarea block that only accepts plain text', 'event_espresso' ),
1641
+	__('adds a textarea block that only accepts plain text', 'event_espresso'),
1642 1642
 
1643 1643
 	// Reference: packages/form-builder/src/constants.ts:77
1644
-	__( 'HTML Text Area', 'event_espresso' ),
1644
+	__('HTML Text Area', 'event_espresso'),
1645 1645
 
1646 1646
 	// Reference: packages/form-builder/src/constants.ts:79
1647
-	__( 'adds a textarea block that accepts text including simple HTML markup', 'event_espresso' ),
1647
+	__('adds a textarea block that accepts text including simple HTML markup', 'event_espresso'),
1648 1648
 
1649 1649
 	// Reference: packages/form-builder/src/constants.ts:84
1650
-	__( 'adds a text input that only accepts a valid email address', 'event_espresso' ),
1650
+	__('adds a text input that only accepts a valid email address', 'event_espresso'),
1651 1651
 
1652 1652
 	// Reference: packages/form-builder/src/constants.ts:87
1653
-	__( 'Email Confirmation', 'event_espresso' ),
1653
+	__('Email Confirmation', 'event_espresso'),
1654 1654
 
1655 1655
 	// Reference: packages/form-builder/src/constants.ts:92
1656
-	__( 'Password', 'event_espresso' ),
1656
+	__('Password', 'event_espresso'),
1657 1657
 
1658 1658
 	// Reference: packages/form-builder/src/constants.ts:94
1659
-	__( 'adds a text input that accepts text but masks what the user enters', 'event_espresso' ),
1659
+	__('adds a text input that accepts text but masks what the user enters', 'event_espresso'),
1660 1660
 
1661 1661
 	// Reference: packages/form-builder/src/constants.ts:97
1662
-	__( 'Password Confirmation', 'event_espresso' ),
1662
+	__('Password Confirmation', 'event_espresso'),
1663 1663
 
1664 1664
 	// Reference: packages/form-builder/src/data/useElementMutator.ts:54
1665
-	__( 'element', 'event_espresso' ),
1665
+	__('element', 'event_espresso'),
1666 1666
 
1667 1667
 	// Reference: packages/form-builder/src/data/useSectionMutator.ts:54
1668
-	__( 'section', 'event_espresso' ),
1668
+	__('section', 'event_espresso'),
1669 1669
 
1670 1670
 	// Reference: packages/form-builder/src/state/utils.ts:360
1671
-	__( 'click', 'event_espresso' ),
1671
+	__('click', 'event_espresso'),
1672 1672
 
1673 1673
 	// Reference: packages/form-builder/src/state/utils.ts:363
1674
-	__( 'checkboxes', 'event_espresso' ),
1674
+	__('checkboxes', 'event_espresso'),
1675 1675
 
1676 1676
 	// Reference: packages/form-builder/src/state/utils.ts:366
1677
-	__( 'date', 'event_espresso' ),
1677
+	__('date', 'event_espresso'),
1678 1678
 
1679 1679
 	// Reference: packages/form-builder/src/state/utils.ts:372
1680
-	__( 'day', 'event_espresso' ),
1680
+	__('day', 'event_espresso'),
1681 1681
 
1682 1682
 	// Reference: packages/form-builder/src/state/utils.ts:381
1683
-	__( 'email address', 'event_espresso' ),
1683
+	__('email address', 'event_espresso'),
1684 1684
 
1685 1685
 	// Reference: packages/form-builder/src/state/utils.ts:384
1686
-	__( 'confirm email address', 'event_espresso' ),
1686
+	__('confirm email address', 'event_espresso'),
1687 1687
 
1688 1688
 	// Reference: packages/form-builder/src/state/utils.ts:388
1689
-	__( 'month', 'event_espresso' ),
1689
+	__('month', 'event_espresso'),
1690 1690
 
1691 1691
 	// Reference: packages/form-builder/src/state/utils.ts:391
1692
-	__( 'password', 'event_espresso' ),
1692
+	__('password', 'event_espresso'),
1693 1693
 
1694 1694
 	// Reference: packages/form-builder/src/state/utils.ts:394
1695
-	__( 'confirm password', 'event_espresso' ),
1695
+	__('confirm password', 'event_espresso'),
1696 1696
 
1697 1697
 	// Reference: packages/form-builder/src/state/utils.ts:397
1698
-	__( 'radio buttons', 'event_espresso' ),
1698
+	__('radio buttons', 'event_espresso'),
1699 1699
 
1700 1700
 	// Reference: packages/form-builder/src/state/utils.ts:400
1701
-	__( 'number range', 'event_espresso' ),
1701
+	__('number range', 'event_espresso'),
1702 1702
 
1703 1703
 	// Reference: packages/form-builder/src/state/utils.ts:403
1704
-	__( 'selection dropdown', 'event_espresso' ),
1704
+	__('selection dropdown', 'event_espresso'),
1705 1705
 
1706 1706
 	// Reference: packages/form-builder/src/state/utils.ts:406
1707
-	__( 'country', 'event_espresso' ),
1707
+	__('country', 'event_espresso'),
1708 1708
 
1709 1709
 	// Reference: packages/form-builder/src/state/utils.ts:409
1710
-	__( 'multi-select dropdown', 'event_espresso' ),
1710
+	__('multi-select dropdown', 'event_espresso'),
1711 1711
 
1712 1712
 	// Reference: packages/form-builder/src/state/utils.ts:412
1713
-	__( 'state/province', 'event_espresso' ),
1713
+	__('state/province', 'event_espresso'),
1714 1714
 
1715 1715
 	// Reference: packages/form-builder/src/state/utils.ts:415
1716
-	__( 'on/off switch', 'event_espresso' ),
1716
+	__('on/off switch', 'event_espresso'),
1717 1717
 
1718 1718
 	// Reference: packages/form-builder/src/state/utils.ts:418
1719
-	__( 'reset', 'event_espresso' ),
1719
+	__('reset', 'event_espresso'),
1720 1720
 
1721 1721
 	// Reference: packages/form-builder/src/state/utils.ts:421
1722
-	__( 'phone number', 'event_espresso' ),
1722
+	__('phone number', 'event_espresso'),
1723 1723
 
1724 1724
 	// Reference: packages/form-builder/src/state/utils.ts:424
1725
-	__( 'text', 'event_espresso' ),
1725
+	__('text', 'event_espresso'),
1726 1726
 
1727 1727
 	// Reference: packages/form-builder/src/state/utils.ts:427
1728
-	__( 'simple textarea', 'event_espresso' ),
1728
+	__('simple textarea', 'event_espresso'),
1729 1729
 
1730 1730
 	// Reference: packages/form-builder/src/state/utils.ts:430
1731
-	__( 'html textarea', 'event_espresso' ),
1731
+	__('html textarea', 'event_espresso'),
1732 1732
 
1733 1733
 	// Reference: packages/form-builder/src/state/utils.ts:439
1734
-	__( 'week', 'event_espresso' ),
1734
+	__('week', 'event_espresso'),
1735 1735
 
1736 1736
 	// Reference: packages/form-builder/src/state/utils.ts:442
1737
-	__( 'year', 'event_espresso' ),
1737
+	__('year', 'event_espresso'),
1738 1738
 
1739 1739
 	// Reference: packages/form/src/adapters/WPMediaImage.tsx:12
1740
-	__( 'Select Image', 'event_espresso' ),
1740
+	__('Select Image', 'event_espresso'),
1741 1741
 
1742 1742
 	// Reference: packages/form/src/adapters/WPMediaImage.tsx:44
1743 1743
 	// Reference: packages/rich-text-editor/src/components/AdvancedTextEditor/toolbarButtons/WPMedia.tsx:11
1744 1744
 	// Reference: packages/rich-text-editor/src/rte-old/components/toolbarButtons/WPMedia.tsx:12
1745 1745
 	// Reference: packages/ui-components/src/SimpleEntityList/EntityTemplate.tsx:32
1746
-	__( 'Select', 'event_espresso' ),
1746
+	__('Select', 'event_espresso'),
1747 1747
 
1748 1748
 	// Reference: packages/form/src/renderers/FormRenderer.tsx:51
1749
-	__( 'Form Errors', 'event_espresso' ),
1749
+	__('Form Errors', 'event_espresso'),
1750 1750
 
1751 1751
 	// Reference: packages/form/src/renderers/RepeatableRenderer.tsx:36
1752 1752
 	/* translators: %d the entry number */
1753
-	__( 'Entry %d', 'event_espresso' ),
1753
+	__('Entry %d', 'event_espresso'),
1754 1754
 
1755 1755
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:11
1756 1756
 	// Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:17
1757
-	__( 'sold out', 'event_espresso' ),
1757
+	__('sold out', 'event_espresso'),
1758 1758
 
1759 1759
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:14
1760 1760
 	// Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:14
1761
-	__( 'expired', 'event_espresso' ),
1761
+	__('expired', 'event_espresso'),
1762 1762
 
1763 1763
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:17
1764
-	__( 'upcoming', 'event_espresso' ),
1764
+	__('upcoming', 'event_espresso'),
1765 1765
 
1766 1766
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:20
1767
-	__( 'active', 'event_espresso' ),
1767
+	__('active', 'event_espresso'),
1768 1768
 
1769 1769
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:23
1770 1770
 	// Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:11
1771
-	__( 'trashed', 'event_espresso' ),
1771
+	__('trashed', 'event_espresso'),
1772 1772
 
1773 1773
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:26
1774
-	__( 'cancelled', 'event_espresso' ),
1774
+	__('cancelled', 'event_espresso'),
1775 1775
 
1776 1776
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:29
1777
-	__( 'postponed', 'event_espresso' ),
1777
+	__('postponed', 'event_espresso'),
1778 1778
 
1779 1779
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:33
1780
-	__( 'inactive', 'event_espresso' ),
1780
+	__('inactive', 'event_espresso'),
1781 1781
 
1782 1782
 	// Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:20
1783
-	__( 'pending', 'event_espresso' ),
1783
+	__('pending', 'event_espresso'),
1784 1784
 
1785 1785
 	// Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:23
1786
-	__( 'on sale', 'event_espresso' ),
1786
+	__('on sale', 'event_espresso'),
1787 1787
 
1788 1788
 	// Reference: packages/helpers/src/tickets/ticketVisibilityOptions.ts:6
1789
-	__( 'Where the ticket can be viewed throughout the UI. ', 'event_espresso' ),
1789
+	__('Where the ticket can be viewed throughout the UI. ', 'event_espresso'),
1790 1790
 
1791 1791
 	// Reference: packages/predicates/src/registration/statusOptions.ts:16
1792
-	__( 'Declined', 'event_espresso' ),
1792
+	__('Declined', 'event_espresso'),
1793 1793
 
1794 1794
 	// Reference: packages/predicates/src/registration/statusOptions.ts:21
1795
-	__( 'Incomplete', 'event_espresso' ),
1795
+	__('Incomplete', 'event_espresso'),
1796 1796
 
1797 1797
 	// Reference: packages/predicates/src/registration/statusOptions.ts:26
1798
-	__( 'Not Approved', 'event_espresso' ),
1798
+	__('Not Approved', 'event_espresso'),
1799 1799
 
1800 1800
 	// Reference: packages/predicates/src/registration/statusOptions.ts:31
1801
-	__( 'Pending Payment', 'event_espresso' ),
1801
+	__('Pending Payment', 'event_espresso'),
1802 1802
 
1803 1803
 	// Reference: packages/predicates/src/registration/statusOptions.ts:36
1804
-	__( 'Wait List', 'event_espresso' ),
1804
+	__('Wait List', 'event_espresso'),
1805 1805
 
1806 1806
 	// Reference: packages/predicates/src/registration/statusOptions.ts:6
1807
-	__( 'Approved', 'event_espresso' ),
1807
+	__('Approved', 'event_espresso'),
1808 1808
 
1809 1809
 	// Reference: packages/rich-text-editor/src/components/AdvancedTextEditor/toolbarButtons/WPMedia.tsx:9
1810 1810
 	// Reference: packages/rich-text-editor/src/rte-old/components/toolbarButtons/WPMedia.tsx:10
1811
-	__( 'Select media', 'event_espresso' ),
1811
+	__('Select media', 'event_espresso'),
1812 1812
 
1813 1813
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/RichTextEditor.tsx:84
1814
-	__( 'Write something…', 'event_espresso' ),
1814
+	__('Write something…', 'event_espresso'),
1815 1815
 
1816 1816
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/Toolbar.tsx:20
1817
-	__( 'RTE Toolbar', 'event_espresso' ),
1817
+	__('RTE Toolbar', 'event_espresso'),
1818 1818
 
1819 1819
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:11
1820
-	__( 'Normal', 'event_espresso' ),
1820
+	__('Normal', 'event_espresso'),
1821 1821
 
1822 1822
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:12
1823
-	__( 'H1', 'event_espresso' ),
1823
+	__('H1', 'event_espresso'),
1824 1824
 
1825 1825
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:13
1826
-	__( 'H2', 'event_espresso' ),
1826
+	__('H2', 'event_espresso'),
1827 1827
 
1828 1828
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:14
1829
-	__( 'H3', 'event_espresso' ),
1829
+	__('H3', 'event_espresso'),
1830 1830
 
1831 1831
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:15
1832
-	__( 'H4', 'event_espresso' ),
1832
+	__('H4', 'event_espresso'),
1833 1833
 
1834 1834
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:16
1835
-	__( 'H5', 'event_espresso' ),
1835
+	__('H5', 'event_espresso'),
1836 1836
 
1837 1837
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:17
1838
-	__( 'H6', 'event_espresso' ),
1838
+	__('H6', 'event_espresso'),
1839 1839
 
1840 1840
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:18
1841
-	__( 'Block quote', 'event_espresso' ),
1841
+	__('Block quote', 'event_espresso'),
1842 1842
 
1843 1843
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/blockType/Component.tsx:19
1844
-	__( 'Code', 'event_espresso' ),
1844
+	__('Code', 'event_espresso'),
1845 1845
 
1846 1846
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/colorPicker/Component.tsx:36
1847
-	__( 'Set color', 'event_espresso' ),
1847
+	__('Set color', 'event_espresso'),
1848 1848
 
1849 1849
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/colorPicker/Component.tsx:45
1850
-	__( 'Text color', 'event_espresso' ),
1850
+	__('Text color', 'event_espresso'),
1851 1851
 
1852 1852
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/colorPicker/Component.tsx:47
1853
-	__( 'Background color', 'event_espresso' ),
1853
+	__('Background color', 'event_espresso'),
1854 1854
 
1855 1855
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/image/Component.tsx:39
1856
-	__( 'Add image', 'event_espresso' ),
1856
+	__('Add image', 'event_espresso'),
1857 1857
 
1858 1858
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/image/Component.tsx:51
1859
-	__( 'Image URL', 'event_espresso' ),
1859
+	__('Image URL', 'event_espresso'),
1860 1860
 
1861 1861
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/image/Component.tsx:55
1862
-	__( 'Alt text', 'event_espresso' ),
1862
+	__('Alt text', 'event_espresso'),
1863 1863
 
1864 1864
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/image/Component.tsx:56
1865
-	__( 'Width', 'event_espresso' ),
1865
+	__('Width', 'event_espresso'),
1866 1866
 
1867 1867
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/image/Component.tsx:60
1868
-	__( 'Height', 'event_espresso' ),
1868
+	__('Height', 'event_espresso'),
1869 1869
 
1870 1870
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/link/Component.tsx:54
1871
-	__( 'Edit link', 'event_espresso' ),
1871
+	__('Edit link', 'event_espresso'),
1872 1872
 
1873 1873
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/link/Component.tsx:64
1874
-	__( 'URL title', 'event_espresso' ),
1874
+	__('URL title', 'event_espresso'),
1875 1875
 
1876 1876
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/list/Component.tsx:11
1877
-	__( 'Unordered list', 'event_espresso' ),
1877
+	__('Unordered list', 'event_espresso'),
1878 1878
 
1879 1879
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/list/Component.tsx:12
1880
-	__( 'Ordered list', 'event_espresso' ),
1880
+	__('Ordered list', 'event_espresso'),
1881 1881
 
1882 1882
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/list/Component.tsx:13
1883 1883
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/textAlign/Component.tsx:13
1884
-	__( 'Indent', 'event_espresso' ),
1884
+	__('Indent', 'event_espresso'),
1885 1885
 
1886 1886
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/list/Component.tsx:14
1887 1887
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/textAlign/Component.tsx:14
1888
-	__( 'Outdent', 'event_espresso' ),
1888
+	__('Outdent', 'event_espresso'),
1889 1889
 
1890 1890
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/textAlign/Component.tsx:11
1891
-	__( 'Unordered textalign', 'event_espresso' ),
1891
+	__('Unordered textalign', 'event_espresso'),
1892 1892
 
1893 1893
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/Toolbar/controls/textAlign/Component.tsx:12
1894
-	__( 'Ordered textalign', 'event_espresso' ),
1894
+	__('Ordered textalign', 'event_espresso'),
1895 1895
 
1896 1896
 	// Reference: packages/rich-text-editor/src/components/RichTextEditor/render/Image/Toolbar.tsx:32
1897
-	__( 'Image toolbar', 'event_espresso' ),
1897
+	__('Image toolbar', 'event_espresso'),
1898 1898
 
1899 1899
 	// Reference: packages/rich-text-editor/src/components/WithEditMode/WithEditMode.tsx:62
1900 1900
 	// Reference: packages/rich-text-editor/src/rte-old/components/RTEWithEditMode/RTEWithEditMode.tsx:35
1901
-	__( 'Visual editor', 'event_espresso' ),
1901
+	__('Visual editor', 'event_espresso'),
1902 1902
 
1903 1903
 	// Reference: packages/rich-text-editor/src/components/WithEditMode/WithEditMode.tsx:66
1904 1904
 	// Reference: packages/rich-text-editor/src/rte-old/components/RTEWithEditMode/RTEWithEditMode.tsx:39
1905
-	__( 'HTML editor', 'event_espresso' ),
1905
+	__('HTML editor', 'event_espresso'),
1906 1906
 
1907 1907
 	// Reference: packages/rich-text-editor/src/rte-old/components/toolbarButtons/WPMedia.tsx:68
1908
-	__( 'Add Media', 'event_espresso' ),
1908
+	__('Add Media', 'event_espresso'),
1909 1909
 
1910 1910
 	// Reference: packages/tpc/src/buttons/AddPriceModifierButton.tsx:16
1911
-	__( 'add new price modifier after this row', 'event_espresso' ),
1911
+	__('add new price modifier after this row', 'event_espresso'),
1912 1912
 
1913 1913
 	// Reference: packages/tpc/src/buttons/DeleteAllPricesButton.tsx:14
1914
-	__( 'Delete all prices', 'event_espresso' ),
1914
+	__('Delete all prices', 'event_espresso'),
1915 1915
 
1916 1916
 	// Reference: packages/tpc/src/buttons/DeleteAllPricesButton.tsx:27
1917
-	__( 'Are you sure you want to delete all of this ticket\'s prices and make it free? This action is permanent and can not be undone.', 'event_espresso' ),
1917
+	__('Are you sure you want to delete all of this ticket\'s prices and make it free? This action is permanent and can not be undone.', 'event_espresso'),
1918 1918
 
1919 1919
 	// Reference: packages/tpc/src/buttons/DeleteAllPricesButton.tsx:31
1920
-	__( 'Delete all prices?', 'event_espresso' ),
1920
+	__('Delete all prices?', 'event_espresso'),
1921 1921
 
1922 1922
 	// Reference: packages/tpc/src/buttons/DeletePriceModifierButton.tsx:12
1923
-	__( 'delete price modifier', 'event_espresso' ),
1923
+	__('delete price modifier', 'event_espresso'),
1924 1924
 
1925 1925
 	// Reference: packages/tpc/src/buttons/ReverseCalculateButton.tsx:14
1926
-	__( 'Ticket base price is being reverse calculated from bottom to top starting with the ticket total. Entering a new ticket total will reverse calculate the ticket base price after applying all price modifiers in reverse. Click to turn off reverse calculations', 'event_espresso' ),
1926
+	__('Ticket base price is being reverse calculated from bottom to top starting with the ticket total. Entering a new ticket total will reverse calculate the ticket base price after applying all price modifiers in reverse. Click to turn off reverse calculations', 'event_espresso'),
1927 1927
 
1928 1928
 	// Reference: packages/tpc/src/buttons/ReverseCalculateButton.tsx:17
1929
-	__( 'Ticket total is being calculated normally from top to bottom starting from the base price. Entering a new ticket base price will recalculate the ticket total after applying all price modifiers. Click to turn on reverse calculations', 'event_espresso' ),
1929
+	__('Ticket total is being calculated normally from top to bottom starting from the base price. Entering a new ticket base price will recalculate the ticket total after applying all price modifiers. Click to turn on reverse calculations', 'event_espresso'),
1930 1930
 
1931 1931
 	// Reference: packages/tpc/src/buttons/ReverseCalculateButton.tsx:21
1932
-	__( 'Disable reverse calculate', 'event_espresso' ),
1932
+	__('Disable reverse calculate', 'event_espresso'),
1933 1933
 
1934 1934
 	// Reference: packages/tpc/src/buttons/ReverseCalculateButton.tsx:21
1935
-	__( 'Enable reverse calculate', 'event_espresso' ),
1935
+	__('Enable reverse calculate', 'event_espresso'),
1936 1936
 
1937 1937
 	// Reference: packages/tpc/src/buttons/TicketPriceCalculatorButton.tsx:28
1938
-	__( 'ticket price calculator', 'event_espresso' ),
1938
+	__('ticket price calculator', 'event_espresso'),
1939 1939
 
1940 1940
 	// Reference: packages/tpc/src/buttons/taxes/AddDefaultTaxesButton.tsx:9
1941
-	__( 'Add default taxes', 'event_espresso' ),
1941
+	__('Add default taxes', 'event_espresso'),
1942 1942
 
1943 1943
 	// Reference: packages/tpc/src/buttons/taxes/RemoveTaxesButton.tsx:10
1944
-	__( 'Are you sure you want to remove all of this ticket\'s taxes?', 'event_espresso' ),
1944
+	__('Are you sure you want to remove all of this ticket\'s taxes?', 'event_espresso'),
1945 1945
 
1946 1946
 	// Reference: packages/tpc/src/buttons/taxes/RemoveTaxesButton.tsx:14
1947
-	__( 'Remove all taxes?', 'event_espresso' ),
1947
+	__('Remove all taxes?', 'event_espresso'),
1948 1948
 
1949 1949
 	// Reference: packages/tpc/src/buttons/taxes/RemoveTaxesButton.tsx:7
1950
-	__( 'Remove taxes', 'event_espresso' ),
1950
+	__('Remove taxes', 'event_espresso'),
1951 1951
 
1952 1952
 	// Reference: packages/tpc/src/components/AddDefaultPricesButton.tsx:9
1953
-	__( 'Add default prices', 'event_espresso' ),
1953
+	__('Add default prices', 'event_espresso'),
1954 1954
 
1955 1955
 	// Reference: packages/tpc/src/components/DefaultPricesInfo.tsx:29
1956
-	__( 'Modify default prices.', 'event_espresso' ),
1956
+	__('Modify default prices.', 'event_espresso'),
1957 1957
 
1958 1958
 	// Reference: packages/tpc/src/components/DefaultTaxesInfo.tsx:29
1959
-	__( 'New default taxes are available. Click the - Add default taxes - button to add them now.', 'event_espresso' ),
1959
+	__('New default taxes are available. Click the - Add default taxes - button to add them now.', 'event_espresso'),
1960 1960
 
1961 1961
 	// Reference: packages/tpc/src/components/LockedTicketsBanner.tsx:12
1962 1962
 	// Reference: packages/tpc/src/hooks/useLockedTicketAction.ts:74
1963
-	__( 'Price editing is disabled!', 'event_espresso' ),
1963
+	__('Price editing is disabled!', 'event_espresso'),
1964 1964
 
1965 1965
 	// Reference: packages/tpc/src/components/NoPriceTypesBanner.tsx:12
1966
-	__( 'One or more price types are missing. Maybe they were placed in the trash?', 'event_espresso' ),
1966
+	__('One or more price types are missing. Maybe they were placed in the trash?', 'event_espresso'),
1967 1967
 
1968 1968
 	// Reference: packages/tpc/src/components/NoPriceTypesBanner.tsx:17
1969 1969
 	/* translators: %s link to price types admin */
1970
-	__( 'Go to the%sto restore (untrash) your price types and/or create some new ones.', 'event_espresso' ),
1970
+	__('Go to the%sto restore (untrash) your price types and/or create some new ones.', 'event_espresso'),
1971 1971
 
1972 1972
 	// Reference: packages/tpc/src/components/NoPriceTypesBanner.tsx:18
1973
-	__( 'price types admin page', 'event_espresso' ),
1973
+	__('price types admin page', 'event_espresso'),
1974 1974
 
1975 1975
 	// Reference: packages/tpc/src/components/NoPriceTypesBanner.tsx:26
1976
-	__( 'Missing Price Types!', 'event_espresso' ),
1976
+	__('Missing Price Types!', 'event_espresso'),
1977 1977
 
1978 1978
 	// Reference: packages/tpc/src/components/NoPricesBanner.tsx:14
1979
-	__( 'This Ticket is Currently Free', 'event_espresso' ),
1979
+	__('This Ticket is Currently Free', 'event_espresso'),
1980 1980
 
1981 1981
 	// Reference: packages/tpc/src/components/NoPricesBanner.tsx:21
1982 1982
 	/* translators: %s default prices */
1983
-	__( 'Click the button below to load your %s into the calculator.', 'event_espresso' ),
1983
+	__('Click the button below to load your %s into the calculator.', 'event_espresso'),
1984 1984
 
1985 1985
 	// Reference: packages/tpc/src/components/NoPricesBanner.tsx:22
1986
-	__( 'default prices', 'event_espresso' ),
1986
+	__('default prices', 'event_espresso'),
1987 1987
 
1988 1988
 	// Reference: packages/tpc/src/components/NoPricesBanner.tsx:29
1989
-	__( 'Additional ticket price modifiers can be added or removed.', 'event_espresso' ),
1989
+	__('Additional ticket price modifiers can be added or removed.', 'event_espresso'),
1990 1990
 
1991 1991
 	// Reference: packages/tpc/src/components/NoPricesBanner.tsx:31
1992
-	__( 'Click the save button below to assign which dates this ticket will be available for purchase on.', 'event_espresso' ),
1992
+	__('Click the save button below to assign which dates this ticket will be available for purchase on.', 'event_espresso'),
1993 1993
 
1994 1994
 	// Reference: packages/tpc/src/components/TicketPriceCalculatorModal.tsx:22
1995 1995
 	// Reference: packages/ui-components/src/Confirm/ConfirmClose.tsx:7
1996 1996
 	// Reference: packages/ui-components/src/Confirm/useConfirmWithButton.tsx:10
1997 1997
 	// Reference: packages/ui-components/src/Confirm/useConfirmationDialog.tsx:52
1998
-	__( 'Changes will be lost if you proceed.', 'event_espresso' ),
1998
+	__('Changes will be lost if you proceed.', 'event_espresso'),
1999 1999
 
2000 2000
 	// Reference: packages/tpc/src/components/TicketPriceCalculatorModal.tsx:33
2001 2001
 	/* translators: %s ticket name */
2002
-	__( 'Price Calculator for Ticket: %s', 'event_espresso' ),
2002
+	__('Price Calculator for Ticket: %s', 'event_espresso'),
2003 2003
 
2004 2004
 	// Reference: packages/tpc/src/components/table/useFooterRowGenerator.tsx:48
2005
-	__( 'Total', 'event_espresso' ),
2005
+	__('Total', 'event_espresso'),
2006 2006
 
2007 2007
 	// Reference: packages/tpc/src/components/table/useFooterRowGenerator.tsx:57
2008
-	__( 'ticket total', 'event_espresso' ),
2008
+	__('ticket total', 'event_espresso'),
2009 2009
 
2010 2010
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:29
2011
-	__( 'Order', 'event_espresso' ),
2011
+	__('Order', 'event_espresso'),
2012 2012
 
2013 2013
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:35
2014
-	__( 'Price Type', 'event_espresso' ),
2014
+	__('Price Type', 'event_espresso'),
2015 2015
 
2016 2016
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:41
2017
-	__( 'Label', 'event_espresso' ),
2017
+	__('Label', 'event_espresso'),
2018 2018
 
2019 2019
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:53
2020
-	__( 'Amount', 'event_espresso' ),
2020
+	__('Amount', 'event_espresso'),
2021 2021
 
2022 2022
 	// Reference: packages/tpc/src/hooks/useLockedTicketAction.ts:22
2023
-	__( 'Copy ticket', 'event_espresso' ),
2023
+	__('Copy ticket', 'event_espresso'),
2024 2024
 
2025 2025
 	// Reference: packages/tpc/src/hooks/useLockedTicketAction.ts:26
2026
-	__( 'Copy and archive this ticket', 'event_espresso' ),
2026
+	__('Copy and archive this ticket', 'event_espresso'),
2027 2027
 
2028 2028
 	// Reference: packages/tpc/src/hooks/useLockedTicketAction.ts:29
2029
-	__( 'OK', 'event_espresso' ),
2029
+	__('OK', 'event_espresso'),
2030 2030
 
2031 2031
 	// Reference: packages/tpc/src/inputs/PriceAmountInput.tsx:34
2032
-	__( 'amount', 'event_espresso' ),
2032
+	__('amount', 'event_espresso'),
2033 2033
 
2034 2034
 	// Reference: packages/tpc/src/inputs/PriceAmountInput.tsx:46
2035
-	__( 'amount…', 'event_espresso' ),
2035
+	__('amount…', 'event_espresso'),
2036 2036
 
2037 2037
 	// Reference: packages/tpc/src/inputs/PriceDescriptionInput.tsx:14
2038
-	__( 'description…', 'event_espresso' ),
2038
+	__('description…', 'event_espresso'),
2039 2039
 
2040 2040
 	// Reference: packages/tpc/src/inputs/PriceDescriptionInput.tsx:9
2041
-	__( 'price description', 'event_espresso' ),
2041
+	__('price description', 'event_espresso'),
2042 2042
 
2043 2043
 	// Reference: packages/tpc/src/inputs/PriceIdInput.tsx:6
2044
-	__( 'price id', 'event_espresso' ),
2044
+	__('price id', 'event_espresso'),
2045 2045
 
2046 2046
 	// Reference: packages/tpc/src/inputs/PriceNameInput.tsx:13
2047
-	__( 'label…', 'event_espresso' ),
2047
+	__('label…', 'event_espresso'),
2048 2048
 
2049 2049
 	// Reference: packages/tpc/src/inputs/PriceNameInput.tsx:8
2050
-	__( 'price name', 'event_espresso' ),
2050
+	__('price name', 'event_espresso'),
2051 2051
 
2052 2052
 	// Reference: packages/tpc/src/inputs/PriceOrderInput.tsx:14
2053
-	__( 'price order', 'event_espresso' ),
2053
+	__('price order', 'event_espresso'),
2054 2054
 
2055 2055
 	// Reference: packages/tpc/src/utils/constants.ts:8
2056
-	__( 'Ticket price modifications are blocked for Tickets that have already been sold to registrants, because doing so would negatively affect internal accounting for the event. If you still need to modify ticket prices, then create a copy of those tickets, edit the prices for the new tickets, and then trash the old tickets.', 'event_espresso' ),
2056
+	__('Ticket price modifications are blocked for Tickets that have already been sold to registrants, because doing so would negatively affect internal accounting for the event. If you still need to modify ticket prices, then create a copy of those tickets, edit the prices for the new tickets, and then trash the old tickets.', 'event_espresso'),
2057 2057
 
2058 2058
 	// Reference: packages/ui-components/src/ActiveFilters/ActiveFilters.tsx:8
2059
-	__( 'active filters:', 'event_espresso' ),
2059
+	__('active filters:', 'event_espresso'),
2060 2060
 
2061 2061
 	// Reference: packages/ui-components/src/ActiveFilters/FilterTag/index.tsx:15
2062 2062
 	/* translators: %s filter name */
2063
-	__( 'remove filter - %s', 'event_espresso' ),
2063
+	__('remove filter - %s', 'event_espresso'),
2064 2064
 
2065 2065
 	// Reference: packages/ui-components/src/Address/Address.tsx:105
2066
-	__( 'Country:', 'event_espresso' ),
2066
+	__('Country:', 'event_espresso'),
2067 2067
 
2068 2068
 	// Reference: packages/ui-components/src/Address/Address.tsx:113
2069
-	__( 'Zip:', 'event_espresso' ),
2069
+	__('Zip:', 'event_espresso'),
2070 2070
 
2071 2071
 	// Reference: packages/ui-components/src/Address/Address.tsx:81
2072
-	__( 'Address:', 'event_espresso' ),
2072
+	__('Address:', 'event_espresso'),
2073 2073
 
2074 2074
 	// Reference: packages/ui-components/src/Address/Address.tsx:89
2075
-	__( 'City:', 'event_espresso' ),
2075
+	__('City:', 'event_espresso'),
2076 2076
 
2077 2077
 	// Reference: packages/ui-components/src/Address/Address.tsx:97
2078
-	__( 'State:', 'event_espresso' ),
2078
+	__('State:', 'event_espresso'),
2079 2079
 
2080 2080
 	// Reference: packages/ui-components/src/CalendarDateRange/CalendarDateRange.tsx:37
2081
-	__( 'to', 'event_espresso' ),
2081
+	__('to', 'event_espresso'),
2082 2082
 
2083 2083
 	// Reference: packages/ui-components/src/CalendarPageDate/CalendarPageDate.tsx:54
2084
-	__( 'TO', 'event_espresso' ),
2084
+	__('TO', 'event_espresso'),
2085 2085
 
2086 2086
 	// Reference: packages/ui-components/src/ColorPicker/ColorPicker.tsx:60
2087
-	__( 'Custom color', 'event_espresso' ),
2087
+	__('Custom color', 'event_espresso'),
2088 2088
 
2089 2089
 	// Reference: packages/ui-components/src/ColorPicker/Swatch.tsx:23
2090 2090
 	/* translators: color name */
2091
-	__( 'Color: %s', 'event_espresso' ),
2091
+	__('Color: %s', 'event_espresso'),
2092 2092
 
2093 2093
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:13
2094
-	__( 'Cyan bluish gray', 'event_espresso' ),
2094
+	__('Cyan bluish gray', 'event_espresso'),
2095 2095
 
2096 2096
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:17
2097
-	__( 'White', 'event_espresso' ),
2097
+	__('White', 'event_espresso'),
2098 2098
 
2099 2099
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:21
2100
-	__( 'Pale pink', 'event_espresso' ),
2100
+	__('Pale pink', 'event_espresso'),
2101 2101
 
2102 2102
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:25
2103
-	__( 'Vivid red', 'event_espresso' ),
2103
+	__('Vivid red', 'event_espresso'),
2104 2104
 
2105 2105
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:29
2106
-	__( 'Luminous vivid orange', 'event_espresso' ),
2106
+	__('Luminous vivid orange', 'event_espresso'),
2107 2107
 
2108 2108
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:33
2109
-	__( 'Luminous vivid amber', 'event_espresso' ),
2109
+	__('Luminous vivid amber', 'event_espresso'),
2110 2110
 
2111 2111
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:37
2112
-	__( 'Light green cyan', 'event_espresso' ),
2112
+	__('Light green cyan', 'event_espresso'),
2113 2113
 
2114 2114
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:41
2115
-	__( 'Vivid green cyan', 'event_espresso' ),
2115
+	__('Vivid green cyan', 'event_espresso'),
2116 2116
 
2117 2117
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:45
2118
-	__( 'Pale cyan blue', 'event_espresso' ),
2118
+	__('Pale cyan blue', 'event_espresso'),
2119 2119
 
2120 2120
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:49
2121
-	__( 'Vivid cyan blue', 'event_espresso' ),
2121
+	__('Vivid cyan blue', 'event_espresso'),
2122 2122
 
2123 2123
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:53
2124
-	__( 'Vivid purple', 'event_espresso' ),
2124
+	__('Vivid purple', 'event_espresso'),
2125 2125
 
2126 2126
 	// Reference: packages/ui-components/src/ColorPicker/constants.ts:9
2127
-	__( 'Black', 'event_espresso' ),
2127
+	__('Black', 'event_espresso'),
2128 2128
 
2129 2129
 	// Reference: packages/ui-components/src/Confirm/ConfirmClose.tsx:8
2130 2130
 	// Reference: packages/ui-components/src/Modal/ModalWithAlert.tsx:24
2131
-	__( 'Are you sure you want to close this?', 'event_espresso' ),
2131
+	__('Are you sure you want to close this?', 'event_espresso'),
2132 2132
 
2133 2133
 	// Reference: packages/ui-components/src/Confirm/ConfirmClose.tsx:9
2134 2134
 	// Reference: packages/ui-components/src/Modal/ModalWithAlert.tsx:25
2135
-	__( 'Yes, discard changes', 'event_espresso' ),
2135
+	__('Yes, discard changes', 'event_espresso'),
2136 2136
 
2137 2137
 	// Reference: packages/ui-components/src/Confirm/ConfirmDelete.tsx:7
2138
-	__( 'Are you sure you want to delete this?', 'event_espresso' ),
2138
+	__('Are you sure you want to delete this?', 'event_espresso'),
2139 2139
 
2140 2140
 	// Reference: packages/ui-components/src/Confirm/useConfirmWithButton.tsx:11
2141
-	__( 'Please confirm this action.', 'event_espresso' ),
2141
+	__('Please confirm this action.', 'event_espresso'),
2142 2142
 
2143 2143
 	// Reference: packages/ui-components/src/Confirm/useConfirmationDialog.tsx:39
2144
-	__( 'cancel', 'event_espresso' ),
2144
+	__('cancel', 'event_espresso'),
2145 2145
 
2146 2146
 	// Reference: packages/ui-components/src/Confirm/useConfirmationDialog.tsx:40
2147
-	__( 'confirm', 'event_espresso' ),
2147
+	__('confirm', 'event_espresso'),
2148 2148
 
2149 2149
 	// Reference: packages/ui-components/src/CurrencyDisplay/CurrencyDisplay.tsx:34
2150
-	__( 'free', 'event_espresso' ),
2150
+	__('free', 'event_espresso'),
2151 2151
 
2152 2152
 	// Reference: packages/ui-components/src/DateTimeRangePicker/DateTimeRangePicker.tsx:117
2153 2153
 	// Reference: packages/ui-components/src/Popover/PopoverForm/PopoverForm.tsx:44
2154
-	__( 'save', 'event_espresso' ),
2154
+	__('save', 'event_espresso'),
2155 2155
 
2156 2156
 	// Reference: packages/ui-components/src/DebugInfo/DebugInfo.tsx:36
2157
-	__( 'Hide Debug Info', 'event_espresso' ),
2157
+	__('Hide Debug Info', 'event_espresso'),
2158 2158
 
2159 2159
 	// Reference: packages/ui-components/src/DebugInfo/DebugInfo.tsx:36
2160
-	__( 'Show Debug Info', 'event_espresso' ),
2160
+	__('Show Debug Info', 'event_espresso'),
2161 2161
 
2162 2162
 	// Reference: packages/ui-components/src/EditDateRangeButton/EditDateRangeButton.tsx:49
2163
-	__( 'Edit Start and End Dates and Times', 'event_espresso' ),
2163
+	__('Edit Start and End Dates and Times', 'event_espresso'),
2164 2164
 
2165 2165
 	// Reference: packages/ui-components/src/EntityActionsMenu/entityMenuItems/CopyEntity.tsx:8
2166
-	__( 'copy', 'event_espresso' ),
2166
+	__('copy', 'event_espresso'),
2167 2167
 
2168 2168
 	// Reference: packages/ui-components/src/EntityActionsMenu/entityMenuItems/EditEntity.tsx:8
2169
-	__( 'edit', 'event_espresso' ),
2169
+	__('edit', 'event_espresso'),
2170 2170
 
2171 2171
 	// Reference: packages/ui-components/src/EntityActionsMenu/entityMenuItems/TrashEntity.tsx:8
2172
-	__( 'trash', 'event_espresso' ),
2172
+	__('trash', 'event_espresso'),
2173 2173
 
2174 2174
 	// Reference: packages/ui-components/src/EntityActionsMenu/entityMenuItems/Untrash.tsx:8
2175
-	__( 'untrash', 'event_espresso' ),
2175
+	__('untrash', 'event_espresso'),
2176 2176
 
2177 2177
 	// Reference: packages/ui-components/src/EntityList/EntityList.tsx:23
2178
-	__( 'OOPS!', 'event_espresso' ),
2178
+	__('OOPS!', 'event_espresso'),
2179 2179
 
2180 2180
 	// Reference: packages/ui-components/src/EntityList/EntityList.tsx:23
2181
-	__( 'Error Loading Entites List', 'event_espresso' ),
2181
+	__('Error Loading Entites List', 'event_espresso'),
2182 2182
 
2183 2183
 	// Reference: packages/ui-components/src/EntityList/RegistrationsLink/index.tsx:12
2184
-	__( 'click to open the registrations admin page in a new tab or window', 'event_espresso' ),
2184
+	__('click to open the registrations admin page in a new tab or window', 'event_espresso'),
2185 2185
 
2186 2186
 	// Reference: packages/ui-components/src/EntityList/filterBar/buttons/CardViewFilterButton.tsx:22
2187
-	__( 'card view', 'event_espresso' ),
2187
+	__('card view', 'event_espresso'),
2188 2188
 
2189 2189
 	// Reference: packages/ui-components/src/EntityList/filterBar/buttons/TableViewFilterButton.tsx:21
2190
-	__( 'table view', 'event_espresso' ),
2190
+	__('table view', 'event_espresso'),
2191 2191
 
2192 2192
 	// Reference: packages/ui-components/src/EntityList/filterBar/buttons/ToggleBulkActionsButton.tsx:8
2193
-	__( 'hide bulk actions', 'event_espresso' ),
2193
+	__('hide bulk actions', 'event_espresso'),
2194 2194
 
2195 2195
 	// Reference: packages/ui-components/src/EntityList/filterBar/buttons/ToggleBulkActionsButton.tsx:8
2196
-	__( 'show bulk actions', 'event_espresso' ),
2196
+	__('show bulk actions', 'event_espresso'),
2197 2197
 
2198 2198
 	// Reference: packages/ui-components/src/EntityList/filterBar/buttons/ToggleFiltersButton.tsx:23
2199
-	__( 'filters', 'event_espresso' ),
2199
+	__('filters', 'event_espresso'),
2200 2200
 
2201 2201
 	// Reference: packages/ui-components/src/Legend/ToggleLegendButton.tsx:38
2202
-	__( 'legend', 'event_espresso' ),
2202
+	__('legend', 'event_espresso'),
2203 2203
 
2204 2204
 	// Reference: packages/ui-components/src/LoadingNotice/LoadingNotice.tsx:11
2205
-	__( 'loading…', 'event_espresso' ),
2205
+	__('loading…', 'event_espresso'),
2206 2206
 
2207 2207
 	// Reference: packages/ui-components/src/Modal/Modal.tsx:59
2208
-	__( 'close modal', 'event_espresso' ),
2208
+	__('close modal', 'event_espresso'),
2209 2209
 
2210 2210
 	// Reference: packages/ui-components/src/Pagination/ItemRender.tsx:10
2211
-	__( 'jump to previous', 'event_espresso' ),
2211
+	__('jump to previous', 'event_espresso'),
2212 2212
 
2213 2213
 	// Reference: packages/ui-components/src/Pagination/ItemRender.tsx:11
2214
-	__( 'jump to next', 'event_espresso' ),
2214
+	__('jump to next', 'event_espresso'),
2215 2215
 
2216 2216
 	// Reference: packages/ui-components/src/Pagination/ItemRender.tsx:12
2217
-	__( 'page', 'event_espresso' ),
2217
+	__('page', 'event_espresso'),
2218 2218
 
2219 2219
 	// Reference: packages/ui-components/src/Pagination/ItemRender.tsx:8
2220
-	__( 'previous', 'event_espresso' ),
2220
+	__('previous', 'event_espresso'),
2221 2221
 
2222 2222
 	// Reference: packages/ui-components/src/Pagination/ItemRender.tsx:9
2223
-	__( 'next', 'event_espresso' ),
2223
+	__('next', 'event_espresso'),
2224 2224
 
2225 2225
 	// Reference: packages/ui-components/src/Pagination/PerPage.tsx:37
2226
-	__( 'items per page', 'event_espresso' ),
2226
+	__('items per page', 'event_espresso'),
2227 2227
 
2228 2228
 	// Reference: packages/ui-components/src/Pagination/constants.ts:10
2229 2229
 	/* translators: %s is per page value */
2230
-	__( '%s / page', 'event_espresso' ),
2230
+	__('%s / page', 'event_espresso'),
2231 2231
 
2232 2232
 	// Reference: packages/ui-components/src/Pagination/constants.ts:13
2233
-	__( 'Next Page', 'event_espresso' ),
2233
+	__('Next Page', 'event_espresso'),
2234 2234
 
2235 2235
 	// Reference: packages/ui-components/src/Pagination/constants.ts:14
2236
-	__( 'Previous Page', 'event_espresso' ),
2236
+	__('Previous Page', 'event_espresso'),
2237 2237
 
2238 2238
 	// Reference: packages/ui-components/src/PercentSign/index.tsx:10
2239
-	__( '%', 'event_espresso' ),
2239
+	__('%', 'event_espresso'),
2240 2240
 
2241 2241
 	// Reference: packages/ui-components/src/SimpleEntityList/EntityOptionsRow/index.tsx:31
2242 2242
 	/* translators: entity type to select */
2243
-	__( 'Select an existing %s to use as a template.', 'event_espresso' ),
2243
+	__('Select an existing %s to use as a template.', 'event_espresso'),
2244 2244
 
2245 2245
 	// Reference: packages/ui-components/src/SimpleEntityList/EntityOptionsRow/index.tsx:38
2246
-	__( 'or', 'event_espresso' ),
2246
+	__('or', 'event_espresso'),
2247 2247
 
2248 2248
 	// Reference: packages/ui-components/src/SimpleEntityList/EntityOptionsRow/index.tsx:43
2249 2249
 	/* translators: entity type to add */
2250
-	__( 'Add a new %s and insert details manually', 'event_espresso' ),
2250
+	__('Add a new %s and insert details manually', 'event_espresso'),
2251 2251
 
2252 2252
 	// Reference: packages/ui-components/src/SimpleEntityList/EntityOptionsRow/index.tsx:48
2253
-	__( 'Add New', 'event_espresso' ),
2253
+	__('Add New', 'event_espresso'),
2254 2254
 
2255 2255
 	// Reference: packages/ui-components/src/Stepper/buttons/Next.tsx:8
2256
-	__( 'Next', 'event_espresso' ),
2256
+	__('Next', 'event_espresso'),
2257 2257
 
2258 2258
 	// Reference: packages/ui-components/src/Stepper/buttons/Previous.tsx:8
2259
-	__( 'Previous', 'event_espresso' ),
2259
+	__('Previous', 'event_espresso'),
2260 2260
 
2261 2261
 	// Reference: packages/ui-components/src/Steps/Steps.tsx:31
2262
-	__( 'Steps', 'event_espresso' ),
2262
+	__('Steps', 'event_espresso'),
2263 2263
 
2264 2264
 	// Reference: packages/ui-components/src/TabbableText/index.tsx:21
2265
-	__( 'click to edit…', 'event_espresso' ),
2265
+	__('click to edit…', 'event_espresso'),
2266 2266
 
2267 2267
 	// Reference: packages/ui-components/src/TimezoneTimeInfo/Content.tsx:14
2268
-	__( 'The Website\'s Time Zone', 'event_espresso' ),
2268
+	__('The Website\'s Time Zone', 'event_espresso'),
2269 2269
 
2270 2270
 	// Reference: packages/ui-components/src/TimezoneTimeInfo/Content.tsx:19
2271
-	__( 'UTC (Greenwich Mean Time)', 'event_espresso' ),
2271
+	__('UTC (Greenwich Mean Time)', 'event_espresso'),
2272 2272
 
2273 2273
 	// Reference: packages/ui-components/src/TimezoneTimeInfo/Content.tsx:9
2274
-	__( 'Your Local Time Zone', 'event_espresso' ),
2274
+	__('Your Local Time Zone', 'event_espresso'),
2275 2275
 
2276 2276
 	// Reference: packages/ui-components/src/TimezoneTimeInfo/TimezoneTimeInfo.tsx:25
2277
-	__( 'click for timezone information', 'event_espresso' ),
2277
+	__('click for timezone information', 'event_espresso'),
2278 2278
 
2279 2279
 	// Reference: packages/ui-components/src/TimezoneTimeInfo/TimezoneTimeInfo.tsx:30
2280
-	__( 'This Date Converted To:', 'event_espresso' ),
2280
+	__('This Date Converted To:', 'event_espresso'),
2281 2281
 
2282 2282
 	// Reference: packages/ui-components/src/VenueSelector/VenueSelector.tsx:120
2283
-	__( 'Add New Venue', 'event_espresso' ),
2283
+	__('Add New Venue', 'event_espresso'),
2284 2284
 
2285 2285
 	// Reference: packages/ui-components/src/VenueSelector/VenueSelector.tsx:36
2286
-	__( '~ no venue ~', 'event_espresso' ),
2286
+	__('~ no venue ~', 'event_espresso'),
2287 2287
 
2288 2288
 	// Reference: packages/ui-components/src/VenueSelector/VenueSelector.tsx:43
2289
-	__( 'assign venue…', 'event_espresso' ),
2289
+	__('assign venue…', 'event_espresso'),
2290 2290
 
2291 2291
 	// Reference: packages/ui-components/src/VenueSelector/VenueSelector.tsx:44
2292
-	__( 'click to select a venue…', 'event_espresso' ),
2292
+	__('click to select a venue…', 'event_espresso'),
2293 2293
 
2294 2294
 	// Reference: packages/ui-components/src/bulkEdit/BulkActions.tsx:51
2295
-	__( 'select all', 'event_espresso' ),
2295
+	__('select all', 'event_espresso'),
2296 2296
 
2297 2297
 	// Reference: packages/ui-components/src/bulkEdit/BulkActions.tsx:54
2298
-	__( 'apply', 'event_espresso' )
2298
+	__('apply', 'event_espresso')
2299 2299
 );
2300 2300
 /* THIS IS THE END OF THE GENERATED FILE */
Please login to merge, or discard this patch.
modules/thank_you_page/templates/thank-you-page-overview.template.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -13,24 +13,24 @@
 block discarded – undo
13 13
         <div class="ee-attention">
14 14
             <div class="extra-padding-sides">
15 15
                 <?php echo apply_filters(
16
-                    'FHEE__thank_you_page_overview_template__order_conf_desc',
17
-                    sprintf(
18
-                        $order_conf_desc,
19
-                        '<h3 class="">',
20
-                        '</h3>',
21
-                        '<br />'
22
-                    )
23
-                );
24
-                if (! empty($TXN_receipt_url)) : ?>
16
+					'FHEE__thank_you_page_overview_template__order_conf_desc',
17
+					sprintf(
18
+						$order_conf_desc,
19
+						'<h3 class="">',
20
+						'</h3>',
21
+						'<br />'
22
+					)
23
+				);
24
+				if (! empty($TXN_receipt_url)) : ?>
25 25
                     <br/>
26 26
                     <a class="ee-button ee-roundish indented-text big-text"
27 27
                        href="<?php echo esc_url_raw($TXN_receipt_url); ?>"
28 28
                     >
29 29
                         <span class="ee-icon ee-icon-PDF-file-type"></span>
30 30
                         <?php echo apply_filters(
31
-                            'FHEE__thank_you_page_overview_template__order_conf_button_text',
32
-                            esc_html__('View Full Order Confirmation Receipt', 'event_espresso')
33
-                        ); ?>
31
+							'FHEE__thank_you_page_overview_template__order_conf_button_text',
32
+							esc_html__('View Full Order Confirmation Receipt', 'event_espresso')
33
+						); ?>
34 34
                     </a>
35 35
                 <?php endif; ?>
36 36
             </div>
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 <div id="espresso-thank-you-page-overview-dv" class="width-100">
11 11
 
12
-    <?php if (! $revisit) : ?>
12
+    <?php if ( ! $revisit) : ?>
13 13
         <div class="ee-attention">
14 14
             <div class="extra-padding-sides">
15 15
                 <?php echo apply_filters(
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
                         '<br />'
22 22
                     )
23 23
                 );
24
-                if (! empty($TXN_receipt_url)) : ?>
24
+                if ( ! empty($TXN_receipt_url)) : ?>
25 25
                     <br/>
26 26
                     <a class="ee-button ee-roundish indented-text big-text"
27 27
                        href="<?php echo esc_url_raw($TXN_receipt_url); ?>"
Please login to merge, or discard this patch.
modules/core_rest_api/EED_Core_Rest_Api.module.php 1 patch
Indentation   +1378 added lines, -1378 removed lines patch added patch discarded remove patch
@@ -22,1382 +22,1382 @@
 block discarded – undo
22 22
  */
23 23
 class EED_Core_Rest_Api extends EED_Module
24 24
 {
25
-    const ee_api_namespace = Domain::API_NAMESPACE;
26
-
27
-    const ee_api_namespace_for_regex = 'ee\/v([^/]*)\/';
28
-
29
-    const saved_routes_option_names = 'ee_core_routes';
30
-
31
-    /**
32
-     * string used in _links response bodies to make them globally unique.
33
-     *
34
-     * @see http://v2.wp-api.org/extending/linking/
35
-     */
36
-    const ee_api_link_namespace = 'https://api.eventespresso.com/';
37
-
38
-    /**
39
-     * @var CalculatedModelFields
40
-     */
41
-    protected static $_field_calculator;
42
-
43
-
44
-    /**
45
-     * @return EED_Core_Rest_Api|EED_Module
46
-     */
47
-    public static function instance()
48
-    {
49
-        return parent::get_instance(EED_Core_Rest_Api::class);
50
-    }
51
-
52
-
53
-    /**
54
-     *    set_hooks - for hooking into EE Core, other modules, etc
55
-     *
56
-     * @access    public
57
-     * @return    void
58
-     */
59
-    public static function set_hooks()
60
-    {
61
-    }
62
-
63
-
64
-    /**
65
-     *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
66
-     *
67
-     * @access    public
68
-     * @return    void
69
-     */
70
-    public static function set_hooks_admin()
71
-    {
72
-    }
73
-
74
-
75
-    public static function set_hooks_both()
76
-    {
77
-        add_action('rest_api_init', ['EED_Core_Rest_Api', 'set_hooks_rest_api'], 5);
78
-        add_action('rest_api_init', ['EED_Core_Rest_Api', 'register_routes'], 10);
79
-        add_filter('rest_route_data', ['EED_Core_Rest_Api', 'hide_old_endpoints'], 10, 2);
80
-        add_filter(
81
-            'rest_index',
82
-            ['EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filterEeMetadataIntoIndex']
83
-        );
84
-    }
85
-
86
-
87
-    /**
88
-     * @since   5.0.0.p
89
-     */
90
-    public static function loadCalculatedModelFields()
91
-    {
92
-        EED_Core_Rest_Api::$_field_calculator = LoaderFactory::getLoader()->load(
93
-            'EventEspresso\core\libraries\rest_api\CalculatedModelFields'
94
-        );
95
-        EED_Core_Rest_Api::invalidate_cached_route_data_on_version_change();
96
-    }
97
-
98
-
99
-    /**
100
-     * sets up hooks which only need to be included as part of REST API requests;
101
-     * other requests like to the frontend or admin etc don't need them
102
-     *
103
-     * @throws EE_Error
104
-     */
105
-    public static function set_hooks_rest_api()
106
-    {
107
-        // set hooks which account for changes made to the API
108
-        EED_Core_Rest_Api::_set_hooks_for_changes();
109
-    }
110
-
111
-
112
-    /**
113
-     * public wrapper of _set_hooks_for_changes.
114
-     * Loads all the hooks which make requests to old versions of the API
115
-     * appear the same as they always did
116
-     *
117
-     * @throws EE_Error
118
-     */
119
-    public static function set_hooks_for_changes()
120
-    {
121
-        EED_Core_Rest_Api::_set_hooks_for_changes();
122
-    }
123
-
124
-
125
-    /**
126
-     * Loads all the hooks which make requests to old versions of the API
127
-     * appear the same as they always did
128
-     *
129
-     * @throws EE_Error
130
-     */
131
-    protected static function _set_hooks_for_changes()
132
-    {
133
-        $folder_contents = EEH_File::get_contents_of_folders([EE_LIBRARIES . 'rest_api/changes'], false);
134
-        foreach ($folder_contents as $classname_in_namespace => $filepath) {
135
-            // ignore the base parent class
136
-            // and legacy named classes
137
-            if (
138
-                $classname_in_namespace === 'ChangesInBase'
139
-                || strpos($classname_in_namespace, 'Changes_In_') === 0
140
-            ) {
141
-                continue;
142
-            }
143
-            $full_classname = 'EventEspresso\core\libraries\rest_api\changes\\' . $classname_in_namespace;
144
-            if (class_exists($full_classname)) {
145
-                $instance_of_class = new $full_classname();
146
-                if ($instance_of_class instanceof ChangesInBase) {
147
-                    $instance_of_class->setHooks();
148
-                }
149
-            }
150
-        }
151
-    }
152
-
153
-
154
-    /**
155
-     * Filters the WP routes to add our EE-related ones. This takes a bit of time
156
-     * so we actually prefer to only do it when an EE plugin is activated or upgraded
157
-     *
158
-     * @throws EE_Error
159
-     * @throws ReflectionException
160
-     */
161
-    public static function register_routes()
162
-    {
163
-        foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_routes) {
164
-            foreach ($relative_routes as $relative_route => $data_for_multiple_endpoints) {
165
-                /**
166
-                 * @var array     $data_for_multiple_endpoints numerically indexed array
167
-                 *                                         but can also contain route options like {
168
-                 * @type array    $schema                      {
169
-                 * @type callable $schema_callback
170
-                 * @type array    $callback_args               arguments that will be passed to the callback, after the
171
-                 * WP_REST_Request of course
172
-                 * }
173
-                 * }
174
-                 */
175
-                // when registering routes, register all the endpoints' data at the same time
176
-                $multiple_endpoint_args = [];
177
-                foreach ($data_for_multiple_endpoints as $endpoint_key => $data_for_single_endpoint) {
178
-                    /**
179
-                     * @var array     $data_for_single_endpoint {
180
-                     * @type callable $callback
181
-                     * @type string methods
182
-                     * @type array args
183
-                     * @type array _links
184
-                     * @type array    $callback_args            arguments that will be passed to the callback, after the
185
-                     * WP_REST_Request of course
186
-                     * }
187
-                     */
188
-                    // skip route options
189
-                    if (! is_numeric($endpoint_key)) {
190
-                        continue;
191
-                    }
192
-                    if (! isset($data_for_single_endpoint['callback'], $data_for_single_endpoint['methods'])) {
193
-                        throw new EE_Error(
194
-                            esc_html__(
195
-                            // @codingStandardsIgnoreStart
196
-                                'Endpoint configuration data needs to have entries "callback" (callable) and "methods" (comma-separated list of accepts HTTP methods).',
197
-                                // @codingStandardsIgnoreEnd
198
-                                'event_espresso'
199
-                            )
200
-                        );
201
-                    }
202
-                    $callback = $data_for_single_endpoint['callback'];
203
-                    $single_endpoint_args = [
204
-                        'methods' => $data_for_single_endpoint['methods'],
205
-                        'args'    => isset($data_for_single_endpoint['args']) ? $data_for_single_endpoint['args']
206
-                            : [],
207
-                    ];
208
-                    if (isset($data_for_single_endpoint['_links'])) {
209
-                        $single_endpoint_args['_links'] = $data_for_single_endpoint['_links'];
210
-                    }
211
-                    if (isset($data_for_single_endpoint['callback_args'])) {
212
-                        $callback_args = $data_for_single_endpoint['callback_args'];
213
-                        $single_endpoint_args['callback'] = static function (WP_REST_Request $request) use (
214
-                            $callback,
215
-                            $callback_args
216
-                        ) {
217
-                            array_unshift($callback_args, $request);
218
-                            return call_user_func_array(
219
-                                $callback,
220
-                                $callback_args
221
-                            );
222
-                        };
223
-                    } else {
224
-                        $single_endpoint_args['callback'] = $data_for_single_endpoint['callback'];
225
-                    }
226
-                    // As of WordPress 5.5, if a permission_callback is not provided,
227
-                    // the REST API will issue a _doing_it_wrong notice.
228
-                    // Since the EE REST API defers capabilities to the db model system,
229
-                    // we will just use the generic WP callback for public endpoints
230
-                    if (! isset($single_endpoint_args['permission_callback'])) {
231
-                        $single_endpoint_args['permission_callback'] = '__return_true';
232
-                    }
233
-                    $multiple_endpoint_args[] = $single_endpoint_args;
234
-                }
235
-                if (isset($data_for_multiple_endpoints['schema'])) {
236
-                    $schema_route_data = $data_for_multiple_endpoints['schema'];
237
-                    $schema_callback = $schema_route_data['schema_callback'];
238
-                    $callback_args = $schema_route_data['callback_args'];
239
-                    $multiple_endpoint_args['schema'] = static function () use ($schema_callback, $callback_args) {
240
-                        return call_user_func_array(
241
-                            $schema_callback,
242
-                            $callback_args
243
-                        );
244
-                    };
245
-                }
246
-                register_rest_route(
247
-                    $namespace,
248
-                    $relative_route,
249
-                    $multiple_endpoint_args
250
-                );
251
-            }
252
-        }
253
-    }
254
-
255
-
256
-    /**
257
-     * Checks if there was a version change or something that merits invalidating the cached
258
-     * route data. If so, invalidates the cached route data so that it gets refreshed
259
-     * next time the WP API is used
260
-     */
261
-    public static function invalidate_cached_route_data_on_version_change()
262
-    {
263
-        if (EE_System::instance()->detect_req_type() !== EE_System::req_type_normal) {
264
-            EED_Core_Rest_Api::invalidate_cached_route_data();
265
-        }
266
-        foreach (EE_Registry::instance()->addons as $addon) {
267
-            if ($addon instanceof EE_Addon && $addon->detect_req_type() !== EE_System::req_type_normal) {
268
-                EED_Core_Rest_Api::invalidate_cached_route_data();
269
-            }
270
-        }
271
-    }
272
-
273
-
274
-    /**
275
-     * Removes the cached route data so it will get refreshed next time the WP API is used
276
-     */
277
-    public static function invalidate_cached_route_data()
278
-    {
279
-        // delete the saved EE REST API routes
280
-        foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden) {
281
-            delete_option(EED_Core_Rest_Api::saved_routes_option_names . $version);
282
-        }
283
-    }
284
-
285
-
286
-    /**
287
-     * Gets the EE route data
288
-     *
289
-     * @return array top-level key is the namespace, next-level key is the route and its value is array{
290
-     * @throws EE_Error
291
-     * @throws ReflectionException
292
-     * @type string|array $callback
293
-     * @type string       $methods
294
-     * @type boolean      $hidden_endpoint
295
-     * }
296
-     */
297
-    public static function get_ee_route_data()
298
-    {
299
-        $ee_routes = [];
300
-        foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden_endpoints) {
301
-            $ee_routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = EED_Core_Rest_Api::_get_ee_route_data_for_version(
302
-                $version,
303
-                $hidden_endpoints
304
-            );
305
-        }
306
-        return $ee_routes;
307
-    }
308
-
309
-
310
-    /**
311
-     * Gets the EE route data from the wp options if it exists already,
312
-     * otherwise re-generates it and saves it to the option
313
-     *
314
-     * @param string  $version
315
-     * @param boolean $hidden_endpoints
316
-     * @return array
317
-     * @throws EE_Error
318
-     * @throws ReflectionException
319
-     */
320
-    protected static function _get_ee_route_data_for_version($version, $hidden_endpoints = false)
321
-    {
322
-        $ee_routes = get_option(EED_Core_Rest_Api::saved_routes_option_names . $version, null);
323
-        if (! $ee_routes || EED_Core_Rest_Api::debugMode()) {
324
-            $ee_routes = EED_Core_Rest_Api::_save_ee_route_data_for_version($version, $hidden_endpoints);
325
-        }
326
-        return $ee_routes;
327
-    }
328
-
329
-
330
-    /**
331
-     * Saves the EE REST API route data to a wp option and returns it
332
-     *
333
-     * @param string  $version
334
-     * @param boolean $hidden_endpoints
335
-     * @return mixed|null
336
-     * @throws EE_Error
337
-     * @throws ReflectionException
338
-     */
339
-    protected static function _save_ee_route_data_for_version($version, $hidden_endpoints = false)
340
-    {
341
-        $instance = EED_Core_Rest_Api::instance();
342
-        $routes = apply_filters(
343
-            'EED_Core_Rest_Api__save_ee_route_data_for_version__routes',
344
-            array_replace_recursive(
345
-                $instance->_get_config_route_data_for_version($version, $hidden_endpoints),
346
-                $instance->_get_meta_route_data_for_version($version, $hidden_endpoints),
347
-                $instance->_get_model_route_data_for_version($version, $hidden_endpoints),
348
-                $instance->_get_rpc_route_data_for_version($version, $hidden_endpoints)
349
-            )
350
-        );
351
-        $option_name = EED_Core_Rest_Api::saved_routes_option_names . $version;
352
-        if (get_option($option_name)) {
353
-            update_option($option_name, $routes, true);
354
-        } else {
355
-            add_option($option_name, $routes, null, 'no');
356
-        }
357
-        return $routes;
358
-    }
359
-
360
-
361
-    /**
362
-     * Calculates all the EE routes and saves it to a WordPress option so we don't
363
-     * need to calculate it on every request
364
-     *
365
-     * @return void
366
-     * @deprecated since version 4.9.1
367
-     */
368
-    public static function save_ee_routes()
369
-    {
370
-        if (DbStatus::isOnline()) {
371
-            $instance = EED_Core_Rest_Api::instance();
372
-            $routes = apply_filters(
373
-                'EED_Core_Rest_Api__save_ee_routes__routes',
374
-                array_replace_recursive(
375
-                    $instance->_register_config_routes(),
376
-                    $instance->_register_meta_routes(),
377
-                    $instance->_register_model_routes(),
378
-                    $instance->_register_rpc_routes()
379
-                )
380
-            );
381
-            update_option(EED_Core_Rest_Api::saved_routes_option_names, $routes, true);
382
-        }
383
-    }
384
-
385
-
386
-    /**
387
-     * Gets all the route information relating to EE models
388
-     *
389
-     * @return array @see get_ee_route_data
390
-     * @deprecated since version 4.9.1
391
-     */
392
-    protected function _register_model_routes()
393
-    {
394
-        $model_routes = [];
395
-        foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden_endpoint) {
396
-            $model_routes[ EED_Core_Rest_Api::ee_api_namespace
397
-                           . $version ] = $this->_get_config_route_data_for_version($version, $hidden_endpoint);
398
-        }
399
-        return $model_routes;
400
-    }
401
-
402
-
403
-    /**
404
-     * Decides whether or not to add write endpoints for this model.
405
-     * Currently, this defaults to exclude all global tables and models
406
-     * which would allow inserting WP core data (we don't want to duplicate
407
-     * what WP API does, as it's unnecessary, extra work, and potentially extra bugs)
408
-     *
409
-     * @param EEM_Base $model
410
-     * @return bool
411
-     */
412
-    public static function should_have_write_endpoints(EEM_Base $model)
413
-    {
414
-        if ($model->is_wp_core_model()) {
415
-            return false;
416
-        }
417
-        foreach ($model->get_tables() as $table) {
418
-            if ($table->is_global()) {
419
-                return false;
420
-            }
421
-        }
422
-        return true;
423
-    }
424
-
425
-
426
-    /**
427
-     * Gets the names of all models which should have plural routes (eg `ee/v4.8.36/events`)
428
-     * in this versioned namespace of EE4
429
-     *
430
-     * @param $version
431
-     * @return array keys are model names (eg 'Event') and values ar either classnames (eg 'EEM_Event')
432
-     */
433
-    public static function model_names_with_plural_routes($version)
434
-    {
435
-        $model_version_info = new ModelVersionInfo($version);
436
-        $models_to_register = $model_version_info->modelsForRequestedVersion();
437
-        // let's not bother having endpoints for extra metas
438
-        unset(
439
-            $models_to_register['Extra_Meta'],
440
-            $models_to_register['Extra_Join'],
441
-            $models_to_register['Post_Meta']
442
-        );
443
-        return apply_filters(
444
-            'FHEE__EED_Core_REST_API___register_model_routes',
445
-            $models_to_register
446
-        );
447
-    }
448
-
449
-
450
-    /**
451
-     * Gets the route data for EE models in the specified version
452
-     *
453
-     * @param string  $version
454
-     * @param boolean $hidden_endpoint
455
-     * @return array
456
-     * @throws EE_Error
457
-     * @throws ReflectionException
458
-     */
459
-    protected function _get_model_route_data_for_version($version, $hidden_endpoint = false)
460
-    {
461
-        $model_routes = [];
462
-        $model_version_info = new ModelVersionInfo($version);
463
-        foreach (EED_Core_Rest_Api::model_names_with_plural_routes($version) as $model_name => $model_classname) {
464
-            $model = EE_Registry::instance()->load_model($model_name);
465
-            // if this isn't a valid model then let's skip iterate to the next item in the loop.
466
-            if (! $model instanceof EEM_Base) {
467
-                continue;
468
-            }
469
-            // yes we could just register one route for ALL models, but then they wouldn't show up in the index
470
-            $plural_model_route = EED_Core_Rest_Api::get_collection_route($model);
471
-            $singular_model_route = EED_Core_Rest_Api::get_entity_route($model, '(?P<id>[^\/]+)');
472
-            $model_routes[ $plural_model_route ] = [
473
-                [
474
-                    'callback'        => [
475
-                        'EventEspresso\core\libraries\rest_api\controllers\model\Read',
476
-                        'handleRequestGetAll',
477
-                    ],
478
-                    'callback_args'   => [$version, $model_name],
479
-                    'methods'         => WP_REST_Server::READABLE,
480
-                    'hidden_endpoint' => $hidden_endpoint,
481
-                    'args'            => $this->_get_read_query_params($model, $version),
482
-                    '_links'          => [
483
-                        'self' => rest_url(EED_Core_Rest_Api::ee_api_namespace . $version . $singular_model_route),
484
-                    ],
485
-                ],
486
-                'schema' => [
487
-                    'schema_callback' => [
488
-                        'EventEspresso\core\libraries\rest_api\controllers\model\Read',
489
-                        'handleSchemaRequest',
490
-                    ],
491
-                    'callback_args'   => [$version, $model_name],
492
-                ],
493
-            ];
494
-            $model_routes[ $singular_model_route ] = [
495
-                [
496
-                    'callback'        => [
497
-                        'EventEspresso\core\libraries\rest_api\controllers\model\Read',
498
-                        'handleRequestGetOne',
499
-                    ],
500
-                    'callback_args'   => [$version, $model_name],
501
-                    'methods'         => WP_REST_Server::READABLE,
502
-                    'hidden_endpoint' => $hidden_endpoint,
503
-                    'args'            => $this->_get_response_selection_query_params($model, $version, true),
504
-                ],
505
-            ];
506
-            if (
507
-                apply_filters(
508
-                    'FHEE__EED_Core_Rest_Api___get_model_route_data_for_version__add_write_endpoints',
509
-                    EED_Core_Rest_Api::should_have_write_endpoints($model),
510
-                    $model
511
-                )
512
-            ) {
513
-                $model_routes[ $plural_model_route ][] = [
514
-                    'callback'        => [
515
-                        'EventEspresso\core\libraries\rest_api\controllers\model\Write',
516
-                        'handleRequestInsert',
517
-                    ],
518
-                    'callback_args'   => [$version, $model_name],
519
-                    'methods'         => WP_REST_Server::CREATABLE,
520
-                    'hidden_endpoint' => $hidden_endpoint,
521
-                    'args'            => $this->_get_write_params($model_name, $model_version_info, true),
522
-                ];
523
-                $model_routes[ $singular_model_route ] = array_merge(
524
-                    $model_routes[ $singular_model_route ],
525
-                    [
526
-                        [
527
-                            'callback'        => [
528
-                                'EventEspresso\core\libraries\rest_api\controllers\model\Write',
529
-                                'handleRequestUpdate',
530
-                            ],
531
-                            'callback_args'   => [$version, $model_name],
532
-                            'methods'         => WP_REST_Server::EDITABLE,
533
-                            'hidden_endpoint' => $hidden_endpoint,
534
-                            'args'            => $this->_get_write_params($model_name, $model_version_info),
535
-                        ],
536
-                        [
537
-                            'callback'        => [
538
-                                'EventEspresso\core\libraries\rest_api\controllers\model\Write',
539
-                                'handleRequestDelete',
540
-                            ],
541
-                            'callback_args'   => [$version, $model_name],
542
-                            'methods'         => WP_REST_Server::DELETABLE,
543
-                            'hidden_endpoint' => $hidden_endpoint,
544
-                            'args'            => $this->_get_delete_query_params($model, $version),
545
-                        ],
546
-                    ]
547
-                );
548
-            }
549
-            foreach ($model->relation_settings() as $relation_name => $relation_obj) {
550
-                $related_route = EED_Core_Rest_Api::get_relation_route_via(
551
-                    $model,
552
-                    '(?P<id>[^\/]+)',
553
-                    $relation_obj
554
-                );
555
-                $model_routes[ $related_route ] = [
556
-                    [
557
-                        'callback'        => [
558
-                            'EventEspresso\core\libraries\rest_api\controllers\model\Read',
559
-                            'handleRequestGetRelated',
560
-                        ],
561
-                        'callback_args'   => [$version, $model_name, $relation_name],
562
-                        'methods'         => WP_REST_Server::READABLE,
563
-                        'hidden_endpoint' => $hidden_endpoint,
564
-                        'args'            => $this->_get_read_query_params($relation_obj->get_other_model(), $version),
565
-                    ],
566
-                ];
567
-
568
-                $related_write_route = $related_route . '/' . '(?P<related_id>[^\/]+)';
569
-                $model_routes[ $related_write_route ] = [
570
-                    [
571
-                        'callback'        => [
572
-                            'EventEspresso\core\libraries\rest_api\controllers\model\Write',
573
-                            'handleRequestAddRelation',
574
-                        ],
575
-                        'callback_args'   => [$version, $model_name, $relation_name],
576
-                        'methods'         => WP_REST_Server::EDITABLE,
577
-                        'hidden_endpoint' => $hidden_endpoint,
578
-                        'args'            => $this->_get_add_relation_query_params(
579
-                            $model,
580
-                            $relation_obj->get_other_model(),
581
-                            $version
582
-                        ),
583
-                    ],
584
-                    [
585
-                        'callback'        => [
586
-                            'EventEspresso\core\libraries\rest_api\controllers\model\Write',
587
-                            'handleRequestRemoveRelation',
588
-                        ],
589
-                        'callback_args'   => [$version, $model_name, $relation_name],
590
-                        'methods'         => WP_REST_Server::DELETABLE,
591
-                        'hidden_endpoint' => $hidden_endpoint,
592
-                        'args'            => [],
593
-                    ],
594
-                ];
595
-            }
596
-        }
597
-        return $model_routes;
598
-    }
599
-
600
-
601
-    /**
602
-     * Gets the relative URI to a model's REST API plural route, after the EE4 versioned namespace,
603
-     * excluding the preceding slash.
604
-     * Eg you pass get_plural_route_to('Event') = 'events'
605
-     *
606
-     * @param EEM_Base $model
607
-     * @return string
608
-     */
609
-    public static function get_collection_route(EEM_Base $model)
610
-    {
611
-        return EEH_Inflector::pluralize_and_lower($model->get_this_model_name());
612
-    }
613
-
614
-
615
-    /**
616
-     * Gets the relative URI to a model's REST API singular route, after the EE4 versioned namespace,
617
-     * excluding the preceding slash.
618
-     * Eg you pass get_plural_route_to('Event', 12) = 'events/12'
619
-     *
620
-     * @param EEM_Base $model eg Event or Venue
621
-     * @param string   $id
622
-     * @return string
623
-     */
624
-    public static function get_entity_route($model, $id)
625
-    {
626
-        return EED_Core_Rest_Api::get_collection_route($model) . '/' . $id;
627
-    }
628
-
629
-
630
-    /**
631
-     * Gets the relative URI to a model's REST API singular route, after the EE4 versioned namespace,
632
-     * excluding the preceding slash.
633
-     * Eg you pass get_plural_route_to('Event', 12) = 'events/12'
634
-     *
635
-     * @param EEM_Base               $model eg Event or Venue
636
-     * @param string                 $id
637
-     * @param EE_Model_Relation_Base $relation_obj
638
-     * @return string
639
-     */
640
-    public static function get_relation_route_via(EEM_Base $model, $id, EE_Model_Relation_Base $relation_obj)
641
-    {
642
-        $related_model_name_endpoint_part = ModelRead::getRelatedEntityName(
643
-            $relation_obj->get_other_model()->get_this_model_name(),
644
-            $relation_obj
645
-        );
646
-        return EED_Core_Rest_Api::get_entity_route($model, $id) . '/' . $related_model_name_endpoint_part;
647
-    }
648
-
649
-
650
-    /**
651
-     * Adds onto the $relative_route the EE4 REST API versioned namespace.
652
-     * Eg if given '4.8.36' and 'events', will return 'ee/v4.8.36/events'
653
-     *
654
-     * @param string $relative_route
655
-     * @param string $version
656
-     * @return string
657
-     */
658
-    public static function get_versioned_route_to($relative_route, $version = '4.8.36')
659
-    {
660
-        return '/' . EED_Core_Rest_Api::ee_api_namespace . $version . '/' . $relative_route;
661
-    }
662
-
663
-
664
-    /**
665
-     * Adds all the RPC-style routes (remote procedure call-like routes, ie
666
-     * routes that don't conform to the traditional REST CRUD-style).
667
-     *
668
-     * @deprecated since 4.9.1
669
-     */
670
-    protected function _register_rpc_routes()
671
-    {
672
-        $routes = [];
673
-        foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden_endpoint) {
674
-            $routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = $this->_get_rpc_route_data_for_version(
675
-                $version,
676
-                $hidden_endpoint
677
-            );
678
-        }
679
-        return $routes;
680
-    }
681
-
682
-
683
-    /**
684
-     * @param string  $version
685
-     * @param boolean $hidden_endpoint
686
-     * @return array
687
-     */
688
-    protected function _get_rpc_route_data_for_version($version, $hidden_endpoint = false)
689
-    {
690
-        $this_versions_routes = [];
691
-        // checkin endpoint
692
-        $this_versions_routes['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)'] = [
693
-            [
694
-                'callback'        => [
695
-                    'EventEspresso\core\libraries\rest_api\controllers\rpc\Checkin',
696
-                    'handleRequestToggleCheckin',
697
-                ],
698
-                'methods'         => WP_REST_Server::CREATABLE,
699
-                'hidden_endpoint' => $hidden_endpoint,
700
-                'args'            => [
701
-                    'force' => [
702
-                        'required'    => false,
703
-                        'default'     => false,
704
-                        'description' => esc_html__(
705
-                        // @codingStandardsIgnoreStart
706
-                            'Whether to force toggle checkin, or to verify the registration status and allowed ticket uses',
707
-                            // @codingStandardsIgnoreEnd
708
-                            'event_espresso'
709
-                        ),
710
-                    ],
711
-                ],
712
-                'callback_args'   => [$version],
713
-            ],
714
-        ];
715
-        return apply_filters(
716
-            'FHEE__EED_Core_Rest_Api___register_rpc_routes__this_versions_routes',
717
-            $this_versions_routes,
718
-            $version,
719
-            $hidden_endpoint
720
-        );
721
-    }
722
-
723
-
724
-    /**
725
-     * Gets the query params that can be used when request one or many
726
-     *
727
-     * @param EEM_Base $model
728
-     * @param string   $version
729
-     * @return array
730
-     */
731
-    protected function _get_response_selection_query_params(EEM_Base $model, $version, $single_only = false)
732
-    {
733
-        EED_Core_Rest_Api::loadCalculatedModelFields();
734
-        $query_params = [
735
-            'include'   => [
736
-                'required' => false,
737
-                'default'  => '*',
738
-                'type'     => 'string',
739
-            ],
740
-            'calculate' => [
741
-                'required'          => false,
742
-                'default'           => '',
743
-                'enum'              => EED_Core_Rest_Api::$_field_calculator->retrieveCalculatedFieldsForModel($model),
744
-                'type'              => 'string',
745
-                // because we accept a CSV list of the enumerated strings, WP core validation and sanitization
746
-                // freaks out. We'll just validate this argument while handling the request
747
-                'validate_callback' => null,
748
-                'sanitize_callback' => null,
749
-            ],
750
-            'password'  => [
751
-                'required' => false,
752
-                'default'  => '',
753
-                'type'     => 'string',
754
-            ],
755
-        ];
756
-        return apply_filters(
757
-            'FHEE__EED_Core_Rest_Api___get_response_selection_query_params',
758
-            $query_params,
759
-            $model,
760
-            $version
761
-        );
762
-    }
763
-
764
-
765
-    /**
766
-     * Gets the parameters acceptable for delete requests
767
-     *
768
-     * @param EEM_Base $model
769
-     * @param string   $version
770
-     * @return array
771
-     */
772
-    protected function _get_delete_query_params(EEM_Base $model, $version)
773
-    {
774
-        $params_for_delete = [
775
-            'allow_blocking' => [
776
-                'required' => false,
777
-                'default'  => true,
778
-                'type'     => 'boolean',
779
-            ],
780
-        ];
781
-        $params_for_delete['force'] = [
782
-            'required' => false,
783
-            'default'  => false,
784
-            'type'     => 'boolean',
785
-        ];
786
-        return apply_filters(
787
-            'FHEE__EED_Core_Rest_Api___get_delete_query_params',
788
-            $params_for_delete,
789
-            $model,
790
-            $version
791
-        );
792
-    }
793
-
794
-
795
-    /**
796
-     * @param EEM_Base $source_model
797
-     * @param EEM_Base $related_model
798
-     * @param          $version
799
-     * @return array
800
-     * @throws EE_Error
801
-     * @since 5.0.0.p
802
-     */
803
-    protected function _get_add_relation_query_params(EEM_Base $source_model, EEM_Base $related_model, $version)
804
-    {
805
-        // if they're related through a HABTM relation, check for any non-FKs
806
-        $all_relation_settings = $source_model->relation_settings();
807
-        $relation_settings = $all_relation_settings[ $related_model->get_this_model_name() ];
808
-        $params = [];
809
-        if ($relation_settings instanceof EE_HABTM_Relation && $relation_settings->hasNonKeyFields()) {
810
-            foreach ($relation_settings->getNonKeyFields() as $field) {
811
-                /* @var $field EE_Model_Field_Base */
812
-                $params[ $field->get_name() ] = [
813
-                    'required'          => ! $field->is_nullable(),
814
-                    'default'           => ModelDataTranslator::prepareFieldValueForJson(
815
-                        $field,
816
-                        $field->get_default_value(),
817
-                        $version
818
-                    ),
819
-                    'type'              => $field->getSchemaType(),
820
-                    'validate_callback' => null,
821
-                    'sanitize_callback' => null,
822
-                ];
823
-            }
824
-        }
825
-        return $params;
826
-    }
827
-
828
-
829
-    /**
830
-     * Gets info about reading query params that are acceptable
831
-     *
832
-     * @param EEM_Base $model eg 'Event' or 'Venue'
833
-     * @param string   $version
834
-     * @return array    describing the args acceptable when querying this model
835
-     * @throws EE_Error
836
-     */
837
-    protected function _get_read_query_params(EEM_Base $model, $version)
838
-    {
839
-        $default_orderby = [];
840
-        foreach ($model->get_combined_primary_key_fields() as $key_field) {
841
-            $default_orderby[ $key_field->get_name() ] = 'ASC';
842
-        }
843
-        return array_merge(
844
-            $this->_get_response_selection_query_params($model, $version),
845
-            [
846
-                'where'    => [
847
-                    'required'          => false,
848
-                    'default'           => [],
849
-                    'type'              => 'object',
850
-                    // because we accept an almost infinite list of possible where conditions, WP
851
-                    // core validation and sanitization freaks out. We'll just validate this argument
852
-                    // while handling the request
853
-                    'validate_callback' => null,
854
-                    'sanitize_callback' => null,
855
-                ],
856
-                'limit'    => [
857
-                    'required'          => false,
858
-                    'default'           => EED_Core_Rest_Api::get_default_query_limit(),
859
-                    'type'              => [
860
-                        'array',
861
-                        'string',
862
-                        'integer',
863
-                    ],
864
-                    // because we accept a variety of types, WP core validation and sanitization
865
-                    // freaks out. We'll just validate this argument while handling the request
866
-                    'validate_callback' => null,
867
-                    'sanitize_callback' => null,
868
-                ],
869
-                'order_by' => [
870
-                    'required'          => false,
871
-                    'default'           => $default_orderby,
872
-                    'type'              => [
873
-                        'object',
874
-                        'string',
875
-                    ],// because we accept a variety of types, WP core validation and sanitization
876
-                    // freaks out. We'll just validate this argument while handling the request
877
-                    'validate_callback' => null,
878
-                    'sanitize_callback' => null,
879
-                ],
880
-                'group_by' => [
881
-                    'required'          => false,
882
-                    'default'           => null,
883
-                    'type'              => [
884
-                        'object',
885
-                        'string',
886
-                    ],
887
-                    // because we accept  an almost infinite list of possible groupings,
888
-                    // WP core validation and sanitization
889
-                    // freaks out. We'll just validate this argument while handling the request
890
-                    'validate_callback' => null,
891
-                    'sanitize_callback' => null,
892
-                ],
893
-                'having'   => [
894
-                    'required'          => false,
895
-                    'default'           => null,
896
-                    'type'              => 'object',
897
-                    // because we accept an almost infinite list of possible where conditions, WP
898
-                    // core validation and sanitization freaks out. We'll just validate this argument
899
-                    // while handling the request
900
-                    'validate_callback' => null,
901
-                    'sanitize_callback' => null,
902
-                ],
903
-                'caps'     => [
904
-                    'required' => false,
905
-                    'default'  => EEM_Base::caps_read,
906
-                    'type'     => 'string',
907
-                    'enum'     => [
908
-                        EEM_Base::caps_read,
909
-                        EEM_Base::caps_read_admin,
910
-                        EEM_Base::caps_edit,
911
-                        EEM_Base::caps_delete,
912
-                    ],
913
-                ],
914
-            ]
915
-        );
916
-    }
917
-
918
-
919
-    /**
920
-     * Gets parameter information for a model regarding writing data
921
-     *
922
-     * @param string           $model_name
923
-     * @param ModelVersionInfo $model_version_info
924
-     * @param boolean          $create                                       whether this is for request to create (in
925
-     *                                                                       which case we need all required params) or
926
-     *                                                                       just to update (in which case we don't
927
-     *                                                                       need those on every request)
928
-     * @return array
929
-     * @throws EE_Error
930
-     * @throws ReflectionException
931
-     */
932
-    protected function _get_write_params(
933
-        $model_name,
934
-        ModelVersionInfo $model_version_info,
935
-        $create = false
936
-    ) {
937
-        $model = EE_Registry::instance()->load_model($model_name);
938
-        $fields = $model_version_info->fieldsOnModelInThisVersion($model);
939
-
940
-        // we do our own validation and sanitization within the controller
941
-        $sanitize_callback = function_exists('rest_validate_value_from_schema')
942
-            ? ['EED_Core_Rest_Api', 'default_sanitize_callback']
943
-            : null;
944
-        $args_info = [];
945
-        foreach ($fields as $field_name => $field_obj) {
946
-            if ($field_obj->is_auto_increment()) {
947
-                // totally ignore auto increment IDs
948
-                continue;
949
-            }
950
-            $arg_info = $field_obj->getSchema();
951
-            $required = $create && ! $field_obj->is_nullable() && $field_obj->get_default_value() === null;
952
-            $arg_info['required'] = $required;
953
-            // remove the read-only flag. If it were read-only we wouldn't list it as an argument while writing, right?
954
-            unset($arg_info['readonly']);
955
-            $schema_properties = $field_obj->getSchemaProperties();
956
-            if (
957
-                isset($schema_properties['raw'])
958
-                && $field_obj->getSchemaType() === 'object'
959
-            ) {
960
-                // if there's a "raw" form of this argument, use those properties instead
961
-                $arg_info = array_replace(
962
-                    $arg_info,
963
-                    $schema_properties['raw']
964
-                );
965
-            }
966
-            $arg_info['default'] = ModelDataTranslator::prepareFieldValueForJson(
967
-                $field_obj,
968
-                $field_obj->get_default_value(),
969
-                $model_version_info->requestedVersion()
970
-            );
971
-            $arg_info['sanitize_callback'] = $sanitize_callback;
972
-            $args_info[ $field_name ] = $arg_info;
973
-            if ($field_obj instanceof EE_Datetime_Field) {
974
-                $gmt_arg_info = $arg_info;
975
-                $gmt_arg_info['description'] = sprintf(
976
-                    esc_html__(
977
-                        '%1$s - the value for this field in UTC. Ignored if %2$s is provided.',
978
-                        'event_espresso'
979
-                    ),
980
-                    $field_obj->get_nicename(),
981
-                    $field_name
982
-                );
983
-                $args_info[ $field_name . '_gmt' ] = $gmt_arg_info;
984
-            }
985
-        }
986
-        return $args_info;
987
-    }
988
-
989
-
990
-    /**
991
-     * Replacement for WP API's 'rest_parse_request_arg'.
992
-     * If the value is blank but not required, don't bother validating it.
993
-     * Also, it uses our email validation instead of WP API's default.
994
-     *
995
-     * @param                 $value
996
-     * @param WP_REST_Request $request
997
-     * @param                 $param
998
-     * @return bool|true|WP_Error
999
-     * @throws InvalidArgumentException
1000
-     * @throws InvalidInterfaceException
1001
-     * @throws InvalidDataTypeException
1002
-     */
1003
-    public static function default_sanitize_callback($value, WP_REST_Request $request, $param)
1004
-    {
1005
-        $attributes = $request->get_attributes();
1006
-        if (
1007
-            ! isset($attributes['args'][ $param ])
1008
-            || ! is_array($attributes['args'][ $param ])
1009
-        ) {
1010
-            $validation_result = true;
1011
-        } else {
1012
-            $args = $attributes['args'][ $param ];
1013
-            if (
1014
-                (
1015
-                    $value === ''
1016
-                    || $value === null
1017
-                )
1018
-                && (! isset($args['required'])
1019
-                    || $args['required'] === false
1020
-                )
1021
-            ) {
1022
-                // not required and not provided? that's cool
1023
-                $validation_result = true;
1024
-            } elseif (
1025
-                isset($args['format'])
1026
-                      && $args['format'] === 'email'
1027
-            ) {
1028
-                $validation_result = true;
1029
-                if (! EED_Core_Rest_Api::_validate_email($value)) {
1030
-                    $validation_result = new WP_Error(
1031
-                        'rest_invalid_param',
1032
-                        esc_html__(
1033
-                            'The email address is not valid or does not exist.',
1034
-                            'event_espresso'
1035
-                        )
1036
-                    );
1037
-                }
1038
-            } else {
1039
-                $validation_result = rest_validate_value_from_schema($value, $args, $param);
1040
-            }
1041
-        }
1042
-        if (is_wp_error($validation_result)) {
1043
-            return $validation_result;
1044
-        }
1045
-        return rest_sanitize_request_arg($value, $request, $param);
1046
-    }
1047
-
1048
-
1049
-    /**
1050
-     * Returns whether or not this email address is valid. Copied from EE_Email_Validation_Strategy::_validate_email()
1051
-     *
1052
-     * @param $email
1053
-     * @return bool
1054
-     * @throws InvalidArgumentException
1055
-     * @throws InvalidInterfaceException
1056
-     * @throws InvalidDataTypeException
1057
-     */
1058
-    protected static function _validate_email($email)
1059
-    {
1060
-        try {
1061
-            EmailAddressFactory::create($email);
1062
-            return true;
1063
-        } catch (EmailValidationException $e) {
1064
-            return false;
1065
-        }
1066
-    }
1067
-
1068
-
1069
-    /**
1070
-     * Gets routes for the config
1071
-     *
1072
-     * @return array @see _register_model_routes
1073
-     * @deprecated since version 4.9.1
1074
-     */
1075
-    protected function _register_config_routes()
1076
-    {
1077
-        $config_routes = [];
1078
-        foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden_endpoint) {
1079
-            $config_routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = $this->_get_config_route_data_for_version(
1080
-                $version,
1081
-                $hidden_endpoint
1082
-            );
1083
-        }
1084
-        return $config_routes;
1085
-    }
1086
-
1087
-
1088
-    /**
1089
-     * Gets routes for the config for the specified version
1090
-     *
1091
-     * @param string  $version
1092
-     * @param boolean $hidden_endpoint
1093
-     * @return array
1094
-     */
1095
-    protected function _get_config_route_data_for_version($version, $hidden_endpoint)
1096
-    {
1097
-        return [
1098
-            'config'    => [
1099
-                [
1100
-                    'callback'        => [
1101
-                        'EventEspresso\core\libraries\rest_api\controllers\config\Read',
1102
-                        'handleRequest',
1103
-                    ],
1104
-                    'methods'         => WP_REST_Server::READABLE,
1105
-                    'hidden_endpoint' => $hidden_endpoint,
1106
-                    'callback_args'   => [$version],
1107
-                ],
1108
-            ],
1109
-            'site_info' => [
1110
-                [
1111
-                    'callback'        => [
1112
-                        'EventEspresso\core\libraries\rest_api\controllers\config\Read',
1113
-                        'handleRequestSiteInfo',
1114
-                    ],
1115
-                    'methods'         => WP_REST_Server::READABLE,
1116
-                    'hidden_endpoint' => $hidden_endpoint,
1117
-                    'callback_args'   => [$version],
1118
-                ],
1119
-            ],
1120
-        ];
1121
-    }
1122
-
1123
-
1124
-    /**
1125
-     * Gets the meta info routes
1126
-     *
1127
-     * @return array @see _register_model_routes
1128
-     * @deprecated since version 4.9.1
1129
-     */
1130
-    protected function _register_meta_routes()
1131
-    {
1132
-        $meta_routes = [];
1133
-        foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden_endpoint) {
1134
-            $meta_routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = $this->_get_meta_route_data_for_version(
1135
-                $version,
1136
-                $hidden_endpoint
1137
-            );
1138
-        }
1139
-        return $meta_routes;
1140
-    }
1141
-
1142
-
1143
-    /**
1144
-     * @param string  $version
1145
-     * @param boolean $hidden_endpoint
1146
-     * @return array
1147
-     */
1148
-    protected function _get_meta_route_data_for_version($version, $hidden_endpoint = false)
1149
-    {
1150
-        return [
1151
-            'resources' => [
1152
-                [
1153
-                    'callback'        => [
1154
-                        'EventEspresso\core\libraries\rest_api\controllers\model\Meta',
1155
-                        'handleRequestModelsMeta',
1156
-                    ],
1157
-                    'methods'         => WP_REST_Server::READABLE,
1158
-                    'hidden_endpoint' => $hidden_endpoint,
1159
-                    'callback_args'   => [$version],
1160
-                ],
1161
-            ],
1162
-        ];
1163
-    }
1164
-
1165
-
1166
-    /**
1167
-     * Tries to hide old 4.6 endpoints from the
1168
-     *
1169
-     * @param array $route_data
1170
-     * @return array
1171
-     * @throws EE_Error
1172
-     * @throws ReflectionException
1173
-     */
1174
-    public static function hide_old_endpoints($route_data)
1175
-    {
1176
-        // allow API clients to override which endpoints get hidden, in case
1177
-        // they want to discover particular endpoints
1178
-        // also, we don't have access to the request so we have to just grab it from the superglobal
1179
-        $force_show_ee_namespace = ltrim(
1180
-            EED_Core_Rest_Api::getRequest()->getRequestParam('force_show_ee_namespace'),
1181
-            '/'
1182
-        );
1183
-        foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) {
1184
-            foreach ($relative_urls as $resource_name => $endpoints) {
1185
-                foreach ($endpoints as $key => $endpoint) {
1186
-                    // skip schema and other route options
1187
-                    if (! is_numeric($key)) {
1188
-                        continue;
1189
-                    }
1190
-                    // by default, hide "hidden_endpoint"s, unless the request indicates
1191
-                    // to $force_show_ee_namespace, in which case only show that one
1192
-                    // namespace's endpoints (and hide all others)
1193
-                    if (
1194
-                        ($force_show_ee_namespace !== '' && $force_show_ee_namespace !== $namespace)
1195
-                        || ($endpoint['hidden_endpoint'] && $force_show_ee_namespace === '')
1196
-                    ) {
1197
-                        $full_route = '/' . ltrim($namespace, '/');
1198
-                        $full_route .= '/' . ltrim($resource_name, '/');
1199
-                        unset($route_data[ $full_route ]);
1200
-                    }
1201
-                }
1202
-            }
1203
-        }
1204
-        return $route_data;
1205
-    }
1206
-
1207
-
1208
-    /**
1209
-     * Returns an array describing which versions of core support serving requests for.
1210
-     * Keys are core versions' major and minor version, and values are the
1211
-     * LOWEST requested version they can serve. Eg, 4.7 can serve requests for 4.6-like
1212
-     * data by just removing a few models and fields from the responses. However, 4.15 might remove
1213
-     * the answers table entirely, in which case it would be very difficult for
1214
-     * it to serve 4.6-style responses.
1215
-     * Versions of core that are missing from this array are unknowns.
1216
-     * previous ver
1217
-     *
1218
-     * @return array
1219
-     */
1220
-    public static function version_compatibilities()
1221
-    {
1222
-        return apply_filters(
1223
-            'FHEE__EED_Core_REST_API__version_compatibilities',
1224
-            [
1225
-                '4.8.29' => '4.8.29',
1226
-                '4.8.33' => '4.8.29',
1227
-                '4.8.34' => '4.8.29',
1228
-                '4.8.36' => '4.8.29',
1229
-            ]
1230
-        );
1231
-    }
1232
-
1233
-
1234
-    /**
1235
-     * Gets the latest API version served. Eg if there
1236
-     * are two versions served of the API, 4.8.29 and 4.8.32, and
1237
-     * we are on core version 4.8.34, it will return the string "4.8.32"
1238
-     *
1239
-     * @return string
1240
-     */
1241
-    public static function latest_rest_api_version()
1242
-    {
1243
-        $versions_served = EED_Core_Rest_Api::versions_served();
1244
-        $versions_served_keys = array_keys($versions_served);
1245
-        return end($versions_served_keys);
1246
-    }
1247
-
1248
-
1249
-    /**
1250
-     * Using EED_Core_Rest_Api::version_compatibilities(), determines what version of
1251
-     * EE the API can serve requests for. Eg, if we are on 4.15 of core, and
1252
-     * we can serve requests from 4.12 or later, this will return array( '4.12', '4.13', '4.14', '4.15' ).
1253
-     * We also indicate whether or not this version should be put in the index or not
1254
-     *
1255
-     * @return array keys are API version numbers (just major and minor numbers), and values
1256
-     * are whether or not they should be hidden
1257
-     */
1258
-    public static function versions_served()
1259
-    {
1260
-        $versions_served = [];
1261
-        $possibly_served_versions = EED_Core_Rest_Api::version_compatibilities();
1262
-        $lowest_compatible_version = end($possibly_served_versions);
1263
-        reset($possibly_served_versions);
1264
-        $versions_served_historically = array_keys($possibly_served_versions);
1265
-        $latest_version = end($versions_served_historically);
1266
-        reset($versions_served_historically);
1267
-        // for each version of core we have ever served:
1268
-        foreach ($versions_served_historically as $key_versioned_endpoint) {
1269
-            // if it's not above the current core version, and it's compatible with the current version of core
1270
-
1271
-            if ($key_versioned_endpoint === $latest_version) {
1272
-                // don't hide the latest version in the index
1273
-                $versions_served[ $key_versioned_endpoint ] = false;
1274
-            } elseif (
1275
-                version_compare($key_versioned_endpoint, $lowest_compatible_version, '>=')
1276
-                && version_compare($key_versioned_endpoint, EED_Core_Rest_Api::core_version(), '<')
1277
-            ) {
1278
-                // include, but hide, previous versions which are still supported
1279
-                $versions_served[ $key_versioned_endpoint ] = true;
1280
-            } elseif (
1281
-                apply_filters(
1282
-                    'FHEE__EED_Core_Rest_Api__versions_served__include_incompatible_versions',
1283
-                    false,
1284
-                    $possibly_served_versions
1285
-                )
1286
-            ) {
1287
-                // if a version is no longer supported, don't include it in index or list of versions served
1288
-                $versions_served[ $key_versioned_endpoint ] = true;
1289
-            }
1290
-        }
1291
-        return $versions_served;
1292
-    }
1293
-
1294
-
1295
-    /**
1296
-     * Gets the major and minor version of EE core's version string
1297
-     *
1298
-     * @return string
1299
-     */
1300
-    public static function core_version()
1301
-    {
1302
-        return apply_filters(
1303
-            'FHEE__EED_Core_REST_API__core_version',
1304
-            implode(
1305
-                '.',
1306
-                array_slice(
1307
-                    explode(
1308
-                        '.',
1309
-                        espresso_version()
1310
-                    ),
1311
-                    0,
1312
-                    3
1313
-                )
1314
-            )
1315
-        );
1316
-    }
1317
-
1318
-
1319
-    /**
1320
-     * Gets the default limit that should be used when querying for resources
1321
-     *
1322
-     * @return int
1323
-     */
1324
-    public static function get_default_query_limit()
1325
-    {
1326
-        // we actually don't use a const because we want folks to always use
1327
-        // this method, not the const directly
1328
-        return apply_filters(
1329
-            'FHEE__EED_Core_Rest_Api__get_default_query_limit',
1330
-            100
1331
-        );
1332
-    }
1333
-
1334
-
1335
-    /**
1336
-     * @param string $version api version string (i.e. '4.8.36')
1337
-     * @return array
1338
-     */
1339
-    public static function getCollectionRoutesIndexedByModelName($version = '')
1340
-    {
1341
-        $version = empty($version) ? EED_Core_Rest_Api::latest_rest_api_version() : $version;
1342
-        $model_names = EED_Core_Rest_Api::model_names_with_plural_routes($version);
1343
-        $collection_routes = [];
1344
-        foreach ($model_names as $model_name => $model_class_name) {
1345
-            $collection_routes[ strtolower($model_name) ] = '/' . EED_Core_Rest_Api::ee_api_namespace . $version . '/'
1346
-                                                            . EEH_Inflector::pluralize_and_lower($model_name);
1347
-        }
1348
-        return $collection_routes;
1349
-    }
1350
-
1351
-
1352
-    /**
1353
-     * Returns an array of primary key names indexed by model names.
1354
-     *
1355
-     * @param string $version
1356
-     * @return array
1357
-     */
1358
-    public static function getPrimaryKeyNamesIndexedByModelName($version = '')
1359
-    {
1360
-        $version = empty($version) ? EED_Core_Rest_Api::latest_rest_api_version() : $version;
1361
-        $model_names = EED_Core_Rest_Api::model_names_with_plural_routes($version);
1362
-        $primary_key_items = [];
1363
-        foreach ($model_names as $model_name => $model_class_name) {
1364
-            $primary_keys = $model_class_name::instance()->get_combined_primary_key_fields();
1365
-            foreach ($primary_keys as $primary_key_name => $primary_key_field) {
1366
-                if (count($primary_keys) > 1) {
1367
-                    $primary_key_items[ strtolower($model_name) ][] = $primary_key_name;
1368
-                } else {
1369
-                    $primary_key_items[ strtolower($model_name) ] = $primary_key_name;
1370
-                }
1371
-            }
1372
-        }
1373
-        return $primary_key_items;
1374
-    }
1375
-
1376
-
1377
-    /**
1378
-     * Determines the EE REST API debug mode is activated, or not.
1379
-     *
1380
-     * @return bool
1381
-     * @since 4.9.76.p
1382
-     */
1383
-    public static function debugMode()
1384
-    {
1385
-        static $debug_mode = null; // could be class prop
1386
-        if ($debug_mode === null) {
1387
-            $debug_mode = defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE;
1388
-        }
1389
-        return $debug_mode;
1390
-    }
1391
-
1392
-
1393
-    /**
1394
-     *    run - initial module setup
1395
-     *
1396
-     * @access    public
1397
-     * @param WP $WP
1398
-     * @return    void
1399
-     */
1400
-    public function run($WP)
1401
-    {
1402
-    }
25
+	const ee_api_namespace = Domain::API_NAMESPACE;
26
+
27
+	const ee_api_namespace_for_regex = 'ee\/v([^/]*)\/';
28
+
29
+	const saved_routes_option_names = 'ee_core_routes';
30
+
31
+	/**
32
+	 * string used in _links response bodies to make them globally unique.
33
+	 *
34
+	 * @see http://v2.wp-api.org/extending/linking/
35
+	 */
36
+	const ee_api_link_namespace = 'https://api.eventespresso.com/';
37
+
38
+	/**
39
+	 * @var CalculatedModelFields
40
+	 */
41
+	protected static $_field_calculator;
42
+
43
+
44
+	/**
45
+	 * @return EED_Core_Rest_Api|EED_Module
46
+	 */
47
+	public static function instance()
48
+	{
49
+		return parent::get_instance(EED_Core_Rest_Api::class);
50
+	}
51
+
52
+
53
+	/**
54
+	 *    set_hooks - for hooking into EE Core, other modules, etc
55
+	 *
56
+	 * @access    public
57
+	 * @return    void
58
+	 */
59
+	public static function set_hooks()
60
+	{
61
+	}
62
+
63
+
64
+	/**
65
+	 *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
66
+	 *
67
+	 * @access    public
68
+	 * @return    void
69
+	 */
70
+	public static function set_hooks_admin()
71
+	{
72
+	}
73
+
74
+
75
+	public static function set_hooks_both()
76
+	{
77
+		add_action('rest_api_init', ['EED_Core_Rest_Api', 'set_hooks_rest_api'], 5);
78
+		add_action('rest_api_init', ['EED_Core_Rest_Api', 'register_routes'], 10);
79
+		add_filter('rest_route_data', ['EED_Core_Rest_Api', 'hide_old_endpoints'], 10, 2);
80
+		add_filter(
81
+			'rest_index',
82
+			['EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filterEeMetadataIntoIndex']
83
+		);
84
+	}
85
+
86
+
87
+	/**
88
+	 * @since   5.0.0.p
89
+	 */
90
+	public static function loadCalculatedModelFields()
91
+	{
92
+		EED_Core_Rest_Api::$_field_calculator = LoaderFactory::getLoader()->load(
93
+			'EventEspresso\core\libraries\rest_api\CalculatedModelFields'
94
+		);
95
+		EED_Core_Rest_Api::invalidate_cached_route_data_on_version_change();
96
+	}
97
+
98
+
99
+	/**
100
+	 * sets up hooks which only need to be included as part of REST API requests;
101
+	 * other requests like to the frontend or admin etc don't need them
102
+	 *
103
+	 * @throws EE_Error
104
+	 */
105
+	public static function set_hooks_rest_api()
106
+	{
107
+		// set hooks which account for changes made to the API
108
+		EED_Core_Rest_Api::_set_hooks_for_changes();
109
+	}
110
+
111
+
112
+	/**
113
+	 * public wrapper of _set_hooks_for_changes.
114
+	 * Loads all the hooks which make requests to old versions of the API
115
+	 * appear the same as they always did
116
+	 *
117
+	 * @throws EE_Error
118
+	 */
119
+	public static function set_hooks_for_changes()
120
+	{
121
+		EED_Core_Rest_Api::_set_hooks_for_changes();
122
+	}
123
+
124
+
125
+	/**
126
+	 * Loads all the hooks which make requests to old versions of the API
127
+	 * appear the same as they always did
128
+	 *
129
+	 * @throws EE_Error
130
+	 */
131
+	protected static function _set_hooks_for_changes()
132
+	{
133
+		$folder_contents = EEH_File::get_contents_of_folders([EE_LIBRARIES . 'rest_api/changes'], false);
134
+		foreach ($folder_contents as $classname_in_namespace => $filepath) {
135
+			// ignore the base parent class
136
+			// and legacy named classes
137
+			if (
138
+				$classname_in_namespace === 'ChangesInBase'
139
+				|| strpos($classname_in_namespace, 'Changes_In_') === 0
140
+			) {
141
+				continue;
142
+			}
143
+			$full_classname = 'EventEspresso\core\libraries\rest_api\changes\\' . $classname_in_namespace;
144
+			if (class_exists($full_classname)) {
145
+				$instance_of_class = new $full_classname();
146
+				if ($instance_of_class instanceof ChangesInBase) {
147
+					$instance_of_class->setHooks();
148
+				}
149
+			}
150
+		}
151
+	}
152
+
153
+
154
+	/**
155
+	 * Filters the WP routes to add our EE-related ones. This takes a bit of time
156
+	 * so we actually prefer to only do it when an EE plugin is activated or upgraded
157
+	 *
158
+	 * @throws EE_Error
159
+	 * @throws ReflectionException
160
+	 */
161
+	public static function register_routes()
162
+	{
163
+		foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_routes) {
164
+			foreach ($relative_routes as $relative_route => $data_for_multiple_endpoints) {
165
+				/**
166
+				 * @var array     $data_for_multiple_endpoints numerically indexed array
167
+				 *                                         but can also contain route options like {
168
+				 * @type array    $schema                      {
169
+				 * @type callable $schema_callback
170
+				 * @type array    $callback_args               arguments that will be passed to the callback, after the
171
+				 * WP_REST_Request of course
172
+				 * }
173
+				 * }
174
+				 */
175
+				// when registering routes, register all the endpoints' data at the same time
176
+				$multiple_endpoint_args = [];
177
+				foreach ($data_for_multiple_endpoints as $endpoint_key => $data_for_single_endpoint) {
178
+					/**
179
+					 * @var array     $data_for_single_endpoint {
180
+					 * @type callable $callback
181
+					 * @type string methods
182
+					 * @type array args
183
+					 * @type array _links
184
+					 * @type array    $callback_args            arguments that will be passed to the callback, after the
185
+					 * WP_REST_Request of course
186
+					 * }
187
+					 */
188
+					// skip route options
189
+					if (! is_numeric($endpoint_key)) {
190
+						continue;
191
+					}
192
+					if (! isset($data_for_single_endpoint['callback'], $data_for_single_endpoint['methods'])) {
193
+						throw new EE_Error(
194
+							esc_html__(
195
+							// @codingStandardsIgnoreStart
196
+								'Endpoint configuration data needs to have entries "callback" (callable) and "methods" (comma-separated list of accepts HTTP methods).',
197
+								// @codingStandardsIgnoreEnd
198
+								'event_espresso'
199
+							)
200
+						);
201
+					}
202
+					$callback = $data_for_single_endpoint['callback'];
203
+					$single_endpoint_args = [
204
+						'methods' => $data_for_single_endpoint['methods'],
205
+						'args'    => isset($data_for_single_endpoint['args']) ? $data_for_single_endpoint['args']
206
+							: [],
207
+					];
208
+					if (isset($data_for_single_endpoint['_links'])) {
209
+						$single_endpoint_args['_links'] = $data_for_single_endpoint['_links'];
210
+					}
211
+					if (isset($data_for_single_endpoint['callback_args'])) {
212
+						$callback_args = $data_for_single_endpoint['callback_args'];
213
+						$single_endpoint_args['callback'] = static function (WP_REST_Request $request) use (
214
+							$callback,
215
+							$callback_args
216
+						) {
217
+							array_unshift($callback_args, $request);
218
+							return call_user_func_array(
219
+								$callback,
220
+								$callback_args
221
+							);
222
+						};
223
+					} else {
224
+						$single_endpoint_args['callback'] = $data_for_single_endpoint['callback'];
225
+					}
226
+					// As of WordPress 5.5, if a permission_callback is not provided,
227
+					// the REST API will issue a _doing_it_wrong notice.
228
+					// Since the EE REST API defers capabilities to the db model system,
229
+					// we will just use the generic WP callback for public endpoints
230
+					if (! isset($single_endpoint_args['permission_callback'])) {
231
+						$single_endpoint_args['permission_callback'] = '__return_true';
232
+					}
233
+					$multiple_endpoint_args[] = $single_endpoint_args;
234
+				}
235
+				if (isset($data_for_multiple_endpoints['schema'])) {
236
+					$schema_route_data = $data_for_multiple_endpoints['schema'];
237
+					$schema_callback = $schema_route_data['schema_callback'];
238
+					$callback_args = $schema_route_data['callback_args'];
239
+					$multiple_endpoint_args['schema'] = static function () use ($schema_callback, $callback_args) {
240
+						return call_user_func_array(
241
+							$schema_callback,
242
+							$callback_args
243
+						);
244
+					};
245
+				}
246
+				register_rest_route(
247
+					$namespace,
248
+					$relative_route,
249
+					$multiple_endpoint_args
250
+				);
251
+			}
252
+		}
253
+	}
254
+
255
+
256
+	/**
257
+	 * Checks if there was a version change or something that merits invalidating the cached
258
+	 * route data. If so, invalidates the cached route data so that it gets refreshed
259
+	 * next time the WP API is used
260
+	 */
261
+	public static function invalidate_cached_route_data_on_version_change()
262
+	{
263
+		if (EE_System::instance()->detect_req_type() !== EE_System::req_type_normal) {
264
+			EED_Core_Rest_Api::invalidate_cached_route_data();
265
+		}
266
+		foreach (EE_Registry::instance()->addons as $addon) {
267
+			if ($addon instanceof EE_Addon && $addon->detect_req_type() !== EE_System::req_type_normal) {
268
+				EED_Core_Rest_Api::invalidate_cached_route_data();
269
+			}
270
+		}
271
+	}
272
+
273
+
274
+	/**
275
+	 * Removes the cached route data so it will get refreshed next time the WP API is used
276
+	 */
277
+	public static function invalidate_cached_route_data()
278
+	{
279
+		// delete the saved EE REST API routes
280
+		foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden) {
281
+			delete_option(EED_Core_Rest_Api::saved_routes_option_names . $version);
282
+		}
283
+	}
284
+
285
+
286
+	/**
287
+	 * Gets the EE route data
288
+	 *
289
+	 * @return array top-level key is the namespace, next-level key is the route and its value is array{
290
+	 * @throws EE_Error
291
+	 * @throws ReflectionException
292
+	 * @type string|array $callback
293
+	 * @type string       $methods
294
+	 * @type boolean      $hidden_endpoint
295
+	 * }
296
+	 */
297
+	public static function get_ee_route_data()
298
+	{
299
+		$ee_routes = [];
300
+		foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden_endpoints) {
301
+			$ee_routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = EED_Core_Rest_Api::_get_ee_route_data_for_version(
302
+				$version,
303
+				$hidden_endpoints
304
+			);
305
+		}
306
+		return $ee_routes;
307
+	}
308
+
309
+
310
+	/**
311
+	 * Gets the EE route data from the wp options if it exists already,
312
+	 * otherwise re-generates it and saves it to the option
313
+	 *
314
+	 * @param string  $version
315
+	 * @param boolean $hidden_endpoints
316
+	 * @return array
317
+	 * @throws EE_Error
318
+	 * @throws ReflectionException
319
+	 */
320
+	protected static function _get_ee_route_data_for_version($version, $hidden_endpoints = false)
321
+	{
322
+		$ee_routes = get_option(EED_Core_Rest_Api::saved_routes_option_names . $version, null);
323
+		if (! $ee_routes || EED_Core_Rest_Api::debugMode()) {
324
+			$ee_routes = EED_Core_Rest_Api::_save_ee_route_data_for_version($version, $hidden_endpoints);
325
+		}
326
+		return $ee_routes;
327
+	}
328
+
329
+
330
+	/**
331
+	 * Saves the EE REST API route data to a wp option and returns it
332
+	 *
333
+	 * @param string  $version
334
+	 * @param boolean $hidden_endpoints
335
+	 * @return mixed|null
336
+	 * @throws EE_Error
337
+	 * @throws ReflectionException
338
+	 */
339
+	protected static function _save_ee_route_data_for_version($version, $hidden_endpoints = false)
340
+	{
341
+		$instance = EED_Core_Rest_Api::instance();
342
+		$routes = apply_filters(
343
+			'EED_Core_Rest_Api__save_ee_route_data_for_version__routes',
344
+			array_replace_recursive(
345
+				$instance->_get_config_route_data_for_version($version, $hidden_endpoints),
346
+				$instance->_get_meta_route_data_for_version($version, $hidden_endpoints),
347
+				$instance->_get_model_route_data_for_version($version, $hidden_endpoints),
348
+				$instance->_get_rpc_route_data_for_version($version, $hidden_endpoints)
349
+			)
350
+		);
351
+		$option_name = EED_Core_Rest_Api::saved_routes_option_names . $version;
352
+		if (get_option($option_name)) {
353
+			update_option($option_name, $routes, true);
354
+		} else {
355
+			add_option($option_name, $routes, null, 'no');
356
+		}
357
+		return $routes;
358
+	}
359
+
360
+
361
+	/**
362
+	 * Calculates all the EE routes and saves it to a WordPress option so we don't
363
+	 * need to calculate it on every request
364
+	 *
365
+	 * @return void
366
+	 * @deprecated since version 4.9.1
367
+	 */
368
+	public static function save_ee_routes()
369
+	{
370
+		if (DbStatus::isOnline()) {
371
+			$instance = EED_Core_Rest_Api::instance();
372
+			$routes = apply_filters(
373
+				'EED_Core_Rest_Api__save_ee_routes__routes',
374
+				array_replace_recursive(
375
+					$instance->_register_config_routes(),
376
+					$instance->_register_meta_routes(),
377
+					$instance->_register_model_routes(),
378
+					$instance->_register_rpc_routes()
379
+				)
380
+			);
381
+			update_option(EED_Core_Rest_Api::saved_routes_option_names, $routes, true);
382
+		}
383
+	}
384
+
385
+
386
+	/**
387
+	 * Gets all the route information relating to EE models
388
+	 *
389
+	 * @return array @see get_ee_route_data
390
+	 * @deprecated since version 4.9.1
391
+	 */
392
+	protected function _register_model_routes()
393
+	{
394
+		$model_routes = [];
395
+		foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden_endpoint) {
396
+			$model_routes[ EED_Core_Rest_Api::ee_api_namespace
397
+						   . $version ] = $this->_get_config_route_data_for_version($version, $hidden_endpoint);
398
+		}
399
+		return $model_routes;
400
+	}
401
+
402
+
403
+	/**
404
+	 * Decides whether or not to add write endpoints for this model.
405
+	 * Currently, this defaults to exclude all global tables and models
406
+	 * which would allow inserting WP core data (we don't want to duplicate
407
+	 * what WP API does, as it's unnecessary, extra work, and potentially extra bugs)
408
+	 *
409
+	 * @param EEM_Base $model
410
+	 * @return bool
411
+	 */
412
+	public static function should_have_write_endpoints(EEM_Base $model)
413
+	{
414
+		if ($model->is_wp_core_model()) {
415
+			return false;
416
+		}
417
+		foreach ($model->get_tables() as $table) {
418
+			if ($table->is_global()) {
419
+				return false;
420
+			}
421
+		}
422
+		return true;
423
+	}
424
+
425
+
426
+	/**
427
+	 * Gets the names of all models which should have plural routes (eg `ee/v4.8.36/events`)
428
+	 * in this versioned namespace of EE4
429
+	 *
430
+	 * @param $version
431
+	 * @return array keys are model names (eg 'Event') and values ar either classnames (eg 'EEM_Event')
432
+	 */
433
+	public static function model_names_with_plural_routes($version)
434
+	{
435
+		$model_version_info = new ModelVersionInfo($version);
436
+		$models_to_register = $model_version_info->modelsForRequestedVersion();
437
+		// let's not bother having endpoints for extra metas
438
+		unset(
439
+			$models_to_register['Extra_Meta'],
440
+			$models_to_register['Extra_Join'],
441
+			$models_to_register['Post_Meta']
442
+		);
443
+		return apply_filters(
444
+			'FHEE__EED_Core_REST_API___register_model_routes',
445
+			$models_to_register
446
+		);
447
+	}
448
+
449
+
450
+	/**
451
+	 * Gets the route data for EE models in the specified version
452
+	 *
453
+	 * @param string  $version
454
+	 * @param boolean $hidden_endpoint
455
+	 * @return array
456
+	 * @throws EE_Error
457
+	 * @throws ReflectionException
458
+	 */
459
+	protected function _get_model_route_data_for_version($version, $hidden_endpoint = false)
460
+	{
461
+		$model_routes = [];
462
+		$model_version_info = new ModelVersionInfo($version);
463
+		foreach (EED_Core_Rest_Api::model_names_with_plural_routes($version) as $model_name => $model_classname) {
464
+			$model = EE_Registry::instance()->load_model($model_name);
465
+			// if this isn't a valid model then let's skip iterate to the next item in the loop.
466
+			if (! $model instanceof EEM_Base) {
467
+				continue;
468
+			}
469
+			// yes we could just register one route for ALL models, but then they wouldn't show up in the index
470
+			$plural_model_route = EED_Core_Rest_Api::get_collection_route($model);
471
+			$singular_model_route = EED_Core_Rest_Api::get_entity_route($model, '(?P<id>[^\/]+)');
472
+			$model_routes[ $plural_model_route ] = [
473
+				[
474
+					'callback'        => [
475
+						'EventEspresso\core\libraries\rest_api\controllers\model\Read',
476
+						'handleRequestGetAll',
477
+					],
478
+					'callback_args'   => [$version, $model_name],
479
+					'methods'         => WP_REST_Server::READABLE,
480
+					'hidden_endpoint' => $hidden_endpoint,
481
+					'args'            => $this->_get_read_query_params($model, $version),
482
+					'_links'          => [
483
+						'self' => rest_url(EED_Core_Rest_Api::ee_api_namespace . $version . $singular_model_route),
484
+					],
485
+				],
486
+				'schema' => [
487
+					'schema_callback' => [
488
+						'EventEspresso\core\libraries\rest_api\controllers\model\Read',
489
+						'handleSchemaRequest',
490
+					],
491
+					'callback_args'   => [$version, $model_name],
492
+				],
493
+			];
494
+			$model_routes[ $singular_model_route ] = [
495
+				[
496
+					'callback'        => [
497
+						'EventEspresso\core\libraries\rest_api\controllers\model\Read',
498
+						'handleRequestGetOne',
499
+					],
500
+					'callback_args'   => [$version, $model_name],
501
+					'methods'         => WP_REST_Server::READABLE,
502
+					'hidden_endpoint' => $hidden_endpoint,
503
+					'args'            => $this->_get_response_selection_query_params($model, $version, true),
504
+				],
505
+			];
506
+			if (
507
+				apply_filters(
508
+					'FHEE__EED_Core_Rest_Api___get_model_route_data_for_version__add_write_endpoints',
509
+					EED_Core_Rest_Api::should_have_write_endpoints($model),
510
+					$model
511
+				)
512
+			) {
513
+				$model_routes[ $plural_model_route ][] = [
514
+					'callback'        => [
515
+						'EventEspresso\core\libraries\rest_api\controllers\model\Write',
516
+						'handleRequestInsert',
517
+					],
518
+					'callback_args'   => [$version, $model_name],
519
+					'methods'         => WP_REST_Server::CREATABLE,
520
+					'hidden_endpoint' => $hidden_endpoint,
521
+					'args'            => $this->_get_write_params($model_name, $model_version_info, true),
522
+				];
523
+				$model_routes[ $singular_model_route ] = array_merge(
524
+					$model_routes[ $singular_model_route ],
525
+					[
526
+						[
527
+							'callback'        => [
528
+								'EventEspresso\core\libraries\rest_api\controllers\model\Write',
529
+								'handleRequestUpdate',
530
+							],
531
+							'callback_args'   => [$version, $model_name],
532
+							'methods'         => WP_REST_Server::EDITABLE,
533
+							'hidden_endpoint' => $hidden_endpoint,
534
+							'args'            => $this->_get_write_params($model_name, $model_version_info),
535
+						],
536
+						[
537
+							'callback'        => [
538
+								'EventEspresso\core\libraries\rest_api\controllers\model\Write',
539
+								'handleRequestDelete',
540
+							],
541
+							'callback_args'   => [$version, $model_name],
542
+							'methods'         => WP_REST_Server::DELETABLE,
543
+							'hidden_endpoint' => $hidden_endpoint,
544
+							'args'            => $this->_get_delete_query_params($model, $version),
545
+						],
546
+					]
547
+				);
548
+			}
549
+			foreach ($model->relation_settings() as $relation_name => $relation_obj) {
550
+				$related_route = EED_Core_Rest_Api::get_relation_route_via(
551
+					$model,
552
+					'(?P<id>[^\/]+)',
553
+					$relation_obj
554
+				);
555
+				$model_routes[ $related_route ] = [
556
+					[
557
+						'callback'        => [
558
+							'EventEspresso\core\libraries\rest_api\controllers\model\Read',
559
+							'handleRequestGetRelated',
560
+						],
561
+						'callback_args'   => [$version, $model_name, $relation_name],
562
+						'methods'         => WP_REST_Server::READABLE,
563
+						'hidden_endpoint' => $hidden_endpoint,
564
+						'args'            => $this->_get_read_query_params($relation_obj->get_other_model(), $version),
565
+					],
566
+				];
567
+
568
+				$related_write_route = $related_route . '/' . '(?P<related_id>[^\/]+)';
569
+				$model_routes[ $related_write_route ] = [
570
+					[
571
+						'callback'        => [
572
+							'EventEspresso\core\libraries\rest_api\controllers\model\Write',
573
+							'handleRequestAddRelation',
574
+						],
575
+						'callback_args'   => [$version, $model_name, $relation_name],
576
+						'methods'         => WP_REST_Server::EDITABLE,
577
+						'hidden_endpoint' => $hidden_endpoint,
578
+						'args'            => $this->_get_add_relation_query_params(
579
+							$model,
580
+							$relation_obj->get_other_model(),
581
+							$version
582
+						),
583
+					],
584
+					[
585
+						'callback'        => [
586
+							'EventEspresso\core\libraries\rest_api\controllers\model\Write',
587
+							'handleRequestRemoveRelation',
588
+						],
589
+						'callback_args'   => [$version, $model_name, $relation_name],
590
+						'methods'         => WP_REST_Server::DELETABLE,
591
+						'hidden_endpoint' => $hidden_endpoint,
592
+						'args'            => [],
593
+					],
594
+				];
595
+			}
596
+		}
597
+		return $model_routes;
598
+	}
599
+
600
+
601
+	/**
602
+	 * Gets the relative URI to a model's REST API plural route, after the EE4 versioned namespace,
603
+	 * excluding the preceding slash.
604
+	 * Eg you pass get_plural_route_to('Event') = 'events'
605
+	 *
606
+	 * @param EEM_Base $model
607
+	 * @return string
608
+	 */
609
+	public static function get_collection_route(EEM_Base $model)
610
+	{
611
+		return EEH_Inflector::pluralize_and_lower($model->get_this_model_name());
612
+	}
613
+
614
+
615
+	/**
616
+	 * Gets the relative URI to a model's REST API singular route, after the EE4 versioned namespace,
617
+	 * excluding the preceding slash.
618
+	 * Eg you pass get_plural_route_to('Event', 12) = 'events/12'
619
+	 *
620
+	 * @param EEM_Base $model eg Event or Venue
621
+	 * @param string   $id
622
+	 * @return string
623
+	 */
624
+	public static function get_entity_route($model, $id)
625
+	{
626
+		return EED_Core_Rest_Api::get_collection_route($model) . '/' . $id;
627
+	}
628
+
629
+
630
+	/**
631
+	 * Gets the relative URI to a model's REST API singular route, after the EE4 versioned namespace,
632
+	 * excluding the preceding slash.
633
+	 * Eg you pass get_plural_route_to('Event', 12) = 'events/12'
634
+	 *
635
+	 * @param EEM_Base               $model eg Event or Venue
636
+	 * @param string                 $id
637
+	 * @param EE_Model_Relation_Base $relation_obj
638
+	 * @return string
639
+	 */
640
+	public static function get_relation_route_via(EEM_Base $model, $id, EE_Model_Relation_Base $relation_obj)
641
+	{
642
+		$related_model_name_endpoint_part = ModelRead::getRelatedEntityName(
643
+			$relation_obj->get_other_model()->get_this_model_name(),
644
+			$relation_obj
645
+		);
646
+		return EED_Core_Rest_Api::get_entity_route($model, $id) . '/' . $related_model_name_endpoint_part;
647
+	}
648
+
649
+
650
+	/**
651
+	 * Adds onto the $relative_route the EE4 REST API versioned namespace.
652
+	 * Eg if given '4.8.36' and 'events', will return 'ee/v4.8.36/events'
653
+	 *
654
+	 * @param string $relative_route
655
+	 * @param string $version
656
+	 * @return string
657
+	 */
658
+	public static function get_versioned_route_to($relative_route, $version = '4.8.36')
659
+	{
660
+		return '/' . EED_Core_Rest_Api::ee_api_namespace . $version . '/' . $relative_route;
661
+	}
662
+
663
+
664
+	/**
665
+	 * Adds all the RPC-style routes (remote procedure call-like routes, ie
666
+	 * routes that don't conform to the traditional REST CRUD-style).
667
+	 *
668
+	 * @deprecated since 4.9.1
669
+	 */
670
+	protected function _register_rpc_routes()
671
+	{
672
+		$routes = [];
673
+		foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden_endpoint) {
674
+			$routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = $this->_get_rpc_route_data_for_version(
675
+				$version,
676
+				$hidden_endpoint
677
+			);
678
+		}
679
+		return $routes;
680
+	}
681
+
682
+
683
+	/**
684
+	 * @param string  $version
685
+	 * @param boolean $hidden_endpoint
686
+	 * @return array
687
+	 */
688
+	protected function _get_rpc_route_data_for_version($version, $hidden_endpoint = false)
689
+	{
690
+		$this_versions_routes = [];
691
+		// checkin endpoint
692
+		$this_versions_routes['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)'] = [
693
+			[
694
+				'callback'        => [
695
+					'EventEspresso\core\libraries\rest_api\controllers\rpc\Checkin',
696
+					'handleRequestToggleCheckin',
697
+				],
698
+				'methods'         => WP_REST_Server::CREATABLE,
699
+				'hidden_endpoint' => $hidden_endpoint,
700
+				'args'            => [
701
+					'force' => [
702
+						'required'    => false,
703
+						'default'     => false,
704
+						'description' => esc_html__(
705
+						// @codingStandardsIgnoreStart
706
+							'Whether to force toggle checkin, or to verify the registration status and allowed ticket uses',
707
+							// @codingStandardsIgnoreEnd
708
+							'event_espresso'
709
+						),
710
+					],
711
+				],
712
+				'callback_args'   => [$version],
713
+			],
714
+		];
715
+		return apply_filters(
716
+			'FHEE__EED_Core_Rest_Api___register_rpc_routes__this_versions_routes',
717
+			$this_versions_routes,
718
+			$version,
719
+			$hidden_endpoint
720
+		);
721
+	}
722
+
723
+
724
+	/**
725
+	 * Gets the query params that can be used when request one or many
726
+	 *
727
+	 * @param EEM_Base $model
728
+	 * @param string   $version
729
+	 * @return array
730
+	 */
731
+	protected function _get_response_selection_query_params(EEM_Base $model, $version, $single_only = false)
732
+	{
733
+		EED_Core_Rest_Api::loadCalculatedModelFields();
734
+		$query_params = [
735
+			'include'   => [
736
+				'required' => false,
737
+				'default'  => '*',
738
+				'type'     => 'string',
739
+			],
740
+			'calculate' => [
741
+				'required'          => false,
742
+				'default'           => '',
743
+				'enum'              => EED_Core_Rest_Api::$_field_calculator->retrieveCalculatedFieldsForModel($model),
744
+				'type'              => 'string',
745
+				// because we accept a CSV list of the enumerated strings, WP core validation and sanitization
746
+				// freaks out. We'll just validate this argument while handling the request
747
+				'validate_callback' => null,
748
+				'sanitize_callback' => null,
749
+			],
750
+			'password'  => [
751
+				'required' => false,
752
+				'default'  => '',
753
+				'type'     => 'string',
754
+			],
755
+		];
756
+		return apply_filters(
757
+			'FHEE__EED_Core_Rest_Api___get_response_selection_query_params',
758
+			$query_params,
759
+			$model,
760
+			$version
761
+		);
762
+	}
763
+
764
+
765
+	/**
766
+	 * Gets the parameters acceptable for delete requests
767
+	 *
768
+	 * @param EEM_Base $model
769
+	 * @param string   $version
770
+	 * @return array
771
+	 */
772
+	protected function _get_delete_query_params(EEM_Base $model, $version)
773
+	{
774
+		$params_for_delete = [
775
+			'allow_blocking' => [
776
+				'required' => false,
777
+				'default'  => true,
778
+				'type'     => 'boolean',
779
+			],
780
+		];
781
+		$params_for_delete['force'] = [
782
+			'required' => false,
783
+			'default'  => false,
784
+			'type'     => 'boolean',
785
+		];
786
+		return apply_filters(
787
+			'FHEE__EED_Core_Rest_Api___get_delete_query_params',
788
+			$params_for_delete,
789
+			$model,
790
+			$version
791
+		);
792
+	}
793
+
794
+
795
+	/**
796
+	 * @param EEM_Base $source_model
797
+	 * @param EEM_Base $related_model
798
+	 * @param          $version
799
+	 * @return array
800
+	 * @throws EE_Error
801
+	 * @since 5.0.0.p
802
+	 */
803
+	protected function _get_add_relation_query_params(EEM_Base $source_model, EEM_Base $related_model, $version)
804
+	{
805
+		// if they're related through a HABTM relation, check for any non-FKs
806
+		$all_relation_settings = $source_model->relation_settings();
807
+		$relation_settings = $all_relation_settings[ $related_model->get_this_model_name() ];
808
+		$params = [];
809
+		if ($relation_settings instanceof EE_HABTM_Relation && $relation_settings->hasNonKeyFields()) {
810
+			foreach ($relation_settings->getNonKeyFields() as $field) {
811
+				/* @var $field EE_Model_Field_Base */
812
+				$params[ $field->get_name() ] = [
813
+					'required'          => ! $field->is_nullable(),
814
+					'default'           => ModelDataTranslator::prepareFieldValueForJson(
815
+						$field,
816
+						$field->get_default_value(),
817
+						$version
818
+					),
819
+					'type'              => $field->getSchemaType(),
820
+					'validate_callback' => null,
821
+					'sanitize_callback' => null,
822
+				];
823
+			}
824
+		}
825
+		return $params;
826
+	}
827
+
828
+
829
+	/**
830
+	 * Gets info about reading query params that are acceptable
831
+	 *
832
+	 * @param EEM_Base $model eg 'Event' or 'Venue'
833
+	 * @param string   $version
834
+	 * @return array    describing the args acceptable when querying this model
835
+	 * @throws EE_Error
836
+	 */
837
+	protected function _get_read_query_params(EEM_Base $model, $version)
838
+	{
839
+		$default_orderby = [];
840
+		foreach ($model->get_combined_primary_key_fields() as $key_field) {
841
+			$default_orderby[ $key_field->get_name() ] = 'ASC';
842
+		}
843
+		return array_merge(
844
+			$this->_get_response_selection_query_params($model, $version),
845
+			[
846
+				'where'    => [
847
+					'required'          => false,
848
+					'default'           => [],
849
+					'type'              => 'object',
850
+					// because we accept an almost infinite list of possible where conditions, WP
851
+					// core validation and sanitization freaks out. We'll just validate this argument
852
+					// while handling the request
853
+					'validate_callback' => null,
854
+					'sanitize_callback' => null,
855
+				],
856
+				'limit'    => [
857
+					'required'          => false,
858
+					'default'           => EED_Core_Rest_Api::get_default_query_limit(),
859
+					'type'              => [
860
+						'array',
861
+						'string',
862
+						'integer',
863
+					],
864
+					// because we accept a variety of types, WP core validation and sanitization
865
+					// freaks out. We'll just validate this argument while handling the request
866
+					'validate_callback' => null,
867
+					'sanitize_callback' => null,
868
+				],
869
+				'order_by' => [
870
+					'required'          => false,
871
+					'default'           => $default_orderby,
872
+					'type'              => [
873
+						'object',
874
+						'string',
875
+					],// because we accept a variety of types, WP core validation and sanitization
876
+					// freaks out. We'll just validate this argument while handling the request
877
+					'validate_callback' => null,
878
+					'sanitize_callback' => null,
879
+				],
880
+				'group_by' => [
881
+					'required'          => false,
882
+					'default'           => null,
883
+					'type'              => [
884
+						'object',
885
+						'string',
886
+					],
887
+					// because we accept  an almost infinite list of possible groupings,
888
+					// WP core validation and sanitization
889
+					// freaks out. We'll just validate this argument while handling the request
890
+					'validate_callback' => null,
891
+					'sanitize_callback' => null,
892
+				],
893
+				'having'   => [
894
+					'required'          => false,
895
+					'default'           => null,
896
+					'type'              => 'object',
897
+					// because we accept an almost infinite list of possible where conditions, WP
898
+					// core validation and sanitization freaks out. We'll just validate this argument
899
+					// while handling the request
900
+					'validate_callback' => null,
901
+					'sanitize_callback' => null,
902
+				],
903
+				'caps'     => [
904
+					'required' => false,
905
+					'default'  => EEM_Base::caps_read,
906
+					'type'     => 'string',
907
+					'enum'     => [
908
+						EEM_Base::caps_read,
909
+						EEM_Base::caps_read_admin,
910
+						EEM_Base::caps_edit,
911
+						EEM_Base::caps_delete,
912
+					],
913
+				],
914
+			]
915
+		);
916
+	}
917
+
918
+
919
+	/**
920
+	 * Gets parameter information for a model regarding writing data
921
+	 *
922
+	 * @param string           $model_name
923
+	 * @param ModelVersionInfo $model_version_info
924
+	 * @param boolean          $create                                       whether this is for request to create (in
925
+	 *                                                                       which case we need all required params) or
926
+	 *                                                                       just to update (in which case we don't
927
+	 *                                                                       need those on every request)
928
+	 * @return array
929
+	 * @throws EE_Error
930
+	 * @throws ReflectionException
931
+	 */
932
+	protected function _get_write_params(
933
+		$model_name,
934
+		ModelVersionInfo $model_version_info,
935
+		$create = false
936
+	) {
937
+		$model = EE_Registry::instance()->load_model($model_name);
938
+		$fields = $model_version_info->fieldsOnModelInThisVersion($model);
939
+
940
+		// we do our own validation and sanitization within the controller
941
+		$sanitize_callback = function_exists('rest_validate_value_from_schema')
942
+			? ['EED_Core_Rest_Api', 'default_sanitize_callback']
943
+			: null;
944
+		$args_info = [];
945
+		foreach ($fields as $field_name => $field_obj) {
946
+			if ($field_obj->is_auto_increment()) {
947
+				// totally ignore auto increment IDs
948
+				continue;
949
+			}
950
+			$arg_info = $field_obj->getSchema();
951
+			$required = $create && ! $field_obj->is_nullable() && $field_obj->get_default_value() === null;
952
+			$arg_info['required'] = $required;
953
+			// remove the read-only flag. If it were read-only we wouldn't list it as an argument while writing, right?
954
+			unset($arg_info['readonly']);
955
+			$schema_properties = $field_obj->getSchemaProperties();
956
+			if (
957
+				isset($schema_properties['raw'])
958
+				&& $field_obj->getSchemaType() === 'object'
959
+			) {
960
+				// if there's a "raw" form of this argument, use those properties instead
961
+				$arg_info = array_replace(
962
+					$arg_info,
963
+					$schema_properties['raw']
964
+				);
965
+			}
966
+			$arg_info['default'] = ModelDataTranslator::prepareFieldValueForJson(
967
+				$field_obj,
968
+				$field_obj->get_default_value(),
969
+				$model_version_info->requestedVersion()
970
+			);
971
+			$arg_info['sanitize_callback'] = $sanitize_callback;
972
+			$args_info[ $field_name ] = $arg_info;
973
+			if ($field_obj instanceof EE_Datetime_Field) {
974
+				$gmt_arg_info = $arg_info;
975
+				$gmt_arg_info['description'] = sprintf(
976
+					esc_html__(
977
+						'%1$s - the value for this field in UTC. Ignored if %2$s is provided.',
978
+						'event_espresso'
979
+					),
980
+					$field_obj->get_nicename(),
981
+					$field_name
982
+				);
983
+				$args_info[ $field_name . '_gmt' ] = $gmt_arg_info;
984
+			}
985
+		}
986
+		return $args_info;
987
+	}
988
+
989
+
990
+	/**
991
+	 * Replacement for WP API's 'rest_parse_request_arg'.
992
+	 * If the value is blank but not required, don't bother validating it.
993
+	 * Also, it uses our email validation instead of WP API's default.
994
+	 *
995
+	 * @param                 $value
996
+	 * @param WP_REST_Request $request
997
+	 * @param                 $param
998
+	 * @return bool|true|WP_Error
999
+	 * @throws InvalidArgumentException
1000
+	 * @throws InvalidInterfaceException
1001
+	 * @throws InvalidDataTypeException
1002
+	 */
1003
+	public static function default_sanitize_callback($value, WP_REST_Request $request, $param)
1004
+	{
1005
+		$attributes = $request->get_attributes();
1006
+		if (
1007
+			! isset($attributes['args'][ $param ])
1008
+			|| ! is_array($attributes['args'][ $param ])
1009
+		) {
1010
+			$validation_result = true;
1011
+		} else {
1012
+			$args = $attributes['args'][ $param ];
1013
+			if (
1014
+				(
1015
+					$value === ''
1016
+					|| $value === null
1017
+				)
1018
+				&& (! isset($args['required'])
1019
+					|| $args['required'] === false
1020
+				)
1021
+			) {
1022
+				// not required and not provided? that's cool
1023
+				$validation_result = true;
1024
+			} elseif (
1025
+				isset($args['format'])
1026
+					  && $args['format'] === 'email'
1027
+			) {
1028
+				$validation_result = true;
1029
+				if (! EED_Core_Rest_Api::_validate_email($value)) {
1030
+					$validation_result = new WP_Error(
1031
+						'rest_invalid_param',
1032
+						esc_html__(
1033
+							'The email address is not valid or does not exist.',
1034
+							'event_espresso'
1035
+						)
1036
+					);
1037
+				}
1038
+			} else {
1039
+				$validation_result = rest_validate_value_from_schema($value, $args, $param);
1040
+			}
1041
+		}
1042
+		if (is_wp_error($validation_result)) {
1043
+			return $validation_result;
1044
+		}
1045
+		return rest_sanitize_request_arg($value, $request, $param);
1046
+	}
1047
+
1048
+
1049
+	/**
1050
+	 * Returns whether or not this email address is valid. Copied from EE_Email_Validation_Strategy::_validate_email()
1051
+	 *
1052
+	 * @param $email
1053
+	 * @return bool
1054
+	 * @throws InvalidArgumentException
1055
+	 * @throws InvalidInterfaceException
1056
+	 * @throws InvalidDataTypeException
1057
+	 */
1058
+	protected static function _validate_email($email)
1059
+	{
1060
+		try {
1061
+			EmailAddressFactory::create($email);
1062
+			return true;
1063
+		} catch (EmailValidationException $e) {
1064
+			return false;
1065
+		}
1066
+	}
1067
+
1068
+
1069
+	/**
1070
+	 * Gets routes for the config
1071
+	 *
1072
+	 * @return array @see _register_model_routes
1073
+	 * @deprecated since version 4.9.1
1074
+	 */
1075
+	protected function _register_config_routes()
1076
+	{
1077
+		$config_routes = [];
1078
+		foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden_endpoint) {
1079
+			$config_routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = $this->_get_config_route_data_for_version(
1080
+				$version,
1081
+				$hidden_endpoint
1082
+			);
1083
+		}
1084
+		return $config_routes;
1085
+	}
1086
+
1087
+
1088
+	/**
1089
+	 * Gets routes for the config for the specified version
1090
+	 *
1091
+	 * @param string  $version
1092
+	 * @param boolean $hidden_endpoint
1093
+	 * @return array
1094
+	 */
1095
+	protected function _get_config_route_data_for_version($version, $hidden_endpoint)
1096
+	{
1097
+		return [
1098
+			'config'    => [
1099
+				[
1100
+					'callback'        => [
1101
+						'EventEspresso\core\libraries\rest_api\controllers\config\Read',
1102
+						'handleRequest',
1103
+					],
1104
+					'methods'         => WP_REST_Server::READABLE,
1105
+					'hidden_endpoint' => $hidden_endpoint,
1106
+					'callback_args'   => [$version],
1107
+				],
1108
+			],
1109
+			'site_info' => [
1110
+				[
1111
+					'callback'        => [
1112
+						'EventEspresso\core\libraries\rest_api\controllers\config\Read',
1113
+						'handleRequestSiteInfo',
1114
+					],
1115
+					'methods'         => WP_REST_Server::READABLE,
1116
+					'hidden_endpoint' => $hidden_endpoint,
1117
+					'callback_args'   => [$version],
1118
+				],
1119
+			],
1120
+		];
1121
+	}
1122
+
1123
+
1124
+	/**
1125
+	 * Gets the meta info routes
1126
+	 *
1127
+	 * @return array @see _register_model_routes
1128
+	 * @deprecated since version 4.9.1
1129
+	 */
1130
+	protected function _register_meta_routes()
1131
+	{
1132
+		$meta_routes = [];
1133
+		foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden_endpoint) {
1134
+			$meta_routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = $this->_get_meta_route_data_for_version(
1135
+				$version,
1136
+				$hidden_endpoint
1137
+			);
1138
+		}
1139
+		return $meta_routes;
1140
+	}
1141
+
1142
+
1143
+	/**
1144
+	 * @param string  $version
1145
+	 * @param boolean $hidden_endpoint
1146
+	 * @return array
1147
+	 */
1148
+	protected function _get_meta_route_data_for_version($version, $hidden_endpoint = false)
1149
+	{
1150
+		return [
1151
+			'resources' => [
1152
+				[
1153
+					'callback'        => [
1154
+						'EventEspresso\core\libraries\rest_api\controllers\model\Meta',
1155
+						'handleRequestModelsMeta',
1156
+					],
1157
+					'methods'         => WP_REST_Server::READABLE,
1158
+					'hidden_endpoint' => $hidden_endpoint,
1159
+					'callback_args'   => [$version],
1160
+				],
1161
+			],
1162
+		];
1163
+	}
1164
+
1165
+
1166
+	/**
1167
+	 * Tries to hide old 4.6 endpoints from the
1168
+	 *
1169
+	 * @param array $route_data
1170
+	 * @return array
1171
+	 * @throws EE_Error
1172
+	 * @throws ReflectionException
1173
+	 */
1174
+	public static function hide_old_endpoints($route_data)
1175
+	{
1176
+		// allow API clients to override which endpoints get hidden, in case
1177
+		// they want to discover particular endpoints
1178
+		// also, we don't have access to the request so we have to just grab it from the superglobal
1179
+		$force_show_ee_namespace = ltrim(
1180
+			EED_Core_Rest_Api::getRequest()->getRequestParam('force_show_ee_namespace'),
1181
+			'/'
1182
+		);
1183
+		foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) {
1184
+			foreach ($relative_urls as $resource_name => $endpoints) {
1185
+				foreach ($endpoints as $key => $endpoint) {
1186
+					// skip schema and other route options
1187
+					if (! is_numeric($key)) {
1188
+						continue;
1189
+					}
1190
+					// by default, hide "hidden_endpoint"s, unless the request indicates
1191
+					// to $force_show_ee_namespace, in which case only show that one
1192
+					// namespace's endpoints (and hide all others)
1193
+					if (
1194
+						($force_show_ee_namespace !== '' && $force_show_ee_namespace !== $namespace)
1195
+						|| ($endpoint['hidden_endpoint'] && $force_show_ee_namespace === '')
1196
+					) {
1197
+						$full_route = '/' . ltrim($namespace, '/');
1198
+						$full_route .= '/' . ltrim($resource_name, '/');
1199
+						unset($route_data[ $full_route ]);
1200
+					}
1201
+				}
1202
+			}
1203
+		}
1204
+		return $route_data;
1205
+	}
1206
+
1207
+
1208
+	/**
1209
+	 * Returns an array describing which versions of core support serving requests for.
1210
+	 * Keys are core versions' major and minor version, and values are the
1211
+	 * LOWEST requested version they can serve. Eg, 4.7 can serve requests for 4.6-like
1212
+	 * data by just removing a few models and fields from the responses. However, 4.15 might remove
1213
+	 * the answers table entirely, in which case it would be very difficult for
1214
+	 * it to serve 4.6-style responses.
1215
+	 * Versions of core that are missing from this array are unknowns.
1216
+	 * previous ver
1217
+	 *
1218
+	 * @return array
1219
+	 */
1220
+	public static function version_compatibilities()
1221
+	{
1222
+		return apply_filters(
1223
+			'FHEE__EED_Core_REST_API__version_compatibilities',
1224
+			[
1225
+				'4.8.29' => '4.8.29',
1226
+				'4.8.33' => '4.8.29',
1227
+				'4.8.34' => '4.8.29',
1228
+				'4.8.36' => '4.8.29',
1229
+			]
1230
+		);
1231
+	}
1232
+
1233
+
1234
+	/**
1235
+	 * Gets the latest API version served. Eg if there
1236
+	 * are two versions served of the API, 4.8.29 and 4.8.32, and
1237
+	 * we are on core version 4.8.34, it will return the string "4.8.32"
1238
+	 *
1239
+	 * @return string
1240
+	 */
1241
+	public static function latest_rest_api_version()
1242
+	{
1243
+		$versions_served = EED_Core_Rest_Api::versions_served();
1244
+		$versions_served_keys = array_keys($versions_served);
1245
+		return end($versions_served_keys);
1246
+	}
1247
+
1248
+
1249
+	/**
1250
+	 * Using EED_Core_Rest_Api::version_compatibilities(), determines what version of
1251
+	 * EE the API can serve requests for. Eg, if we are on 4.15 of core, and
1252
+	 * we can serve requests from 4.12 or later, this will return array( '4.12', '4.13', '4.14', '4.15' ).
1253
+	 * We also indicate whether or not this version should be put in the index or not
1254
+	 *
1255
+	 * @return array keys are API version numbers (just major and minor numbers), and values
1256
+	 * are whether or not they should be hidden
1257
+	 */
1258
+	public static function versions_served()
1259
+	{
1260
+		$versions_served = [];
1261
+		$possibly_served_versions = EED_Core_Rest_Api::version_compatibilities();
1262
+		$lowest_compatible_version = end($possibly_served_versions);
1263
+		reset($possibly_served_versions);
1264
+		$versions_served_historically = array_keys($possibly_served_versions);
1265
+		$latest_version = end($versions_served_historically);
1266
+		reset($versions_served_historically);
1267
+		// for each version of core we have ever served:
1268
+		foreach ($versions_served_historically as $key_versioned_endpoint) {
1269
+			// if it's not above the current core version, and it's compatible with the current version of core
1270
+
1271
+			if ($key_versioned_endpoint === $latest_version) {
1272
+				// don't hide the latest version in the index
1273
+				$versions_served[ $key_versioned_endpoint ] = false;
1274
+			} elseif (
1275
+				version_compare($key_versioned_endpoint, $lowest_compatible_version, '>=')
1276
+				&& version_compare($key_versioned_endpoint, EED_Core_Rest_Api::core_version(), '<')
1277
+			) {
1278
+				// include, but hide, previous versions which are still supported
1279
+				$versions_served[ $key_versioned_endpoint ] = true;
1280
+			} elseif (
1281
+				apply_filters(
1282
+					'FHEE__EED_Core_Rest_Api__versions_served__include_incompatible_versions',
1283
+					false,
1284
+					$possibly_served_versions
1285
+				)
1286
+			) {
1287
+				// if a version is no longer supported, don't include it in index or list of versions served
1288
+				$versions_served[ $key_versioned_endpoint ] = true;
1289
+			}
1290
+		}
1291
+		return $versions_served;
1292
+	}
1293
+
1294
+
1295
+	/**
1296
+	 * Gets the major and minor version of EE core's version string
1297
+	 *
1298
+	 * @return string
1299
+	 */
1300
+	public static function core_version()
1301
+	{
1302
+		return apply_filters(
1303
+			'FHEE__EED_Core_REST_API__core_version',
1304
+			implode(
1305
+				'.',
1306
+				array_slice(
1307
+					explode(
1308
+						'.',
1309
+						espresso_version()
1310
+					),
1311
+					0,
1312
+					3
1313
+				)
1314
+			)
1315
+		);
1316
+	}
1317
+
1318
+
1319
+	/**
1320
+	 * Gets the default limit that should be used when querying for resources
1321
+	 *
1322
+	 * @return int
1323
+	 */
1324
+	public static function get_default_query_limit()
1325
+	{
1326
+		// we actually don't use a const because we want folks to always use
1327
+		// this method, not the const directly
1328
+		return apply_filters(
1329
+			'FHEE__EED_Core_Rest_Api__get_default_query_limit',
1330
+			100
1331
+		);
1332
+	}
1333
+
1334
+
1335
+	/**
1336
+	 * @param string $version api version string (i.e. '4.8.36')
1337
+	 * @return array
1338
+	 */
1339
+	public static function getCollectionRoutesIndexedByModelName($version = '')
1340
+	{
1341
+		$version = empty($version) ? EED_Core_Rest_Api::latest_rest_api_version() : $version;
1342
+		$model_names = EED_Core_Rest_Api::model_names_with_plural_routes($version);
1343
+		$collection_routes = [];
1344
+		foreach ($model_names as $model_name => $model_class_name) {
1345
+			$collection_routes[ strtolower($model_name) ] = '/' . EED_Core_Rest_Api::ee_api_namespace . $version . '/'
1346
+															. EEH_Inflector::pluralize_and_lower($model_name);
1347
+		}
1348
+		return $collection_routes;
1349
+	}
1350
+
1351
+
1352
+	/**
1353
+	 * Returns an array of primary key names indexed by model names.
1354
+	 *
1355
+	 * @param string $version
1356
+	 * @return array
1357
+	 */
1358
+	public static function getPrimaryKeyNamesIndexedByModelName($version = '')
1359
+	{
1360
+		$version = empty($version) ? EED_Core_Rest_Api::latest_rest_api_version() : $version;
1361
+		$model_names = EED_Core_Rest_Api::model_names_with_plural_routes($version);
1362
+		$primary_key_items = [];
1363
+		foreach ($model_names as $model_name => $model_class_name) {
1364
+			$primary_keys = $model_class_name::instance()->get_combined_primary_key_fields();
1365
+			foreach ($primary_keys as $primary_key_name => $primary_key_field) {
1366
+				if (count($primary_keys) > 1) {
1367
+					$primary_key_items[ strtolower($model_name) ][] = $primary_key_name;
1368
+				} else {
1369
+					$primary_key_items[ strtolower($model_name) ] = $primary_key_name;
1370
+				}
1371
+			}
1372
+		}
1373
+		return $primary_key_items;
1374
+	}
1375
+
1376
+
1377
+	/**
1378
+	 * Determines the EE REST API debug mode is activated, or not.
1379
+	 *
1380
+	 * @return bool
1381
+	 * @since 4.9.76.p
1382
+	 */
1383
+	public static function debugMode()
1384
+	{
1385
+		static $debug_mode = null; // could be class prop
1386
+		if ($debug_mode === null) {
1387
+			$debug_mode = defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE;
1388
+		}
1389
+		return $debug_mode;
1390
+	}
1391
+
1392
+
1393
+	/**
1394
+	 *    run - initial module setup
1395
+	 *
1396
+	 * @access    public
1397
+	 * @param WP $WP
1398
+	 * @return    void
1399
+	 */
1400
+	public function run($WP)
1401
+	{
1402
+	}
1403 1403
 }
Please login to merge, or discard this patch.
modules/messages/EED_Messages.module.php 1 patch
Indentation   +1352 added lines, -1352 removed lines patch added patch discarded remove patch
@@ -16,1365 +16,1365 @@
 block discarded – undo
16 16
  */
17 17
 class EED_Messages extends EED_Module
18 18
 {
19
-    /**
20
-     * This holds the EE_messages controller
21
-     *
22
-     * @deprecated 4.9.0
23
-     * @var EE_messages $_EEMSG
24
-     */
25
-    protected static $_EEMSG;
26
-
27
-    /**
28
-     * @type EE_Message_Resource_Manager $_message_resource_manager
29
-     */
30
-    protected static $_message_resource_manager;
31
-
32
-    /**
33
-     * This holds the EE_Messages_Processor business class.
34
-     *
35
-     * @type EE_Messages_Processor
36
-     */
37
-    protected static $_MSG_PROCESSOR;
38
-
39
-    /**
40
-     * holds all the paths for various messages components.
41
-     * Utilized by autoloader registry
42
-     *
43
-     * @var array
44
-     */
45
-    protected static $_MSG_PATHS;
46
-
47
-
48
-    /**
49
-     * This will hold an array of messages template packs that are registered in the messages system.
50
-     * Format is:
51
-     * array(
52
-     *    'template_pack_dbref' => EE_Messages_Template_Pack (instance)
53
-     * )
54
-     *
55
-     * @var EE_Messages_Template_Pack[]
56
-     */
57
-    protected static $_TMP_PACKS = [];
58
-
59
-
60
-    /**
61
-     * @return EED_Messages|EED_Module
62
-     * @throws EE_Error
63
-     * @throws ReflectionException
64
-     */
65
-    public static function instance()
66
-    {
67
-        return parent::get_instance(__CLASS__);
68
-    }
69
-
70
-
71
-    /**
72
-     *  set_hooks - for hooking into EE Core, other modules, etc
73
-     *
74
-     * @return    void
75
-     * @since 4.5.0
76
-     */
77
-    public static function set_hooks()
78
-    {
79
-        // actions
80
-        add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', ['EED_Messages', 'payment'], 10, 2);
81
-        add_action(
82
-            'AHEE__EE_Registration_Processor__trigger_registration_update_notifications',
83
-            ['EED_Messages', 'maybe_registration'],
84
-            10,
85
-            2
86
-        );
87
-        // filters
88
-        add_filter(
89
-            'FHEE__EE_Registration__receipt_url__receipt_url',
90
-            ['EED_Messages', 'registration_message_trigger_url'],
91
-            10,
92
-            4
93
-        );
94
-        add_filter(
95
-            'FHEE__EE_Registration__invoice_url__invoice_url',
96
-            ['EED_Messages', 'registration_message_trigger_url'],
97
-            10,
98
-            4
99
-        );
100
-        // register routes
101
-        self::_register_routes();
102
-    }
103
-
104
-
105
-    /**
106
-     *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
107
-     *
108
-     * @access    public
109
-     * @return    void
110
-     */
111
-    public static function set_hooks_admin()
112
-    {
113
-        // actions
114
-        add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', ['EED_Messages', 'payment'], 10, 2);
115
-        add_action(
116
-            'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder',
117
-            ['EED_Messages', 'payment_reminder'],
118
-            10
119
-        );
120
-        add_action(
121
-            'AHEE__EE_Registration_Processor__trigger_registration_update_notifications',
122
-            ['EED_Messages', 'maybe_registration'],
123
-            10,
124
-            3
125
-        );
126
-        add_action(
127
-            'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations',
128
-            ['EED_Messages', 'send_newsletter_message'],
129
-            10,
130
-            2
131
-        );
132
-        add_action(
133
-            'AHEE__EES_Espresso_Cancelled__process_shortcode__transaction',
134
-            ['EED_Messages', 'cancelled_registration'],
135
-            10
136
-        );
137
-        add_action(
138
-            'AHEE__EE_Admin_Page___process_admin_payment_notification',
139
-            ['EED_Messages', 'process_admin_payment'],
140
-            10,
141
-            1
142
-        );
143
-        // filters
144
-        add_filter(
145
-            'FHEE__EE_Admin_Page___process_resend_registration__success',
146
-            ['EED_Messages', 'process_resend'],
147
-            10,
148
-            2
149
-        );
150
-        add_filter(
151
-            'FHEE__EE_Registration__receipt_url__receipt_url',
152
-            ['EED_Messages', 'registration_message_trigger_url'],
153
-            10,
154
-            4
155
-        );
156
-        add_filter(
157
-            'FHEE__EE_Registration__invoice_url__invoice_url',
158
-            ['EED_Messages', 'registration_message_trigger_url'],
159
-            10,
160
-            4
161
-        );
162
-    }
163
-
164
-
165
-    /**
166
-     * All the message triggers done by route go in here.
167
-     *
168
-     * @return void
169
-     * @since 4.5.0
170
-     */
171
-    protected static function _register_routes()
172
-    {
173
-        EE_Config::register_route('msg_url_trigger', 'Messages', 'run');
174
-        EE_Config::register_route('msg_cron_trigger', 'Messages', 'execute_batch_request');
175
-        EE_Config::register_route('msg_browser_trigger', 'Messages', 'browser_trigger');
176
-        EE_Config::register_route('msg_browser_error_trigger', 'Messages', 'browser_error_trigger');
177
-        do_action('AHEE__EED_Messages___register_routes');
178
-    }
179
-
180
-
181
-    /**
182
-     * This is called when a browser display trigger is executed.
183
-     * The browser display trigger is typically used when a already generated message is displayed directly in the
184
-     * browser.
185
-     *
186
-     * @param WP $WP
187
-     * @throws EE_Error
188
-     * @throws InvalidArgumentException
189
-     * @throws ReflectionException
190
-     * @throws InvalidDataTypeException
191
-     * @throws InvalidInterfaceException
192
-     * @since 4.9.0
193
-     */
194
-    public function browser_trigger($WP)
195
-    {
196
-        // ensure controller is loaded
197
-        self::_load_controller();
198
-        $token = self::getRequest()->getRequestParam('token');
199
-        try {
200
-            $mtg = new EE_Message_Generated_From_Token($token, 'html', self::$_message_resource_manager);
201
-            self::$_MSG_PROCESSOR->generate_and_send_now($mtg);
202
-        } catch (EE_Error $e) {
203
-            $error_msg = esc_html__(
204
-                'Please note that a system message failed to send due to a technical issue.',
205
-                'event_espresso'
206
-            );
207
-            // add specific message for developers if WP_DEBUG in on
208
-            $error_msg .= '||' . $e->getMessage();
209
-            EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
210
-        }
211
-    }
212
-
213
-
214
-    /**
215
-     * This is called when a browser error trigger is executed.
216
-     * When triggered this will grab the EE_Message matching the token in the request and use that to get the error
217
-     * message and display it.
218
-     *
219
-     * @param $WP
220
-     * @throws EE_Error
221
-     * @throws InvalidArgumentException
222
-     * @throws InvalidDataTypeException
223
-     * @throws InvalidInterfaceException
224
-     * @throws ReflectionException
225
-     * @since 4.9.0
226
-     */
227
-    public function browser_error_trigger($WP)
228
-    {
229
-        $token = self::getRequest()->getRequestParam('token');
230
-        if ($token) {
231
-            $message = EEM_Message::instance()->get_one_by_token($token);
232
-            if ($message instanceof EE_Message) {
233
-                header('HTTP/1.1 200 OK');
234
-                $error_msg = nl2br($message->error_message());
235
-                ?>
19
+	/**
20
+	 * This holds the EE_messages controller
21
+	 *
22
+	 * @deprecated 4.9.0
23
+	 * @var EE_messages $_EEMSG
24
+	 */
25
+	protected static $_EEMSG;
26
+
27
+	/**
28
+	 * @type EE_Message_Resource_Manager $_message_resource_manager
29
+	 */
30
+	protected static $_message_resource_manager;
31
+
32
+	/**
33
+	 * This holds the EE_Messages_Processor business class.
34
+	 *
35
+	 * @type EE_Messages_Processor
36
+	 */
37
+	protected static $_MSG_PROCESSOR;
38
+
39
+	/**
40
+	 * holds all the paths for various messages components.
41
+	 * Utilized by autoloader registry
42
+	 *
43
+	 * @var array
44
+	 */
45
+	protected static $_MSG_PATHS;
46
+
47
+
48
+	/**
49
+	 * This will hold an array of messages template packs that are registered in the messages system.
50
+	 * Format is:
51
+	 * array(
52
+	 *    'template_pack_dbref' => EE_Messages_Template_Pack (instance)
53
+	 * )
54
+	 *
55
+	 * @var EE_Messages_Template_Pack[]
56
+	 */
57
+	protected static $_TMP_PACKS = [];
58
+
59
+
60
+	/**
61
+	 * @return EED_Messages|EED_Module
62
+	 * @throws EE_Error
63
+	 * @throws ReflectionException
64
+	 */
65
+	public static function instance()
66
+	{
67
+		return parent::get_instance(__CLASS__);
68
+	}
69
+
70
+
71
+	/**
72
+	 *  set_hooks - for hooking into EE Core, other modules, etc
73
+	 *
74
+	 * @return    void
75
+	 * @since 4.5.0
76
+	 */
77
+	public static function set_hooks()
78
+	{
79
+		// actions
80
+		add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', ['EED_Messages', 'payment'], 10, 2);
81
+		add_action(
82
+			'AHEE__EE_Registration_Processor__trigger_registration_update_notifications',
83
+			['EED_Messages', 'maybe_registration'],
84
+			10,
85
+			2
86
+		);
87
+		// filters
88
+		add_filter(
89
+			'FHEE__EE_Registration__receipt_url__receipt_url',
90
+			['EED_Messages', 'registration_message_trigger_url'],
91
+			10,
92
+			4
93
+		);
94
+		add_filter(
95
+			'FHEE__EE_Registration__invoice_url__invoice_url',
96
+			['EED_Messages', 'registration_message_trigger_url'],
97
+			10,
98
+			4
99
+		);
100
+		// register routes
101
+		self::_register_routes();
102
+	}
103
+
104
+
105
+	/**
106
+	 *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
107
+	 *
108
+	 * @access    public
109
+	 * @return    void
110
+	 */
111
+	public static function set_hooks_admin()
112
+	{
113
+		// actions
114
+		add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', ['EED_Messages', 'payment'], 10, 2);
115
+		add_action(
116
+			'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder',
117
+			['EED_Messages', 'payment_reminder'],
118
+			10
119
+		);
120
+		add_action(
121
+			'AHEE__EE_Registration_Processor__trigger_registration_update_notifications',
122
+			['EED_Messages', 'maybe_registration'],
123
+			10,
124
+			3
125
+		);
126
+		add_action(
127
+			'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations',
128
+			['EED_Messages', 'send_newsletter_message'],
129
+			10,
130
+			2
131
+		);
132
+		add_action(
133
+			'AHEE__EES_Espresso_Cancelled__process_shortcode__transaction',
134
+			['EED_Messages', 'cancelled_registration'],
135
+			10
136
+		);
137
+		add_action(
138
+			'AHEE__EE_Admin_Page___process_admin_payment_notification',
139
+			['EED_Messages', 'process_admin_payment'],
140
+			10,
141
+			1
142
+		);
143
+		// filters
144
+		add_filter(
145
+			'FHEE__EE_Admin_Page___process_resend_registration__success',
146
+			['EED_Messages', 'process_resend'],
147
+			10,
148
+			2
149
+		);
150
+		add_filter(
151
+			'FHEE__EE_Registration__receipt_url__receipt_url',
152
+			['EED_Messages', 'registration_message_trigger_url'],
153
+			10,
154
+			4
155
+		);
156
+		add_filter(
157
+			'FHEE__EE_Registration__invoice_url__invoice_url',
158
+			['EED_Messages', 'registration_message_trigger_url'],
159
+			10,
160
+			4
161
+		);
162
+	}
163
+
164
+
165
+	/**
166
+	 * All the message triggers done by route go in here.
167
+	 *
168
+	 * @return void
169
+	 * @since 4.5.0
170
+	 */
171
+	protected static function _register_routes()
172
+	{
173
+		EE_Config::register_route('msg_url_trigger', 'Messages', 'run');
174
+		EE_Config::register_route('msg_cron_trigger', 'Messages', 'execute_batch_request');
175
+		EE_Config::register_route('msg_browser_trigger', 'Messages', 'browser_trigger');
176
+		EE_Config::register_route('msg_browser_error_trigger', 'Messages', 'browser_error_trigger');
177
+		do_action('AHEE__EED_Messages___register_routes');
178
+	}
179
+
180
+
181
+	/**
182
+	 * This is called when a browser display trigger is executed.
183
+	 * The browser display trigger is typically used when a already generated message is displayed directly in the
184
+	 * browser.
185
+	 *
186
+	 * @param WP $WP
187
+	 * @throws EE_Error
188
+	 * @throws InvalidArgumentException
189
+	 * @throws ReflectionException
190
+	 * @throws InvalidDataTypeException
191
+	 * @throws InvalidInterfaceException
192
+	 * @since 4.9.0
193
+	 */
194
+	public function browser_trigger($WP)
195
+	{
196
+		// ensure controller is loaded
197
+		self::_load_controller();
198
+		$token = self::getRequest()->getRequestParam('token');
199
+		try {
200
+			$mtg = new EE_Message_Generated_From_Token($token, 'html', self::$_message_resource_manager);
201
+			self::$_MSG_PROCESSOR->generate_and_send_now($mtg);
202
+		} catch (EE_Error $e) {
203
+			$error_msg = esc_html__(
204
+				'Please note that a system message failed to send due to a technical issue.',
205
+				'event_espresso'
206
+			);
207
+			// add specific message for developers if WP_DEBUG in on
208
+			$error_msg .= '||' . $e->getMessage();
209
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
210
+		}
211
+	}
212
+
213
+
214
+	/**
215
+	 * This is called when a browser error trigger is executed.
216
+	 * When triggered this will grab the EE_Message matching the token in the request and use that to get the error
217
+	 * message and display it.
218
+	 *
219
+	 * @param $WP
220
+	 * @throws EE_Error
221
+	 * @throws InvalidArgumentException
222
+	 * @throws InvalidDataTypeException
223
+	 * @throws InvalidInterfaceException
224
+	 * @throws ReflectionException
225
+	 * @since 4.9.0
226
+	 */
227
+	public function browser_error_trigger($WP)
228
+	{
229
+		$token = self::getRequest()->getRequestParam('token');
230
+		if ($token) {
231
+			$message = EEM_Message::instance()->get_one_by_token($token);
232
+			if ($message instanceof EE_Message) {
233
+				header('HTTP/1.1 200 OK');
234
+				$error_msg = nl2br($message->error_message());
235
+				?>
236 236
                 <!DOCTYPE html>
237 237
                 <html>
238 238
                 <head></head>
239 239
                 <body>
240 240
                 <?php echo empty($error_msg)
241
-                    ? esc_html__(
242
-                        'Unfortunately, we were unable to capture the error message for this message.',
243
-                        'event_espresso'
244
-                    )
245
-                    : wp_kses(
246
-                        $error_msg,
247
-                        [
248
-                            'a'      => [
249
-                                'href'  => [],
250
-                                'title' => [],
251
-                            ],
252
-                            'span'   => [],
253
-                            'div'    => [],
254
-                            'p'      => [],
255
-                            'strong' => [],
256
-                            'em'     => [],
257
-                            'br'     => [],
258
-                        ]
259
-                    ); ?>
241
+					? esc_html__(
242
+						'Unfortunately, we were unable to capture the error message for this message.',
243
+						'event_espresso'
244
+					)
245
+					: wp_kses(
246
+						$error_msg,
247
+						[
248
+							'a'      => [
249
+								'href'  => [],
250
+								'title' => [],
251
+							],
252
+							'span'   => [],
253
+							'div'    => [],
254
+							'p'      => [],
255
+							'strong' => [],
256
+							'em'     => [],
257
+							'br'     => [],
258
+						]
259
+					); ?>
260 260
                 </body>
261 261
                 </html>
262 262
                 <?php
263
-                exit;
264
-            }
265
-        }
266
-    }
267
-
268
-
269
-    /**
270
-     *  This runs when the msg_url_trigger route has initiated.
271
-     *
272
-     * @param WP $WP
273
-     * @throws EE_Error
274
-     * @throws InvalidArgumentException
275
-     * @throws ReflectionException
276
-     * @throws InvalidDataTypeException
277
-     * @throws InvalidInterfaceException
278
-     * @since 4.5.0
279
-     */
280
-    public function run($WP)
281
-    {
282
-        // ensure controller is loaded
283
-        self::_load_controller();
284
-        // attempt to process message
285
-        try {
286
-            /** @type EE_Message_To_Generate_From_Request $message_to_generate */
287
-            $message_to_generate = EE_Registry::instance()->load_lib('Message_To_Generate_From_Request');
288
-            self::$_MSG_PROCESSOR->generate_and_send_now($message_to_generate);
289
-        } catch (EE_Error $e) {
290
-            $error_msg = esc_html__(
291
-                'Please note that a system message failed to send due to a technical issue.',
292
-                'event_espresso'
293
-            );
294
-            // add specific message for developers if WP_DEBUG in on
295
-            $error_msg .= '||' . $e->getMessage();
296
-            EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
297
-        }
298
-    }
299
-
300
-
301
-    /**
302
-     * This is triggered by the 'msg_cron_trigger' route.
303
-     *
304
-     * @param WP $WP
305
-     * @throws EE_Error
306
-     */
307
-    public function execute_batch_request($WP)
308
-    {
309
-        $this->run_cron();
310
-        header('HTTP/1.1 200 OK');
311
-        exit();
312
-    }
313
-
314
-
315
-    /**
316
-     * This gets executed on wp_cron jobs or when a batch request is initiated on its own separate non regular wp
317
-     * request.
318
-     *
319
-     * @throws EE_Error
320
-     * @throws ReflectionException
321
-     */
322
-    public function run_cron()
323
-    {
324
-        self::_load_controller();
325
-        $request = self::getRequest();
326
-        // get required vars
327
-        $cron_type     = $request->getRequestParam('type');
328
-        $transient_key = $request->getRequestParam('key');
329
-
330
-        // now let's verify transient, if not valid exit immediately
331
-        if (! get_transient($transient_key)) {
332
-            /**
333
-             * trigger error so this gets in the error logs.  This is important because it happens on a non-user
334
-             * request.
335
-             */
336
-            trigger_error(esc_attr__('Invalid Request (Transient does not exist)', 'event_espresso'));
337
-        }
338
-
339
-        // if made it here, lets' delete the transient to keep the db clean
340
-        delete_transient($transient_key);
341
-
342
-        if (apply_filters('FHEE__EED_Messages__run_cron__use_wp_cron', true)) {
343
-            $method = 'batch_' . $cron_type . '_from_queue';
344
-            if (method_exists(self::$_MSG_PROCESSOR, $method)) {
345
-                self::$_MSG_PROCESSOR->$method();
346
-            } else {
347
-                // no matching task
348
-                /**
349
-                 * trigger error so this gets in the error logs.  This is important because it happens on a non user
350
-                 * request.
351
-                 */
352
-                trigger_error(
353
-                    esc_attr(
354
-                        sprintf(
355
-                            esc_html__('There is no task corresponding to this route %s', 'event_espresso'),
356
-                            $cron_type
357
-                        )
358
-                    )
359
-                );
360
-            }
361
-        }
362
-
363
-        do_action('FHEE__EED_Messages__run_cron__end');
364
-    }
365
-
366
-
367
-    /**
368
-     * This is used to retrieve the template pack for the given name.
369
-     * Retrieved packs are cached on the static $_TMP_PACKS array.  If there is no class matching the given name then
370
-     * the default template pack is returned.
371
-     *
372
-     * @param string $template_pack_name This should correspond to the dbref of the template pack (which is also used
373
-     *                                   in generating the Pack class name).
374
-     * @return EE_Messages_Template_Pack
375
-     * @throws EE_Error
376
-     * @throws InvalidArgumentException
377
-     * @throws ReflectionException
378
-     * @throws InvalidDataTypeException
379
-     * @throws InvalidInterfaceException
380
-     * @deprecated 4.9.0  @see EEH_MSG_Template::get_template_pack()
381
-     */
382
-    public static function get_template_pack($template_pack_name)
383
-    {
384
-        EE_Registry::instance()->load_helper('MSG_Template');
385
-        return EEH_MSG_Template::get_template_pack($template_pack_name);
386
-    }
387
-
388
-
389
-    /**
390
-     * Retrieves an array of all template packs.
391
-     * Array is in the format array( 'dbref' => EE_Messages_Template_Pack )
392
-     *
393
-     * @return EE_Messages_Template_Pack[]
394
-     * @throws EE_Error
395
-     * @throws InvalidArgumentException
396
-     * @throws ReflectionException
397
-     * @throws InvalidDataTypeException
398
-     * @throws InvalidInterfaceException
399
-     * @deprecated 4.9.0  @see EEH_MSG_Template_Pack::get_template_pack_collection
400
-     */
401
-    public static function get_template_packs()
402
-    {
403
-        EE_Registry::instance()->load_helper('MSG_Template');
404
-
405
-        // for backward compat, let's make sure this returns in the same format as originally.
406
-        $template_pack_collection = EEH_MSG_Template::get_template_pack_collection();
407
-        $template_pack_collection->rewind();
408
-        $template_packs = [];
409
-        while ($template_pack_collection->valid()) {
410
-            $template_packs[ $template_pack_collection->current()->dbref ] = $template_pack_collection->current();
411
-            $template_pack_collection->next();
412
-        }
413
-        return $template_packs;
414
-    }
415
-
416
-
417
-    /**
418
-     * This simply makes sure the autoloaders are registered for the EE_messages system.
419
-     *
420
-     * @return void
421
-     * @throws EE_Error
422
-     * @since 4.5.0
423
-     */
424
-    public static function set_autoloaders()
425
-    {
426
-        if (empty(self::$_MSG_PATHS)) {
427
-            self::_set_messages_paths();
428
-            foreach (self::$_MSG_PATHS as $path) {
429
-                EEH_Autoloader::register_autoloaders_for_each_file_in_folder($path);
430
-            }
431
-            // add aliases
432
-            EEH_Autoloader::add_alias('EE_messages', 'EE_messages');
433
-            EEH_Autoloader::add_alias('EE_messenger', 'EE_messenger');
434
-        }
435
-    }
436
-
437
-
438
-    /**
439
-     * Take care of adding all the paths for the messages components to the $_MSG_PATHS property
440
-     * for use by the Messages Autoloaders
441
-     *
442
-     * @return void.
443
-     * @since 4.5.0
444
-     */
445
-    protected static function _set_messages_paths()
446
-    {
447
-        self::$_MSG_PATHS = apply_filters(
448
-            'FHEE__EED_Messages___set_messages_paths___MSG_PATHS',
449
-            [
450
-                EE_LIBRARIES . 'messages/message_type',
451
-                EE_LIBRARIES . 'messages/messenger',
452
-                EE_LIBRARIES . 'messages/defaults',
453
-                EE_LIBRARIES . 'messages/defaults/email',
454
-                EE_LIBRARIES . 'messages/data_class',
455
-                EE_LIBRARIES . 'messages/validators',
456
-                EE_LIBRARIES . 'messages/validators/email',
457
-                EE_LIBRARIES . 'messages/validators/html',
458
-                EE_LIBRARIES . 'shortcodes',
459
-            ]
460
-        );
461
-    }
462
-
463
-
464
-    /**
465
-     * Takes care of loading dependencies
466
-     *
467
-     * @return void
468
-     * @throws EE_Error
469
-     * @throws InvalidArgumentException
470
-     * @throws ReflectionException
471
-     * @throws InvalidDataTypeException
472
-     * @throws InvalidInterfaceException
473
-     * @since 4.5.0
474
-     */
475
-    protected static function _load_controller()
476
-    {
477
-        if (! self::$_MSG_PROCESSOR instanceof EE_Messages_Processor) {
478
-            EE_Registry::instance()->load_core('Request_Handler');
479
-            self::set_autoloaders();
480
-            self::$_EEMSG                    = EE_Registry::instance()->load_lib('messages');
481
-            self::$_MSG_PROCESSOR            = EE_Registry::instance()->load_lib('Messages_Processor');
482
-            self::$_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
483
-        }
484
-    }
485
-
486
-
487
-    /**
488
-     * @param EE_Transaction $transaction
489
-     * @throws EE_Error
490
-     * @throws InvalidArgumentException
491
-     * @throws InvalidDataTypeException
492
-     * @throws InvalidInterfaceException
493
-     * @throws ReflectionException
494
-     */
495
-    public static function payment_reminder(EE_Transaction $transaction)
496
-    {
497
-        self::_load_controller();
498
-        $data = [$transaction, null];
499
-        self::$_MSG_PROCESSOR->generate_for_all_active_messengers('payment_reminder', $data);
500
-    }
501
-
502
-
503
-    /**
504
-     * Any messages triggers for after successful gateway payments should go in here.
505
-     *
506
-     * @param EE_Transaction  $transaction object
507
-     * @param EE_Payment|null $payment     object
508
-     * @return void
509
-     * @throws EE_Error
510
-     * @throws InvalidArgumentException
511
-     * @throws ReflectionException
512
-     * @throws InvalidDataTypeException
513
-     * @throws InvalidInterfaceException
514
-     */
515
-    public static function payment(EE_Transaction $transaction, EE_Payment $payment = null)
516
-    {
517
-        // if there's no payment object, then we cannot do a payment type message!
518
-        if (! $payment instanceof EE_Payment) {
519
-            return;
520
-        }
521
-        self::_load_controller();
522
-        $data = [$transaction, $payment];
523
-        EE_Registry::instance()->load_helper('MSG_Template');
524
-        $message_type = EEH_MSG_Template::convert_payment_status_to_message_type($payment->STS_ID());
525
-        // if payment amount is less than 0 then switch to payment_refund message type.
526
-        $message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type;
527
-        self::$_MSG_PROCESSOR->generate_for_all_active_messengers($message_type, $data);
528
-    }
529
-
530
-
531
-    /**
532
-     * @param EE_Transaction $transaction
533
-     * @throws EE_Error
534
-     * @throws InvalidArgumentException
535
-     * @throws InvalidDataTypeException
536
-     * @throws InvalidInterfaceException
537
-     * @throws ReflectionException
538
-     */
539
-    public static function cancelled_registration(EE_Transaction $transaction)
540
-    {
541
-        self::_load_controller();
542
-        $data = [$transaction, null];
543
-        self::$_MSG_PROCESSOR->generate_for_all_active_messengers('cancelled_registration', $data);
544
-    }
545
-
546
-
547
-    /**
548
-     * Trigger for Registration messages
549
-     * Note that what registration message type is sent depends on what the reg status is for the registrations on the
550
-     * incoming transaction.
551
-     *
552
-     * @param EE_Registration $registration
553
-     * @param array           $extra_details
554
-     * @return void
555
-     * @throws EE_Error
556
-     * @throws InvalidArgumentException
557
-     * @throws InvalidDataTypeException
558
-     * @throws InvalidInterfaceException
559
-     * @throws ReflectionException
560
-     * @throws EntityNotFoundException
561
-     */
562
-    public static function maybe_registration(EE_Registration $registration, $extra_details = [])
563
-    {
564
-
565
-        if (! self::_verify_registration_notification_send($registration, $extra_details)) {
566
-            // no messages please
567
-            return;
568
-        }
569
-
570
-        // get all non-trashed registrations so we make sure we send messages for the right status.
571
-        $all_registrations = $registration->transaction()->registrations(
572
-            [
573
-                ['REG_deleted' => false],
574
-                'order_by' => [
575
-                    'Event.EVT_name'     => 'ASC',
576
-                    'Attendee.ATT_lname' => 'ASC',
577
-                    'Attendee.ATT_fname' => 'ASC',
578
-                ],
579
-            ]
580
-        );
581
-        // cached array of statuses so we only trigger messages once per status.
582
-        $statuses_sent = [];
583
-        self::_load_controller();
584
-        $mtgs = [];
585
-
586
-        // loop through registrations and trigger messages once per status.
587
-        foreach ($all_registrations as $reg) {
588
-            // already triggered?
589
-            if (in_array($reg->status_ID(), $statuses_sent)) {
590
-                continue;
591
-            }
592
-
593
-            $message_type    = EEH_MSG_Template::convert_reg_status_to_message_type($reg->status_ID());
594
-            $mtgs            = array_merge(
595
-                $mtgs,
596
-                self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers(
597
-                    $message_type,
598
-                    [$registration->transaction(), null, $reg->status_ID()]
599
-                )
600
-            );
601
-            $statuses_sent[] = $reg->status_ID();
602
-        }
603
-
604
-        if (count($statuses_sent) > 1) {
605
-            $mtgs = array_merge(
606
-                $mtgs,
607
-                self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers(
608
-                    'registration_summary',
609
-                    [$registration->transaction(), null]
610
-                )
611
-            );
612
-        }
613
-
614
-        // batch queue and initiate request
615
-        self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist($mtgs);
616
-        self::$_MSG_PROCESSOR->get_queue()->initiate_request_by_priority();
617
-    }
618
-
619
-
620
-    /**
621
-     * This is a helper method used to very whether a registration notification should be sent or
622
-     * not.  Prevents duplicate notifications going out for registration context notifications.
623
-     *
624
-     * @param EE_Registration $registration  [description]
625
-     * @param array           $extra_details [description]
626
-     * @return bool          true = send away, false = nope halt the presses.
627
-     */
628
-    protected static function _verify_registration_notification_send(
629
-        EE_Registration $registration,
630
-        $extra_details = []
631
-    ) {
632
-        $request = self::getRequest();
633
-        if (
634
-            ! $request->getRequestParam('non_primary_reg_notification', 0, 'int')
635
-            && ! $registration->is_primary_registrant()
636
-        ) {
637
-            return false;
638
-        }
639
-        // first we check if we're in admin and not doing front ajax
640
-        if (
641
-            ($request->isAdmin() || $request->isAdminAjax())
642
-            && ! $request->isFrontAjax()
643
-        ) {
644
-            $status_change = $request->getRequestParam('txn_reg_status_change', [], 'int', true);
645
-            // make sure appropriate admin params are set for sending messages
646
-            if (
647
-                ! isset($status_change['send_notifications'])
648
-                || (isset($status_change['send_notifications']) && ! $status_change['send_notifications'])
649
-            ) {
650
-                // no messages sent please.
651
-                return false;
652
-            }
653
-        } else {
654
-            // frontend request (either regular or via AJAX)
655
-            // TXN is NOT finalized ?
656
-            if (! isset($extra_details['finalized']) || $extra_details['finalized'] === false) {
657
-                return false;
658
-            }
659
-            // return visit but nothing changed ???
660
-            if (
661
-                isset($extra_details['revisit'], $extra_details['status_updates'])
662
-                && $extra_details['revisit']
663
-                && ! $extra_details['status_updates']
664
-            ) {
665
-                return false;
666
-            }
667
-            // NOT sending messages && reg status is something other than "Not-Approved"
668
-            if (
669
-                ! apply_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications', false)
670
-                && $registration->status_ID() !== EEM_Registration::status_id_not_approved
671
-            ) {
672
-                return false;
673
-            }
674
-        }
675
-        // release the kraken
676
-        return true;
677
-    }
678
-
679
-
680
-    /**
681
-     * Simply returns an array indexed by Registration Status ID and the related message_type name associated with that
682
-     * status id.
683
-     *
684
-     * @param string $reg_status
685
-     * @return array
686
-     * @throws EE_Error
687
-     * @throws InvalidArgumentException
688
-     * @throws ReflectionException
689
-     * @throws InvalidDataTypeException
690
-     * @throws InvalidInterfaceException
691
-     * @deprecated        4.9.0  Use EEH_MSG_Template::reg_status_to_message_type_array()
692
-     *                    or EEH_MSG_Template::convert_reg_status_to_message_type
693
-     */
694
-    protected static function _get_reg_status_array($reg_status = '')
695
-    {
696
-        EE_Registry::instance()->load_helper('MSG_Template');
697
-        return EEH_MSG_Template::convert_reg_status_to_message_type($reg_status)
698
-            ? EEH_MSG_Template::convert_reg_status_to_message_type($reg_status)
699
-            : EEH_MSG_Template::reg_status_to_message_type_array();
700
-    }
701
-
702
-
703
-    /**
704
-     * Simply returns the payment message type for the given payment status.
705
-     *
706
-     * @param string $payment_status The payment status being matched.
707
-     * @return bool|string The payment message type slug matching the status or false if no match.
708
-     * @throws EE_Error
709
-     * @throws InvalidArgumentException
710
-     * @throws ReflectionException
711
-     * @throws InvalidDataTypeException
712
-     * @throws InvalidInterfaceException
713
-     * @deprecated       4.9.0 Use EEH_MSG_Template::payment_status_to_message_type_array
714
-     *                   or EEH_MSG_Template::convert_payment_status_to_message_type
715
-     */
716
-    protected static function _get_payment_message_type($payment_status)
717
-    {
718
-        EE_Registry::instance()->load_helper('MSG_Template');
719
-        return EEH_MSG_Template::convert_payment_status_to_message_type($payment_status)
720
-            ? EEH_MSG_Template::convert_payment_status_to_message_type($payment_status)
721
-            : false;
722
-    }
723
-
724
-
725
-    /**
726
-     * Message triggers for a resending already sent message(s) (via EE_Message list table)
727
-     *
728
-     * @access public
729
-     * @param array $req_data This is the $_POST & $_GET data sent from EE_Admin Pages
730
-     * @return bool success/fail
731
-     * @throws EE_Error
732
-     * @throws InvalidArgumentException
733
-     * @throws InvalidDataTypeException
734
-     * @throws InvalidInterfaceException
735
-     * @throws ReflectionException
736
-     */
737
-    public static function process_resend(array $req_data = [])
738
-    {
739
-        self::_load_controller();
740
-        $request = self::getRequest();
741
-        // if $msgID in this request then skip to the new resend_message
742
-        if ($request->getRequestParam('MSG_ID')) {
743
-            return self::resend_message();
744
-        }
745
-
746
-        // make sure any incoming request data is set on the request so that it gets picked up later.
747
-        foreach ((array) $req_data as $request_key => $request_value) {
748
-            if (! $request->requestParamIsSet($request_key)) {
749
-                $request->setRequestParam($request_key, $request_value);
750
-            }
751
-        }
752
-
753
-        if (
754
-            ! $messages_to_send = self::$_MSG_PROCESSOR->setup_messages_to_generate_from_registration_ids_in_request()
755
-        ) {
756
-            return false;
757
-        }
758
-
759
-        try {
760
-            self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist($messages_to_send);
761
-            self::$_MSG_PROCESSOR->get_queue()->initiate_request_by_priority();
762
-        } catch (EE_Error $e) {
763
-            EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
764
-            return false;
765
-        }
766
-        EE_Error::add_success(
767
-            esc_html__('Messages have been successfully queued for generation and sending.', 'event_espresso')
768
-        );
769
-        return true; // everything got queued.
770
-    }
771
-
772
-
773
-    /**
774
-     * Message triggers for a resending already sent message(s) (via EE_Message list table)
775
-     *
776
-     * @return bool
777
-     * @throws EE_Error
778
-     * @throws InvalidArgumentException
779
-     * @throws InvalidDataTypeException
780
-     * @throws InvalidInterfaceException
781
-     * @throws ReflectionException
782
-     */
783
-    public static function resend_message()
784
-    {
785
-        self::_load_controller();
786
-
787
-        $msgID = self::getRequest()->getRequestParam('MSG_ID', 0, 'int');
788
-        if (! $msgID) {
789
-            EE_Error::add_error(
790
-                esc_html__(
791
-                    'Something went wrong because there is no "MSG_ID" value in the request',
792
-                    'event_espresso'
793
-                ),
794
-                __FILE__,
795
-                __FUNCTION__,
796
-                __LINE__
797
-            );
798
-            return false;
799
-        }
800
-
801
-        self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send((array) $msgID);
802
-
803
-        // setup success message.
804
-        $count_ready_for_resend = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_resend);
805
-        EE_Error::add_success(
806
-            sprintf(
807
-                _n(
808
-                    'There was %d message queued for resending.',
809
-                    'There were %d messages queued for resending.',
810
-                    $count_ready_for_resend,
811
-                    'event_espresso'
812
-                ),
813
-                $count_ready_for_resend
814
-            )
815
-        );
816
-        return true;
817
-    }
818
-
819
-
820
-    /**
821
-     * Message triggers for manual payment applied by admin
822
-     *
823
-     * @param EE_Payment $payment EE_payment object
824
-     * @return bool success/fail
825
-     * @throws EE_Error
826
-     * @throws InvalidArgumentException
827
-     * @throws ReflectionException
828
-     * @throws InvalidDataTypeException
829
-     * @throws InvalidInterfaceException
830
-     */
831
-    public static function process_admin_payment(EE_Payment $payment)
832
-    {
833
-        EE_Registry::instance()->load_helper('MSG_Template');
834
-        // we need to get the transaction object
835
-        $transaction = $payment->transaction();
836
-        if ($transaction instanceof EE_Transaction) {
837
-            $data         = [$transaction, $payment];
838
-            $message_type = EEH_MSG_Template::convert_payment_status_to_message_type($payment->STS_ID());
839
-
840
-            // if payment amount is less than 0 then switch to payment_refund message type.
841
-            $message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type;
842
-
843
-            // if payment_refund is selected, but the status is NOT accepted.  Then change message type to false so NO message notification goes out.
844
-            $message_type = $message_type == 'payment_refund' && $payment->STS_ID() != EEM_Payment::status_id_approved
845
-                ? false : $message_type;
846
-
847
-            self::_load_controller();
848
-
849
-            self::$_MSG_PROCESSOR->generate_for_all_active_messengers($message_type, $data);
850
-
851
-            // get count of queued for generation
852
-            $count_to_generate = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(
853
-                [
854
-                    EEM_Message::status_incomplete,
855
-                    EEM_Message::status_idle,
856
-                ]
857
-            );
858
-
859
-            if ($count_to_generate > 0 && self::$_MSG_PROCESSOR->get_queue()->get_message_repository()->count() !== 0) {
860
-                add_filter('FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true');
861
-                return true;
862
-            } else {
863
-                $count_failed = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(
864
-                    EEM_Message::instance()->stati_indicating_failed_sending()
865
-                );
866
-                /**
867
-                 * Verify that there are actually errors.  If not then we return a success message because the queue might have been emptied due to successful
868
-                 * IMMEDIATE generation.
869
-                 */
870
-                if ($count_failed > 0) {
871
-                    EE_Error::add_error(
872
-                        sprintf(
873
-                            _n(
874
-                                'The payment notification generation failed.',
875
-                                '%d payment notifications failed being sent.',
876
-                                $count_failed,
877
-                                'event_espresso'
878
-                            ),
879
-                            $count_failed
880
-                        ),
881
-                        __FILE__,
882
-                        __FUNCTION__,
883
-                        __LINE__
884
-                    );
885
-
886
-                    return false;
887
-                } else {
888
-                    add_filter('FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true');
889
-                    return true;
890
-                }
891
-            }
892
-        } else {
893
-            EE_Error::add_error(
894
-                esc_html__(
895
-                    'Unable to generate the payment notification because the given value for the transaction is invalid.',
896
-                    'event_espresso'
897
-                ),
898
-                __FILE__,
899
-                __FUNCTION__,
900
-                __LINE__
901
-            );
902
-            return false;
903
-        }
904
-    }
905
-
906
-
907
-    /**
908
-     * Callback for AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send_with_registrations trigger
909
-     *
910
-     * @param EE_Registration[] $registrations an array of EE_Registration objects
911
-     * @param int               $grp_id        a specific message template group id.
912
-     * @return void
913
-     * @throws EE_Error
914
-     * @throws InvalidArgumentException
915
-     * @throws InvalidDataTypeException
916
-     * @throws InvalidInterfaceException
917
-     * @throws ReflectionException
918
-     * @since   4.3.0
919
-     */
920
-    public static function send_newsletter_message($registrations, $grp_id)
921
-    {
922
-        // make sure mtp is id and set it in the request later messages setup.
923
-        self::getRequest()->setRequestParam('GRP_ID', (int) $grp_id);
924
-        self::_load_controller();
925
-        self::$_MSG_PROCESSOR->generate_for_all_active_messengers('newsletter', $registrations);
926
-    }
927
-
928
-
929
-    /**
930
-     * Callback for FHEE__EE_Registration__invoice_url__invoice_url or FHEE__EE_Registration__receipt_url__receipt_url
931
-     *
932
-     * @param string          $registration_message_trigger_url
933
-     * @param EE_Registration $registration
934
-     * @param string          $messenger
935
-     * @param string          $message_type
936
-     * @return string
937
-     * @throws EE_Error
938
-     * @throws InvalidArgumentException
939
-     * @throws InvalidDataTypeException
940
-     * @throws InvalidInterfaceException
941
-     * @throws ReflectionException
942
-     * @since   4.3.0
943
-     */
944
-    public static function registration_message_trigger_url(
945
-        $registration_message_trigger_url,
946
-        EE_Registration $registration,
947
-        $messenger = 'html',
948
-        $message_type = 'invoice'
949
-    ) {
950
-        // whitelist $messenger
951
-        switch ($messenger) {
952
-            case 'pdf':
953
-                $sending_messenger    = 'pdf';
954
-                $generating_messenger = 'html';
955
-                break;
956
-            case 'html':
957
-            default:
958
-                $sending_messenger    = 'html';
959
-                $generating_messenger = 'html';
960
-                break;
961
-        }
962
-        // whitelist $message_type
963
-        switch ($message_type) {
964
-            case 'receipt':
965
-                $message_type = 'receipt';
966
-                break;
967
-            case 'invoice':
968
-            default:
969
-                $message_type = 'invoice';
970
-                break;
971
-        }
972
-        // verify that both the messenger AND the message type are active
973
-        if (
974
-            EEH_MSG_Template::is_messenger_active($sending_messenger)
975
-            && EEH_MSG_Template::is_mt_active($message_type)
976
-        ) {
977
-            // need to get the correct message template group for this (i.e. is there a custom invoice for the event this registration is registered for?)
978
-            $template_query_params = [
979
-                'MTP_is_active'    => true,
980
-                'MTP_messenger'    => $generating_messenger,
981
-                'MTP_message_type' => $message_type,
982
-                'Event.EVT_ID'     => $registration->event_ID(),
983
-            ];
984
-            // get the message template group.
985
-            $msg_template_group = EEM_Message_Template_Group::instance()->get_one([$template_query_params]);
986
-            // if we don't have an EE_Message_Template_Group then return
987
-            if (! $msg_template_group instanceof EE_Message_Template_Group) {
988
-                // remove EVT_ID from query params so that global templates get picked up
989
-                unset($template_query_params['Event.EVT_ID']);
990
-                // get global template as the fallback
991
-                $msg_template_group = EEM_Message_Template_Group::instance()->get_one([$template_query_params]);
992
-            }
993
-            // if we don't have an EE_Message_Template_Group then return
994
-            if (! $msg_template_group instanceof EE_Message_Template_Group) {
995
-                return '';
996
-            }
997
-            // generate the URL
998
-            $registration_message_trigger_url = EEH_MSG_Template::generate_url_trigger(
999
-                $sending_messenger,
1000
-                $generating_messenger,
1001
-                'purchaser',
1002
-                $message_type,
1003
-                $registration,
1004
-                $msg_template_group->ID(),
1005
-                $registration->transaction_ID()
1006
-            );
1007
-        }
1008
-        return $registration_message_trigger_url;
1009
-    }
1010
-
1011
-
1012
-    /**
1013
-     * Use to generate and return a message preview!
1014
-     *
1015
-     * @param string $type       This should correspond with a valid message type
1016
-     * @param string $context    This should correspond with a valid context for the message type
1017
-     * @param string $messenger  This should correspond with a valid messenger.
1018
-     * @param bool   $send       true we will do a test send using the messenger delivery, false we just do a regular
1019
-     *                           preview
1020
-     * @return bool|string The body of the message or if send is requested, sends.
1021
-     * @throws EE_Error
1022
-     * @throws InvalidArgumentException
1023
-     * @throws InvalidDataTypeException
1024
-     * @throws InvalidInterfaceException
1025
-     * @throws ReflectionException
1026
-     */
1027
-    public static function preview_message($type, $context, $messenger, $send = false)
1028
-    {
1029
-        self::_load_controller();
1030
-        $message_to_generate     = new EE_Message_To_Generate(
1031
-            $messenger,
1032
-            $type,
1033
-            [],
1034
-            $context,
1035
-            true
1036
-        );
1037
-        $generated_preview_queue = self::$_MSG_PROCESSOR->generate_for_preview($message_to_generate, $send);
1038
-
1039
-        if ($generated_preview_queue instanceof EE_Messages_Queue) {
1040
-            // loop through all content for the preview and remove any persisted records.
1041
-            $content = '';
1042
-            foreach ($generated_preview_queue->get_message_repository() as $message) {
1043
-                $content = $message->content();
1044
-                if ($message->ID() > 0 && $message->STS_ID() !== EEM_Message::status_failed) {
1045
-                    $message->delete();
1046
-                }
1047
-            }
1048
-            return $content;
1049
-        }
1050
-        return $generated_preview_queue;
1051
-    }
1052
-
1053
-
1054
-    /**
1055
-     * This is a method that allows for sending a message using a messenger matching the string given and the provided
1056
-     * EE_Message_Queue object.  The EE_Message_Queue object is used to create a single aggregate EE_Message via the
1057
-     * content found in the EE_Message objects in the queue.
1058
-     *
1059
-     * @param string            $messenger            a string matching a valid active messenger in the system
1060
-     * @param string            $message_type         Although it seems contrary to the name of the method, a message
1061
-     *                                                type name is still required to send along the message type to the
1062
-     *                                                messenger because this is used for determining what specific
1063
-     *                                                variations might be loaded for the generated message.
1064
-     * @param EE_Messages_Queue $queue
1065
-     * @param string            $custom_subject       Can be used to set what the custom subject string will be on the
1066
-     *                                                aggregate EE_Message object.
1067
-     * @return bool success or fail.
1068
-     * @throws EE_Error
1069
-     * @throws InvalidArgumentException
1070
-     * @throws ReflectionException
1071
-     * @throws InvalidDataTypeException
1072
-     * @throws InvalidInterfaceException
1073
-     * @since 4.9.0
1074
-     */
1075
-    public static function send_message_with_messenger_only(
1076
-        $messenger,
1077
-        $message_type,
1078
-        EE_Messages_Queue $queue,
1079
-        $custom_subject = ''
1080
-    ) {
1081
-        self::_load_controller();
1082
-        /** @type EE_Message_To_Generate_From_Queue $message_to_generate */
1083
-        $message_to_generate = EE_Registry::instance()->load_lib(
1084
-            'Message_To_Generate_From_Queue',
1085
-            [
1086
-                $messenger,
1087
-                $message_type,
1088
-                $queue,
1089
-                $custom_subject,
1090
-            ]
1091
-        );
1092
-        return self::$_MSG_PROCESSOR->queue_for_sending($message_to_generate);
1093
-    }
1094
-
1095
-
1096
-    /**
1097
-     * Generates Messages immediately for EE_Message IDs (but only for the correct status for generation)
1098
-     *
1099
-     * @param array $message_ids An array of message ids
1100
-     * @return bool|EE_Messages_Queue false if nothing was generated, EE_Messages_Queue containing generated
1101
-     *                           messages.
1102
-     * @throws EE_Error
1103
-     * @throws InvalidArgumentException
1104
-     * @throws InvalidDataTypeException
1105
-     * @throws InvalidInterfaceException
1106
-     * @throws ReflectionException
1107
-     * @since 4.9.0
1108
-     */
1109
-    public static function generate_now($message_ids)
1110
-    {
1111
-        self::_load_controller();
1112
-        $messages        = EEM_Message::instance()->get_all(
1113
-            [
1114
-                0 => [
1115
-                    'MSG_ID' => ['IN', $message_ids],
1116
-                    'STS_ID' => EEM_Message::status_incomplete,
1117
-                ],
1118
-            ]
1119
-        );
1120
-        $generated_queue = false;
1121
-        if ($messages) {
1122
-            $generated_queue = self::$_MSG_PROCESSOR->batch_generate_from_queue($messages);
1123
-        }
1124
-
1125
-        if (! $generated_queue instanceof EE_Messages_Queue) {
1126
-            EE_Error::add_error(
1127
-                esc_html__(
1128
-                    'The messages were not generated. This could mean there is already a batch being generated on a separate request, or because the selected messages are not ready for generation. Please wait a minute or two and try again.',
1129
-                    'event_espresso'
1130
-                ),
1131
-                __FILE__,
1132
-                __FUNCTION__,
1133
-                __LINE__
1134
-            );
1135
-        }
1136
-        return $generated_queue;
1137
-    }
1138
-
1139
-
1140
-    /**
1141
-     * Sends messages immediately for the incoming message_ids that have the status of EEM_Message::status_resend or,
1142
-     * EEM_Message::status_idle
1143
-     *
1144
-     * @param $message_ids
1145
-     * @return bool|EE_Messages_Queue false if no messages sent.
1146
-     * @throws EE_Error
1147
-     * @throws InvalidArgumentException
1148
-     * @throws InvalidDataTypeException
1149
-     * @throws InvalidInterfaceException
1150
-     * @throws ReflectionException
1151
-     * @since 4.9.0
1152
-     */
1153
-    public static function send_now($message_ids)
1154
-    {
1155
-        self::_load_controller();
1156
-        $messages   = EEM_Message::instance()->get_all(
1157
-            [
1158
-                0 => [
1159
-                    'MSG_ID' => ['IN', $message_ids],
1160
-                    'STS_ID' => [
1161
-                        'IN',
1162
-                        [EEM_Message::status_idle, EEM_Message::status_resend, EEM_Message::status_retry],
1163
-                    ],
1164
-                ],
1165
-            ]
1166
-        );
1167
-        $sent_queue = false;
1168
-        if ($messages) {
1169
-            $sent_queue = self::$_MSG_PROCESSOR->batch_send_from_queue($messages);
1170
-        }
1171
-
1172
-        if (! $sent_queue instanceof EE_Messages_Queue) {
1173
-            EE_Error::add_error(
1174
-                esc_html__(
1175
-                    'The messages were not sent. This could mean there is already a batch being sent on a separate request, or because the selected messages are not sendable. Please wait a minute or two and try again.',
1176
-                    'event_espresso'
1177
-                ),
1178
-                __FILE__,
1179
-                __FUNCTION__,
1180
-                __LINE__
1181
-            );
1182
-        } else {
1183
-            // can count how many sent by using the messages in the queue
1184
-            $sent_count = $sent_queue->count_STS_in_queue(EEM_Message::instance()->stati_indicating_sent());
1185
-            if ($sent_count > 0) {
1186
-                EE_Error::add_success(
1187
-                    sprintf(
1188
-                        _n(
1189
-                            'There was %d message successfully sent.',
1190
-                            'There were %d messages successfully sent.',
1191
-                            $sent_count,
1192
-                            'event_espresso'
1193
-                        ),
1194
-                        $sent_count
1195
-                    )
1196
-                );
1197
-            } else {
1198
-                EE_Error::overwrite_errors();
1199
-                EE_Error::add_error(
1200
-                    esc_html__(
1201
-                        'No message was sent because of problems with sending. Either all the messages you selected were not a sendable message, they were ALREADY sent on a different scheduled task, or there was an error.
263
+				exit;
264
+			}
265
+		}
266
+	}
267
+
268
+
269
+	/**
270
+	 *  This runs when the msg_url_trigger route has initiated.
271
+	 *
272
+	 * @param WP $WP
273
+	 * @throws EE_Error
274
+	 * @throws InvalidArgumentException
275
+	 * @throws ReflectionException
276
+	 * @throws InvalidDataTypeException
277
+	 * @throws InvalidInterfaceException
278
+	 * @since 4.5.0
279
+	 */
280
+	public function run($WP)
281
+	{
282
+		// ensure controller is loaded
283
+		self::_load_controller();
284
+		// attempt to process message
285
+		try {
286
+			/** @type EE_Message_To_Generate_From_Request $message_to_generate */
287
+			$message_to_generate = EE_Registry::instance()->load_lib('Message_To_Generate_From_Request');
288
+			self::$_MSG_PROCESSOR->generate_and_send_now($message_to_generate);
289
+		} catch (EE_Error $e) {
290
+			$error_msg = esc_html__(
291
+				'Please note that a system message failed to send due to a technical issue.',
292
+				'event_espresso'
293
+			);
294
+			// add specific message for developers if WP_DEBUG in on
295
+			$error_msg .= '||' . $e->getMessage();
296
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
297
+		}
298
+	}
299
+
300
+
301
+	/**
302
+	 * This is triggered by the 'msg_cron_trigger' route.
303
+	 *
304
+	 * @param WP $WP
305
+	 * @throws EE_Error
306
+	 */
307
+	public function execute_batch_request($WP)
308
+	{
309
+		$this->run_cron();
310
+		header('HTTP/1.1 200 OK');
311
+		exit();
312
+	}
313
+
314
+
315
+	/**
316
+	 * This gets executed on wp_cron jobs or when a batch request is initiated on its own separate non regular wp
317
+	 * request.
318
+	 *
319
+	 * @throws EE_Error
320
+	 * @throws ReflectionException
321
+	 */
322
+	public function run_cron()
323
+	{
324
+		self::_load_controller();
325
+		$request = self::getRequest();
326
+		// get required vars
327
+		$cron_type     = $request->getRequestParam('type');
328
+		$transient_key = $request->getRequestParam('key');
329
+
330
+		// now let's verify transient, if not valid exit immediately
331
+		if (! get_transient($transient_key)) {
332
+			/**
333
+			 * trigger error so this gets in the error logs.  This is important because it happens on a non-user
334
+			 * request.
335
+			 */
336
+			trigger_error(esc_attr__('Invalid Request (Transient does not exist)', 'event_espresso'));
337
+		}
338
+
339
+		// if made it here, lets' delete the transient to keep the db clean
340
+		delete_transient($transient_key);
341
+
342
+		if (apply_filters('FHEE__EED_Messages__run_cron__use_wp_cron', true)) {
343
+			$method = 'batch_' . $cron_type . '_from_queue';
344
+			if (method_exists(self::$_MSG_PROCESSOR, $method)) {
345
+				self::$_MSG_PROCESSOR->$method();
346
+			} else {
347
+				// no matching task
348
+				/**
349
+				 * trigger error so this gets in the error logs.  This is important because it happens on a non user
350
+				 * request.
351
+				 */
352
+				trigger_error(
353
+					esc_attr(
354
+						sprintf(
355
+							esc_html__('There is no task corresponding to this route %s', 'event_espresso'),
356
+							$cron_type
357
+						)
358
+					)
359
+				);
360
+			}
361
+		}
362
+
363
+		do_action('FHEE__EED_Messages__run_cron__end');
364
+	}
365
+
366
+
367
+	/**
368
+	 * This is used to retrieve the template pack for the given name.
369
+	 * Retrieved packs are cached on the static $_TMP_PACKS array.  If there is no class matching the given name then
370
+	 * the default template pack is returned.
371
+	 *
372
+	 * @param string $template_pack_name This should correspond to the dbref of the template pack (which is also used
373
+	 *                                   in generating the Pack class name).
374
+	 * @return EE_Messages_Template_Pack
375
+	 * @throws EE_Error
376
+	 * @throws InvalidArgumentException
377
+	 * @throws ReflectionException
378
+	 * @throws InvalidDataTypeException
379
+	 * @throws InvalidInterfaceException
380
+	 * @deprecated 4.9.0  @see EEH_MSG_Template::get_template_pack()
381
+	 */
382
+	public static function get_template_pack($template_pack_name)
383
+	{
384
+		EE_Registry::instance()->load_helper('MSG_Template');
385
+		return EEH_MSG_Template::get_template_pack($template_pack_name);
386
+	}
387
+
388
+
389
+	/**
390
+	 * Retrieves an array of all template packs.
391
+	 * Array is in the format array( 'dbref' => EE_Messages_Template_Pack )
392
+	 *
393
+	 * @return EE_Messages_Template_Pack[]
394
+	 * @throws EE_Error
395
+	 * @throws InvalidArgumentException
396
+	 * @throws ReflectionException
397
+	 * @throws InvalidDataTypeException
398
+	 * @throws InvalidInterfaceException
399
+	 * @deprecated 4.9.0  @see EEH_MSG_Template_Pack::get_template_pack_collection
400
+	 */
401
+	public static function get_template_packs()
402
+	{
403
+		EE_Registry::instance()->load_helper('MSG_Template');
404
+
405
+		// for backward compat, let's make sure this returns in the same format as originally.
406
+		$template_pack_collection = EEH_MSG_Template::get_template_pack_collection();
407
+		$template_pack_collection->rewind();
408
+		$template_packs = [];
409
+		while ($template_pack_collection->valid()) {
410
+			$template_packs[ $template_pack_collection->current()->dbref ] = $template_pack_collection->current();
411
+			$template_pack_collection->next();
412
+		}
413
+		return $template_packs;
414
+	}
415
+
416
+
417
+	/**
418
+	 * This simply makes sure the autoloaders are registered for the EE_messages system.
419
+	 *
420
+	 * @return void
421
+	 * @throws EE_Error
422
+	 * @since 4.5.0
423
+	 */
424
+	public static function set_autoloaders()
425
+	{
426
+		if (empty(self::$_MSG_PATHS)) {
427
+			self::_set_messages_paths();
428
+			foreach (self::$_MSG_PATHS as $path) {
429
+				EEH_Autoloader::register_autoloaders_for_each_file_in_folder($path);
430
+			}
431
+			// add aliases
432
+			EEH_Autoloader::add_alias('EE_messages', 'EE_messages');
433
+			EEH_Autoloader::add_alias('EE_messenger', 'EE_messenger');
434
+		}
435
+	}
436
+
437
+
438
+	/**
439
+	 * Take care of adding all the paths for the messages components to the $_MSG_PATHS property
440
+	 * for use by the Messages Autoloaders
441
+	 *
442
+	 * @return void.
443
+	 * @since 4.5.0
444
+	 */
445
+	protected static function _set_messages_paths()
446
+	{
447
+		self::$_MSG_PATHS = apply_filters(
448
+			'FHEE__EED_Messages___set_messages_paths___MSG_PATHS',
449
+			[
450
+				EE_LIBRARIES . 'messages/message_type',
451
+				EE_LIBRARIES . 'messages/messenger',
452
+				EE_LIBRARIES . 'messages/defaults',
453
+				EE_LIBRARIES . 'messages/defaults/email',
454
+				EE_LIBRARIES . 'messages/data_class',
455
+				EE_LIBRARIES . 'messages/validators',
456
+				EE_LIBRARIES . 'messages/validators/email',
457
+				EE_LIBRARIES . 'messages/validators/html',
458
+				EE_LIBRARIES . 'shortcodes',
459
+			]
460
+		);
461
+	}
462
+
463
+
464
+	/**
465
+	 * Takes care of loading dependencies
466
+	 *
467
+	 * @return void
468
+	 * @throws EE_Error
469
+	 * @throws InvalidArgumentException
470
+	 * @throws ReflectionException
471
+	 * @throws InvalidDataTypeException
472
+	 * @throws InvalidInterfaceException
473
+	 * @since 4.5.0
474
+	 */
475
+	protected static function _load_controller()
476
+	{
477
+		if (! self::$_MSG_PROCESSOR instanceof EE_Messages_Processor) {
478
+			EE_Registry::instance()->load_core('Request_Handler');
479
+			self::set_autoloaders();
480
+			self::$_EEMSG                    = EE_Registry::instance()->load_lib('messages');
481
+			self::$_MSG_PROCESSOR            = EE_Registry::instance()->load_lib('Messages_Processor');
482
+			self::$_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
483
+		}
484
+	}
485
+
486
+
487
+	/**
488
+	 * @param EE_Transaction $transaction
489
+	 * @throws EE_Error
490
+	 * @throws InvalidArgumentException
491
+	 * @throws InvalidDataTypeException
492
+	 * @throws InvalidInterfaceException
493
+	 * @throws ReflectionException
494
+	 */
495
+	public static function payment_reminder(EE_Transaction $transaction)
496
+	{
497
+		self::_load_controller();
498
+		$data = [$transaction, null];
499
+		self::$_MSG_PROCESSOR->generate_for_all_active_messengers('payment_reminder', $data);
500
+	}
501
+
502
+
503
+	/**
504
+	 * Any messages triggers for after successful gateway payments should go in here.
505
+	 *
506
+	 * @param EE_Transaction  $transaction object
507
+	 * @param EE_Payment|null $payment     object
508
+	 * @return void
509
+	 * @throws EE_Error
510
+	 * @throws InvalidArgumentException
511
+	 * @throws ReflectionException
512
+	 * @throws InvalidDataTypeException
513
+	 * @throws InvalidInterfaceException
514
+	 */
515
+	public static function payment(EE_Transaction $transaction, EE_Payment $payment = null)
516
+	{
517
+		// if there's no payment object, then we cannot do a payment type message!
518
+		if (! $payment instanceof EE_Payment) {
519
+			return;
520
+		}
521
+		self::_load_controller();
522
+		$data = [$transaction, $payment];
523
+		EE_Registry::instance()->load_helper('MSG_Template');
524
+		$message_type = EEH_MSG_Template::convert_payment_status_to_message_type($payment->STS_ID());
525
+		// if payment amount is less than 0 then switch to payment_refund message type.
526
+		$message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type;
527
+		self::$_MSG_PROCESSOR->generate_for_all_active_messengers($message_type, $data);
528
+	}
529
+
530
+
531
+	/**
532
+	 * @param EE_Transaction $transaction
533
+	 * @throws EE_Error
534
+	 * @throws InvalidArgumentException
535
+	 * @throws InvalidDataTypeException
536
+	 * @throws InvalidInterfaceException
537
+	 * @throws ReflectionException
538
+	 */
539
+	public static function cancelled_registration(EE_Transaction $transaction)
540
+	{
541
+		self::_load_controller();
542
+		$data = [$transaction, null];
543
+		self::$_MSG_PROCESSOR->generate_for_all_active_messengers('cancelled_registration', $data);
544
+	}
545
+
546
+
547
+	/**
548
+	 * Trigger for Registration messages
549
+	 * Note that what registration message type is sent depends on what the reg status is for the registrations on the
550
+	 * incoming transaction.
551
+	 *
552
+	 * @param EE_Registration $registration
553
+	 * @param array           $extra_details
554
+	 * @return void
555
+	 * @throws EE_Error
556
+	 * @throws InvalidArgumentException
557
+	 * @throws InvalidDataTypeException
558
+	 * @throws InvalidInterfaceException
559
+	 * @throws ReflectionException
560
+	 * @throws EntityNotFoundException
561
+	 */
562
+	public static function maybe_registration(EE_Registration $registration, $extra_details = [])
563
+	{
564
+
565
+		if (! self::_verify_registration_notification_send($registration, $extra_details)) {
566
+			// no messages please
567
+			return;
568
+		}
569
+
570
+		// get all non-trashed registrations so we make sure we send messages for the right status.
571
+		$all_registrations = $registration->transaction()->registrations(
572
+			[
573
+				['REG_deleted' => false],
574
+				'order_by' => [
575
+					'Event.EVT_name'     => 'ASC',
576
+					'Attendee.ATT_lname' => 'ASC',
577
+					'Attendee.ATT_fname' => 'ASC',
578
+				],
579
+			]
580
+		);
581
+		// cached array of statuses so we only trigger messages once per status.
582
+		$statuses_sent = [];
583
+		self::_load_controller();
584
+		$mtgs = [];
585
+
586
+		// loop through registrations and trigger messages once per status.
587
+		foreach ($all_registrations as $reg) {
588
+			// already triggered?
589
+			if (in_array($reg->status_ID(), $statuses_sent)) {
590
+				continue;
591
+			}
592
+
593
+			$message_type    = EEH_MSG_Template::convert_reg_status_to_message_type($reg->status_ID());
594
+			$mtgs            = array_merge(
595
+				$mtgs,
596
+				self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers(
597
+					$message_type,
598
+					[$registration->transaction(), null, $reg->status_ID()]
599
+				)
600
+			);
601
+			$statuses_sent[] = $reg->status_ID();
602
+		}
603
+
604
+		if (count($statuses_sent) > 1) {
605
+			$mtgs = array_merge(
606
+				$mtgs,
607
+				self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers(
608
+					'registration_summary',
609
+					[$registration->transaction(), null]
610
+				)
611
+			);
612
+		}
613
+
614
+		// batch queue and initiate request
615
+		self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist($mtgs);
616
+		self::$_MSG_PROCESSOR->get_queue()->initiate_request_by_priority();
617
+	}
618
+
619
+
620
+	/**
621
+	 * This is a helper method used to very whether a registration notification should be sent or
622
+	 * not.  Prevents duplicate notifications going out for registration context notifications.
623
+	 *
624
+	 * @param EE_Registration $registration  [description]
625
+	 * @param array           $extra_details [description]
626
+	 * @return bool          true = send away, false = nope halt the presses.
627
+	 */
628
+	protected static function _verify_registration_notification_send(
629
+		EE_Registration $registration,
630
+		$extra_details = []
631
+	) {
632
+		$request = self::getRequest();
633
+		if (
634
+			! $request->getRequestParam('non_primary_reg_notification', 0, 'int')
635
+			&& ! $registration->is_primary_registrant()
636
+		) {
637
+			return false;
638
+		}
639
+		// first we check if we're in admin and not doing front ajax
640
+		if (
641
+			($request->isAdmin() || $request->isAdminAjax())
642
+			&& ! $request->isFrontAjax()
643
+		) {
644
+			$status_change = $request->getRequestParam('txn_reg_status_change', [], 'int', true);
645
+			// make sure appropriate admin params are set for sending messages
646
+			if (
647
+				! isset($status_change['send_notifications'])
648
+				|| (isset($status_change['send_notifications']) && ! $status_change['send_notifications'])
649
+			) {
650
+				// no messages sent please.
651
+				return false;
652
+			}
653
+		} else {
654
+			// frontend request (either regular or via AJAX)
655
+			// TXN is NOT finalized ?
656
+			if (! isset($extra_details['finalized']) || $extra_details['finalized'] === false) {
657
+				return false;
658
+			}
659
+			// return visit but nothing changed ???
660
+			if (
661
+				isset($extra_details['revisit'], $extra_details['status_updates'])
662
+				&& $extra_details['revisit']
663
+				&& ! $extra_details['status_updates']
664
+			) {
665
+				return false;
666
+			}
667
+			// NOT sending messages && reg status is something other than "Not-Approved"
668
+			if (
669
+				! apply_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications', false)
670
+				&& $registration->status_ID() !== EEM_Registration::status_id_not_approved
671
+			) {
672
+				return false;
673
+			}
674
+		}
675
+		// release the kraken
676
+		return true;
677
+	}
678
+
679
+
680
+	/**
681
+	 * Simply returns an array indexed by Registration Status ID and the related message_type name associated with that
682
+	 * status id.
683
+	 *
684
+	 * @param string $reg_status
685
+	 * @return array
686
+	 * @throws EE_Error
687
+	 * @throws InvalidArgumentException
688
+	 * @throws ReflectionException
689
+	 * @throws InvalidDataTypeException
690
+	 * @throws InvalidInterfaceException
691
+	 * @deprecated        4.9.0  Use EEH_MSG_Template::reg_status_to_message_type_array()
692
+	 *                    or EEH_MSG_Template::convert_reg_status_to_message_type
693
+	 */
694
+	protected static function _get_reg_status_array($reg_status = '')
695
+	{
696
+		EE_Registry::instance()->load_helper('MSG_Template');
697
+		return EEH_MSG_Template::convert_reg_status_to_message_type($reg_status)
698
+			? EEH_MSG_Template::convert_reg_status_to_message_type($reg_status)
699
+			: EEH_MSG_Template::reg_status_to_message_type_array();
700
+	}
701
+
702
+
703
+	/**
704
+	 * Simply returns the payment message type for the given payment status.
705
+	 *
706
+	 * @param string $payment_status The payment status being matched.
707
+	 * @return bool|string The payment message type slug matching the status or false if no match.
708
+	 * @throws EE_Error
709
+	 * @throws InvalidArgumentException
710
+	 * @throws ReflectionException
711
+	 * @throws InvalidDataTypeException
712
+	 * @throws InvalidInterfaceException
713
+	 * @deprecated       4.9.0 Use EEH_MSG_Template::payment_status_to_message_type_array
714
+	 *                   or EEH_MSG_Template::convert_payment_status_to_message_type
715
+	 */
716
+	protected static function _get_payment_message_type($payment_status)
717
+	{
718
+		EE_Registry::instance()->load_helper('MSG_Template');
719
+		return EEH_MSG_Template::convert_payment_status_to_message_type($payment_status)
720
+			? EEH_MSG_Template::convert_payment_status_to_message_type($payment_status)
721
+			: false;
722
+	}
723
+
724
+
725
+	/**
726
+	 * Message triggers for a resending already sent message(s) (via EE_Message list table)
727
+	 *
728
+	 * @access public
729
+	 * @param array $req_data This is the $_POST & $_GET data sent from EE_Admin Pages
730
+	 * @return bool success/fail
731
+	 * @throws EE_Error
732
+	 * @throws InvalidArgumentException
733
+	 * @throws InvalidDataTypeException
734
+	 * @throws InvalidInterfaceException
735
+	 * @throws ReflectionException
736
+	 */
737
+	public static function process_resend(array $req_data = [])
738
+	{
739
+		self::_load_controller();
740
+		$request = self::getRequest();
741
+		// if $msgID in this request then skip to the new resend_message
742
+		if ($request->getRequestParam('MSG_ID')) {
743
+			return self::resend_message();
744
+		}
745
+
746
+		// make sure any incoming request data is set on the request so that it gets picked up later.
747
+		foreach ((array) $req_data as $request_key => $request_value) {
748
+			if (! $request->requestParamIsSet($request_key)) {
749
+				$request->setRequestParam($request_key, $request_value);
750
+			}
751
+		}
752
+
753
+		if (
754
+			! $messages_to_send = self::$_MSG_PROCESSOR->setup_messages_to_generate_from_registration_ids_in_request()
755
+		) {
756
+			return false;
757
+		}
758
+
759
+		try {
760
+			self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist($messages_to_send);
761
+			self::$_MSG_PROCESSOR->get_queue()->initiate_request_by_priority();
762
+		} catch (EE_Error $e) {
763
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
764
+			return false;
765
+		}
766
+		EE_Error::add_success(
767
+			esc_html__('Messages have been successfully queued for generation and sending.', 'event_espresso')
768
+		);
769
+		return true; // everything got queued.
770
+	}
771
+
772
+
773
+	/**
774
+	 * Message triggers for a resending already sent message(s) (via EE_Message list table)
775
+	 *
776
+	 * @return bool
777
+	 * @throws EE_Error
778
+	 * @throws InvalidArgumentException
779
+	 * @throws InvalidDataTypeException
780
+	 * @throws InvalidInterfaceException
781
+	 * @throws ReflectionException
782
+	 */
783
+	public static function resend_message()
784
+	{
785
+		self::_load_controller();
786
+
787
+		$msgID = self::getRequest()->getRequestParam('MSG_ID', 0, 'int');
788
+		if (! $msgID) {
789
+			EE_Error::add_error(
790
+				esc_html__(
791
+					'Something went wrong because there is no "MSG_ID" value in the request',
792
+					'event_espresso'
793
+				),
794
+				__FILE__,
795
+				__FUNCTION__,
796
+				__LINE__
797
+			);
798
+			return false;
799
+		}
800
+
801
+		self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send((array) $msgID);
802
+
803
+		// setup success message.
804
+		$count_ready_for_resend = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_resend);
805
+		EE_Error::add_success(
806
+			sprintf(
807
+				_n(
808
+					'There was %d message queued for resending.',
809
+					'There were %d messages queued for resending.',
810
+					$count_ready_for_resend,
811
+					'event_espresso'
812
+				),
813
+				$count_ready_for_resend
814
+			)
815
+		);
816
+		return true;
817
+	}
818
+
819
+
820
+	/**
821
+	 * Message triggers for manual payment applied by admin
822
+	 *
823
+	 * @param EE_Payment $payment EE_payment object
824
+	 * @return bool success/fail
825
+	 * @throws EE_Error
826
+	 * @throws InvalidArgumentException
827
+	 * @throws ReflectionException
828
+	 * @throws InvalidDataTypeException
829
+	 * @throws InvalidInterfaceException
830
+	 */
831
+	public static function process_admin_payment(EE_Payment $payment)
832
+	{
833
+		EE_Registry::instance()->load_helper('MSG_Template');
834
+		// we need to get the transaction object
835
+		$transaction = $payment->transaction();
836
+		if ($transaction instanceof EE_Transaction) {
837
+			$data         = [$transaction, $payment];
838
+			$message_type = EEH_MSG_Template::convert_payment_status_to_message_type($payment->STS_ID());
839
+
840
+			// if payment amount is less than 0 then switch to payment_refund message type.
841
+			$message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type;
842
+
843
+			// if payment_refund is selected, but the status is NOT accepted.  Then change message type to false so NO message notification goes out.
844
+			$message_type = $message_type == 'payment_refund' && $payment->STS_ID() != EEM_Payment::status_id_approved
845
+				? false : $message_type;
846
+
847
+			self::_load_controller();
848
+
849
+			self::$_MSG_PROCESSOR->generate_for_all_active_messengers($message_type, $data);
850
+
851
+			// get count of queued for generation
852
+			$count_to_generate = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(
853
+				[
854
+					EEM_Message::status_incomplete,
855
+					EEM_Message::status_idle,
856
+				]
857
+			);
858
+
859
+			if ($count_to_generate > 0 && self::$_MSG_PROCESSOR->get_queue()->get_message_repository()->count() !== 0) {
860
+				add_filter('FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true');
861
+				return true;
862
+			} else {
863
+				$count_failed = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(
864
+					EEM_Message::instance()->stati_indicating_failed_sending()
865
+				);
866
+				/**
867
+				 * Verify that there are actually errors.  If not then we return a success message because the queue might have been emptied due to successful
868
+				 * IMMEDIATE generation.
869
+				 */
870
+				if ($count_failed > 0) {
871
+					EE_Error::add_error(
872
+						sprintf(
873
+							_n(
874
+								'The payment notification generation failed.',
875
+								'%d payment notifications failed being sent.',
876
+								$count_failed,
877
+								'event_espresso'
878
+							),
879
+							$count_failed
880
+						),
881
+						__FILE__,
882
+						__FUNCTION__,
883
+						__LINE__
884
+					);
885
+
886
+					return false;
887
+				} else {
888
+					add_filter('FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true');
889
+					return true;
890
+				}
891
+			}
892
+		} else {
893
+			EE_Error::add_error(
894
+				esc_html__(
895
+					'Unable to generate the payment notification because the given value for the transaction is invalid.',
896
+					'event_espresso'
897
+				),
898
+				__FILE__,
899
+				__FUNCTION__,
900
+				__LINE__
901
+			);
902
+			return false;
903
+		}
904
+	}
905
+
906
+
907
+	/**
908
+	 * Callback for AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send_with_registrations trigger
909
+	 *
910
+	 * @param EE_Registration[] $registrations an array of EE_Registration objects
911
+	 * @param int               $grp_id        a specific message template group id.
912
+	 * @return void
913
+	 * @throws EE_Error
914
+	 * @throws InvalidArgumentException
915
+	 * @throws InvalidDataTypeException
916
+	 * @throws InvalidInterfaceException
917
+	 * @throws ReflectionException
918
+	 * @since   4.3.0
919
+	 */
920
+	public static function send_newsletter_message($registrations, $grp_id)
921
+	{
922
+		// make sure mtp is id and set it in the request later messages setup.
923
+		self::getRequest()->setRequestParam('GRP_ID', (int) $grp_id);
924
+		self::_load_controller();
925
+		self::$_MSG_PROCESSOR->generate_for_all_active_messengers('newsletter', $registrations);
926
+	}
927
+
928
+
929
+	/**
930
+	 * Callback for FHEE__EE_Registration__invoice_url__invoice_url or FHEE__EE_Registration__receipt_url__receipt_url
931
+	 *
932
+	 * @param string          $registration_message_trigger_url
933
+	 * @param EE_Registration $registration
934
+	 * @param string          $messenger
935
+	 * @param string          $message_type
936
+	 * @return string
937
+	 * @throws EE_Error
938
+	 * @throws InvalidArgumentException
939
+	 * @throws InvalidDataTypeException
940
+	 * @throws InvalidInterfaceException
941
+	 * @throws ReflectionException
942
+	 * @since   4.3.0
943
+	 */
944
+	public static function registration_message_trigger_url(
945
+		$registration_message_trigger_url,
946
+		EE_Registration $registration,
947
+		$messenger = 'html',
948
+		$message_type = 'invoice'
949
+	) {
950
+		// whitelist $messenger
951
+		switch ($messenger) {
952
+			case 'pdf':
953
+				$sending_messenger    = 'pdf';
954
+				$generating_messenger = 'html';
955
+				break;
956
+			case 'html':
957
+			default:
958
+				$sending_messenger    = 'html';
959
+				$generating_messenger = 'html';
960
+				break;
961
+		}
962
+		// whitelist $message_type
963
+		switch ($message_type) {
964
+			case 'receipt':
965
+				$message_type = 'receipt';
966
+				break;
967
+			case 'invoice':
968
+			default:
969
+				$message_type = 'invoice';
970
+				break;
971
+		}
972
+		// verify that both the messenger AND the message type are active
973
+		if (
974
+			EEH_MSG_Template::is_messenger_active($sending_messenger)
975
+			&& EEH_MSG_Template::is_mt_active($message_type)
976
+		) {
977
+			// need to get the correct message template group for this (i.e. is there a custom invoice for the event this registration is registered for?)
978
+			$template_query_params = [
979
+				'MTP_is_active'    => true,
980
+				'MTP_messenger'    => $generating_messenger,
981
+				'MTP_message_type' => $message_type,
982
+				'Event.EVT_ID'     => $registration->event_ID(),
983
+			];
984
+			// get the message template group.
985
+			$msg_template_group = EEM_Message_Template_Group::instance()->get_one([$template_query_params]);
986
+			// if we don't have an EE_Message_Template_Group then return
987
+			if (! $msg_template_group instanceof EE_Message_Template_Group) {
988
+				// remove EVT_ID from query params so that global templates get picked up
989
+				unset($template_query_params['Event.EVT_ID']);
990
+				// get global template as the fallback
991
+				$msg_template_group = EEM_Message_Template_Group::instance()->get_one([$template_query_params]);
992
+			}
993
+			// if we don't have an EE_Message_Template_Group then return
994
+			if (! $msg_template_group instanceof EE_Message_Template_Group) {
995
+				return '';
996
+			}
997
+			// generate the URL
998
+			$registration_message_trigger_url = EEH_MSG_Template::generate_url_trigger(
999
+				$sending_messenger,
1000
+				$generating_messenger,
1001
+				'purchaser',
1002
+				$message_type,
1003
+				$registration,
1004
+				$msg_template_group->ID(),
1005
+				$registration->transaction_ID()
1006
+			);
1007
+		}
1008
+		return $registration_message_trigger_url;
1009
+	}
1010
+
1011
+
1012
+	/**
1013
+	 * Use to generate and return a message preview!
1014
+	 *
1015
+	 * @param string $type       This should correspond with a valid message type
1016
+	 * @param string $context    This should correspond with a valid context for the message type
1017
+	 * @param string $messenger  This should correspond with a valid messenger.
1018
+	 * @param bool   $send       true we will do a test send using the messenger delivery, false we just do a regular
1019
+	 *                           preview
1020
+	 * @return bool|string The body of the message or if send is requested, sends.
1021
+	 * @throws EE_Error
1022
+	 * @throws InvalidArgumentException
1023
+	 * @throws InvalidDataTypeException
1024
+	 * @throws InvalidInterfaceException
1025
+	 * @throws ReflectionException
1026
+	 */
1027
+	public static function preview_message($type, $context, $messenger, $send = false)
1028
+	{
1029
+		self::_load_controller();
1030
+		$message_to_generate     = new EE_Message_To_Generate(
1031
+			$messenger,
1032
+			$type,
1033
+			[],
1034
+			$context,
1035
+			true
1036
+		);
1037
+		$generated_preview_queue = self::$_MSG_PROCESSOR->generate_for_preview($message_to_generate, $send);
1038
+
1039
+		if ($generated_preview_queue instanceof EE_Messages_Queue) {
1040
+			// loop through all content for the preview and remove any persisted records.
1041
+			$content = '';
1042
+			foreach ($generated_preview_queue->get_message_repository() as $message) {
1043
+				$content = $message->content();
1044
+				if ($message->ID() > 0 && $message->STS_ID() !== EEM_Message::status_failed) {
1045
+					$message->delete();
1046
+				}
1047
+			}
1048
+			return $content;
1049
+		}
1050
+		return $generated_preview_queue;
1051
+	}
1052
+
1053
+
1054
+	/**
1055
+	 * This is a method that allows for sending a message using a messenger matching the string given and the provided
1056
+	 * EE_Message_Queue object.  The EE_Message_Queue object is used to create a single aggregate EE_Message via the
1057
+	 * content found in the EE_Message objects in the queue.
1058
+	 *
1059
+	 * @param string            $messenger            a string matching a valid active messenger in the system
1060
+	 * @param string            $message_type         Although it seems contrary to the name of the method, a message
1061
+	 *                                                type name is still required to send along the message type to the
1062
+	 *                                                messenger because this is used for determining what specific
1063
+	 *                                                variations might be loaded for the generated message.
1064
+	 * @param EE_Messages_Queue $queue
1065
+	 * @param string            $custom_subject       Can be used to set what the custom subject string will be on the
1066
+	 *                                                aggregate EE_Message object.
1067
+	 * @return bool success or fail.
1068
+	 * @throws EE_Error
1069
+	 * @throws InvalidArgumentException
1070
+	 * @throws ReflectionException
1071
+	 * @throws InvalidDataTypeException
1072
+	 * @throws InvalidInterfaceException
1073
+	 * @since 4.9.0
1074
+	 */
1075
+	public static function send_message_with_messenger_only(
1076
+		$messenger,
1077
+		$message_type,
1078
+		EE_Messages_Queue $queue,
1079
+		$custom_subject = ''
1080
+	) {
1081
+		self::_load_controller();
1082
+		/** @type EE_Message_To_Generate_From_Queue $message_to_generate */
1083
+		$message_to_generate = EE_Registry::instance()->load_lib(
1084
+			'Message_To_Generate_From_Queue',
1085
+			[
1086
+				$messenger,
1087
+				$message_type,
1088
+				$queue,
1089
+				$custom_subject,
1090
+			]
1091
+		);
1092
+		return self::$_MSG_PROCESSOR->queue_for_sending($message_to_generate);
1093
+	}
1094
+
1095
+
1096
+	/**
1097
+	 * Generates Messages immediately for EE_Message IDs (but only for the correct status for generation)
1098
+	 *
1099
+	 * @param array $message_ids An array of message ids
1100
+	 * @return bool|EE_Messages_Queue false if nothing was generated, EE_Messages_Queue containing generated
1101
+	 *                           messages.
1102
+	 * @throws EE_Error
1103
+	 * @throws InvalidArgumentException
1104
+	 * @throws InvalidDataTypeException
1105
+	 * @throws InvalidInterfaceException
1106
+	 * @throws ReflectionException
1107
+	 * @since 4.9.0
1108
+	 */
1109
+	public static function generate_now($message_ids)
1110
+	{
1111
+		self::_load_controller();
1112
+		$messages        = EEM_Message::instance()->get_all(
1113
+			[
1114
+				0 => [
1115
+					'MSG_ID' => ['IN', $message_ids],
1116
+					'STS_ID' => EEM_Message::status_incomplete,
1117
+				],
1118
+			]
1119
+		);
1120
+		$generated_queue = false;
1121
+		if ($messages) {
1122
+			$generated_queue = self::$_MSG_PROCESSOR->batch_generate_from_queue($messages);
1123
+		}
1124
+
1125
+		if (! $generated_queue instanceof EE_Messages_Queue) {
1126
+			EE_Error::add_error(
1127
+				esc_html__(
1128
+					'The messages were not generated. This could mean there is already a batch being generated on a separate request, or because the selected messages are not ready for generation. Please wait a minute or two and try again.',
1129
+					'event_espresso'
1130
+				),
1131
+				__FILE__,
1132
+				__FUNCTION__,
1133
+				__LINE__
1134
+			);
1135
+		}
1136
+		return $generated_queue;
1137
+	}
1138
+
1139
+
1140
+	/**
1141
+	 * Sends messages immediately for the incoming message_ids that have the status of EEM_Message::status_resend or,
1142
+	 * EEM_Message::status_idle
1143
+	 *
1144
+	 * @param $message_ids
1145
+	 * @return bool|EE_Messages_Queue false if no messages sent.
1146
+	 * @throws EE_Error
1147
+	 * @throws InvalidArgumentException
1148
+	 * @throws InvalidDataTypeException
1149
+	 * @throws InvalidInterfaceException
1150
+	 * @throws ReflectionException
1151
+	 * @since 4.9.0
1152
+	 */
1153
+	public static function send_now($message_ids)
1154
+	{
1155
+		self::_load_controller();
1156
+		$messages   = EEM_Message::instance()->get_all(
1157
+			[
1158
+				0 => [
1159
+					'MSG_ID' => ['IN', $message_ids],
1160
+					'STS_ID' => [
1161
+						'IN',
1162
+						[EEM_Message::status_idle, EEM_Message::status_resend, EEM_Message::status_retry],
1163
+					],
1164
+				],
1165
+			]
1166
+		);
1167
+		$sent_queue = false;
1168
+		if ($messages) {
1169
+			$sent_queue = self::$_MSG_PROCESSOR->batch_send_from_queue($messages);
1170
+		}
1171
+
1172
+		if (! $sent_queue instanceof EE_Messages_Queue) {
1173
+			EE_Error::add_error(
1174
+				esc_html__(
1175
+					'The messages were not sent. This could mean there is already a batch being sent on a separate request, or because the selected messages are not sendable. Please wait a minute or two and try again.',
1176
+					'event_espresso'
1177
+				),
1178
+				__FILE__,
1179
+				__FUNCTION__,
1180
+				__LINE__
1181
+			);
1182
+		} else {
1183
+			// can count how many sent by using the messages in the queue
1184
+			$sent_count = $sent_queue->count_STS_in_queue(EEM_Message::instance()->stati_indicating_sent());
1185
+			if ($sent_count > 0) {
1186
+				EE_Error::add_success(
1187
+					sprintf(
1188
+						_n(
1189
+							'There was %d message successfully sent.',
1190
+							'There were %d messages successfully sent.',
1191
+							$sent_count,
1192
+							'event_espresso'
1193
+						),
1194
+						$sent_count
1195
+					)
1196
+				);
1197
+			} else {
1198
+				EE_Error::overwrite_errors();
1199
+				EE_Error::add_error(
1200
+					esc_html__(
1201
+						'No message was sent because of problems with sending. Either all the messages you selected were not a sendable message, they were ALREADY sent on a different scheduled task, or there was an error.
1202 1202
 					If there was an error, you can look at the messages in the message activity list table for any error messages.',
1203
-                        'event_espresso'
1204
-                    ),
1205
-                    __FILE__,
1206
-                    __FUNCTION__,
1207
-                    __LINE__
1208
-                );
1209
-            }
1210
-        }
1211
-        return $sent_queue;
1212
-    }
1213
-
1214
-
1215
-    /**
1216
-     * Generate and send immediately from the given $message_ids
1217
-     *
1218
-     * @param array $message_ids EE_Message entity ids.
1219
-     * @throws EE_Error
1220
-     * @throws InvalidArgumentException
1221
-     * @throws InvalidDataTypeException
1222
-     * @throws InvalidInterfaceException
1223
-     * @throws ReflectionException
1224
-     */
1225
-    public static function generate_and_send_now(array $message_ids)
1226
-    {
1227
-        $generated_queue = self::generate_now($message_ids);
1228
-        // now let's just trigger sending immediately from this queue.
1229
-        $messages_sent = $generated_queue instanceof EE_Messages_Queue
1230
-            ? $generated_queue->execute()
1231
-            : 0;
1232
-        if ($messages_sent) {
1233
-            EE_Error::add_success(
1234
-                esc_html(
1235
-                    sprintf(
1236
-                        _n(
1237
-                            'There was %d message successfully generated and sent.',
1238
-                            'There were %d messages successfully generated and sent.',
1239
-                            $messages_sent,
1240
-                            'event_espresso'
1241
-                        ),
1242
-                        $messages_sent
1243
-                    )
1244
-                )
1245
-            );
1246
-            // errors would be added via the generate_now method.
1247
-        }
1248
-    }
1249
-
1250
-
1251
-    /**
1252
-     * This will queue the incoming message ids for resending.
1253
-     * Note, only message_ids corresponding to messages with the status of EEM_Message::sent will be queued.
1254
-     *
1255
-     * @param array $message_ids An array of EE_Message IDs
1256
-     * @return bool true means messages were successfully queued for resending, false means none were queued for
1257
-     *                           resending.
1258
-     * @throws EE_Error
1259
-     * @throws InvalidArgumentException
1260
-     * @throws InvalidDataTypeException
1261
-     * @throws InvalidInterfaceException
1262
-     * @throws ReflectionException
1263
-     * @since 4.9.0
1264
-     */
1265
-    public static function queue_for_resending($message_ids)
1266
-    {
1267
-        self::_load_controller();
1268
-        self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send($message_ids);
1269
-
1270
-        // get queue and count
1271
-        $queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_resend);
1272
-
1273
-        if (
1274
-            $queue_count > 0
1275
-        ) {
1276
-            EE_Error::add_success(
1277
-                sprintf(
1278
-                    _n(
1279
-                        '%d message successfully queued for resending.',
1280
-                        '%d messages successfully queued for resending.',
1281
-                        $queue_count,
1282
-                        'event_espresso'
1283
-                    ),
1284
-                    $queue_count
1285
-                )
1286
-            );
1287
-            /**
1288
-             * @see filter usage in EE_Messages_Queue::initiate_request_by_priority
1289
-             */
1290
-        } elseif (
1291
-            apply_filters('FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', true)
1292
-            || EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request
1293
-        ) {
1294
-            $queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_sent);
1295
-            if ($queue_count > 0) {
1296
-                EE_Error::add_success(
1297
-                    sprintf(
1298
-                        _n(
1299
-                            '%d message successfully sent.',
1300
-                            '%d messages successfully sent.',
1301
-                            $queue_count,
1302
-                            'event_espresso'
1303
-                        ),
1304
-                        $queue_count
1305
-                    )
1306
-                );
1307
-            } else {
1308
-                EE_Error::add_error(
1309
-                    esc_html__(
1310
-                        'No messages were queued for resending. This usually only happens when all the messages flagged for resending are not a status that can be resent.',
1311
-                        'event_espresso'
1312
-                    ),
1313
-                    __FILE__,
1314
-                    __FUNCTION__,
1315
-                    __LINE__
1316
-                );
1317
-            }
1318
-        } else {
1319
-            EE_Error::add_error(
1320
-                esc_html__(
1321
-                    'No messages were queued for resending. This usually only happens when all the messages flagged for resending are not a status that can be resent.',
1322
-                    'event_espresso'
1323
-                ),
1324
-                __FILE__,
1325
-                __FUNCTION__,
1326
-                __LINE__
1327
-            );
1328
-        }
1329
-        return (bool) $queue_count;
1330
-    }
1331
-
1332
-
1333
-    /**
1334
-     * debug
1335
-     *
1336
-     * @param string              $class
1337
-     * @param string              $func
1338
-     * @param string              $line
1339
-     * @param EE_Transaction|null $transaction
1340
-     * @param array               $info
1341
-     * @param bool                $display_request
1342
-     * @throws EE_Error
1343
-     * @throws ReflectionException
1344
-     * @throws InvalidSessionDataException
1345
-     */
1346
-    protected static function log(
1347
-        $class = '',
1348
-        $func = '',
1349
-        $line = '',
1350
-        EE_Transaction $transaction = null,
1351
-        $info = [],
1352
-        $display_request = false
1353
-    ) {
1354
-        if (defined('EE_DEBUG') && EE_DEBUG) {
1355
-            if ($transaction instanceof EE_Transaction) {
1356
-                // don't serialize objects
1357
-                $info                  = EEH_Debug_Tools::strip_objects($info);
1358
-                $info['TXN_status']    = $transaction->status_ID();
1359
-                $info['TXN_reg_steps'] = $transaction->reg_steps();
1360
-                if ($transaction->ID()) {
1361
-                    $index = 'EE_Transaction: ' . $transaction->ID();
1362
-                    EEH_Debug_Tools::log($class, $func, $line, $info, $display_request, $index);
1363
-                }
1364
-            }
1365
-        }
1366
-    }
1367
-
1368
-
1369
-    /**
1370
-     *  Resets all the static properties in this class when called.
1371
-     */
1372
-    public static function reset()
1373
-    {
1374
-        self::$_EEMSG                    = null;
1375
-        self::$_message_resource_manager = null;
1376
-        self::$_MSG_PROCESSOR            = null;
1377
-        self::$_MSG_PATHS                = null;
1378
-        self::$_TMP_PACKS                = [];
1379
-    }
1203
+						'event_espresso'
1204
+					),
1205
+					__FILE__,
1206
+					__FUNCTION__,
1207
+					__LINE__
1208
+				);
1209
+			}
1210
+		}
1211
+		return $sent_queue;
1212
+	}
1213
+
1214
+
1215
+	/**
1216
+	 * Generate and send immediately from the given $message_ids
1217
+	 *
1218
+	 * @param array $message_ids EE_Message entity ids.
1219
+	 * @throws EE_Error
1220
+	 * @throws InvalidArgumentException
1221
+	 * @throws InvalidDataTypeException
1222
+	 * @throws InvalidInterfaceException
1223
+	 * @throws ReflectionException
1224
+	 */
1225
+	public static function generate_and_send_now(array $message_ids)
1226
+	{
1227
+		$generated_queue = self::generate_now($message_ids);
1228
+		// now let's just trigger sending immediately from this queue.
1229
+		$messages_sent = $generated_queue instanceof EE_Messages_Queue
1230
+			? $generated_queue->execute()
1231
+			: 0;
1232
+		if ($messages_sent) {
1233
+			EE_Error::add_success(
1234
+				esc_html(
1235
+					sprintf(
1236
+						_n(
1237
+							'There was %d message successfully generated and sent.',
1238
+							'There were %d messages successfully generated and sent.',
1239
+							$messages_sent,
1240
+							'event_espresso'
1241
+						),
1242
+						$messages_sent
1243
+					)
1244
+				)
1245
+			);
1246
+			// errors would be added via the generate_now method.
1247
+		}
1248
+	}
1249
+
1250
+
1251
+	/**
1252
+	 * This will queue the incoming message ids for resending.
1253
+	 * Note, only message_ids corresponding to messages with the status of EEM_Message::sent will be queued.
1254
+	 *
1255
+	 * @param array $message_ids An array of EE_Message IDs
1256
+	 * @return bool true means messages were successfully queued for resending, false means none were queued for
1257
+	 *                           resending.
1258
+	 * @throws EE_Error
1259
+	 * @throws InvalidArgumentException
1260
+	 * @throws InvalidDataTypeException
1261
+	 * @throws InvalidInterfaceException
1262
+	 * @throws ReflectionException
1263
+	 * @since 4.9.0
1264
+	 */
1265
+	public static function queue_for_resending($message_ids)
1266
+	{
1267
+		self::_load_controller();
1268
+		self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send($message_ids);
1269
+
1270
+		// get queue and count
1271
+		$queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_resend);
1272
+
1273
+		if (
1274
+			$queue_count > 0
1275
+		) {
1276
+			EE_Error::add_success(
1277
+				sprintf(
1278
+					_n(
1279
+						'%d message successfully queued for resending.',
1280
+						'%d messages successfully queued for resending.',
1281
+						$queue_count,
1282
+						'event_espresso'
1283
+					),
1284
+					$queue_count
1285
+				)
1286
+			);
1287
+			/**
1288
+			 * @see filter usage in EE_Messages_Queue::initiate_request_by_priority
1289
+			 */
1290
+		} elseif (
1291
+			apply_filters('FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', true)
1292
+			|| EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request
1293
+		) {
1294
+			$queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_sent);
1295
+			if ($queue_count > 0) {
1296
+				EE_Error::add_success(
1297
+					sprintf(
1298
+						_n(
1299
+							'%d message successfully sent.',
1300
+							'%d messages successfully sent.',
1301
+							$queue_count,
1302
+							'event_espresso'
1303
+						),
1304
+						$queue_count
1305
+					)
1306
+				);
1307
+			} else {
1308
+				EE_Error::add_error(
1309
+					esc_html__(
1310
+						'No messages were queued for resending. This usually only happens when all the messages flagged for resending are not a status that can be resent.',
1311
+						'event_espresso'
1312
+					),
1313
+					__FILE__,
1314
+					__FUNCTION__,
1315
+					__LINE__
1316
+				);
1317
+			}
1318
+		} else {
1319
+			EE_Error::add_error(
1320
+				esc_html__(
1321
+					'No messages were queued for resending. This usually only happens when all the messages flagged for resending are not a status that can be resent.',
1322
+					'event_espresso'
1323
+				),
1324
+				__FILE__,
1325
+				__FUNCTION__,
1326
+				__LINE__
1327
+			);
1328
+		}
1329
+		return (bool) $queue_count;
1330
+	}
1331
+
1332
+
1333
+	/**
1334
+	 * debug
1335
+	 *
1336
+	 * @param string              $class
1337
+	 * @param string              $func
1338
+	 * @param string              $line
1339
+	 * @param EE_Transaction|null $transaction
1340
+	 * @param array               $info
1341
+	 * @param bool                $display_request
1342
+	 * @throws EE_Error
1343
+	 * @throws ReflectionException
1344
+	 * @throws InvalidSessionDataException
1345
+	 */
1346
+	protected static function log(
1347
+		$class = '',
1348
+		$func = '',
1349
+		$line = '',
1350
+		EE_Transaction $transaction = null,
1351
+		$info = [],
1352
+		$display_request = false
1353
+	) {
1354
+		if (defined('EE_DEBUG') && EE_DEBUG) {
1355
+			if ($transaction instanceof EE_Transaction) {
1356
+				// don't serialize objects
1357
+				$info                  = EEH_Debug_Tools::strip_objects($info);
1358
+				$info['TXN_status']    = $transaction->status_ID();
1359
+				$info['TXN_reg_steps'] = $transaction->reg_steps();
1360
+				if ($transaction->ID()) {
1361
+					$index = 'EE_Transaction: ' . $transaction->ID();
1362
+					EEH_Debug_Tools::log($class, $func, $line, $info, $display_request, $index);
1363
+				}
1364
+			}
1365
+		}
1366
+	}
1367
+
1368
+
1369
+	/**
1370
+	 *  Resets all the static properties in this class when called.
1371
+	 */
1372
+	public static function reset()
1373
+	{
1374
+		self::$_EEMSG                    = null;
1375
+		self::$_message_resource_manager = null;
1376
+		self::$_MSG_PROCESSOR            = null;
1377
+		self::$_MSG_PATHS                = null;
1378
+		self::$_TMP_PACKS                = [];
1379
+	}
1380 1380
 }
Please login to merge, or discard this patch.
admin_pages/venues/Venues_Admin_List_Table.class.php 1 patch
Indentation   +258 added lines, -258 removed lines patch added patch discarded remove patch
@@ -13,269 +13,269 @@
 block discarded – undo
13 13
  */
14 14
 class Venues_Admin_List_Table extends EE_Admin_List_Table
15 15
 {
16
-    /**
17
-     * @var Venues_Admin_Page $_admin_page
18
-     */
19
-    protected EE_Admin_Page $_admin_page;
20
-
21
-
22
-    protected function _setup_data()
23
-    {
24
-        $this->_data           = $this->_admin_page->get_venues($this->_per_page);
25
-        $this->_all_data_count = $this->_admin_page->get_venues($this->_per_page, true);
26
-    }
27
-
28
-
29
-    protected function _set_properties()
30
-    {
31
-        $this->_wp_list_args = [
32
-            'singular' => esc_html__('Event Venue', 'event_espresso'),
33
-            'plural'   => esc_html__('Event Venues', 'event_espresso'),
34
-            'ajax'     => true, // for now,
35
-            'screen'   => $this->_admin_page->get_current_screen()->id,
36
-        ];
37
-
38
-        $this->_columns = [
39
-            'cb'       => '<input type="checkbox" />',
40
-            'id'       => esc_html__('ID', 'event_espresso'),
41
-            'name'     => esc_html__('Name', 'event_espresso'),
42
-            'address'  => esc_html__('Address', 'event_espresso'),
43
-            'city'     => esc_html__('City', 'event_espresso'),
44
-            'capacity' => esc_html__('Capacity', 'event_espresso'),
45
-            // 'shortcode' => esc_html__('Shortcode', 'event_espresso'),
46
-        ];
47
-
48
-        $this->_sortable_columns = [
49
-            'id'       => ['id' => true],
50
-            'name'     => ['name' => false],
51
-            'city'     => ['city' => false],
52
-            'capacity' => ['capacity' => false],
53
-        ];
54
-
55
-        $this->_hidden_columns = [];
56
-    }
57
-
58
-
59
-    // todo... add _venue_status in here (which we'll define a EE_Admin_CPT_List_Table for common properties)
60
-
61
-
62
-    /**
63
-     * @return array
64
-     */
65
-    protected function _get_table_filters()
66
-    {
67
-        return [];
68
-    }
69
-
70
-
71
-    /**
72
-     * @throws EE_Error
73
-     * @throws ReflectionException
74
-     */
75
-    protected function _add_view_counts()
76
-    {
77
-        $this->_views['all']['count'] = EEM_Venue::instance()->count();
78
-        if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) {
79
-            $this->_views['trash']['count'] = EEM_Venue::instance()->count_deleted();
80
-        }
81
-    }
82
-
83
-
84
-    /**
85
-     * @param EE_Venue|null $item
86
-     * @return string
87
-     * @throws EE_Error
88
-     * @throws ReflectionException
89
-     */
90
-    public function column_cb($item): string
91
-    {
92
-        return $item->count_related('Event') > 0 && $item->get('status') === 'trash'
93
-            ? '<span class="dashicons dashicons-lock"></span>'
94
-            : sprintf(
95
-                '<input type="checkbox" name="venue_id[]" value="%s" />',
96
-                $item->ID()
97
-            );
98
-    }
99
-
100
-
101
-    /**
102
-     * @param EE_Venue $venue
103
-     * @return string
104
-     * @throws EE_Error
105
-     * @throws ReflectionException
106
-     */
107
-    public function column_id(EE_Venue $venue): string
108
-    {
109
-        $content = '
16
+	/**
17
+	 * @var Venues_Admin_Page $_admin_page
18
+	 */
19
+	protected EE_Admin_Page $_admin_page;
20
+
21
+
22
+	protected function _setup_data()
23
+	{
24
+		$this->_data           = $this->_admin_page->get_venues($this->_per_page);
25
+		$this->_all_data_count = $this->_admin_page->get_venues($this->_per_page, true);
26
+	}
27
+
28
+
29
+	protected function _set_properties()
30
+	{
31
+		$this->_wp_list_args = [
32
+			'singular' => esc_html__('Event Venue', 'event_espresso'),
33
+			'plural'   => esc_html__('Event Venues', 'event_espresso'),
34
+			'ajax'     => true, // for now,
35
+			'screen'   => $this->_admin_page->get_current_screen()->id,
36
+		];
37
+
38
+		$this->_columns = [
39
+			'cb'       => '<input type="checkbox" />',
40
+			'id'       => esc_html__('ID', 'event_espresso'),
41
+			'name'     => esc_html__('Name', 'event_espresso'),
42
+			'address'  => esc_html__('Address', 'event_espresso'),
43
+			'city'     => esc_html__('City', 'event_espresso'),
44
+			'capacity' => esc_html__('Capacity', 'event_espresso'),
45
+			// 'shortcode' => esc_html__('Shortcode', 'event_espresso'),
46
+		];
47
+
48
+		$this->_sortable_columns = [
49
+			'id'       => ['id' => true],
50
+			'name'     => ['name' => false],
51
+			'city'     => ['city' => false],
52
+			'capacity' => ['capacity' => false],
53
+		];
54
+
55
+		$this->_hidden_columns = [];
56
+	}
57
+
58
+
59
+	// todo... add _venue_status in here (which we'll define a EE_Admin_CPT_List_Table for common properties)
60
+
61
+
62
+	/**
63
+	 * @return array
64
+	 */
65
+	protected function _get_table_filters()
66
+	{
67
+		return [];
68
+	}
69
+
70
+
71
+	/**
72
+	 * @throws EE_Error
73
+	 * @throws ReflectionException
74
+	 */
75
+	protected function _add_view_counts()
76
+	{
77
+		$this->_views['all']['count'] = EEM_Venue::instance()->count();
78
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) {
79
+			$this->_views['trash']['count'] = EEM_Venue::instance()->count_deleted();
80
+		}
81
+	}
82
+
83
+
84
+	/**
85
+	 * @param EE_Venue|null $item
86
+	 * @return string
87
+	 * @throws EE_Error
88
+	 * @throws ReflectionException
89
+	 */
90
+	public function column_cb($item): string
91
+	{
92
+		return $item->count_related('Event') > 0 && $item->get('status') === 'trash'
93
+			? '<span class="dashicons dashicons-lock"></span>'
94
+			: sprintf(
95
+				'<input type="checkbox" name="venue_id[]" value="%s" />',
96
+				$item->ID()
97
+			);
98
+	}
99
+
100
+
101
+	/**
102
+	 * @param EE_Venue $venue
103
+	 * @return string
104
+	 * @throws EE_Error
105
+	 * @throws ReflectionException
106
+	 */
107
+	public function column_id(EE_Venue $venue): string
108
+	{
109
+		$content = '
110 110
             <span class="ee-entity-id">' . $venue->ID() . '</span>
111 111
             <span class="show-on-mobile-view-only">' . $this->column_name($venue, false) . '</span>';
112
-        return $this->columnContent('id', $content, 'end');
113
-    }
114
-
115
-
116
-    /**
117
-     * @param EE_Venue $venue
118
-     * @param bool     $prep_content
119
-     * @return string
120
-     * @throws EE_Error
121
-     * @throws ReflectionException
122
-     */
123
-    public function column_name(EE_Venue $venue, bool $prep_content = true): string
124
-    {
125
-        $edit_link = EE_Admin_Page::add_query_args_and_nonce(
126
-            [
127
-                'action' => 'edit',
128
-                'post'   => $venue->ID(),
129
-            ],
130
-            EE_VENUES_ADMIN_URL
131
-        );
132
-
133
-        $statuses = EEM_Venue::instance()->get_status_array();
134
-        $actions  = $prep_content ? $this->_column_name_action_setup($venue) : [];
135
-        $content  =
136
-            EE_Registry::instance()->CAP->current_user_can('ee_edit_venue', 'espresso_venues_edit', $venue->ID())
137
-                ? '<strong><a class="row-title" href="' . $edit_link . '">' . stripslashes_deep(
138
-                    $venue->name()
139
-                ) . '</a></strong>' : $venue->name();
140
-        $content  .= $venue->status() == 'draft' ? ' - <span class="post-state">' . $statuses['draft'] . '</span>' : '';
141
-
142
-        $content .= $prep_content ? $this->row_actions($actions) : '';
143
-        return $prep_content ? $this->columnContent('name', $content) : $content;
144
-    }
145
-
146
-
147
-    /**
148
-     * Used to setup the actions for the Venue name column
149
-     *
150
-     * @param EE_Venue $venue
151
-     * @return array()
152
-     * @throws EE_Error
153
-     * @throws ReflectionException
154
-     * @throws EE_Error
155
-     * @throws ReflectionException
156
-     */
157
-    protected function _column_name_action_setup(EE_Venue $venue): array
158
-    {
159
-        $actions = [];
160
-
161
-        if (EE_Registry::instance()->CAP->current_user_can('ee_edit_venue', 'espresso_venues_edit', $venue->ID())) {
162
-            $edit_query_args = [
163
-                'action' => 'edit',
164
-                'post'   => $venue->ID(),
165
-            ];
166
-            $edit_link       = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_VENUES_ADMIN_URL);
167
-            $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr__(
168
-                'Edit Venue',
169
-                'event_espresso'
170
-            ) . '">' . esc_html__('Edit', 'event_espresso') . '</a>';
171
-        }
172
-
173
-
174
-        switch ($venue->get('status')) {
175
-            case 'trash':
176
-                if (
177
-                    EE_Registry::instance()->CAP->current_user_can(
178
-                        'ee_delete_venue',
179
-                        'espresso_venues_restore_venue',
180
-                        $venue->ID()
181
-                    )
182
-                ) {
183
-                    $restore_venue_link = EE_Admin_Page::add_query_args_and_nonce(
184
-                        [
185
-                            'action' => 'restore_venue',
186
-                            'VNU_ID' => $venue->ID(),
187
-                        ],
188
-                        EE_VENUES_ADMIN_URL
189
-                    );
190
-
191
-                    $actions['restore_from_trash'] = '<a href="' . $restore_venue_link . '" title="' . esc_attr__(
192
-                        'Restore from Trash',
193
-                        'event_espresso'
194
-                    ) . '">' . esc_html__('Restore from Trash', 'event_espresso') . '</a>';
195
-                }
196
-                if (
197
-                    $venue->count_related('Event') === 0
198
-                    && EE_Registry::instance()->CAP->current_user_can(
199
-                        'ee_delete_venue',
200
-                        'espresso_venues_delete_venue',
201
-                        $venue->ID()
202
-                    )
203
-                ) {
204
-                    $delete_venue_link = EE_Admin_Page::add_query_args_and_nonce(
205
-                        [
206
-                            'action' => 'delete_venue',
207
-                            'VNU_ID' => $venue->ID(),
208
-                        ],
209
-                        EE_VENUES_ADMIN_URL
210
-                    );
211
-
212
-                    $actions['delete permanently'] = '<a href="' . $delete_venue_link . '" title="' . esc_attr__(
213
-                        'Delete Permanently',
214
-                        'event_espresso'
215
-                    ) . '">' . esc_html__('Delete Permanently', 'event_espresso') . '</a>';
216
-                }
217
-                break;
218
-            default:
219
-                $actions['view'] = '
112
+		return $this->columnContent('id', $content, 'end');
113
+	}
114
+
115
+
116
+	/**
117
+	 * @param EE_Venue $venue
118
+	 * @param bool     $prep_content
119
+	 * @return string
120
+	 * @throws EE_Error
121
+	 * @throws ReflectionException
122
+	 */
123
+	public function column_name(EE_Venue $venue, bool $prep_content = true): string
124
+	{
125
+		$edit_link = EE_Admin_Page::add_query_args_and_nonce(
126
+			[
127
+				'action' => 'edit',
128
+				'post'   => $venue->ID(),
129
+			],
130
+			EE_VENUES_ADMIN_URL
131
+		);
132
+
133
+		$statuses = EEM_Venue::instance()->get_status_array();
134
+		$actions  = $prep_content ? $this->_column_name_action_setup($venue) : [];
135
+		$content  =
136
+			EE_Registry::instance()->CAP->current_user_can('ee_edit_venue', 'espresso_venues_edit', $venue->ID())
137
+				? '<strong><a class="row-title" href="' . $edit_link . '">' . stripslashes_deep(
138
+					$venue->name()
139
+				) . '</a></strong>' : $venue->name();
140
+		$content  .= $venue->status() == 'draft' ? ' - <span class="post-state">' . $statuses['draft'] . '</span>' : '';
141
+
142
+		$content .= $prep_content ? $this->row_actions($actions) : '';
143
+		return $prep_content ? $this->columnContent('name', $content) : $content;
144
+	}
145
+
146
+
147
+	/**
148
+	 * Used to setup the actions for the Venue name column
149
+	 *
150
+	 * @param EE_Venue $venue
151
+	 * @return array()
152
+	 * @throws EE_Error
153
+	 * @throws ReflectionException
154
+	 * @throws EE_Error
155
+	 * @throws ReflectionException
156
+	 */
157
+	protected function _column_name_action_setup(EE_Venue $venue): array
158
+	{
159
+		$actions = [];
160
+
161
+		if (EE_Registry::instance()->CAP->current_user_can('ee_edit_venue', 'espresso_venues_edit', $venue->ID())) {
162
+			$edit_query_args = [
163
+				'action' => 'edit',
164
+				'post'   => $venue->ID(),
165
+			];
166
+			$edit_link       = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_VENUES_ADMIN_URL);
167
+			$actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr__(
168
+				'Edit Venue',
169
+				'event_espresso'
170
+			) . '">' . esc_html__('Edit', 'event_espresso') . '</a>';
171
+		}
172
+
173
+
174
+		switch ($venue->get('status')) {
175
+			case 'trash':
176
+				if (
177
+					EE_Registry::instance()->CAP->current_user_can(
178
+						'ee_delete_venue',
179
+						'espresso_venues_restore_venue',
180
+						$venue->ID()
181
+					)
182
+				) {
183
+					$restore_venue_link = EE_Admin_Page::add_query_args_and_nonce(
184
+						[
185
+							'action' => 'restore_venue',
186
+							'VNU_ID' => $venue->ID(),
187
+						],
188
+						EE_VENUES_ADMIN_URL
189
+					);
190
+
191
+					$actions['restore_from_trash'] = '<a href="' . $restore_venue_link . '" title="' . esc_attr__(
192
+						'Restore from Trash',
193
+						'event_espresso'
194
+					) . '">' . esc_html__('Restore from Trash', 'event_espresso') . '</a>';
195
+				}
196
+				if (
197
+					$venue->count_related('Event') === 0
198
+					&& EE_Registry::instance()->CAP->current_user_can(
199
+						'ee_delete_venue',
200
+						'espresso_venues_delete_venue',
201
+						$venue->ID()
202
+					)
203
+				) {
204
+					$delete_venue_link = EE_Admin_Page::add_query_args_and_nonce(
205
+						[
206
+							'action' => 'delete_venue',
207
+							'VNU_ID' => $venue->ID(),
208
+						],
209
+						EE_VENUES_ADMIN_URL
210
+					);
211
+
212
+					$actions['delete permanently'] = '<a href="' . $delete_venue_link . '" title="' . esc_attr__(
213
+						'Delete Permanently',
214
+						'event_espresso'
215
+					) . '">' . esc_html__('Delete Permanently', 'event_espresso') . '</a>';
216
+				}
217
+				break;
218
+			default:
219
+				$actions['view'] = '
220 220
                     <a  href="' . get_permalink($venue->ID()) . '"
221 221
                         title="' . esc_attr__('View Venue', 'event_espresso') . '"
222 222
                     >
223 223
                         ' . esc_html__('View', 'event_espresso') . '
224 224
                     </a>';
225
-                if (
226
-                    EE_Registry::instance()->CAP->current_user_can(
227
-                        'ee_delete_venue',
228
-                        'espresso_venues_trash_venue',
229
-                        $venue->ID()
230
-                    )
231
-                ) {
232
-                    $trash_venue_link = EE_Admin_Page::add_query_args_and_nonce(
233
-                        [
234
-                            'action' => 'trash_venue',
235
-                            'VNU_ID' => $venue->ID(),
236
-                        ],
237
-                        EE_VENUES_ADMIN_URL
238
-                    );
239
-
240
-                    $actions['move to trash'] = '<a href="' . $trash_venue_link . '" title="' . esc_attr__(
241
-                        'Trash Event',
242
-                        'event_espresso'
243
-                    ) . '">' . esc_html__('Trash', 'event_espresso') . '</a>';
244
-                }
245
-        }
246
-        return $actions;
247
-    }
248
-
249
-
250
-    public function column_address(EE_Venue $venue): string
251
-    {
252
-        return $this->columnContent('address', $venue->address());
253
-    }
254
-
255
-
256
-    public function column_city(EE_Venue $venue): string
257
-    {
258
-        return $this->columnContent('city', $venue->city());
259
-    }
260
-
261
-
262
-    /**
263
-     * @throws EE_Error
264
-     * @throws ReflectionException
265
-     */
266
-    public function column_capacity(EE_Venue $venue): string
267
-    {
268
-        return $this->columnContent('capacity', $venue->capacity());
269
-    }
270
-
271
-
272
-    /**
273
-     * @throws ReflectionException
274
-     * @throws EE_Error
275
-     */
276
-    public function column_shortcode(EE_Venue $venue): string
277
-    {
278
-        $content = '[ESPRESSO_VENUE id=' . $venue->ID() . ']';
279
-        return $this->columnContent('shortcode', $content);
280
-    }
225
+				if (
226
+					EE_Registry::instance()->CAP->current_user_can(
227
+						'ee_delete_venue',
228
+						'espresso_venues_trash_venue',
229
+						$venue->ID()
230
+					)
231
+				) {
232
+					$trash_venue_link = EE_Admin_Page::add_query_args_and_nonce(
233
+						[
234
+							'action' => 'trash_venue',
235
+							'VNU_ID' => $venue->ID(),
236
+						],
237
+						EE_VENUES_ADMIN_URL
238
+					);
239
+
240
+					$actions['move to trash'] = '<a href="' . $trash_venue_link . '" title="' . esc_attr__(
241
+						'Trash Event',
242
+						'event_espresso'
243
+					) . '">' . esc_html__('Trash', 'event_espresso') . '</a>';
244
+				}
245
+		}
246
+		return $actions;
247
+	}
248
+
249
+
250
+	public function column_address(EE_Venue $venue): string
251
+	{
252
+		return $this->columnContent('address', $venue->address());
253
+	}
254
+
255
+
256
+	public function column_city(EE_Venue $venue): string
257
+	{
258
+		return $this->columnContent('city', $venue->city());
259
+	}
260
+
261
+
262
+	/**
263
+	 * @throws EE_Error
264
+	 * @throws ReflectionException
265
+	 */
266
+	public function column_capacity(EE_Venue $venue): string
267
+	{
268
+		return $this->columnContent('capacity', $venue->capacity());
269
+	}
270
+
271
+
272
+	/**
273
+	 * @throws ReflectionException
274
+	 * @throws EE_Error
275
+	 */
276
+	public function column_shortcode(EE_Venue $venue): string
277
+	{
278
+		$content = '[ESPRESSO_VENUE id=' . $venue->ID() . ']';
279
+		return $this->columnContent('shortcode', $content);
280
+	}
281 281
 }
Please login to merge, or discard this patch.
admin_pages/registrations/EE_Attendee_Contact_List_Table.class.php 1 patch
Indentation   +386 added lines, -386 removed lines patch added patch discarded remove patch
@@ -12,412 +12,412 @@
 block discarded – undo
12 12
  */
13 13
 class EE_Attendee_Contact_List_Table extends EE_Admin_List_Table
14 14
 {
15
-    /**
16
-     * @var Registrations_Admin_Page
17
-     */
18
-    protected EE_Admin_Page $_admin_page;
19
-
20
-
21
-    /**
22
-     * Initial setup of data (called by parent).
23
-     *
24
-     * @throws EE_Error
25
-     */
26
-    protected function _setup_data()
27
-    {
28
-        $this->_data = $this->_view !== 'trash'
29
-            ? $this->_admin_page->get_attendees($this->_per_page)
30
-            : $this->_admin_page->get_attendees($this->_per_page, false, true);
31
-
32
-        $this->_all_data_count = $this->_view !== 'trash'
33
-            ? $this->_admin_page->get_attendees($this->_per_page, true)
34
-            : $this->_admin_page->get_attendees($this->_per_page, true, true);
35
-    }
36
-
37
-
38
-    /**
39
-     * Initial setup of properties.
40
-     */
41
-    protected function _set_properties()
42
-    {
43
-        $this->_wp_list_args = [
44
-            'singular' => esc_html__('attendee', 'event_espresso'),
45
-            'plural'   => esc_html__('attendees', 'event_espresso'),
46
-            'ajax'     => true,
47
-            'screen'   => $this->_admin_page->get_current_screen()->id,
48
-        ];
49
-
50
-        $this->_columns = [
51
-            'cb'                 => '<input type="checkbox" />', // Render a checkbox instead of text
52
-            'id'                 => esc_html__('ID', 'event_espresso'),
53
-            'ATT_fname'          => esc_html__('First Name', 'event_espresso'),
54
-            'ATT_lname'          => esc_html__('Last Name', 'event_espresso'),
55
-            'ATT_email'          => esc_html__('Email Address', 'event_espresso'),
56
-            'Registration_Count' => esc_html__('# Reg', 'event_espresso'),
57
-            'ATT_phone'          => esc_html__('Phone', 'event_espresso'),
58
-            'ATT_address'        => esc_html__('Address', 'event_espresso'),
59
-            'ATT_city'           => esc_html__('City', 'event_espresso'),
60
-            'STA_ID'             => esc_html__('State/Province', 'event_espresso'),
61
-            'CNT_ISO'            => esc_html__('Country', 'event_espresso'),
62
-        ];
63
-
64
-        $this->_sortable_columns = [
65
-            'id'                 => ['id' => false],
66
-            'ATT_lname'          => ['ATT_lname' => true], // true means its already sorted
67
-            'ATT_fname'          => ['ATT_fname' => false],
68
-            'ATT_email'          => ['ATT_email' => false],
69
-            'Registration_Count' => ['Registration_Count' => false],
70
-            'ATT_city'           => ['ATT_city' => false],
71
-            'STA_ID'             => ['STA_ID' => false],
72
-            'CNT_ISO'            => ['CNT_ISO' => false],
73
-        ];
74
-
75
-        $this->_hidden_columns = [
76
-            'ATT_phone',
77
-            'ATT_address',
78
-            'ATT_city',
79
-            'STA_ID',
80
-            'CNT_ISO',
81
-        ];
82
-    }
83
-
84
-
85
-    /**
86
-     * Initial setup of filters
87
-     *
88
-     * @return array
89
-     */
90
-    protected function _get_table_filters()
91
-    {
92
-        return [];
93
-    }
94
-
95
-
96
-    /**
97
-     * Initial setup of counts for views
98
-     *
99
-     * @throws InvalidArgumentException
100
-     * @throws InvalidDataTypeException
101
-     * @throws InvalidInterfaceException
102
-     * @throws EE_Error
103
-     * @throws EE_Error
104
-     */
105
-    protected function _add_view_counts()
106
-    {
107
-        $this->_views['in_use']['count'] = $this->_admin_page->get_attendees($this->_per_page, true);
108
-        if (
109
-            EE_Registry::instance()->CAP->current_user_can(
110
-                'ee_delete_contacts',
111
-                'espresso_registrations_delete_registration'
112
-            )
113
-        ) {
114
-            $this->_views['trash']['count'] = $this->_admin_page->get_attendees($this->_per_page, true, true);
115
-        }
116
-    }
117
-
118
-
119
-    /**
120
-     * Get count of attendees.
121
-     *
122
-     * @return int
123
-     * @throws EE_Error
124
-     * @throws InvalidArgumentException
125
-     * @throws InvalidDataTypeException
126
-     * @throws InvalidInterfaceException
127
-     * @throws ReflectionException
128
-     */
129
-    protected function _get_attendees_count(): int
130
-    {
131
-        return EEM_Attendee::instance()->count();
132
-    }
133
-
134
-
135
-    /**
136
-     * Checkbox column
137
-     *
138
-     * @param EE_Attendee $item Unable to typehint this method because overrides parent.
139
-     * @return string
140
-     * @throws EE_Error
141
-     * @throws ReflectionException
142
-     */
143
-    public function column_cb($item): string
144
-    {
145
-        if (! $item instanceof EE_Attendee) {
146
-            return '';
147
-        }
148
-        return sprintf(
149
-            '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />',
150
-            $item->ID()
151
-        );
152
-    }
153
-
154
-
155
-    /**
156
-     * @param EE_Attendee|null $attendee
157
-     * @return string
158
-     * @throws EE_Error
159
-     * @throws ReflectionException
160
-     */
161
-    public function column_id(?EE_Attendee $attendee): string
162
-    {
163
-        $content = '
15
+	/**
16
+	 * @var Registrations_Admin_Page
17
+	 */
18
+	protected EE_Admin_Page $_admin_page;
19
+
20
+
21
+	/**
22
+	 * Initial setup of data (called by parent).
23
+	 *
24
+	 * @throws EE_Error
25
+	 */
26
+	protected function _setup_data()
27
+	{
28
+		$this->_data = $this->_view !== 'trash'
29
+			? $this->_admin_page->get_attendees($this->_per_page)
30
+			: $this->_admin_page->get_attendees($this->_per_page, false, true);
31
+
32
+		$this->_all_data_count = $this->_view !== 'trash'
33
+			? $this->_admin_page->get_attendees($this->_per_page, true)
34
+			: $this->_admin_page->get_attendees($this->_per_page, true, true);
35
+	}
36
+
37
+
38
+	/**
39
+	 * Initial setup of properties.
40
+	 */
41
+	protected function _set_properties()
42
+	{
43
+		$this->_wp_list_args = [
44
+			'singular' => esc_html__('attendee', 'event_espresso'),
45
+			'plural'   => esc_html__('attendees', 'event_espresso'),
46
+			'ajax'     => true,
47
+			'screen'   => $this->_admin_page->get_current_screen()->id,
48
+		];
49
+
50
+		$this->_columns = [
51
+			'cb'                 => '<input type="checkbox" />', // Render a checkbox instead of text
52
+			'id'                 => esc_html__('ID', 'event_espresso'),
53
+			'ATT_fname'          => esc_html__('First Name', 'event_espresso'),
54
+			'ATT_lname'          => esc_html__('Last Name', 'event_espresso'),
55
+			'ATT_email'          => esc_html__('Email Address', 'event_espresso'),
56
+			'Registration_Count' => esc_html__('# Reg', 'event_espresso'),
57
+			'ATT_phone'          => esc_html__('Phone', 'event_espresso'),
58
+			'ATT_address'        => esc_html__('Address', 'event_espresso'),
59
+			'ATT_city'           => esc_html__('City', 'event_espresso'),
60
+			'STA_ID'             => esc_html__('State/Province', 'event_espresso'),
61
+			'CNT_ISO'            => esc_html__('Country', 'event_espresso'),
62
+		];
63
+
64
+		$this->_sortable_columns = [
65
+			'id'                 => ['id' => false],
66
+			'ATT_lname'          => ['ATT_lname' => true], // true means its already sorted
67
+			'ATT_fname'          => ['ATT_fname' => false],
68
+			'ATT_email'          => ['ATT_email' => false],
69
+			'Registration_Count' => ['Registration_Count' => false],
70
+			'ATT_city'           => ['ATT_city' => false],
71
+			'STA_ID'             => ['STA_ID' => false],
72
+			'CNT_ISO'            => ['CNT_ISO' => false],
73
+		];
74
+
75
+		$this->_hidden_columns = [
76
+			'ATT_phone',
77
+			'ATT_address',
78
+			'ATT_city',
79
+			'STA_ID',
80
+			'CNT_ISO',
81
+		];
82
+	}
83
+
84
+
85
+	/**
86
+	 * Initial setup of filters
87
+	 *
88
+	 * @return array
89
+	 */
90
+	protected function _get_table_filters()
91
+	{
92
+		return [];
93
+	}
94
+
95
+
96
+	/**
97
+	 * Initial setup of counts for views
98
+	 *
99
+	 * @throws InvalidArgumentException
100
+	 * @throws InvalidDataTypeException
101
+	 * @throws InvalidInterfaceException
102
+	 * @throws EE_Error
103
+	 * @throws EE_Error
104
+	 */
105
+	protected function _add_view_counts()
106
+	{
107
+		$this->_views['in_use']['count'] = $this->_admin_page->get_attendees($this->_per_page, true);
108
+		if (
109
+			EE_Registry::instance()->CAP->current_user_can(
110
+				'ee_delete_contacts',
111
+				'espresso_registrations_delete_registration'
112
+			)
113
+		) {
114
+			$this->_views['trash']['count'] = $this->_admin_page->get_attendees($this->_per_page, true, true);
115
+		}
116
+	}
117
+
118
+
119
+	/**
120
+	 * Get count of attendees.
121
+	 *
122
+	 * @return int
123
+	 * @throws EE_Error
124
+	 * @throws InvalidArgumentException
125
+	 * @throws InvalidDataTypeException
126
+	 * @throws InvalidInterfaceException
127
+	 * @throws ReflectionException
128
+	 */
129
+	protected function _get_attendees_count(): int
130
+	{
131
+		return EEM_Attendee::instance()->count();
132
+	}
133
+
134
+
135
+	/**
136
+	 * Checkbox column
137
+	 *
138
+	 * @param EE_Attendee $item Unable to typehint this method because overrides parent.
139
+	 * @return string
140
+	 * @throws EE_Error
141
+	 * @throws ReflectionException
142
+	 */
143
+	public function column_cb($item): string
144
+	{
145
+		if (! $item instanceof EE_Attendee) {
146
+			return '';
147
+		}
148
+		return sprintf(
149
+			'<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />',
150
+			$item->ID()
151
+		);
152
+	}
153
+
154
+
155
+	/**
156
+	 * @param EE_Attendee|null $attendee
157
+	 * @return string
158
+	 * @throws EE_Error
159
+	 * @throws ReflectionException
160
+	 */
161
+	public function column_id(?EE_Attendee $attendee): string
162
+	{
163
+		$content = '
164 164
             <span class="ee-entity-id">' . $attendee->ID() . '</span>
165 165
             <span class="show-on-mobile-view-only">
166 166
                 ' . $this->editAttendeeLink($attendee->ID(), $attendee->full_name()) . '
167 167
             </span>';
168
-        return $this->columnContent('id', $content, 'end');
169
-    }
170
-
171
-
172
-    /**
173
-     * ATT_lname column
174
-     *
175
-     * @param EE_Attendee $attendee
176
-     * @return string
177
-     * @throws EE_Error
178
-     * @throws ReflectionException
179
-     */
180
-    public function column_ATT_lname(EE_Attendee $attendee): string
181
-    {
182
-        // edit attendee link
183
-        $content = $this->editAttendeeLink($attendee->ID(), $attendee->lname());
184
-        return $this->columnContent('ATT_lname', $content);
185
-    }
186
-
187
-
188
-    /**
189
-     * @param int    $ID
190
-     * @param string $attendee_name
191
-     * @return string
192
-     * @since   5.0.0.p
193
-     */
194
-    private function editAttendeeLink(int $ID, string $attendee_name): string
195
-    {
196
-        $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
197
-            [
198
-                'action' => 'edit_attendee',
199
-                'post'   => $ID,
200
-            ],
201
-            REG_ADMIN_URL
202
-        );
203
-        return EE_Registry::instance()->CAP->current_user_can(
204
-            'ee_edit_contacts',
205
-            'espresso_registrations_edit_attendee'
206
-        )
207
-            ? '
168
+		return $this->columnContent('id', $content, 'end');
169
+	}
170
+
171
+
172
+	/**
173
+	 * ATT_lname column
174
+	 *
175
+	 * @param EE_Attendee $attendee
176
+	 * @return string
177
+	 * @throws EE_Error
178
+	 * @throws ReflectionException
179
+	 */
180
+	public function column_ATT_lname(EE_Attendee $attendee): string
181
+	{
182
+		// edit attendee link
183
+		$content = $this->editAttendeeLink($attendee->ID(), $attendee->lname());
184
+		return $this->columnContent('ATT_lname', $content);
185
+	}
186
+
187
+
188
+	/**
189
+	 * @param int    $ID
190
+	 * @param string $attendee_name
191
+	 * @return string
192
+	 * @since   5.0.0.p
193
+	 */
194
+	private function editAttendeeLink(int $ID, string $attendee_name): string
195
+	{
196
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
197
+			[
198
+				'action' => 'edit_attendee',
199
+				'post'   => $ID,
200
+			],
201
+			REG_ADMIN_URL
202
+		);
203
+		return EE_Registry::instance()->CAP->current_user_can(
204
+			'ee_edit_contacts',
205
+			'espresso_registrations_edit_attendee'
206
+		)
207
+			? '
208 208
             <a  href="' . $edit_lnk_url . '"
209 209
                 class="ee-aria-tooltip"
210 210
                 aria-label="' . esc_attr__('Edit Contact', 'event_espresso') . '"
211 211
             >
212 212
                 ' . $attendee_name . '
213 213
             </a>'
214
-            : $attendee_name;
215
-    }
216
-
217
-
218
-    /**
219
-     * ATT_fname column
220
-     *
221
-     * @param EE_Attendee $attendee
222
-     * @return string
223
-     * @throws InvalidArgumentException
224
-     * @throws InvalidDataTypeException
225
-     * @throws InvalidInterfaceException
226
-     * @throws EE_Error
227
-     * @throws ReflectionException
228
-     * @throws ReflectionException
229
-     * @throws ReflectionException
230
-     * @throws ReflectionException
231
-     */
232
-    public function column_ATT_fname(EE_Attendee $attendee): string
233
-    {
234
-        // Build row actions
235
-        $actions = [];
236
-        // edit attendee link
237
-        if (
238
-            EE_Registry::instance()->CAP->current_user_can(
239
-                'ee_edit_contacts',
240
-                'espresso_registrations_edit_attendee'
241
-            )
242
-        ) {
243
-            $actions['edit'] = $this->editAttendeeLink(
244
-                $attendee->ID(),
245
-                esc_html__('Edit Contact', 'event_espresso')
246
-            );
247
-        }
248
-
249
-        if ($this->_view === 'in_use') {
250
-            // trash attendee link
251
-            if (
252
-                EE_Registry::instance()->CAP->current_user_can(
253
-                    'ee_delete_contacts',
254
-                    'espresso_registrations_trash_attendees'
255
-                )
256
-            ) {
257
-                $trash_lnk_url    = EE_Admin_Page::add_query_args_and_nonce(
258
-                    [
259
-                        'action' => 'trash_attendee',
260
-                        'ATT_ID' => $attendee->ID(),
261
-                    ],
262
-                    REG_ADMIN_URL
263
-                );
264
-                $actions['trash'] = '
214
+			: $attendee_name;
215
+	}
216
+
217
+
218
+	/**
219
+	 * ATT_fname column
220
+	 *
221
+	 * @param EE_Attendee $attendee
222
+	 * @return string
223
+	 * @throws InvalidArgumentException
224
+	 * @throws InvalidDataTypeException
225
+	 * @throws InvalidInterfaceException
226
+	 * @throws EE_Error
227
+	 * @throws ReflectionException
228
+	 * @throws ReflectionException
229
+	 * @throws ReflectionException
230
+	 * @throws ReflectionException
231
+	 */
232
+	public function column_ATT_fname(EE_Attendee $attendee): string
233
+	{
234
+		// Build row actions
235
+		$actions = [];
236
+		// edit attendee link
237
+		if (
238
+			EE_Registry::instance()->CAP->current_user_can(
239
+				'ee_edit_contacts',
240
+				'espresso_registrations_edit_attendee'
241
+			)
242
+		) {
243
+			$actions['edit'] = $this->editAttendeeLink(
244
+				$attendee->ID(),
245
+				esc_html__('Edit Contact', 'event_espresso')
246
+			);
247
+		}
248
+
249
+		if ($this->_view === 'in_use') {
250
+			// trash attendee link
251
+			if (
252
+				EE_Registry::instance()->CAP->current_user_can(
253
+					'ee_delete_contacts',
254
+					'espresso_registrations_trash_attendees'
255
+				)
256
+			) {
257
+				$trash_lnk_url    = EE_Admin_Page::add_query_args_and_nonce(
258
+					[
259
+						'action' => 'trash_attendee',
260
+						'ATT_ID' => $attendee->ID(),
261
+					],
262
+					REG_ADMIN_URL
263
+				);
264
+				$actions['trash'] = '
265 265
                     <a  href="' . $trash_lnk_url . '"
266 266
                         class="ee-aria-tooltip"
267 267
                         aria-label="' . esc_attr__('Move Contact to Trash', 'event_espresso') . '"
268 268
                     >
269 269
                         ' . esc_html__('Trash', 'event_espresso') . '
270 270
                     </a>';
271
-            }
272
-        } else {
273
-            if (
274
-                EE_Registry::instance()->CAP->current_user_can(
275
-                    'ee_delete_contacts',
276
-                    'espresso_registrations_restore_attendees'
277
-                )
278
-            ) {
279
-                // restore attendee link
280
-                $restore_lnk_url    = EE_Admin_Page::add_query_args_and_nonce(
281
-                    [
282
-                        'action' => 'restore_attendees',
283
-                        'ATT_ID' => $attendee->ID(),
284
-                    ],
285
-                    REG_ADMIN_URL
286
-                );
287
-                $actions['restore'] = '
271
+			}
272
+		} else {
273
+			if (
274
+				EE_Registry::instance()->CAP->current_user_can(
275
+					'ee_delete_contacts',
276
+					'espresso_registrations_restore_attendees'
277
+				)
278
+			) {
279
+				// restore attendee link
280
+				$restore_lnk_url    = EE_Admin_Page::add_query_args_and_nonce(
281
+					[
282
+						'action' => 'restore_attendees',
283
+						'ATT_ID' => $attendee->ID(),
284
+					],
285
+					REG_ADMIN_URL
286
+				);
287
+				$actions['restore'] = '
288 288
                     <a  href="' . $restore_lnk_url . '"
289 289
                         class="ee-aria-tooltip"
290 290
                         aria-label="' . esc_attr__('Restore Contact', 'event_espresso') . '"
291 291
                     >
292 292
                         ' . esc_html__('Restore', 'event_espresso') . '
293 293
                     </a>';
294
-            }
295
-        }
296
-
297
-        $name_link    = $this->editAttendeeLink($attendee->ID(), $attendee->fname());
298
-
299
-        // Return the name contents
300
-        $content = sprintf('%1$s %2$s', $name_link, $this->row_actions($actions));
301
-        return $this->columnContent('ATT_fname', $content);
302
-    }
303
-
304
-
305
-    /**
306
-     * Email Column
307
-     *
308
-     * @param EE_Attendee $attendee
309
-     * @return string
310
-     * @throws EE_Error
311
-     */
312
-    public function column_ATT_email(EE_Attendee $attendee): string
313
-    {
314
-        $content = '<a href="mailto:' . $attendee->email() . '">' . $attendee->email() . '</a>';
315
-        return $this->columnContent('ATT_email', $content);
316
-    }
317
-
318
-
319
-    /**
320
-     * Column displaying count of registrations attached to Attendee.
321
-     *
322
-     * @param EE_Attendee $attendee
323
-     * @return string
324
-     * @throws EE_Error
325
-     * @throws ReflectionException
326
-     */
327
-    public function column_Registration_Count(EE_Attendee $attendee): string
328
-    {
329
-        $link = EEH_URL::add_query_args_and_nonce(
330
-            [
331
-                'action' => 'default',
332
-                'ATT_ID' => $attendee->ID(),
333
-            ],
334
-            REG_ADMIN_URL
335
-        );
336
-        $content = '<a href="' . $link . '">' . $attendee->getCustomSelect('Registration_Count') . '</a>';
337
-        return $this->columnContent('Registration_Count', $content, 'end');
338
-    }
339
-
340
-
341
-    /**
342
-     * ATT_address column
343
-     *
344
-     * @param EE_Attendee $attendee
345
-     * @return string
346
-     * @throws EE_Error
347
-     */
348
-    public function column_ATT_address(EE_Attendee $attendee): string
349
-    {
350
-        return $this->columnContent('ATT_address', $attendee->address());
351
-    }
352
-
353
-
354
-    /**
355
-     * ATT_city column
356
-     *
357
-     * @param EE_Attendee $attendee
358
-     * @return string
359
-     * @throws EE_Error
360
-     */
361
-    public function column_ATT_city(EE_Attendee $attendee): string
362
-    {
363
-        return $this->columnContent('ATT_city', $attendee->city());
364
-    }
365
-
366
-
367
-    /**
368
-     * State Column
369
-     *
370
-     * @param EE_Attendee $attendee
371
-     * @return string
372
-     * @throws EE_Error
373
-     * @throws InvalidArgumentException
374
-     * @throws InvalidDataTypeException
375
-     * @throws InvalidInterfaceException
376
-     * @throws ReflectionException
377
-     */
378
-    public function column_STA_ID(EE_Attendee $attendee): string
379
-    {
380
-        $states = EEM_State::instance()->get_all_states();
381
-        $state  = isset($states[ $attendee->state_ID() ])
382
-            ? $states[ $attendee->state_ID() ]->get('STA_name')
383
-            : $attendee->state_ID();
384
-        $content = ! is_numeric($state) ? $state : '';
385
-        return $this->columnContent('STA_ID', $content);
386
-    }
387
-
388
-
389
-    /**
390
-     * Country Column
391
-     *
392
-     * @param EE_Attendee $attendee
393
-     * @return string
394
-     * @throws EE_Error
395
-     * @throws InvalidArgumentException
396
-     * @throws InvalidDataTypeException
397
-     * @throws InvalidInterfaceException
398
-     * @throws ReflectionException
399
-     * @throws ReflectionException
400
-     */
401
-    public function column_CNT_ISO(EE_Attendee $attendee): string
402
-    {
403
-        $countries = EEM_Country::instance()->get_all_countries();
404
-        $country   = isset($countries[ $attendee->country_ID() ])
405
-            ? $countries[ $attendee->country_ID() ]->get('CNT_name')
406
-            : $attendee->country_ID();
407
-        $content = ! is_numeric($country) ? $country : '';
408
-        return $this->columnContent('CNT_ISO', $content);
409
-    }
410
-
411
-
412
-    /**
413
-     * Phone Number column
414
-     *
415
-     * @param EE_Attendee $attendee
416
-     * @return string
417
-     * @throws EE_Error
418
-     */
419
-    public function column_ATT_phone(EE_Attendee $attendee): string
420
-    {
421
-        return $this->columnContent('ATT_phone', $attendee->phone());
422
-    }
294
+			}
295
+		}
296
+
297
+		$name_link    = $this->editAttendeeLink($attendee->ID(), $attendee->fname());
298
+
299
+		// Return the name contents
300
+		$content = sprintf('%1$s %2$s', $name_link, $this->row_actions($actions));
301
+		return $this->columnContent('ATT_fname', $content);
302
+	}
303
+
304
+
305
+	/**
306
+	 * Email Column
307
+	 *
308
+	 * @param EE_Attendee $attendee
309
+	 * @return string
310
+	 * @throws EE_Error
311
+	 */
312
+	public function column_ATT_email(EE_Attendee $attendee): string
313
+	{
314
+		$content = '<a href="mailto:' . $attendee->email() . '">' . $attendee->email() . '</a>';
315
+		return $this->columnContent('ATT_email', $content);
316
+	}
317
+
318
+
319
+	/**
320
+	 * Column displaying count of registrations attached to Attendee.
321
+	 *
322
+	 * @param EE_Attendee $attendee
323
+	 * @return string
324
+	 * @throws EE_Error
325
+	 * @throws ReflectionException
326
+	 */
327
+	public function column_Registration_Count(EE_Attendee $attendee): string
328
+	{
329
+		$link = EEH_URL::add_query_args_and_nonce(
330
+			[
331
+				'action' => 'default',
332
+				'ATT_ID' => $attendee->ID(),
333
+			],
334
+			REG_ADMIN_URL
335
+		);
336
+		$content = '<a href="' . $link . '">' . $attendee->getCustomSelect('Registration_Count') . '</a>';
337
+		return $this->columnContent('Registration_Count', $content, 'end');
338
+	}
339
+
340
+
341
+	/**
342
+	 * ATT_address column
343
+	 *
344
+	 * @param EE_Attendee $attendee
345
+	 * @return string
346
+	 * @throws EE_Error
347
+	 */
348
+	public function column_ATT_address(EE_Attendee $attendee): string
349
+	{
350
+		return $this->columnContent('ATT_address', $attendee->address());
351
+	}
352
+
353
+
354
+	/**
355
+	 * ATT_city column
356
+	 *
357
+	 * @param EE_Attendee $attendee
358
+	 * @return string
359
+	 * @throws EE_Error
360
+	 */
361
+	public function column_ATT_city(EE_Attendee $attendee): string
362
+	{
363
+		return $this->columnContent('ATT_city', $attendee->city());
364
+	}
365
+
366
+
367
+	/**
368
+	 * State Column
369
+	 *
370
+	 * @param EE_Attendee $attendee
371
+	 * @return string
372
+	 * @throws EE_Error
373
+	 * @throws InvalidArgumentException
374
+	 * @throws InvalidDataTypeException
375
+	 * @throws InvalidInterfaceException
376
+	 * @throws ReflectionException
377
+	 */
378
+	public function column_STA_ID(EE_Attendee $attendee): string
379
+	{
380
+		$states = EEM_State::instance()->get_all_states();
381
+		$state  = isset($states[ $attendee->state_ID() ])
382
+			? $states[ $attendee->state_ID() ]->get('STA_name')
383
+			: $attendee->state_ID();
384
+		$content = ! is_numeric($state) ? $state : '';
385
+		return $this->columnContent('STA_ID', $content);
386
+	}
387
+
388
+
389
+	/**
390
+	 * Country Column
391
+	 *
392
+	 * @param EE_Attendee $attendee
393
+	 * @return string
394
+	 * @throws EE_Error
395
+	 * @throws InvalidArgumentException
396
+	 * @throws InvalidDataTypeException
397
+	 * @throws InvalidInterfaceException
398
+	 * @throws ReflectionException
399
+	 * @throws ReflectionException
400
+	 */
401
+	public function column_CNT_ISO(EE_Attendee $attendee): string
402
+	{
403
+		$countries = EEM_Country::instance()->get_all_countries();
404
+		$country   = isset($countries[ $attendee->country_ID() ])
405
+			? $countries[ $attendee->country_ID() ]->get('CNT_name')
406
+			: $attendee->country_ID();
407
+		$content = ! is_numeric($country) ? $country : '';
408
+		return $this->columnContent('CNT_ISO', $content);
409
+	}
410
+
411
+
412
+	/**
413
+	 * Phone Number column
414
+	 *
415
+	 * @param EE_Attendee $attendee
416
+	 * @return string
417
+	 * @throws EE_Error
418
+	 */
419
+	public function column_ATT_phone(EE_Attendee $attendee): string
420
+	{
421
+		return $this->columnContent('ATT_phone', $attendee->phone());
422
+	}
423 423
 }
Please login to merge, or discard this patch.
admin_pages/registrations/Registrations_Admin_Page.core.php 2 patches
Indentation   +3686 added lines, -3686 removed lines patch added patch discarded remove patch
@@ -21,2228 +21,2228 @@  discard block
 block discarded – undo
21 21
  */
22 22
 class Registrations_Admin_Page extends EE_Admin_Page_CPT
23 23
 {
24
-    /**
25
-     * @var EE_Registration
26
-     */
27
-    private $_registration;
28
-
29
-    /**
30
-     * @var EE_Event
31
-     */
32
-    private $_reg_event;
33
-
34
-    /**
35
-     * @var EE_Session
36
-     */
37
-    private $_session;
38
-
39
-    /**
40
-     * @var array
41
-     */
42
-    private static $_reg_status;
43
-
44
-    /**
45
-     * Form for displaying the custom questions for this registration.
46
-     * This gets used a few times throughout the request so its best to cache it
47
-     *
48
-     * @var EE_Registration_Custom_Questions_Form
49
-     */
50
-    protected $_reg_custom_questions_form;
51
-
52
-    /**
53
-     * @var EEM_Registration $registration_model
54
-     */
55
-    private $registration_model;
56
-
57
-    /**
58
-     * @var EEM_Attendee $attendee_model
59
-     */
60
-    private $attendee_model;
61
-
62
-    /**
63
-     * @var EEM_Event $event_model
64
-     */
65
-    private $event_model;
66
-
67
-    /**
68
-     * @var EEM_Status $status_model
69
-     */
70
-    private $status_model;
71
-
72
-
73
-    /**
74
-     * @param bool $routing
75
-     * @throws InvalidArgumentException
76
-     * @throws InvalidDataTypeException
77
-     * @throws InvalidInterfaceException
78
-     * @throws ReflectionException
79
-     */
80
-    public function __construct($routing = true)
81
-    {
82
-        parent::__construct($routing);
83
-        $this->cpt_editpost_route = 'edit_attendee';
84
-        add_action('wp_loaded', [$this, 'wp_loaded']);
85
-    }
86
-
87
-
88
-    /**
89
-     * @return EEM_Registration
90
-     * @throws InvalidArgumentException
91
-     * @throws InvalidDataTypeException
92
-     * @throws InvalidInterfaceException
93
-     * @since 4.10.2.p
94
-     */
95
-    protected function getRegistrationModel()
96
-    {
97
-        if (! $this->registration_model instanceof EEM_Registration) {
98
-            $this->registration_model = $this->loader->getShared('EEM_Registration');
99
-        }
100
-        return $this->registration_model;
101
-    }
102
-
103
-
104
-    /**
105
-     * @return EEM_Attendee
106
-     * @throws InvalidArgumentException
107
-     * @throws InvalidDataTypeException
108
-     * @throws InvalidInterfaceException
109
-     * @since 4.10.2.p
110
-     */
111
-    protected function getAttendeeModel()
112
-    {
113
-        if (! $this->attendee_model instanceof EEM_Attendee) {
114
-            $this->attendee_model = $this->loader->getShared('EEM_Attendee');
115
-        }
116
-        return $this->attendee_model;
117
-    }
118
-
119
-
120
-    /**
121
-     * @return EEM_Event
122
-     * @throws InvalidArgumentException
123
-     * @throws InvalidDataTypeException
124
-     * @throws InvalidInterfaceException
125
-     * @since 4.10.2.p
126
-     */
127
-    protected function getEventModel()
128
-    {
129
-        if (! $this->event_model instanceof EEM_Event) {
130
-            $this->event_model = $this->loader->getShared('EEM_Event');
131
-        }
132
-        return $this->event_model;
133
-    }
134
-
135
-
136
-    /**
137
-     * @return EEM_Status
138
-     * @throws InvalidArgumentException
139
-     * @throws InvalidDataTypeException
140
-     * @throws InvalidInterfaceException
141
-     * @since 4.10.2.p
142
-     */
143
-    protected function getStatusModel()
144
-    {
145
-        if (! $this->status_model instanceof EEM_Status) {
146
-            $this->status_model = $this->loader->getShared('EEM_Status');
147
-        }
148
-        return $this->status_model;
149
-    }
150
-
151
-
152
-    public function wp_loaded()
153
-    {
154
-        // when adding a new registration...
155
-        $action = $this->request->getRequestParam('action');
156
-        if ($action === 'new_registration') {
157
-            EE_System::do_not_cache();
158
-            if ($this->request->getRequestParam('processing_registration', 0, 'int') !== 1) {
159
-                // and it's NOT the attendee information reg step
160
-                // force cookie expiration by setting time to last week
161
-                setcookie('ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/');
162
-                // and update the global
163
-                $_COOKIE['ee_registration_added'] = 0;
164
-            }
165
-        }
166
-    }
167
-
168
-
169
-    protected function _init_page_props()
170
-    {
171
-        $this->page_slug        = REG_PG_SLUG;
172
-        $this->_admin_base_url  = REG_ADMIN_URL;
173
-        $this->_admin_base_path = REG_ADMIN;
174
-        $this->page_label       = esc_html__('Registrations', 'event_espresso');
175
-        $this->_cpt_routes      = [
176
-            'add_new_attendee' => 'espresso_attendees',
177
-            'edit_attendee'    => 'espresso_attendees',
178
-            'insert_attendee'  => 'espresso_attendees',
179
-            'update_attendee'  => 'espresso_attendees',
180
-        ];
181
-        $this->_cpt_model_names = [
182
-            'add_new_attendee' => 'EEM_Attendee',
183
-            'edit_attendee'    => 'EEM_Attendee',
184
-        ];
185
-        $this->_cpt_edit_routes = [
186
-            'espresso_attendees' => 'edit_attendee',
187
-        ];
188
-        $this->_pagenow_map     = [
189
-            'add_new_attendee' => 'post-new.php',
190
-            'edit_attendee'    => 'post.php',
191
-            'trash'            => 'post.php',
192
-        ];
193
-        add_action('edit_form_after_title', [$this, 'after_title_form_fields'], 10);
194
-        // add filters so that the comment urls don't take users to a confusing 404 page
195
-        add_filter('get_comment_link', [$this, 'clear_comment_link'], 10, 2);
196
-    }
197
-
198
-
199
-    /**
200
-     * @param string     $link    The comment permalink with '#comment-$id' appended.
201
-     * @param WP_Comment $comment The current comment object.
202
-     * @return string
203
-     */
204
-    public function clear_comment_link($link, WP_Comment $comment)
205
-    {
206
-        // gotta make sure this only happens on this route
207
-        $post_type = get_post_type($comment->comment_post_ID);
208
-        if ($post_type === 'espresso_attendees') {
209
-            return '#commentsdiv';
210
-        }
211
-        return $link;
212
-    }
213
-
214
-
215
-    protected function _ajax_hooks()
216
-    {
217
-        // todo: all hooks for registrations ajax goes in here
218
-        add_action('wp_ajax_toggle_checkin_status', [$this, 'toggle_checkin_status']);
219
-    }
220
-
221
-
222
-    protected function _define_page_props()
223
-    {
224
-        $this->_admin_page_title = $this->page_label;
225
-        $this->_labels           = [
226
-            'buttons'                      => [
227
-                'add-registrant'      => esc_html__('Add New Registration', 'event_espresso'),
228
-                'add-attendee'        => esc_html__('Add Contact', 'event_espresso'),
229
-                'edit'                => esc_html__('Edit Contact', 'event_espresso'),
230
-                'csv_reg_report'      => esc_html__('Registrations CSV Report', 'event_espresso'),
231
-                'contact_list_report' => esc_html__('Contact List Report', 'event_espresso'),
232
-                'contact_list_export' => esc_html__('Export Data', 'event_espresso'),
233
-            ],
234
-            'publishbox'                   => [
235
-                'add_new_attendee' => esc_html__('Add Contact Record', 'event_espresso'),
236
-                'edit_attendee'    => esc_html__('Update Contact Record', 'event_espresso'),
237
-            ],
238
-            'hide_add_button_on_cpt_route' => [
239
-                'edit_attendee' => true,
240
-            ],
241
-        ];
242
-    }
243
-
244
-
245
-    /**
246
-     * grab url requests and route them
247
-     *
248
-     * @return void
249
-     * @throws EE_Error
250
-     */
251
-    public function _set_page_routes()
252
-    {
253
-        $this->_get_registration_status_array();
254
-        $REG_ID             = $this->request->getRequestParam('_REG_ID', 0, 'int');
255
-        $REG_ID             = $this->request->getRequestParam('reg_status_change_form[REG_ID]', $REG_ID, 'int');
256
-        $ATT_ID             = $this->request->getRequestParam('ATT_ID', 0, 'int');
257
-        $ATT_ID             = $this->request->getRequestParam('post', $ATT_ID, 'int');
258
-        $this->_page_routes = [
259
-            'default'                             => [
260
-                'func'       => [$this, '_registrations_overview_list_table'],
261
-                'capability' => 'ee_read_registrations',
262
-            ],
263
-            'view_registration'                   => [
264
-                'func'       => [$this, '_registration_details'],
265
-                'capability' => 'ee_read_registration',
266
-                'obj_id'     => $REG_ID,
267
-            ],
268
-            'edit_registration'                   => [
269
-                'func'               => '_update_attendee_registration_form',
270
-                'noheader'           => true,
271
-                'headers_sent_route' => 'view_registration',
272
-                'capability'         => 'ee_edit_registration',
273
-                'obj_id'             => $REG_ID,
274
-                '_REG_ID'            => $REG_ID,
275
-            ],
276
-            'trash_registrations'                 => [
277
-                'func'       => '_trash_or_restore_registrations',
278
-                'args'       => ['trash' => true],
279
-                'noheader'   => true,
280
-                'capability' => 'ee_delete_registrations',
281
-            ],
282
-            'restore_registrations'               => [
283
-                'func'       => '_trash_or_restore_registrations',
284
-                'args'       => ['trash' => false],
285
-                'noheader'   => true,
286
-                'capability' => 'ee_delete_registrations',
287
-            ],
288
-            'delete_registrations'                => [
289
-                'func'       => '_delete_registrations',
290
-                'noheader'   => true,
291
-                'capability' => 'ee_delete_registrations',
292
-            ],
293
-            'new_registration'                    => [
294
-                'func'       => 'new_registration',
295
-                'capability' => 'ee_edit_registrations',
296
-            ],
297
-            'process_reg_step'                    => [
298
-                'func'       => 'process_reg_step',
299
-                'noheader'   => true,
300
-                'capability' => 'ee_edit_registrations',
301
-            ],
302
-            'redirect_to_txn'                     => [
303
-                'func'       => 'redirect_to_txn',
304
-                'noheader'   => true,
305
-                'capability' => 'ee_edit_registrations',
306
-            ],
307
-            'change_reg_status'                   => [
308
-                'func'       => '_change_reg_status',
309
-                'noheader'   => true,
310
-                'capability' => 'ee_edit_registration',
311
-                'obj_id'     => $REG_ID,
312
-            ],
313
-            'approve_registration'                => [
314
-                'func'       => 'approve_registration',
315
-                'noheader'   => true,
316
-                'capability' => 'ee_edit_registration',
317
-                'obj_id'     => $REG_ID,
318
-            ],
319
-            'approve_and_notify_registration'     => [
320
-                'func'       => 'approve_registration',
321
-                'noheader'   => true,
322
-                'args'       => [true],
323
-                'capability' => 'ee_edit_registration',
324
-                'obj_id'     => $REG_ID,
325
-            ],
326
-            'approve_registrations'               => [
327
-                'func'       => 'bulk_action_on_registrations',
328
-                'noheader'   => true,
329
-                'capability' => 'ee_edit_registrations',
330
-                'args'       => ['approve'],
331
-            ],
332
-            'approve_and_notify_registrations'    => [
333
-                'func'       => 'bulk_action_on_registrations',
334
-                'noheader'   => true,
335
-                'capability' => 'ee_edit_registrations',
336
-                'args'       => ['approve', true],
337
-            ],
338
-            'decline_registration'                => [
339
-                'func'       => 'decline_registration',
340
-                'noheader'   => true,
341
-                'capability' => 'ee_edit_registration',
342
-                'obj_id'     => $REG_ID,
343
-            ],
344
-            'decline_and_notify_registration'     => [
345
-                'func'       => 'decline_registration',
346
-                'noheader'   => true,
347
-                'args'       => [true],
348
-                'capability' => 'ee_edit_registration',
349
-                'obj_id'     => $REG_ID,
350
-            ],
351
-            'decline_registrations'               => [
352
-                'func'       => 'bulk_action_on_registrations',
353
-                'noheader'   => true,
354
-                'capability' => 'ee_edit_registrations',
355
-                'args'       => ['decline'],
356
-            ],
357
-            'decline_and_notify_registrations'    => [
358
-                'func'       => 'bulk_action_on_registrations',
359
-                'noheader'   => true,
360
-                'capability' => 'ee_edit_registrations',
361
-                'args'       => ['decline', true],
362
-            ],
363
-            'pending_registration'                => [
364
-                'func'       => 'pending_registration',
365
-                'noheader'   => true,
366
-                'capability' => 'ee_edit_registration',
367
-                'obj_id'     => $REG_ID,
368
-            ],
369
-            'pending_and_notify_registration'     => [
370
-                'func'       => 'pending_registration',
371
-                'noheader'   => true,
372
-                'args'       => [true],
373
-                'capability' => 'ee_edit_registration',
374
-                'obj_id'     => $REG_ID,
375
-            ],
376
-            'pending_registrations'               => [
377
-                'func'       => 'bulk_action_on_registrations',
378
-                'noheader'   => true,
379
-                'capability' => 'ee_edit_registrations',
380
-                'args'       => ['pending'],
381
-            ],
382
-            'pending_and_notify_registrations'    => [
383
-                'func'       => 'bulk_action_on_registrations',
384
-                'noheader'   => true,
385
-                'capability' => 'ee_edit_registrations',
386
-                'args'       => ['pending', true],
387
-            ],
388
-            'no_approve_registration'             => [
389
-                'func'       => 'not_approve_registration',
390
-                'noheader'   => true,
391
-                'capability' => 'ee_edit_registration',
392
-                'obj_id'     => $REG_ID,
393
-            ],
394
-            'no_approve_and_notify_registration'  => [
395
-                'func'       => 'not_approve_registration',
396
-                'noheader'   => true,
397
-                'args'       => [true],
398
-                'capability' => 'ee_edit_registration',
399
-                'obj_id'     => $REG_ID,
400
-            ],
401
-            'no_approve_registrations'            => [
402
-                'func'       => 'bulk_action_on_registrations',
403
-                'noheader'   => true,
404
-                'capability' => 'ee_edit_registrations',
405
-                'args'       => ['not_approve'],
406
-            ],
407
-            'no_approve_and_notify_registrations' => [
408
-                'func'       => 'bulk_action_on_registrations',
409
-                'noheader'   => true,
410
-                'capability' => 'ee_edit_registrations',
411
-                'args'       => ['not_approve', true],
412
-            ],
413
-            'cancel_registration'                 => [
414
-                'func'       => 'cancel_registration',
415
-                'noheader'   => true,
416
-                'capability' => 'ee_edit_registration',
417
-                'obj_id'     => $REG_ID,
418
-            ],
419
-            'cancel_and_notify_registration'      => [
420
-                'func'       => 'cancel_registration',
421
-                'noheader'   => true,
422
-                'args'       => [true],
423
-                'capability' => 'ee_edit_registration',
424
-                'obj_id'     => $REG_ID,
425
-            ],
426
-            'cancel_registrations'                => [
427
-                'func'       => 'bulk_action_on_registrations',
428
-                'noheader'   => true,
429
-                'capability' => 'ee_edit_registrations',
430
-                'args'       => ['cancel'],
431
-            ],
432
-            'cancel_and_notify_registrations'     => [
433
-                'func'       => 'bulk_action_on_registrations',
434
-                'noheader'   => true,
435
-                'capability' => 'ee_edit_registrations',
436
-                'args'       => ['cancel', true],
437
-            ],
438
-            'wait_list_registration'              => [
439
-                'func'       => 'wait_list_registration',
440
-                'noheader'   => true,
441
-                'capability' => 'ee_edit_registration',
442
-                'obj_id'     => $REG_ID,
443
-            ],
444
-            'wait_list_and_notify_registration'   => [
445
-                'func'       => 'wait_list_registration',
446
-                'noheader'   => true,
447
-                'args'       => [true],
448
-                'capability' => 'ee_edit_registration',
449
-                'obj_id'     => $REG_ID,
450
-            ],
451
-            'contact_list'                        => [
452
-                'func'       => '_attendee_contact_list_table',
453
-                'capability' => 'ee_read_contacts',
454
-            ],
455
-            'add_new_attendee'                    => [
456
-                'func' => '_create_new_cpt_item',
457
-                'args' => [
458
-                    'new_attendee' => true,
459
-                    'capability'   => 'ee_edit_contacts',
460
-                ],
461
-            ],
462
-            'edit_attendee'                       => [
463
-                'func'       => '_edit_cpt_item',
464
-                'capability' => 'ee_edit_contacts',
465
-                'obj_id'     => $ATT_ID,
466
-            ],
467
-            'duplicate_attendee'                  => [
468
-                'func'       => '_duplicate_attendee',
469
-                'noheader'   => true,
470
-                'capability' => 'ee_edit_contacts',
471
-                'obj_id'     => $ATT_ID,
472
-            ],
473
-            'insert_attendee'                     => [
474
-                'func'       => '_insert_or_update_attendee',
475
-                'args'       => [
476
-                    'new_attendee' => true,
477
-                ],
478
-                'noheader'   => true,
479
-                'capability' => 'ee_edit_contacts',
480
-            ],
481
-            'update_attendee'                     => [
482
-                'func'       => '_insert_or_update_attendee',
483
-                'args'       => [
484
-                    'new_attendee' => false,
485
-                ],
486
-                'noheader'   => true,
487
-                'capability' => 'ee_edit_contacts',
488
-                'obj_id'     => $ATT_ID,
489
-            ],
490
-            'trash_attendees'                     => [
491
-                'func'       => '_trash_or_restore_attendees',
492
-                'args'       => [
493
-                    'trash' => 'true',
494
-                ],
495
-                'noheader'   => true,
496
-                'capability' => 'ee_delete_contacts',
497
-            ],
498
-            'trash_attendee'                      => [
499
-                'func'       => '_trash_or_restore_attendees',
500
-                'args'       => [
501
-                    'trash' => true,
502
-                ],
503
-                'noheader'   => true,
504
-                'capability' => 'ee_delete_contacts',
505
-                'obj_id'     => $ATT_ID,
506
-            ],
507
-            'restore_attendees'                   => [
508
-                'func'       => '_trash_or_restore_attendees',
509
-                'args'       => [
510
-                    'trash' => false,
511
-                ],
512
-                'noheader'   => true,
513
-                'capability' => 'ee_delete_contacts',
514
-                'obj_id'     => $ATT_ID,
515
-            ],
516
-            'resend_registration'                 => [
517
-                'func'       => '_resend_registration',
518
-                'noheader'   => true,
519
-                'capability' => 'ee_send_message',
520
-            ],
521
-            'registrations_report'                => [
522
-                'func'       => [$this, '_registrations_report'],
523
-                'noheader'   => true,
524
-                'capability' => 'ee_read_registrations',
525
-            ],
526
-            'contact_list_export'                 => [
527
-                'func'       => '_contact_list_export',
528
-                'noheader'   => true,
529
-                'capability' => 'export',
530
-            ],
531
-            'contact_list_report'                 => [
532
-                'func'       => '_contact_list_report',
533
-                'noheader'   => true,
534
-                'capability' => 'ee_read_contacts',
535
-            ],
536
-        ];
537
-    }
538
-
539
-
540
-    protected function _set_page_config()
541
-    {
542
-        $REG_ID             = $this->request->getRequestParam('_REG_ID', 0, 'int');
543
-        $ATT_ID             = $this->request->getRequestParam('ATT_ID', 0, 'int');
544
-        $this->_page_config = [
545
-            'default'           => [
546
-                'nav'           => [
547
-                    'label' => esc_html__('Overview', 'event_espresso'),
548
-                    'icon'  => 'dashicons-list-view',
549
-                    'order' => 5,
550
-                ],
551
-                'help_tabs'     => [
552
-                    'registrations_overview_help_tab'                       => [
553
-                        'title'    => esc_html__('Registrations Overview', 'event_espresso'),
554
-                        'filename' => 'registrations_overview',
555
-                    ],
556
-                    'registrations_overview_table_column_headings_help_tab' => [
557
-                        'title'    => esc_html__('Registrations Table Column Headings', 'event_espresso'),
558
-                        'filename' => 'registrations_overview_table_column_headings',
559
-                    ],
560
-                    'registrations_overview_filters_help_tab'               => [
561
-                        'title'    => esc_html__('Registration Filters', 'event_espresso'),
562
-                        'filename' => 'registrations_overview_filters',
563
-                    ],
564
-                    'registrations_overview_views_help_tab'                 => [
565
-                        'title'    => esc_html__('Registration Views', 'event_espresso'),
566
-                        'filename' => 'registrations_overview_views',
567
-                    ],
568
-                    'registrations_regoverview_other_help_tab'              => [
569
-                        'title'    => esc_html__('Registrations Other', 'event_espresso'),
570
-                        'filename' => 'registrations_overview_other',
571
-                    ],
572
-                ],
573
-                'list_table'    => 'EE_Registrations_List_Table',
574
-                'require_nonce' => false,
575
-            ],
576
-            'view_registration' => [
577
-                'nav'           => [
578
-                    'label'      => esc_html__('REG Details', 'event_espresso'),
579
-                    'icon'       => 'dashicons-clipboard',
580
-                    'order'      => 15,
581
-                    'url'        => $REG_ID
582
-                        ? add_query_arg(['_REG_ID' => $REG_ID], $this->_current_page_view_url)
583
-                        : $this->_admin_base_url,
584
-                    'persistent' => false,
585
-                ],
586
-                'help_tabs'     => [
587
-                    'registrations_details_help_tab'                    => [
588
-                        'title'    => esc_html__('Registration Details', 'event_espresso'),
589
-                        'filename' => 'registrations_details',
590
-                    ],
591
-                    'registrations_details_table_help_tab'              => [
592
-                        'title'    => esc_html__('Registration Details Table', 'event_espresso'),
593
-                        'filename' => 'registrations_details_table',
594
-                    ],
595
-                    'registrations_details_form_answers_help_tab'       => [
596
-                        'title'    => esc_html__('Registration Form Answers', 'event_espresso'),
597
-                        'filename' => 'registrations_details_form_answers',
598
-                    ],
599
-                    'registrations_details_registrant_details_help_tab' => [
600
-                        'title'    => esc_html__('Contact Details', 'event_espresso'),
601
-                        'filename' => 'registrations_details_registrant_details',
602
-                    ],
603
-                ],
604
-                'metaboxes'     => array_merge(
605
-                    $this->_default_espresso_metaboxes,
606
-                    ['_registration_details_metaboxes']
607
-                ),
608
-                'require_nonce' => false,
609
-            ],
610
-            'new_registration'  => [
611
-                'nav'           => [
612
-                    'label'      => esc_html__('Add New Registration', 'event_espresso'),
613
-                    'icon'       => 'dashicons-plus-alt',
614
-                    'url'        => '#',
615
-                    'order'      => 15,
616
-                    'persistent' => false,
617
-                ],
618
-                'metaboxes'     => $this->_default_espresso_metaboxes,
619
-                'labels'        => [
620
-                    'publishbox' => esc_html__('Save Registration', 'event_espresso'),
621
-                ],
622
-                'require_nonce' => false,
623
-            ],
624
-            'add_new_attendee'  => [
625
-                'nav'           => [
626
-                    'label'      => esc_html__('Add Contact', 'event_espresso'),
627
-                    'icon'       => 'dashicons-plus-alt',
628
-                    'order'      => 15,
629
-                    'persistent' => false,
630
-                ],
631
-                'metaboxes'     => array_merge(
632
-                    $this->_default_espresso_metaboxes,
633
-                    ['_publish_post_box', 'attendee_editor_metaboxes']
634
-                ),
635
-                'require_nonce' => false,
636
-            ],
637
-            'edit_attendee'     => [
638
-                'nav'           => [
639
-                    'label'      => esc_html__('Edit Contact', 'event_espresso'),
640
-                    'icon'       => 'dashicons-edit-large',
641
-                    'order'      => 15,
642
-                    'persistent' => false,
643
-                    'url'        => $ATT_ID
644
-                        ? add_query_arg(['ATT_ID' => $ATT_ID], $this->_current_page_view_url)
645
-                        : $this->_admin_base_url,
646
-                ],
647
-                'metaboxes'     => array_merge(
648
-                    $this->_default_espresso_metaboxes,
649
-                    ['attendee_editor_metaboxes']
650
-                ),
651
-                'require_nonce' => false,
652
-            ],
653
-            'contact_list'      => [
654
-                'nav'           => [
655
-                    'label' => esc_html__('Contact List', 'event_espresso'),
656
-                    'icon'  => 'dashicons-id-alt',
657
-                    'order' => 20,
658
-                ],
659
-                'list_table'    => 'EE_Attendee_Contact_List_Table',
660
-                'help_tabs'     => [
661
-                    'registrations_contact_list_help_tab'                       => [
662
-                        'title'    => esc_html__('Registrations Contact List', 'event_espresso'),
663
-                        'filename' => 'registrations_contact_list',
664
-                    ],
665
-                    'registrations_contact-list_table_column_headings_help_tab' => [
666
-                        'title'    => esc_html__('Contact List Table Column Headings', 'event_espresso'),
667
-                        'filename' => 'registrations_contact_list_table_column_headings',
668
-                    ],
669
-                    'registrations_contact_list_views_help_tab'                 => [
670
-                        'title'    => esc_html__('Contact List Views', 'event_espresso'),
671
-                        'filename' => 'registrations_contact_list_views',
672
-                    ],
673
-                    'registrations_contact_list_other_help_tab'                 => [
674
-                        'title'    => esc_html__('Contact List Other', 'event_espresso'),
675
-                        'filename' => 'registrations_contact_list_other',
676
-                    ],
677
-                ],
678
-                'metaboxes'     => [],
679
-                'require_nonce' => false,
680
-            ],
681
-            // override default cpt routes
682
-            'create_new'        => '',
683
-            'edit'              => '',
684
-        ];
685
-    }
686
-
687
-
688
-    /**
689
-     * The below methods aren't used by this class currently
690
-     */
691
-    protected function _add_screen_options()
692
-    {
693
-    }
694
-
695
-
696
-    protected function _add_feature_pointers()
697
-    {
698
-    }
699
-
700
-
701
-    public function admin_init()
702
-    {
703
-        EE_Registry::$i18n_js_strings['update_att_qstns'] = esc_html__(
704
-            'click "Update Registration Questions" to save your changes',
705
-            'event_espresso'
706
-        );
707
-    }
708
-
709
-
710
-    public function admin_notices()
711
-    {
712
-    }
713
-
714
-
715
-    public function admin_footer_scripts()
716
-    {
717
-    }
718
-
719
-
720
-    /**
721
-     * get list of registration statuses
722
-     *
723
-     * @return void
724
-     * @throws EE_Error
725
-     * @throws ReflectionException
726
-     */
727
-    private function _get_registration_status_array()
728
-    {
729
-        self::$_reg_status = EEM_Registration::reg_status_array([], true);
730
-    }
731
-
732
-
733
-    /**
734
-     * @throws InvalidArgumentException
735
-     * @throws InvalidDataTypeException
736
-     * @throws InvalidInterfaceException
737
-     * @since 4.10.2.p
738
-     */
739
-    protected function _add_screen_options_default()
740
-    {
741
-        $this->_per_page_screen_option();
742
-    }
743
-
744
-
745
-    /**
746
-     * @throws InvalidArgumentException
747
-     * @throws InvalidDataTypeException
748
-     * @throws InvalidInterfaceException
749
-     * @since 4.10.2.p
750
-     */
751
-    protected function _add_screen_options_contact_list()
752
-    {
753
-        $page_title              = $this->_admin_page_title;
754
-        $this->_admin_page_title = esc_html__('Contacts', 'event_espresso');
755
-        $this->_per_page_screen_option();
756
-        $this->_admin_page_title = $page_title;
757
-    }
758
-
759
-
760
-    public function load_scripts_styles()
761
-    {
762
-        // style
763
-        wp_register_style(
764
-            'espresso_reg',
765
-            REG_ASSETS_URL . 'espresso_registrations_admin.css',
766
-            ['ee-admin-css'],
767
-            EVENT_ESPRESSO_VERSION
768
-        );
769
-        wp_enqueue_style('espresso_reg');
770
-        // script
771
-        wp_register_script(
772
-            'espresso_reg',
773
-            REG_ASSETS_URL . 'espresso_registrations_admin.js',
774
-            ['jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'],
775
-            EVENT_ESPRESSO_VERSION,
776
-            true
777
-        );
778
-        wp_enqueue_script('espresso_reg');
779
-    }
780
-
781
-
782
-    /**
783
-     * @throws EE_Error
784
-     * @throws InvalidArgumentException
785
-     * @throws InvalidDataTypeException
786
-     * @throws InvalidInterfaceException
787
-     * @throws ReflectionException
788
-     * @since 4.10.2.p
789
-     */
790
-    public function load_scripts_styles_edit_attendee()
791
-    {
792
-        // stuff to only show up on our attendee edit details page.
793
-        $attendee_details_translations = [
794
-            'att_publish_text' => sprintf(
795
-            /* translators: The date and time */
796
-                wp_strip_all_tags(__('Created on: %s', 'event_espresso')),
797
-                '<b>' . $this->_cpt_model_obj->get_datetime('ATT_created') . '</b>'
798
-            ),
799
-        ];
800
-        wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations);
801
-        wp_enqueue_script('jquery-validate');
802
-    }
803
-
804
-
805
-    /**
806
-     * @throws EE_Error
807
-     * @throws InvalidArgumentException
808
-     * @throws InvalidDataTypeException
809
-     * @throws InvalidInterfaceException
810
-     * @throws ReflectionException
811
-     * @since 4.10.2.p
812
-     */
813
-    public function load_scripts_styles_view_registration()
814
-    {
815
-        $this->_set_registration_object();
816
-        // styles
817
-        wp_enqueue_style('espresso-ui-theme');
818
-        // scripts
819
-        $this->_get_reg_custom_questions_form($this->_registration->ID());
820
-        $this->_reg_custom_questions_form->wp_enqueue_scripts();
821
-    }
822
-
823
-
824
-    public function load_scripts_styles_contact_list()
825
-    {
826
-        wp_dequeue_style('espresso_reg');
827
-        wp_register_style(
828
-            'espresso_att',
829
-            REG_ASSETS_URL . 'espresso_attendees_admin.css',
830
-            ['ee-admin-css'],
831
-            EVENT_ESPRESSO_VERSION
832
-        );
833
-        wp_enqueue_style('espresso_att');
834
-    }
835
-
836
-
837
-    public function load_scripts_styles_new_registration()
838
-    {
839
-        wp_register_script(
840
-            'ee-spco-for-admin',
841
-            REG_ASSETS_URL . 'spco_for_admin.js',
842
-            ['underscore', 'jquery'],
843
-            EVENT_ESPRESSO_VERSION,
844
-            true
845
-        );
846
-        wp_enqueue_script('ee-spco-for-admin');
847
-        add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
848
-        EE_Form_Section_Proper::wp_enqueue_scripts();
849
-        EED_Ticket_Selector::load_tckt_slctr_assets();
850
-        EE_Datepicker_Input::enqueue_styles_and_scripts();
851
-    }
852
-
853
-
854
-    public function AHEE__EE_Admin_Page__route_admin_request_resend_registration()
855
-    {
856
-        add_filter('FHEE_load_EE_messages', '__return_true');
857
-    }
858
-
859
-
860
-    public function AHEE__EE_Admin_Page__route_admin_request_approve_registration()
861
-    {
862
-        add_filter('FHEE_load_EE_messages', '__return_true');
863
-    }
864
-
865
-
866
-    /**
867
-     * @throws EE_Error
868
-     * @throws InvalidArgumentException
869
-     * @throws InvalidDataTypeException
870
-     * @throws InvalidInterfaceException
871
-     * @throws ReflectionException
872
-     * @since 4.10.2.p
873
-     */
874
-    protected function _set_list_table_views_default()
875
-    {
876
-        // for notification related bulk actions we need to make sure only active messengers have an option.
877
-        EED_Messages::set_autoloaders();
878
-        /** @type EE_Message_Resource_Manager $message_resource_manager */
879
-        $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
880
-        $active_mts               = $message_resource_manager->list_of_active_message_types();
881
-        // key= bulk_action_slug, value= message type.
882
-        $match_array = [
883
-            'approve_registrations'    => 'registration',
884
-            'decline_registrations'    => 'declined_registration',
885
-            'pending_registrations'    => 'pending_approval',
886
-            'no_approve_registrations' => 'not_approved_registration',
887
-            'cancel_registrations'     => 'cancelled_registration',
888
-        ];
889
-        $can_send    = $this->capabilities->current_user_can(
890
-            'ee_send_message',
891
-            'batch_send_messages'
892
-        );
893
-        /** setup reg status bulk actions **/
894
-        $def_reg_status_actions['approve_registrations'] = esc_html__('Approve Registrations', 'event_espresso');
895
-        if ($can_send && in_array($match_array['approve_registrations'], $active_mts, true)) {
896
-            $def_reg_status_actions['approve_and_notify_registrations'] = esc_html__(
897
-                'Approve and Notify Registrations',
898
-                'event_espresso'
899
-            );
900
-        }
901
-        $def_reg_status_actions['decline_registrations'] = esc_html__('Decline Registrations', 'event_espresso');
902
-        if ($can_send && in_array($match_array['decline_registrations'], $active_mts, true)) {
903
-            $def_reg_status_actions['decline_and_notify_registrations'] = esc_html__(
904
-                'Decline and Notify Registrations',
905
-                'event_espresso'
906
-            );
907
-        }
908
-        $def_reg_status_actions['pending_registrations'] = esc_html__(
909
-            'Set Registrations to Pending Payment',
910
-            'event_espresso'
911
-        );
912
-        if ($can_send && in_array($match_array['pending_registrations'], $active_mts, true)) {
913
-            $def_reg_status_actions['pending_and_notify_registrations'] = esc_html__(
914
-                'Set Registrations to Pending Payment and Notify',
915
-                'event_espresso'
916
-            );
917
-        }
918
-        $def_reg_status_actions['no_approve_registrations'] = esc_html__(
919
-            'Set Registrations to Not Approved',
920
-            'event_espresso'
921
-        );
922
-        if ($can_send && in_array($match_array['no_approve_registrations'], $active_mts, true)) {
923
-            $def_reg_status_actions['no_approve_and_notify_registrations'] = esc_html__(
924
-                'Set Registrations to Not Approved and Notify',
925
-                'event_espresso'
926
-            );
927
-        }
928
-        $def_reg_status_actions['cancel_registrations'] = esc_html__('Cancel Registrations', 'event_espresso');
929
-        if ($can_send && in_array($match_array['cancel_registrations'], $active_mts, true)) {
930
-            $def_reg_status_actions['cancel_and_notify_registrations'] = esc_html__(
931
-                'Cancel Registrations and Notify',
932
-                'event_espresso'
933
-            );
934
-        }
935
-        $def_reg_status_actions = apply_filters(
936
-            'FHEE__Registrations_Admin_Page___set_list_table_views_default__def_reg_status_actions_array',
937
-            $def_reg_status_actions,
938
-            $active_mts,
939
-            $can_send
940
-        );
941
-
942
-        $current_time = current_time('timestamp');
943
-        $this->_views = [
944
-            'all'   => [
945
-                'slug'        => 'all',
946
-                'label'       => esc_html__('View All Registrations', 'event_espresso'),
947
-                'count'       => 0,
948
-                'bulk_action' => array_merge(
949
-                    $def_reg_status_actions,
950
-                    [
951
-                        'trash_registrations' => esc_html__('Trash Registrations', 'event_espresso'),
952
-                    ]
953
-                ),
954
-            ],
955
-            'today' => [
956
-                'slug'        => 'today',
957
-                'label'       => sprintf(
958
-                    esc_html__('Today - %s', 'event_espresso'),
959
-                    date('M d, Y', $current_time)
960
-                ),
961
-                'count'       => 0,
962
-                'bulk_action' => array_merge(
963
-                    $def_reg_status_actions,
964
-                    [
965
-                        'trash_registrations' => esc_html__('Trash Registrations', 'event_espresso'),
966
-                    ]
967
-                ),
968
-            ],
969
-            'yesterday' => [
970
-                'slug'        => 'yesterday',
971
-                'label'       => sprintf(
972
-                    esc_html__('Yesterday - %s', 'event_espresso'),
973
-                    date('M d, Y', $current_time - DAY_IN_SECONDS)
974
-                ),
975
-                'count'       => 0,
976
-                'bulk_action' => array_merge(
977
-                    $def_reg_status_actions,
978
-                    [
979
-                        'trash_registrations' => esc_html__('Trash Registrations', 'event_espresso'),
980
-                    ]
981
-                ),
982
-            ],
983
-            'month' => [
984
-                'slug'        => 'month',
985
-                'label'       => esc_html__('This Month', 'event_espresso'),
986
-                'count'       => 0,
987
-                'bulk_action' => array_merge(
988
-                    $def_reg_status_actions,
989
-                    [
990
-                        'trash_registrations' => esc_html__('Trash Registrations', 'event_espresso'),
991
-                    ]
992
-                ),
993
-            ],
994
-        ];
995
-        if (
996
-            $this->capabilities->current_user_can(
997
-                'ee_delete_registrations',
998
-                'espresso_registrations_delete_registration'
999
-            )
1000
-        ) {
1001
-            $this->_views['incomplete'] = [
1002
-                'slug'        => 'incomplete',
1003
-                'label'       => esc_html__('Incomplete', 'event_espresso'),
1004
-                'count'       => 0,
1005
-                'bulk_action' => [
1006
-                    'trash_registrations' => esc_html__('Trash Registrations', 'event_espresso'),
1007
-                ],
1008
-            ];
1009
-            $this->_views['trash']      = [
1010
-                'slug'        => 'trash',
1011
-                'label'       => esc_html__('Trash', 'event_espresso'),
1012
-                'count'       => 0,
1013
-                'bulk_action' => [
1014
-                    'restore_registrations' => esc_html__('Restore Registrations', 'event_espresso'),
1015
-                    'delete_registrations'  => esc_html__('Delete Registrations Permanently', 'event_espresso'),
1016
-                ],
1017
-            ];
1018
-        }
1019
-    }
1020
-
1021
-
1022
-    protected function _set_list_table_views_contact_list()
1023
-    {
1024
-        $this->_views = [
1025
-            'in_use' => [
1026
-                'slug'        => 'in_use',
1027
-                'label'       => esc_html__('In Use', 'event_espresso'),
1028
-                'count'       => 0,
1029
-                'bulk_action' => [
1030
-                    'trash_attendees' => esc_html__('Move to Trash', 'event_espresso'),
1031
-                ],
1032
-            ],
1033
-        ];
1034
-        if (
1035
-            $this->capabilities->current_user_can(
1036
-                'ee_delete_contacts',
1037
-                'espresso_registrations_trash_attendees'
1038
-            )
1039
-        ) {
1040
-            $this->_views['trash'] = [
1041
-                'slug'        => 'trash',
1042
-                'label'       => esc_html__('Trash', 'event_espresso'),
1043
-                'count'       => 0,
1044
-                'bulk_action' => [
1045
-                    'restore_attendees' => esc_html__('Restore from Trash', 'event_espresso'),
1046
-                ],
1047
-            ];
1048
-        }
1049
-    }
1050
-
1051
-
1052
-    /**
1053
-     * @return array
1054
-     * @throws EE_Error
1055
-     */
1056
-    protected function _registration_legend_items()
1057
-    {
1058
-        $fc_items = [
1059
-            'star-icon'        => [
1060
-                'class' => 'dashicons dashicons-star-filled gold-icon',
1061
-                'desc'  => esc_html__('This is the Primary Registrant', 'event_espresso'),
1062
-            ],
1063
-            'view_details'     => [
1064
-                'class' => 'dashicons dashicons-clipboard',
1065
-                'desc'  => esc_html__('View Registration Details', 'event_espresso'),
1066
-            ],
1067
-            'edit_attendee'    => [
1068
-                'class' => 'dashicons dashicons-admin-users',
1069
-                'desc'  => esc_html__('Edit Contact Details', 'event_espresso'),
1070
-            ],
1071
-            'view_transaction' => [
1072
-                'class' => 'dashicons dashicons-cart',
1073
-                'desc'  => esc_html__('View Transaction Details', 'event_espresso'),
1074
-            ],
1075
-            'view_invoice'     => [
1076
-                'class' => 'dashicons dashicons-media-spreadsheet',
1077
-                'desc'  => esc_html__('View Transaction Invoice', 'event_espresso'),
1078
-            ],
1079
-        ];
1080
-        if (
1081
-            $this->capabilities->current_user_can(
1082
-                'ee_send_message',
1083
-                'espresso_registrations_resend_registration'
1084
-            )
1085
-        ) {
1086
-            $fc_items['resend_registration'] = [
1087
-                'class' => 'dashicons dashicons-email-alt',
1088
-                'desc'  => esc_html__('Resend Registration Details', 'event_espresso'),
1089
-            ];
1090
-        } else {
1091
-            $fc_items['blank'] = ['class' => 'blank', 'desc' => ''];
1092
-        }
1093
-        if (
1094
-            $this->capabilities->current_user_can(
1095
-                'ee_read_global_messages',
1096
-                'view_filtered_messages'
1097
-            )
1098
-        ) {
1099
-            $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for');
1100
-            if (is_array($related_for_icon) && isset($related_for_icon['css_class'], $related_for_icon['label'])) {
1101
-                $fc_items['view_related_messages'] = [
1102
-                    'class' => $related_for_icon['css_class'],
1103
-                    'desc'  => $related_for_icon['label'],
1104
-                ];
1105
-            }
1106
-        }
1107
-        $sc_items = [
1108
-            'approved_status'   => [
1109
-                'class' => 'ee-status-legend ee-status-bg--' . EEM_Registration::status_id_approved,
1110
-                'desc'  => EEH_Template::pretty_status(
1111
-                    EEM_Registration::status_id_approved,
1112
-                    false,
1113
-                    'sentence'
1114
-                ),
1115
-            ],
1116
-            'pending_status'    => [
1117
-                'class' => 'ee-status-legend ee-status-bg--' . EEM_Registration::status_id_pending_payment,
1118
-                'desc'  => EEH_Template::pretty_status(
1119
-                    EEM_Registration::status_id_pending_payment,
1120
-                    false,
1121
-                    'sentence'
1122
-                ),
1123
-            ],
1124
-            'wait_list'         => [
1125
-                'class' => 'ee-status-legend ee-status-bg--' . EEM_Registration::status_id_wait_list,
1126
-                'desc'  => EEH_Template::pretty_status(
1127
-                    EEM_Registration::status_id_wait_list,
1128
-                    false,
1129
-                    'sentence'
1130
-                ),
1131
-            ],
1132
-            'incomplete_status' => [
1133
-                'class' => 'ee-status-legend ee-status-bg--' . EEM_Registration::status_id_incomplete,
1134
-                'desc'  => EEH_Template::pretty_status(
1135
-                    EEM_Registration::status_id_incomplete,
1136
-                    false,
1137
-                    'sentence'
1138
-                ),
1139
-            ],
1140
-            'not_approved'      => [
1141
-                'class' => 'ee-status-legend ee-status-bg--' . EEM_Registration::status_id_not_approved,
1142
-                'desc'  => EEH_Template::pretty_status(
1143
-                    EEM_Registration::status_id_not_approved,
1144
-                    false,
1145
-                    'sentence'
1146
-                ),
1147
-            ],
1148
-            'declined_status'   => [
1149
-                'class' => 'ee-status-legend ee-status-bg--' . EEM_Registration::status_id_declined,
1150
-                'desc'  => EEH_Template::pretty_status(
1151
-                    EEM_Registration::status_id_declined,
1152
-                    false,
1153
-                    'sentence'
1154
-                ),
1155
-            ],
1156
-            'cancelled_status'  => [
1157
-                'class' => 'ee-status-legend ee-status-bg--' . EEM_Registration::status_id_cancelled,
1158
-                'desc'  => EEH_Template::pretty_status(
1159
-                    EEM_Registration::status_id_cancelled,
1160
-                    false,
1161
-                    'sentence'
1162
-                ),
1163
-            ],
1164
-        ];
1165
-        return array_merge($fc_items, $sc_items);
1166
-    }
1167
-
1168
-
1169
-
1170
-    /***************************************        REGISTRATION OVERVIEW        **************************************/
1171
-
1172
-
1173
-    /**
1174
-     * @throws DomainException
1175
-     * @throws EE_Error
1176
-     * @throws InvalidArgumentException
1177
-     * @throws InvalidDataTypeException
1178
-     * @throws InvalidInterfaceException
1179
-     */
1180
-    protected function _registrations_overview_list_table()
1181
-    {
1182
-        $this->appendAddNewRegistrationButtonToPageTitle();
1183
-        $header_text                  = '';
1184
-        $admin_page_header_decorators = [
1185
-            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader',
1186
-            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader',
1187
-            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader',
1188
-            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader',
1189
-        ];
1190
-        foreach ($admin_page_header_decorators as $admin_page_header_decorator) {
1191
-            $filter_header_decorator = $this->loader->getNew($admin_page_header_decorator);
1192
-            $header_text             = $filter_header_decorator->getHeaderText($header_text);
1193
-        }
1194
-        $this->_template_args['before_list_table'] = $header_text;
1195
-        $this->_template_args['after_list_table']  = $this->_display_legend($this->_registration_legend_items());
1196
-        $this->display_admin_list_table_page_with_no_sidebar();
1197
-    }
1198
-
1199
-
1200
-    /**
1201
-     * @throws EE_Error
1202
-     * @throws InvalidArgumentException
1203
-     * @throws InvalidDataTypeException
1204
-     * @throws InvalidInterfaceException
1205
-     */
1206
-    private function appendAddNewRegistrationButtonToPageTitle()
1207
-    {
1208
-        $EVT_ID = $this->request->getRequestParam('event_id', 0, 'int');
1209
-        if (
1210
-            $EVT_ID
1211
-            && $this->capabilities->current_user_can(
1212
-                'ee_edit_registrations',
1213
-                'espresso_registrations_new_registration',
1214
-                $EVT_ID
1215
-            )
1216
-        ) {
1217
-            $this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
1218
-                    'new_registration',
1219
-                    'add-registrant',
1220
-                    ['event_id' => $EVT_ID],
1221
-                    'add-new-h2'
1222
-                );
1223
-        }
1224
-    }
1225
-
1226
-
1227
-    /**
1228
-     * This sets the _registration property for the registration details screen
1229
-     *
1230
-     * @return void
1231
-     * @throws EE_Error
1232
-     * @throws InvalidArgumentException
1233
-     * @throws InvalidDataTypeException
1234
-     * @throws InvalidInterfaceException
1235
-     * @throws ReflectionException
1236
-     */
1237
-    private function _set_registration_object()
1238
-    {
1239
-        // get out if we've already set the object
1240
-        if ($this->_registration instanceof EE_Registration) {
1241
-            return;
1242
-        }
1243
-        $REG_ID = $this->request->getRequestParam('_REG_ID', 0, 'int');
1244
-        if ($this->_registration = $this->getRegistrationModel()->get_one_by_ID($REG_ID)) {
1245
-            return;
1246
-        }
1247
-        $error_msg = sprintf(
1248
-            esc_html__(
1249
-                'An error occurred and the details for Registration ID #%s could not be retrieved.',
1250
-                'event_espresso'
1251
-            ),
1252
-            $REG_ID
1253
-        );
1254
-        EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
1255
-        $this->_registration = null;
1256
-    }
1257
-
1258
-
1259
-    /**
1260
-     * Used to retrieve registrations for the list table.
1261
-     *
1262
-     * @param int  $per_page
1263
-     * @param bool $count
1264
-     * @param bool $this_month
1265
-     * @param bool $today
1266
-     * @param bool $yesterday
1267
-     * @return EE_Registration[]|int
1268
-     * @throws EE_Error
1269
-     * @throws ReflectionException
1270
-     */
1271
-    public function get_registrations(
1272
-        int $per_page = 10,
1273
-        bool $count = false,
1274
-        bool $this_month = false,
1275
-        bool $today = false,
1276
-        bool $yesterday = false
1277
-    ) {
1278
-        if ($this_month) {
1279
-            $this->request->setRequestParam('status', 'month');
1280
-        }
1281
-        if ($today) {
1282
-            $this->request->setRequestParam('status', 'today');
1283
-        }
1284
-        if ($yesterday) {
1285
-            $this->request->setRequestParam('status', 'yesterday');
1286
-        }
1287
-        $query_params = $this->_get_registration_query_parameters([], $per_page, $count);
1288
-        /**
1289
-         * Override the default groupby added by EEM_Base so that sorts with multiple order bys work as expected
1290
-         *
1291
-         * @link https://events.codebasehq.com/projects/event-espresso/tickets/10093
1292
-         * @see  https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
1293
-         *                      or if you have the development copy of EE you can view this at the path:
1294
-         *                      /docs/G--Model-System/model-query-params.md
1295
-         */
1296
-        $query_params['group_by'] = '';
1297
-
1298
-        return $count
1299
-            ? $this->getRegistrationModel()->count($query_params)
1300
-            /** @type EE_Registration[] */
1301
-            : $this->getRegistrationModel()->get_all($query_params);
1302
-    }
1303
-
1304
-
1305
-    /**
1306
-     * Retrieves the query parameters to be used by the Registration model for getting registrations.
1307
-     * Note: this listens to values on the request for some query parameters.
1308
-     *
1309
-     * @param array $request
1310
-     * @param int   $per_page
1311
-     * @param bool  $count
1312
-     * @return array
1313
-     * @throws EE_Error
1314
-     * @throws InvalidArgumentException
1315
-     * @throws InvalidDataTypeException
1316
-     * @throws InvalidInterfaceException
1317
-     */
1318
-    protected function _get_registration_query_parameters(
1319
-        array $request = [],
1320
-        int $per_page = 10,
1321
-        bool $count = false
1322
-    ): array {
1323
-        /** @var EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder $list_table_query_builder */
1324
-        $list_table_query_builder = $this->loader->getNew(
1325
-            'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder',
1326
-            [null, null, $request]
1327
-        );
1328
-        return $list_table_query_builder->getQueryParams($per_page, $count);
1329
-    }
1330
-
1331
-
1332
-    public function get_registration_status_array(): array
1333
-    {
1334
-        return self::$_reg_status;
1335
-    }
1336
-
1337
-
1338
-
1339
-
1340
-    /***************************************        REGISTRATION DETAILS        ***************************************/
1341
-    /**
1342
-     * generates HTML for the View Registration Details Admin page
1343
-     *
1344
-     * @return void
1345
-     * @throws DomainException
1346
-     * @throws EE_Error
1347
-     * @throws InvalidArgumentException
1348
-     * @throws InvalidDataTypeException
1349
-     * @throws InvalidInterfaceException
1350
-     * @throws EntityNotFoundException
1351
-     * @throws ReflectionException
1352
-     */
1353
-    protected function _registration_details()
1354
-    {
1355
-        $this->_template_args = [];
1356
-        $this->_set_registration_object();
1357
-        if (is_object($this->_registration)) {
1358
-            $transaction                                   = $this->_registration->transaction()
1359
-                ? $this->_registration->transaction()
1360
-                : EE_Transaction::new_instance();
1361
-            $this->_session                                = $transaction->session_data();
1362
-            $event_id                                      = $this->_registration->event_ID();
1363
-            $this->_template_args['reg_nmbr']['value']     = $this->_registration->ID();
1364
-            $this->_template_args['reg_nmbr']['label']     = esc_html__('Registration Number', 'event_espresso');
1365
-            $this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime('REG_date');
1366
-            $this->_template_args['reg_datetime']['label'] = esc_html__('Date', 'event_espresso');
1367
-            $this->_template_args['grand_total']           = $transaction->total();
1368
-            $this->_template_args['currency_sign']         = EE_Registry::instance()->CFG->currency->sign;
1369
-            // link back to overview
1370
-            $this->_template_args['reg_overview_url']            = REG_ADMIN_URL;
1371
-            $this->_template_args['registration']                = $this->_registration;
1372
-            $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(
1373
-                [
1374
-                    'action'   => 'default',
1375
-                    'event_id' => $event_id,
1376
-                ],
1377
-                REG_ADMIN_URL
1378
-            );
1379
-            $this->_template_args['filtered_transactions_link']  = EE_Admin_Page::add_query_args_and_nonce(
1380
-                [
1381
-                    'action' => 'default',
1382
-                    'EVT_ID' => $event_id,
1383
-                    'page'   => 'espresso_transactions',
1384
-                ],
1385
-                admin_url('admin.php')
1386
-            );
1387
-            $this->_template_args['event_link']                  = EE_Admin_Page::add_query_args_and_nonce(
1388
-                [
1389
-                    'page'   => 'espresso_events',
1390
-                    'action' => 'edit',
1391
-                    'post'   => $event_id,
1392
-                ],
1393
-                admin_url('admin.php')
1394
-            );
1395
-            // next and previous links
1396
-            $next_reg                                      = $this->_registration->next(
1397
-                null,
1398
-                [],
1399
-                'REG_ID'
1400
-            );
1401
-            $this->_template_args['next_registration']     = $next_reg
1402
-                ? $this->_next_link(
1403
-                    EE_Admin_Page::add_query_args_and_nonce(
1404
-                        [
1405
-                            'action'  => 'view_registration',
1406
-                            '_REG_ID' => $next_reg['REG_ID'],
1407
-                        ],
1408
-                        REG_ADMIN_URL
1409
-                    ),
1410
-                    'dashicons dashicons-arrow-right ee-icon-size-22'
1411
-                )
1412
-                : '';
1413
-            $previous_reg                                  = $this->_registration->previous(
1414
-                null,
1415
-                [],
1416
-                'REG_ID'
1417
-            );
1418
-            $this->_template_args['previous_registration'] = $previous_reg
1419
-                ? $this->_previous_link(
1420
-                    EE_Admin_Page::add_query_args_and_nonce(
1421
-                        [
1422
-                            'action'  => 'view_registration',
1423
-                            '_REG_ID' => $previous_reg['REG_ID'],
1424
-                        ],
1425
-                        REG_ADMIN_URL
1426
-                    ),
1427
-                    'dashicons dashicons-arrow-left ee-icon-size-22'
1428
-                )
1429
-                : '';
1430
-            // grab header
1431
-            $template_path                             = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php';
1432
-            $this->_template_args['REG_ID']            = $this->_registration->ID();
1433
-            $this->_template_args['admin_page_header'] = EEH_Template::display_template(
1434
-                $template_path,
1435
-                $this->_template_args,
1436
-                true
1437
-            );
1438
-        } else {
1439
-            $this->_template_args['admin_page_header'] = '';
1440
-            $this->_display_espresso_notices();
1441
-        }
1442
-        // the details template wrapper
1443
-        $this->display_admin_page_with_sidebar();
1444
-    }
1445
-
1446
-
1447
-    /**
1448
-     * @throws EE_Error
1449
-     * @throws InvalidArgumentException
1450
-     * @throws InvalidDataTypeException
1451
-     * @throws InvalidInterfaceException
1452
-     * @throws ReflectionException
1453
-     * @since 4.10.2.p
1454
-     */
1455
-    protected function _registration_details_metaboxes()
1456
-    {
1457
-        do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this);
1458
-        $this->_set_registration_object();
1459
-        $attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null;
1460
-        $this->addMetaBox(
1461
-            'edit-reg-status-mbox',
1462
-            esc_html__('Registration Status', 'event_espresso'),
1463
-            [$this, 'set_reg_status_buttons_metabox'],
1464
-            $this->_wp_page_slug
1465
-        );
1466
-        $this->addMetaBox(
1467
-            'edit-reg-details-mbox',
1468
-            '<span>' . esc_html__('Registration Details', 'event_espresso')
1469
-            . '&nbsp;<span class="dashicons dashicons-clipboard"></span></span>',
1470
-            [$this, '_reg_details_meta_box'],
1471
-            $this->_wp_page_slug
1472
-        );
1473
-        if (
1474
-            $attendee instanceof EE_Attendee
1475
-            && $this->capabilities->current_user_can(
1476
-                'ee_read_registration',
1477
-                'edit-reg-questions-mbox',
1478
-                $this->_registration->ID()
1479
-            )
1480
-        ) {
1481
-            $this->addMetaBox(
1482
-                'edit-reg-questions-mbox',
1483
-                esc_html__('Registration Form Answers', 'event_espresso'),
1484
-                [$this, '_reg_questions_meta_box'],
1485
-                $this->_wp_page_slug
1486
-            );
1487
-        }
1488
-        $this->addMetaBox(
1489
-            'edit-reg-registrant-mbox',
1490
-            esc_html__('Contact Details', 'event_espresso'),
1491
-            [$this, '_reg_registrant_side_meta_box'],
1492
-            $this->_wp_page_slug,
1493
-            'side'
1494
-        );
1495
-        if ($this->_registration->group_size() > 1) {
1496
-            $this->addMetaBox(
1497
-                'edit-reg-attendees-mbox',
1498
-                esc_html__('Other Registrations in this Transaction', 'event_espresso'),
1499
-                [$this, '_reg_attendees_meta_box'],
1500
-                $this->_wp_page_slug
1501
-            );
1502
-        }
1503
-    }
1504
-
1505
-
1506
-    /**
1507
-     * set_reg_status_buttons_metabox
1508
-     *
1509
-     * @return void
1510
-     * @throws EE_Error
1511
-     * @throws EntityNotFoundException
1512
-     * @throws InvalidArgumentException
1513
-     * @throws InvalidDataTypeException
1514
-     * @throws InvalidInterfaceException
1515
-     * @throws ReflectionException
1516
-     */
1517
-    public function set_reg_status_buttons_metabox()
1518
-    {
1519
-        $this->_set_registration_object();
1520
-        $change_reg_status_form = $this->_generate_reg_status_change_form();
1521
-        $output                 = $change_reg_status_form->form_open(
1522
-            self::add_query_args_and_nonce(
1523
-                [
1524
-                    'action' => 'change_reg_status',
1525
-                ],
1526
-                REG_ADMIN_URL
1527
-            )
1528
-        );
1529
-        $output                 .= $change_reg_status_form->get_html();
1530
-        $output                 .= $change_reg_status_form->form_close();
1531
-        echo wp_kses($output, AllowedTags::getWithFormTags());
1532
-    }
1533
-
1534
-
1535
-    /**
1536
-     * @return EE_Form_Section_Proper
1537
-     * @throws EE_Error
1538
-     * @throws InvalidArgumentException
1539
-     * @throws InvalidDataTypeException
1540
-     * @throws InvalidInterfaceException
1541
-     * @throws EntityNotFoundException
1542
-     * @throws ReflectionException
1543
-     */
1544
-    protected function _generate_reg_status_change_form()
1545
-    {
1546
-        $reg_status_change_form_array = [
1547
-            'name'            => 'reg_status_change_form',
1548
-            'html_id'         => 'reg-status-change-form',
1549
-            'layout_strategy' => new EE_Admin_Two_Column_Layout(),
1550
-            'subsections'     => [
1551
-                'return' => new EE_Hidden_Input(
1552
-                    [
1553
-                        'name'    => 'return',
1554
-                        'default' => 'view_registration',
1555
-                    ]
1556
-                ),
1557
-                'REG_ID' => new EE_Hidden_Input(
1558
-                    [
1559
-                        'name'    => 'REG_ID',
1560
-                        'default' => $this->_registration->ID(),
1561
-                    ]
1562
-                ),
1563
-            ],
1564
-        ];
1565
-        if (
1566
-            $this->capabilities->current_user_can(
1567
-                'ee_edit_registration',
1568
-                'toggle_registration_status',
1569
-                $this->_registration->ID()
1570
-            )
1571
-        ) {
1572
-            $reg_status_change_form_array['subsections']['reg_status']         = new EE_Select_Input(
1573
-                $this->_get_reg_statuses(),
1574
-                [
1575
-                    'html_label_text' => esc_html__('Change Registration Status to', 'event_espresso'),
1576
-                    'default'         => $this->_registration->status_ID(),
1577
-                ]
1578
-            );
1579
-            $reg_status_change_form_array['subsections']['send_notifications'] = new EE_Yes_No_Input(
1580
-                [
1581
-                    'html_label_text' => esc_html__('Send Related Messages', 'event_espresso'),
1582
-                    'default'         => false,
1583
-                    'html_help_text'  => esc_html__(
1584
-                        'If set to "Yes", then the related messages will be sent to the registrant.',
1585
-                        'event_espresso'
1586
-                    ),
1587
-                ]
1588
-            );
1589
-            $reg_status_change_form_array['subsections']['submit']             = new EE_Submit_Input(
1590
-                [
1591
-                    'html_class'      => 'button--primary',
1592
-                    'html_label_text' => '&nbsp;',
1593
-                    'default'         => esc_html__('Update Registration Status', 'event_espresso'),
1594
-                ]
1595
-            );
1596
-        }
1597
-        return new EE_Form_Section_Proper($reg_status_change_form_array);
1598
-    }
1599
-
1600
-
1601
-    /**
1602
-     * Returns an array of all the buttons for the various statuses and switch status actions
1603
-     *
1604
-     * @return array
1605
-     * @throws EE_Error
1606
-     * @throws InvalidArgumentException
1607
-     * @throws InvalidDataTypeException
1608
-     * @throws InvalidInterfaceException
1609
-     * @throws EntityNotFoundException
1610
-     * @throws ReflectionException
1611
-     */
1612
-    protected function _get_reg_statuses()
1613
-    {
1614
-        $reg_status_array = $this->getRegistrationModel()->reg_status_array();
1615
-        unset($reg_status_array[ EEM_Registration::status_id_incomplete ]);
1616
-        // get current reg status
1617
-        $current_status = $this->_registration->status_ID();
1618
-        // is registration for free event? This will determine whether to display the pending payment option
1619
-        if (
1620
-            $current_status !== EEM_Registration::status_id_pending_payment
1621
-            && EEH_Money::compare_floats($this->_registration->ticket()->price(), 0.00)
1622
-        ) {
1623
-            unset($reg_status_array[ EEM_Registration::status_id_pending_payment ]);
1624
-        }
1625
-        return $this->getStatusModel()->localized_status($reg_status_array, false, 'sentence');
1626
-    }
1627
-
1628
-
1629
-    /**
1630
-     * This method is used when using _REG_ID from request which may or may not be an array of reg_ids.
1631
-     *
1632
-     * @param bool $status REG status given for changing registrations to.
1633
-     * @param bool $notify Whether to send messages notifications or not.
1634
-     * @return array (array with reg_id(s) updated and whether update was successful.
1635
-     * @throws DomainException
1636
-     * @throws EE_Error
1637
-     * @throws EntityNotFoundException
1638
-     * @throws InvalidArgumentException
1639
-     * @throws InvalidDataTypeException
1640
-     * @throws InvalidInterfaceException
1641
-     * @throws ReflectionException
1642
-     * @throws RuntimeException
1643
-     */
1644
-    protected function _set_registration_status_from_request($status = false, $notify = false)
1645
-    {
1646
-        $REG_IDs = $this->request->requestParamIsSet('reg_status_change_form')
1647
-            ? $this->request->getRequestParam('reg_status_change_form[REG_ID]', [], 'int', true)
1648
-            : $this->request->getRequestParam('_REG_ID', [], 'int', true);
1649
-        // sanitize $REG_IDs
1650
-        $REG_IDs = array_map('absint', $REG_IDs);
1651
-        // and remove empty entries
1652
-        $REG_IDs = array_filter($REG_IDs);
1653
-
1654
-        $result = $this->_set_registration_status($REG_IDs, $status, $notify);
1655
-
1656
-        /**
1657
-         * Set and filter $_req_data['_REG_ID'] for any potential future messages notifications.
1658
-         * Currently this value is used downstream by the _process_resend_registration method.
1659
-         *
1660
-         * @param int|array                $registration_ids The registration ids that have had their status changed successfully.
1661
-         * @param bool                     $status           The status registrations were changed to.
1662
-         * @param bool                     $success          If the status was changed successfully for all registrations.
1663
-         * @param Registrations_Admin_Page $admin_page
1664
-         */
1665
-        $REG_ID = apply_filters(
1666
-            'FHEE__Registrations_Admin_Page___set_registration_status_from_request__REG_IDs',
1667
-            $result['REG_ID'],
1668
-            $status,
1669
-            $result['success'],
1670
-            $this
1671
-        );
1672
-        $this->request->setRequestParam('_REG_ID', $REG_ID);
1673
-
1674
-        // notify?
1675
-        if (
1676
-            $notify
1677
-            && $result['success']
1678
-            && ! empty($REG_ID)
1679
-            && $this->capabilities->current_user_can(
1680
-                'ee_send_message',
1681
-                'espresso_registrations_resend_registration'
1682
-            )
1683
-        ) {
1684
-            $this->_process_resend_registration();
1685
-        }
1686
-        return $result;
1687
-    }
1688
-
1689
-
1690
-    /**
1691
-     * Set the registration status for the given reg_id (which may or may not be an array, it gets typecast to an
1692
-     * array). Note, this method does NOT take care of possible notifications.  That is required by calling code.
1693
-     *
1694
-     * @param array  $REG_IDs
1695
-     * @param string $status
1696
-     * @param bool   $notify Used to indicate whether notification was requested or not.  This determines the context
1697
-     *                       slug sent with setting the registration status.
1698
-     * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as
1699
-     * @throws EE_Error
1700
-     * @throws InvalidArgumentException
1701
-     * @throws InvalidDataTypeException
1702
-     * @throws InvalidInterfaceException
1703
-     * @throws ReflectionException
1704
-     * @throws RuntimeException
1705
-     * @throws EntityNotFoundException
1706
-     * @throws DomainException
1707
-     */
1708
-    protected function _set_registration_status($REG_IDs = [], $status = '', $notify = false)
1709
-    {
1710
-        $success = false;
1711
-        // typecast $REG_IDs
1712
-        $REG_IDs = (array) $REG_IDs;
1713
-        if (! empty($REG_IDs)) {
1714
-            $success = true;
1715
-            // set default status if none is passed
1716
-            $status         = $status ?: EEM_Registration::status_id_pending_payment;
1717
-            $status_context = $notify
1718
-                ? Domain::CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN_NOTIFY
1719
-                : Domain::CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN;
1720
-            // loop through REG_ID's and change status
1721
-            foreach ($REG_IDs as $REG_ID) {
1722
-                $registration = $this->getRegistrationModel()->get_one_by_ID($REG_ID);
1723
-                if ($registration instanceof EE_Registration) {
1724
-                    $registration->set_status(
1725
-                        $status,
1726
-                        false,
1727
-                        new Context(
1728
-                            $status_context,
1729
-                            esc_html__(
1730
-                                'Manually triggered status change on a Registration Admin Page route.',
1731
-                                'event_espresso'
1732
-                            )
1733
-                        )
1734
-                    );
1735
-                    $result = $registration->save();
1736
-                    // verifying explicit fails because update *may* just return 0 for 0 rows affected
1737
-                    $success = $result !== false ? $success : false;
1738
-                }
1739
-            }
1740
-        }
1741
-
1742
-        // return $success and processed registrations
1743
-        return ['REG_ID' => $REG_IDs, 'success' => $success];
1744
-    }
1745
-
1746
-
1747
-    /**
1748
-     * Common logic for setting up success message and redirecting to appropriate route
1749
-     *
1750
-     * @param string $STS_ID status id for the registration changed to
1751
-     * @param bool   $notify indicates whether the _set_registration_status_from_request does notifications or not.
1752
-     * @return void
1753
-     * @throws DomainException
1754
-     * @throws EE_Error
1755
-     * @throws EntityNotFoundException
1756
-     * @throws InvalidArgumentException
1757
-     * @throws InvalidDataTypeException
1758
-     * @throws InvalidInterfaceException
1759
-     * @throws ReflectionException
1760
-     * @throws RuntimeException
1761
-     */
1762
-    protected function _reg_status_change_return($STS_ID, $notify = false)
1763
-    {
1764
-        $result  = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify)
1765
-            : ['success' => false];
1766
-        $success = isset($result['success']) && $result['success'];
1767
-        // setup success message
1768
-        if ($success) {
1769
-            if (is_array($result['REG_ID']) && count($result['REG_ID']) === 1) {
1770
-                $msg = sprintf(
1771
-                    esc_html__('Registration status has been set to %s', 'event_espresso'),
1772
-                    EEH_Template::pretty_status($STS_ID, false, 'lower')
1773
-                );
1774
-            } else {
1775
-                $msg = sprintf(
1776
-                    esc_html__('Registrations have been set to %s.', 'event_espresso'),
1777
-                    EEH_Template::pretty_status($STS_ID, false, 'lower')
1778
-                );
1779
-            }
1780
-            EE_Error::add_success($msg);
1781
-        } else {
1782
-            EE_Error::add_error(
1783
-                esc_html__(
1784
-                    'Something went wrong, and the status was not changed',
1785
-                    'event_espresso'
1786
-                ),
1787
-                __FILE__,
1788
-                __LINE__,
1789
-                __FUNCTION__
1790
-            );
1791
-        }
1792
-        $return = $this->request->getRequestParam('return');
1793
-        $route  = $return === 'view_registration'
1794
-            ? ['action' => 'view_registration', '_REG_ID' => reset($result['REG_ID'])]
1795
-            : ['action' => 'default'];
1796
-        $route  = $this->mergeExistingRequestParamsWithRedirectArgs($route);
1797
-        $this->_redirect_after_action($success, '', '', $route, true);
1798
-    }
1799
-
1800
-
1801
-    /**
1802
-     * incoming reg status change from reg details page.
1803
-     *
1804
-     * @return void
1805
-     * @throws EE_Error
1806
-     * @throws EntityNotFoundException
1807
-     * @throws InvalidArgumentException
1808
-     * @throws InvalidDataTypeException
1809
-     * @throws InvalidInterfaceException
1810
-     * @throws ReflectionException
1811
-     * @throws RuntimeException
1812
-     * @throws DomainException
1813
-     */
1814
-    protected function _change_reg_status()
1815
-    {
1816
-        $this->request->setRequestParam('return', 'view_registration');
1817
-        // set notify based on whether the send notifications toggle is set or not
1818
-        $notify     = $this->request->getRequestParam('reg_status_change_form[send_notifications]', false, 'bool');
1819
-        $reg_status = $this->request->getRequestParam('reg_status_change_form[reg_status]', '');
1820
-        $this->request->setRequestParam('reg_status_change_form[reg_status]', $reg_status);
1821
-        switch ($reg_status) {
1822
-            case EEM_Registration::status_id_approved:
1823
-            case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence'):
1824
-                $this->approve_registration($notify);
1825
-                break;
1826
-            case EEM_Registration::status_id_pending_payment:
1827
-            case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence'):
1828
-                $this->pending_registration($notify);
1829
-                break;
1830
-            case EEM_Registration::status_id_not_approved:
1831
-            case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence'):
1832
-                $this->not_approve_registration($notify);
1833
-                break;
1834
-            case EEM_Registration::status_id_declined:
1835
-            case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence'):
1836
-                $this->decline_registration($notify);
1837
-                break;
1838
-            case EEM_Registration::status_id_cancelled:
1839
-            case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence'):
1840
-                $this->cancel_registration($notify);
1841
-                break;
1842
-            case EEM_Registration::status_id_wait_list:
1843
-            case EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence'):
1844
-                $this->wait_list_registration($notify);
1845
-                break;
1846
-            case EEM_Registration::status_id_incomplete:
1847
-            default:
1848
-                $this->request->unSetRequestParam('return');
1849
-                $this->_reg_status_change_return('');
1850
-                break;
1851
-        }
1852
-    }
1853
-
1854
-
1855
-    /**
1856
-     * Callback for bulk action routes.
1857
-     * Note: although we could just register the singular route callbacks for each bulk action route as well, this
1858
-     * method was chosen so there is one central place all the registration status bulk actions are going through.
1859
-     * Potentially, this provides an easier place to locate logic that is specific to these bulk actions (as opposed to
1860
-     * when an action is happening on just a single registration).
1861
-     *
1862
-     * @param      $action
1863
-     * @param bool $notify
1864
-     */
1865
-    protected function bulk_action_on_registrations($action, $notify = false)
1866
-    {
1867
-        do_action(
1868
-            'AHEE__Registrations_Admin_Page__bulk_action_on_registrations__before_execution',
1869
-            $this,
1870
-            $action,
1871
-            $notify
1872
-        );
1873
-        $method = $action . '_registration';
1874
-        if (method_exists($this, $method)) {
1875
-            $this->$method($notify);
1876
-        }
1877
-    }
1878
-
1879
-
1880
-    /**
1881
-     * approve_registration
1882
-     *
1883
-     * @param bool $notify whether or not to notify the registrant about their approval.
1884
-     * @return void
1885
-     * @throws EE_Error
1886
-     * @throws EntityNotFoundException
1887
-     * @throws InvalidArgumentException
1888
-     * @throws InvalidDataTypeException
1889
-     * @throws InvalidInterfaceException
1890
-     * @throws ReflectionException
1891
-     * @throws RuntimeException
1892
-     * @throws DomainException
1893
-     */
1894
-    protected function approve_registration($notify = false)
1895
-    {
1896
-        $this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify);
1897
-    }
1898
-
1899
-
1900
-    /**
1901
-     * decline_registration
1902
-     *
1903
-     * @param bool $notify whether or not to notify the registrant about their status change.
1904
-     * @return void
1905
-     * @throws EE_Error
1906
-     * @throws EntityNotFoundException
1907
-     * @throws InvalidArgumentException
1908
-     * @throws InvalidDataTypeException
1909
-     * @throws InvalidInterfaceException
1910
-     * @throws ReflectionException
1911
-     * @throws RuntimeException
1912
-     * @throws DomainException
1913
-     */
1914
-    protected function decline_registration($notify = false)
1915
-    {
1916
-        $this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify);
1917
-    }
1918
-
1919
-
1920
-    /**
1921
-     * cancel_registration
1922
-     *
1923
-     * @param bool $notify whether or not to notify the registrant about their status change.
1924
-     * @return void
1925
-     * @throws EE_Error
1926
-     * @throws EntityNotFoundException
1927
-     * @throws InvalidArgumentException
1928
-     * @throws InvalidDataTypeException
1929
-     * @throws InvalidInterfaceException
1930
-     * @throws ReflectionException
1931
-     * @throws RuntimeException
1932
-     * @throws DomainException
1933
-     */
1934
-    protected function cancel_registration($notify = false)
1935
-    {
1936
-        $this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify);
1937
-    }
1938
-
1939
-
1940
-    /**
1941
-     * not_approve_registration
1942
-     *
1943
-     * @param bool $notify whether or not to notify the registrant about their status change.
1944
-     * @return void
1945
-     * @throws EE_Error
1946
-     * @throws EntityNotFoundException
1947
-     * @throws InvalidArgumentException
1948
-     * @throws InvalidDataTypeException
1949
-     * @throws InvalidInterfaceException
1950
-     * @throws ReflectionException
1951
-     * @throws RuntimeException
1952
-     * @throws DomainException
1953
-     */
1954
-    protected function not_approve_registration($notify = false)
1955
-    {
1956
-        $this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify);
1957
-    }
1958
-
1959
-
1960
-    /**
1961
-     * decline_registration
1962
-     *
1963
-     * @param bool $notify whether or not to notify the registrant about their status change.
1964
-     * @return void
1965
-     * @throws EE_Error
1966
-     * @throws EntityNotFoundException
1967
-     * @throws InvalidArgumentException
1968
-     * @throws InvalidDataTypeException
1969
-     * @throws InvalidInterfaceException
1970
-     * @throws ReflectionException
1971
-     * @throws RuntimeException
1972
-     * @throws DomainException
1973
-     */
1974
-    protected function pending_registration($notify = false)
1975
-    {
1976
-        $this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify);
1977
-    }
1978
-
1979
-
1980
-    /**
1981
-     * waitlist_registration
1982
-     *
1983
-     * @param bool $notify whether or not to notify the registrant about their status change.
1984
-     * @return void
1985
-     * @throws EE_Error
1986
-     * @throws EntityNotFoundException
1987
-     * @throws InvalidArgumentException
1988
-     * @throws InvalidDataTypeException
1989
-     * @throws InvalidInterfaceException
1990
-     * @throws ReflectionException
1991
-     * @throws RuntimeException
1992
-     * @throws DomainException
1993
-     */
1994
-    protected function wait_list_registration($notify = false)
1995
-    {
1996
-        $this->_reg_status_change_return(EEM_Registration::status_id_wait_list, $notify);
1997
-    }
1998
-
1999
-
2000
-    /**
2001
-     * generates HTML for the Registration main meta box
2002
-     *
2003
-     * @return void
2004
-     * @throws DomainException
2005
-     * @throws EE_Error
2006
-     * @throws InvalidArgumentException
2007
-     * @throws InvalidDataTypeException
2008
-     * @throws InvalidInterfaceException
2009
-     * @throws ReflectionException
2010
-     * @throws EntityNotFoundException
2011
-     */
2012
-    public function _reg_details_meta_box()
2013
-    {
2014
-        EEH_Autoloader::register_line_item_display_autoloaders();
2015
-        EEH_Autoloader::register_line_item_filter_autoloaders();
2016
-        EE_Registry::instance()->load_helper('Line_Item');
2017
-        $transaction    = $this->_registration->transaction() ? $this->_registration->transaction()
2018
-            : EE_Transaction::new_instance();
2019
-        $this->_session = $transaction->session_data();
2020
-        $filters        = new EE_Line_Item_Filter_Collection();
2021
-        $filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration));
2022
-        $filters->add(new EE_Non_Zero_Line_Item_Filter());
2023
-        $line_item_filter_processor              = new EE_Line_Item_Filter_Processor(
2024
-            $filters,
2025
-            $transaction->total_line_item()
2026
-        );
2027
-        $filtered_line_item_tree                 = $line_item_filter_processor->process();
2028
-        $line_item_display                       = new EE_Line_Item_Display(
2029
-            'reg_admin_table',
2030
-            'EE_Admin_Table_Registration_Line_Item_Display_Strategy'
2031
-        );
2032
-        $this->_template_args['line_item_table'] = $line_item_display->display_line_item(
2033
-            $filtered_line_item_tree,
2034
-            ['EE_Registration' => $this->_registration]
2035
-        );
2036
-        $attendee                                = $this->_registration->attendee();
2037
-        if (
2038
-            $this->capabilities->current_user_can(
2039
-                'ee_read_transaction',
2040
-                'espresso_transactions_view_transaction'
2041
-            )
2042
-        ) {
2043
-            $this->_template_args['view_transaction_button'] = EEH_Template::get_button_or_link(
2044
-                EE_Admin_Page::add_query_args_and_nonce(
2045
-                    [
2046
-                        'action' => 'view_transaction',
2047
-                        'TXN_ID' => $transaction->ID(),
2048
-                    ],
2049
-                    TXN_ADMIN_URL
2050
-                ),
2051
-                esc_html__(' View Transaction', 'event_espresso'),
2052
-                'button button--secondary right',
2053
-                'dashicons dashicons-cart'
2054
-            );
2055
-        } else {
2056
-            $this->_template_args['view_transaction_button'] = '';
2057
-        }
2058
-        if (
2059
-            $attendee instanceof EE_Attendee
2060
-            && $this->capabilities->current_user_can(
2061
-                'ee_send_message',
2062
-                'espresso_registrations_resend_registration'
2063
-            )
2064
-        ) {
2065
-            $this->_template_args['resend_registration_button'] = EEH_Template::get_button_or_link(
2066
-                EE_Admin_Page::add_query_args_and_nonce(
2067
-                    [
2068
-                        'action'      => 'resend_registration',
2069
-                        '_REG_ID'     => $this->_registration->ID(),
2070
-                        'redirect_to' => 'view_registration',
2071
-                    ],
2072
-                    REG_ADMIN_URL
2073
-                ),
2074
-                esc_html__(' Resend Registration', 'event_espresso'),
2075
-                'button button--secondary right',
2076
-                'dashicons dashicons-email-alt'
2077
-            );
2078
-        } else {
2079
-            $this->_template_args['resend_registration_button'] = '';
2080
-        }
2081
-        $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
2082
-        $payment                               = $transaction->get_first_related('Payment');
2083
-        $payment                               = ! $payment instanceof EE_Payment
2084
-            ? EE_Payment::new_instance()
2085
-            : $payment;
2086
-        $payment_method                        = $payment->get_first_related('Payment_Method');
2087
-        $payment_method                        = ! $payment_method instanceof EE_Payment_Method
2088
-            ? EE_Payment_Method::new_instance()
2089
-            : $payment_method;
2090
-        $reg_details                           = [
2091
-            'payment_method'       => $payment_method->name(),
2092
-            'response_msg'         => $payment->gateway_response(),
2093
-            'registration_id'      => $this->_registration->get('REG_code'),
2094
-            'registration_session' => $this->_registration->session_ID(),
2095
-            'ip_address'           => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '',
2096
-            'user_agent'           => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '',
2097
-        ];
2098
-        if (isset($reg_details['registration_id'])) {
2099
-            $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id'];
2100
-            $this->_template_args['reg_details']['registration_id']['label'] = esc_html__(
2101
-                'Registration ID',
2102
-                'event_espresso'
2103
-            );
2104
-            $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text';
2105
-        }
2106
-        if (isset($reg_details['payment_method'])) {
2107
-            $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method'];
2108
-            $this->_template_args['reg_details']['payment_method']['label'] = esc_html__(
2109
-                'Most Recent Payment Method',
2110
-                'event_espresso'
2111
-            );
2112
-            $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text';
2113
-            $this->_template_args['reg_details']['response_msg']['value']   = $reg_details['response_msg'];
2114
-            $this->_template_args['reg_details']['response_msg']['label']   = esc_html__(
2115
-                'Payment method response',
2116
-                'event_espresso'
2117
-            );
2118
-            $this->_template_args['reg_details']['response_msg']['class']   = 'regular-text';
2119
-        }
2120
-        $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session'];
2121
-        $this->_template_args['reg_details']['registration_session']['label'] = esc_html__(
2122
-            'Registration Session',
2123
-            'event_espresso'
2124
-        );
2125
-        $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text';
2126
-        $this->_template_args['reg_details']['ip_address']['value']           = $reg_details['ip_address'];
2127
-        $this->_template_args['reg_details']['ip_address']['label']           = esc_html__(
2128
-            'Registration placed from IP',
2129
-            'event_espresso'
2130
-        );
2131
-        $this->_template_args['reg_details']['ip_address']['class']           = 'regular-text';
2132
-        $this->_template_args['reg_details']['user_agent']['value']           = $reg_details['user_agent'];
2133
-        $this->_template_args['reg_details']['user_agent']['label']           = esc_html__(
2134
-            'Registrant User Agent',
2135
-            'event_espresso'
2136
-        );
2137
-        $this->_template_args['reg_details']['user_agent']['class']           = 'large-text';
2138
-        $this->_template_args['event_link']                                   = EE_Admin_Page::add_query_args_and_nonce(
2139
-            [
2140
-                'action'   => 'default',
2141
-                'event_id' => $this->_registration->event_ID(),
2142
-            ],
2143
-            REG_ADMIN_URL
2144
-        );
2145
-
2146
-        $this->_template_args['REG_ID']   = $this->_registration->ID();
2147
-        $this->_template_args['event_id'] = $this->_registration->event_ID();
2148
-
2149
-        $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php';
2150
-        EEH_Template::display_template($template_path, $this->_template_args); // already escaped
2151
-    }
2152
-
2153
-
2154
-    /**
2155
-     * generates HTML for the Registration Questions meta box.
2156
-     * If pre-4.8.32.rc.000 hooks are used, uses old methods (with its filters),
2157
-     * otherwise uses new forms system
2158
-     *
2159
-     * @return void
2160
-     * @throws DomainException
2161
-     * @throws EE_Error
2162
-     * @throws InvalidArgumentException
2163
-     * @throws InvalidDataTypeException
2164
-     * @throws InvalidInterfaceException
2165
-     * @throws ReflectionException
2166
-     */
2167
-    public function _reg_questions_meta_box()
2168
-    {
2169
-        // allow someone to override this method entirely
2170
-        if (
2171
-            apply_filters(
2172
-                'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default',
2173
-                true,
2174
-                $this,
2175
-                $this->_registration
2176
-            )
2177
-        ) {
2178
-            $form = $this->_get_reg_custom_questions_form(
2179
-                $this->_registration->ID()
2180
-            );
2181
-
2182
-            $this->_template_args['att_questions'] = count($form->subforms()) > 0
2183
-                ? $form->get_html_and_js()
2184
-                : '';
2185
-
2186
-            $this->_template_args['reg_questions_form_action'] = 'edit_registration';
2187
-            $this->_template_args['REG_ID']                    = $this->_registration->ID();
2188
-            $template_path                                     =
2189
-                REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
2190
-            EEH_Template::display_template($template_path, $this->_template_args);
2191
-        }
2192
-    }
2193
-
2194
-
2195
-    /**
2196
-     * form_before_question_group
2197
-     *
2198
-     * @param string $output
2199
-     * @return        string
2200
-     * @deprecated    as of 4.8.32.rc.000
2201
-     */
2202
-    public function form_before_question_group($output)
2203
-    {
2204
-        EE_Error::doing_it_wrong(
2205
-            __CLASS__ . '::' . __FUNCTION__,
2206
-            esc_html__(
2207
-                'This method would have been protected but was used on a filter callback so needed to be public. Please discontinue usage as it will be removed soon.',
2208
-                'event_espresso'
2209
-            ),
2210
-            '4.8.32.rc.000'
2211
-        );
2212
-        return '
24
+	/**
25
+	 * @var EE_Registration
26
+	 */
27
+	private $_registration;
28
+
29
+	/**
30
+	 * @var EE_Event
31
+	 */
32
+	private $_reg_event;
33
+
34
+	/**
35
+	 * @var EE_Session
36
+	 */
37
+	private $_session;
38
+
39
+	/**
40
+	 * @var array
41
+	 */
42
+	private static $_reg_status;
43
+
44
+	/**
45
+	 * Form for displaying the custom questions for this registration.
46
+	 * This gets used a few times throughout the request so its best to cache it
47
+	 *
48
+	 * @var EE_Registration_Custom_Questions_Form
49
+	 */
50
+	protected $_reg_custom_questions_form;
51
+
52
+	/**
53
+	 * @var EEM_Registration $registration_model
54
+	 */
55
+	private $registration_model;
56
+
57
+	/**
58
+	 * @var EEM_Attendee $attendee_model
59
+	 */
60
+	private $attendee_model;
61
+
62
+	/**
63
+	 * @var EEM_Event $event_model
64
+	 */
65
+	private $event_model;
66
+
67
+	/**
68
+	 * @var EEM_Status $status_model
69
+	 */
70
+	private $status_model;
71
+
72
+
73
+	/**
74
+	 * @param bool $routing
75
+	 * @throws InvalidArgumentException
76
+	 * @throws InvalidDataTypeException
77
+	 * @throws InvalidInterfaceException
78
+	 * @throws ReflectionException
79
+	 */
80
+	public function __construct($routing = true)
81
+	{
82
+		parent::__construct($routing);
83
+		$this->cpt_editpost_route = 'edit_attendee';
84
+		add_action('wp_loaded', [$this, 'wp_loaded']);
85
+	}
86
+
87
+
88
+	/**
89
+	 * @return EEM_Registration
90
+	 * @throws InvalidArgumentException
91
+	 * @throws InvalidDataTypeException
92
+	 * @throws InvalidInterfaceException
93
+	 * @since 4.10.2.p
94
+	 */
95
+	protected function getRegistrationModel()
96
+	{
97
+		if (! $this->registration_model instanceof EEM_Registration) {
98
+			$this->registration_model = $this->loader->getShared('EEM_Registration');
99
+		}
100
+		return $this->registration_model;
101
+	}
102
+
103
+
104
+	/**
105
+	 * @return EEM_Attendee
106
+	 * @throws InvalidArgumentException
107
+	 * @throws InvalidDataTypeException
108
+	 * @throws InvalidInterfaceException
109
+	 * @since 4.10.2.p
110
+	 */
111
+	protected function getAttendeeModel()
112
+	{
113
+		if (! $this->attendee_model instanceof EEM_Attendee) {
114
+			$this->attendee_model = $this->loader->getShared('EEM_Attendee');
115
+		}
116
+		return $this->attendee_model;
117
+	}
118
+
119
+
120
+	/**
121
+	 * @return EEM_Event
122
+	 * @throws InvalidArgumentException
123
+	 * @throws InvalidDataTypeException
124
+	 * @throws InvalidInterfaceException
125
+	 * @since 4.10.2.p
126
+	 */
127
+	protected function getEventModel()
128
+	{
129
+		if (! $this->event_model instanceof EEM_Event) {
130
+			$this->event_model = $this->loader->getShared('EEM_Event');
131
+		}
132
+		return $this->event_model;
133
+	}
134
+
135
+
136
+	/**
137
+	 * @return EEM_Status
138
+	 * @throws InvalidArgumentException
139
+	 * @throws InvalidDataTypeException
140
+	 * @throws InvalidInterfaceException
141
+	 * @since 4.10.2.p
142
+	 */
143
+	protected function getStatusModel()
144
+	{
145
+		if (! $this->status_model instanceof EEM_Status) {
146
+			$this->status_model = $this->loader->getShared('EEM_Status');
147
+		}
148
+		return $this->status_model;
149
+	}
150
+
151
+
152
+	public function wp_loaded()
153
+	{
154
+		// when adding a new registration...
155
+		$action = $this->request->getRequestParam('action');
156
+		if ($action === 'new_registration') {
157
+			EE_System::do_not_cache();
158
+			if ($this->request->getRequestParam('processing_registration', 0, 'int') !== 1) {
159
+				// and it's NOT the attendee information reg step
160
+				// force cookie expiration by setting time to last week
161
+				setcookie('ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/');
162
+				// and update the global
163
+				$_COOKIE['ee_registration_added'] = 0;
164
+			}
165
+		}
166
+	}
167
+
168
+
169
+	protected function _init_page_props()
170
+	{
171
+		$this->page_slug        = REG_PG_SLUG;
172
+		$this->_admin_base_url  = REG_ADMIN_URL;
173
+		$this->_admin_base_path = REG_ADMIN;
174
+		$this->page_label       = esc_html__('Registrations', 'event_espresso');
175
+		$this->_cpt_routes      = [
176
+			'add_new_attendee' => 'espresso_attendees',
177
+			'edit_attendee'    => 'espresso_attendees',
178
+			'insert_attendee'  => 'espresso_attendees',
179
+			'update_attendee'  => 'espresso_attendees',
180
+		];
181
+		$this->_cpt_model_names = [
182
+			'add_new_attendee' => 'EEM_Attendee',
183
+			'edit_attendee'    => 'EEM_Attendee',
184
+		];
185
+		$this->_cpt_edit_routes = [
186
+			'espresso_attendees' => 'edit_attendee',
187
+		];
188
+		$this->_pagenow_map     = [
189
+			'add_new_attendee' => 'post-new.php',
190
+			'edit_attendee'    => 'post.php',
191
+			'trash'            => 'post.php',
192
+		];
193
+		add_action('edit_form_after_title', [$this, 'after_title_form_fields'], 10);
194
+		// add filters so that the comment urls don't take users to a confusing 404 page
195
+		add_filter('get_comment_link', [$this, 'clear_comment_link'], 10, 2);
196
+	}
197
+
198
+
199
+	/**
200
+	 * @param string     $link    The comment permalink with '#comment-$id' appended.
201
+	 * @param WP_Comment $comment The current comment object.
202
+	 * @return string
203
+	 */
204
+	public function clear_comment_link($link, WP_Comment $comment)
205
+	{
206
+		// gotta make sure this only happens on this route
207
+		$post_type = get_post_type($comment->comment_post_ID);
208
+		if ($post_type === 'espresso_attendees') {
209
+			return '#commentsdiv';
210
+		}
211
+		return $link;
212
+	}
213
+
214
+
215
+	protected function _ajax_hooks()
216
+	{
217
+		// todo: all hooks for registrations ajax goes in here
218
+		add_action('wp_ajax_toggle_checkin_status', [$this, 'toggle_checkin_status']);
219
+	}
220
+
221
+
222
+	protected function _define_page_props()
223
+	{
224
+		$this->_admin_page_title = $this->page_label;
225
+		$this->_labels           = [
226
+			'buttons'                      => [
227
+				'add-registrant'      => esc_html__('Add New Registration', 'event_espresso'),
228
+				'add-attendee'        => esc_html__('Add Contact', 'event_espresso'),
229
+				'edit'                => esc_html__('Edit Contact', 'event_espresso'),
230
+				'csv_reg_report'      => esc_html__('Registrations CSV Report', 'event_espresso'),
231
+				'contact_list_report' => esc_html__('Contact List Report', 'event_espresso'),
232
+				'contact_list_export' => esc_html__('Export Data', 'event_espresso'),
233
+			],
234
+			'publishbox'                   => [
235
+				'add_new_attendee' => esc_html__('Add Contact Record', 'event_espresso'),
236
+				'edit_attendee'    => esc_html__('Update Contact Record', 'event_espresso'),
237
+			],
238
+			'hide_add_button_on_cpt_route' => [
239
+				'edit_attendee' => true,
240
+			],
241
+		];
242
+	}
243
+
244
+
245
+	/**
246
+	 * grab url requests and route them
247
+	 *
248
+	 * @return void
249
+	 * @throws EE_Error
250
+	 */
251
+	public function _set_page_routes()
252
+	{
253
+		$this->_get_registration_status_array();
254
+		$REG_ID             = $this->request->getRequestParam('_REG_ID', 0, 'int');
255
+		$REG_ID             = $this->request->getRequestParam('reg_status_change_form[REG_ID]', $REG_ID, 'int');
256
+		$ATT_ID             = $this->request->getRequestParam('ATT_ID', 0, 'int');
257
+		$ATT_ID             = $this->request->getRequestParam('post', $ATT_ID, 'int');
258
+		$this->_page_routes = [
259
+			'default'                             => [
260
+				'func'       => [$this, '_registrations_overview_list_table'],
261
+				'capability' => 'ee_read_registrations',
262
+			],
263
+			'view_registration'                   => [
264
+				'func'       => [$this, '_registration_details'],
265
+				'capability' => 'ee_read_registration',
266
+				'obj_id'     => $REG_ID,
267
+			],
268
+			'edit_registration'                   => [
269
+				'func'               => '_update_attendee_registration_form',
270
+				'noheader'           => true,
271
+				'headers_sent_route' => 'view_registration',
272
+				'capability'         => 'ee_edit_registration',
273
+				'obj_id'             => $REG_ID,
274
+				'_REG_ID'            => $REG_ID,
275
+			],
276
+			'trash_registrations'                 => [
277
+				'func'       => '_trash_or_restore_registrations',
278
+				'args'       => ['trash' => true],
279
+				'noheader'   => true,
280
+				'capability' => 'ee_delete_registrations',
281
+			],
282
+			'restore_registrations'               => [
283
+				'func'       => '_trash_or_restore_registrations',
284
+				'args'       => ['trash' => false],
285
+				'noheader'   => true,
286
+				'capability' => 'ee_delete_registrations',
287
+			],
288
+			'delete_registrations'                => [
289
+				'func'       => '_delete_registrations',
290
+				'noheader'   => true,
291
+				'capability' => 'ee_delete_registrations',
292
+			],
293
+			'new_registration'                    => [
294
+				'func'       => 'new_registration',
295
+				'capability' => 'ee_edit_registrations',
296
+			],
297
+			'process_reg_step'                    => [
298
+				'func'       => 'process_reg_step',
299
+				'noheader'   => true,
300
+				'capability' => 'ee_edit_registrations',
301
+			],
302
+			'redirect_to_txn'                     => [
303
+				'func'       => 'redirect_to_txn',
304
+				'noheader'   => true,
305
+				'capability' => 'ee_edit_registrations',
306
+			],
307
+			'change_reg_status'                   => [
308
+				'func'       => '_change_reg_status',
309
+				'noheader'   => true,
310
+				'capability' => 'ee_edit_registration',
311
+				'obj_id'     => $REG_ID,
312
+			],
313
+			'approve_registration'                => [
314
+				'func'       => 'approve_registration',
315
+				'noheader'   => true,
316
+				'capability' => 'ee_edit_registration',
317
+				'obj_id'     => $REG_ID,
318
+			],
319
+			'approve_and_notify_registration'     => [
320
+				'func'       => 'approve_registration',
321
+				'noheader'   => true,
322
+				'args'       => [true],
323
+				'capability' => 'ee_edit_registration',
324
+				'obj_id'     => $REG_ID,
325
+			],
326
+			'approve_registrations'               => [
327
+				'func'       => 'bulk_action_on_registrations',
328
+				'noheader'   => true,
329
+				'capability' => 'ee_edit_registrations',
330
+				'args'       => ['approve'],
331
+			],
332
+			'approve_and_notify_registrations'    => [
333
+				'func'       => 'bulk_action_on_registrations',
334
+				'noheader'   => true,
335
+				'capability' => 'ee_edit_registrations',
336
+				'args'       => ['approve', true],
337
+			],
338
+			'decline_registration'                => [
339
+				'func'       => 'decline_registration',
340
+				'noheader'   => true,
341
+				'capability' => 'ee_edit_registration',
342
+				'obj_id'     => $REG_ID,
343
+			],
344
+			'decline_and_notify_registration'     => [
345
+				'func'       => 'decline_registration',
346
+				'noheader'   => true,
347
+				'args'       => [true],
348
+				'capability' => 'ee_edit_registration',
349
+				'obj_id'     => $REG_ID,
350
+			],
351
+			'decline_registrations'               => [
352
+				'func'       => 'bulk_action_on_registrations',
353
+				'noheader'   => true,
354
+				'capability' => 'ee_edit_registrations',
355
+				'args'       => ['decline'],
356
+			],
357
+			'decline_and_notify_registrations'    => [
358
+				'func'       => 'bulk_action_on_registrations',
359
+				'noheader'   => true,
360
+				'capability' => 'ee_edit_registrations',
361
+				'args'       => ['decline', true],
362
+			],
363
+			'pending_registration'                => [
364
+				'func'       => 'pending_registration',
365
+				'noheader'   => true,
366
+				'capability' => 'ee_edit_registration',
367
+				'obj_id'     => $REG_ID,
368
+			],
369
+			'pending_and_notify_registration'     => [
370
+				'func'       => 'pending_registration',
371
+				'noheader'   => true,
372
+				'args'       => [true],
373
+				'capability' => 'ee_edit_registration',
374
+				'obj_id'     => $REG_ID,
375
+			],
376
+			'pending_registrations'               => [
377
+				'func'       => 'bulk_action_on_registrations',
378
+				'noheader'   => true,
379
+				'capability' => 'ee_edit_registrations',
380
+				'args'       => ['pending'],
381
+			],
382
+			'pending_and_notify_registrations'    => [
383
+				'func'       => 'bulk_action_on_registrations',
384
+				'noheader'   => true,
385
+				'capability' => 'ee_edit_registrations',
386
+				'args'       => ['pending', true],
387
+			],
388
+			'no_approve_registration'             => [
389
+				'func'       => 'not_approve_registration',
390
+				'noheader'   => true,
391
+				'capability' => 'ee_edit_registration',
392
+				'obj_id'     => $REG_ID,
393
+			],
394
+			'no_approve_and_notify_registration'  => [
395
+				'func'       => 'not_approve_registration',
396
+				'noheader'   => true,
397
+				'args'       => [true],
398
+				'capability' => 'ee_edit_registration',
399
+				'obj_id'     => $REG_ID,
400
+			],
401
+			'no_approve_registrations'            => [
402
+				'func'       => 'bulk_action_on_registrations',
403
+				'noheader'   => true,
404
+				'capability' => 'ee_edit_registrations',
405
+				'args'       => ['not_approve'],
406
+			],
407
+			'no_approve_and_notify_registrations' => [
408
+				'func'       => 'bulk_action_on_registrations',
409
+				'noheader'   => true,
410
+				'capability' => 'ee_edit_registrations',
411
+				'args'       => ['not_approve', true],
412
+			],
413
+			'cancel_registration'                 => [
414
+				'func'       => 'cancel_registration',
415
+				'noheader'   => true,
416
+				'capability' => 'ee_edit_registration',
417
+				'obj_id'     => $REG_ID,
418
+			],
419
+			'cancel_and_notify_registration'      => [
420
+				'func'       => 'cancel_registration',
421
+				'noheader'   => true,
422
+				'args'       => [true],
423
+				'capability' => 'ee_edit_registration',
424
+				'obj_id'     => $REG_ID,
425
+			],
426
+			'cancel_registrations'                => [
427
+				'func'       => 'bulk_action_on_registrations',
428
+				'noheader'   => true,
429
+				'capability' => 'ee_edit_registrations',
430
+				'args'       => ['cancel'],
431
+			],
432
+			'cancel_and_notify_registrations'     => [
433
+				'func'       => 'bulk_action_on_registrations',
434
+				'noheader'   => true,
435
+				'capability' => 'ee_edit_registrations',
436
+				'args'       => ['cancel', true],
437
+			],
438
+			'wait_list_registration'              => [
439
+				'func'       => 'wait_list_registration',
440
+				'noheader'   => true,
441
+				'capability' => 'ee_edit_registration',
442
+				'obj_id'     => $REG_ID,
443
+			],
444
+			'wait_list_and_notify_registration'   => [
445
+				'func'       => 'wait_list_registration',
446
+				'noheader'   => true,
447
+				'args'       => [true],
448
+				'capability' => 'ee_edit_registration',
449
+				'obj_id'     => $REG_ID,
450
+			],
451
+			'contact_list'                        => [
452
+				'func'       => '_attendee_contact_list_table',
453
+				'capability' => 'ee_read_contacts',
454
+			],
455
+			'add_new_attendee'                    => [
456
+				'func' => '_create_new_cpt_item',
457
+				'args' => [
458
+					'new_attendee' => true,
459
+					'capability'   => 'ee_edit_contacts',
460
+				],
461
+			],
462
+			'edit_attendee'                       => [
463
+				'func'       => '_edit_cpt_item',
464
+				'capability' => 'ee_edit_contacts',
465
+				'obj_id'     => $ATT_ID,
466
+			],
467
+			'duplicate_attendee'                  => [
468
+				'func'       => '_duplicate_attendee',
469
+				'noheader'   => true,
470
+				'capability' => 'ee_edit_contacts',
471
+				'obj_id'     => $ATT_ID,
472
+			],
473
+			'insert_attendee'                     => [
474
+				'func'       => '_insert_or_update_attendee',
475
+				'args'       => [
476
+					'new_attendee' => true,
477
+				],
478
+				'noheader'   => true,
479
+				'capability' => 'ee_edit_contacts',
480
+			],
481
+			'update_attendee'                     => [
482
+				'func'       => '_insert_or_update_attendee',
483
+				'args'       => [
484
+					'new_attendee' => false,
485
+				],
486
+				'noheader'   => true,
487
+				'capability' => 'ee_edit_contacts',
488
+				'obj_id'     => $ATT_ID,
489
+			],
490
+			'trash_attendees'                     => [
491
+				'func'       => '_trash_or_restore_attendees',
492
+				'args'       => [
493
+					'trash' => 'true',
494
+				],
495
+				'noheader'   => true,
496
+				'capability' => 'ee_delete_contacts',
497
+			],
498
+			'trash_attendee'                      => [
499
+				'func'       => '_trash_or_restore_attendees',
500
+				'args'       => [
501
+					'trash' => true,
502
+				],
503
+				'noheader'   => true,
504
+				'capability' => 'ee_delete_contacts',
505
+				'obj_id'     => $ATT_ID,
506
+			],
507
+			'restore_attendees'                   => [
508
+				'func'       => '_trash_or_restore_attendees',
509
+				'args'       => [
510
+					'trash' => false,
511
+				],
512
+				'noheader'   => true,
513
+				'capability' => 'ee_delete_contacts',
514
+				'obj_id'     => $ATT_ID,
515
+			],
516
+			'resend_registration'                 => [
517
+				'func'       => '_resend_registration',
518
+				'noheader'   => true,
519
+				'capability' => 'ee_send_message',
520
+			],
521
+			'registrations_report'                => [
522
+				'func'       => [$this, '_registrations_report'],
523
+				'noheader'   => true,
524
+				'capability' => 'ee_read_registrations',
525
+			],
526
+			'contact_list_export'                 => [
527
+				'func'       => '_contact_list_export',
528
+				'noheader'   => true,
529
+				'capability' => 'export',
530
+			],
531
+			'contact_list_report'                 => [
532
+				'func'       => '_contact_list_report',
533
+				'noheader'   => true,
534
+				'capability' => 'ee_read_contacts',
535
+			],
536
+		];
537
+	}
538
+
539
+
540
+	protected function _set_page_config()
541
+	{
542
+		$REG_ID             = $this->request->getRequestParam('_REG_ID', 0, 'int');
543
+		$ATT_ID             = $this->request->getRequestParam('ATT_ID', 0, 'int');
544
+		$this->_page_config = [
545
+			'default'           => [
546
+				'nav'           => [
547
+					'label' => esc_html__('Overview', 'event_espresso'),
548
+					'icon'  => 'dashicons-list-view',
549
+					'order' => 5,
550
+				],
551
+				'help_tabs'     => [
552
+					'registrations_overview_help_tab'                       => [
553
+						'title'    => esc_html__('Registrations Overview', 'event_espresso'),
554
+						'filename' => 'registrations_overview',
555
+					],
556
+					'registrations_overview_table_column_headings_help_tab' => [
557
+						'title'    => esc_html__('Registrations Table Column Headings', 'event_espresso'),
558
+						'filename' => 'registrations_overview_table_column_headings',
559
+					],
560
+					'registrations_overview_filters_help_tab'               => [
561
+						'title'    => esc_html__('Registration Filters', 'event_espresso'),
562
+						'filename' => 'registrations_overview_filters',
563
+					],
564
+					'registrations_overview_views_help_tab'                 => [
565
+						'title'    => esc_html__('Registration Views', 'event_espresso'),
566
+						'filename' => 'registrations_overview_views',
567
+					],
568
+					'registrations_regoverview_other_help_tab'              => [
569
+						'title'    => esc_html__('Registrations Other', 'event_espresso'),
570
+						'filename' => 'registrations_overview_other',
571
+					],
572
+				],
573
+				'list_table'    => 'EE_Registrations_List_Table',
574
+				'require_nonce' => false,
575
+			],
576
+			'view_registration' => [
577
+				'nav'           => [
578
+					'label'      => esc_html__('REG Details', 'event_espresso'),
579
+					'icon'       => 'dashicons-clipboard',
580
+					'order'      => 15,
581
+					'url'        => $REG_ID
582
+						? add_query_arg(['_REG_ID' => $REG_ID], $this->_current_page_view_url)
583
+						: $this->_admin_base_url,
584
+					'persistent' => false,
585
+				],
586
+				'help_tabs'     => [
587
+					'registrations_details_help_tab'                    => [
588
+						'title'    => esc_html__('Registration Details', 'event_espresso'),
589
+						'filename' => 'registrations_details',
590
+					],
591
+					'registrations_details_table_help_tab'              => [
592
+						'title'    => esc_html__('Registration Details Table', 'event_espresso'),
593
+						'filename' => 'registrations_details_table',
594
+					],
595
+					'registrations_details_form_answers_help_tab'       => [
596
+						'title'    => esc_html__('Registration Form Answers', 'event_espresso'),
597
+						'filename' => 'registrations_details_form_answers',
598
+					],
599
+					'registrations_details_registrant_details_help_tab' => [
600
+						'title'    => esc_html__('Contact Details', 'event_espresso'),
601
+						'filename' => 'registrations_details_registrant_details',
602
+					],
603
+				],
604
+				'metaboxes'     => array_merge(
605
+					$this->_default_espresso_metaboxes,
606
+					['_registration_details_metaboxes']
607
+				),
608
+				'require_nonce' => false,
609
+			],
610
+			'new_registration'  => [
611
+				'nav'           => [
612
+					'label'      => esc_html__('Add New Registration', 'event_espresso'),
613
+					'icon'       => 'dashicons-plus-alt',
614
+					'url'        => '#',
615
+					'order'      => 15,
616
+					'persistent' => false,
617
+				],
618
+				'metaboxes'     => $this->_default_espresso_metaboxes,
619
+				'labels'        => [
620
+					'publishbox' => esc_html__('Save Registration', 'event_espresso'),
621
+				],
622
+				'require_nonce' => false,
623
+			],
624
+			'add_new_attendee'  => [
625
+				'nav'           => [
626
+					'label'      => esc_html__('Add Contact', 'event_espresso'),
627
+					'icon'       => 'dashicons-plus-alt',
628
+					'order'      => 15,
629
+					'persistent' => false,
630
+				],
631
+				'metaboxes'     => array_merge(
632
+					$this->_default_espresso_metaboxes,
633
+					['_publish_post_box', 'attendee_editor_metaboxes']
634
+				),
635
+				'require_nonce' => false,
636
+			],
637
+			'edit_attendee'     => [
638
+				'nav'           => [
639
+					'label'      => esc_html__('Edit Contact', 'event_espresso'),
640
+					'icon'       => 'dashicons-edit-large',
641
+					'order'      => 15,
642
+					'persistent' => false,
643
+					'url'        => $ATT_ID
644
+						? add_query_arg(['ATT_ID' => $ATT_ID], $this->_current_page_view_url)
645
+						: $this->_admin_base_url,
646
+				],
647
+				'metaboxes'     => array_merge(
648
+					$this->_default_espresso_metaboxes,
649
+					['attendee_editor_metaboxes']
650
+				),
651
+				'require_nonce' => false,
652
+			],
653
+			'contact_list'      => [
654
+				'nav'           => [
655
+					'label' => esc_html__('Contact List', 'event_espresso'),
656
+					'icon'  => 'dashicons-id-alt',
657
+					'order' => 20,
658
+				],
659
+				'list_table'    => 'EE_Attendee_Contact_List_Table',
660
+				'help_tabs'     => [
661
+					'registrations_contact_list_help_tab'                       => [
662
+						'title'    => esc_html__('Registrations Contact List', 'event_espresso'),
663
+						'filename' => 'registrations_contact_list',
664
+					],
665
+					'registrations_contact-list_table_column_headings_help_tab' => [
666
+						'title'    => esc_html__('Contact List Table Column Headings', 'event_espresso'),
667
+						'filename' => 'registrations_contact_list_table_column_headings',
668
+					],
669
+					'registrations_contact_list_views_help_tab'                 => [
670
+						'title'    => esc_html__('Contact List Views', 'event_espresso'),
671
+						'filename' => 'registrations_contact_list_views',
672
+					],
673
+					'registrations_contact_list_other_help_tab'                 => [
674
+						'title'    => esc_html__('Contact List Other', 'event_espresso'),
675
+						'filename' => 'registrations_contact_list_other',
676
+					],
677
+				],
678
+				'metaboxes'     => [],
679
+				'require_nonce' => false,
680
+			],
681
+			// override default cpt routes
682
+			'create_new'        => '',
683
+			'edit'              => '',
684
+		];
685
+	}
686
+
687
+
688
+	/**
689
+	 * The below methods aren't used by this class currently
690
+	 */
691
+	protected function _add_screen_options()
692
+	{
693
+	}
694
+
695
+
696
+	protected function _add_feature_pointers()
697
+	{
698
+	}
699
+
700
+
701
+	public function admin_init()
702
+	{
703
+		EE_Registry::$i18n_js_strings['update_att_qstns'] = esc_html__(
704
+			'click "Update Registration Questions" to save your changes',
705
+			'event_espresso'
706
+		);
707
+	}
708
+
709
+
710
+	public function admin_notices()
711
+	{
712
+	}
713
+
714
+
715
+	public function admin_footer_scripts()
716
+	{
717
+	}
718
+
719
+
720
+	/**
721
+	 * get list of registration statuses
722
+	 *
723
+	 * @return void
724
+	 * @throws EE_Error
725
+	 * @throws ReflectionException
726
+	 */
727
+	private function _get_registration_status_array()
728
+	{
729
+		self::$_reg_status = EEM_Registration::reg_status_array([], true);
730
+	}
731
+
732
+
733
+	/**
734
+	 * @throws InvalidArgumentException
735
+	 * @throws InvalidDataTypeException
736
+	 * @throws InvalidInterfaceException
737
+	 * @since 4.10.2.p
738
+	 */
739
+	protected function _add_screen_options_default()
740
+	{
741
+		$this->_per_page_screen_option();
742
+	}
743
+
744
+
745
+	/**
746
+	 * @throws InvalidArgumentException
747
+	 * @throws InvalidDataTypeException
748
+	 * @throws InvalidInterfaceException
749
+	 * @since 4.10.2.p
750
+	 */
751
+	protected function _add_screen_options_contact_list()
752
+	{
753
+		$page_title              = $this->_admin_page_title;
754
+		$this->_admin_page_title = esc_html__('Contacts', 'event_espresso');
755
+		$this->_per_page_screen_option();
756
+		$this->_admin_page_title = $page_title;
757
+	}
758
+
759
+
760
+	public function load_scripts_styles()
761
+	{
762
+		// style
763
+		wp_register_style(
764
+			'espresso_reg',
765
+			REG_ASSETS_URL . 'espresso_registrations_admin.css',
766
+			['ee-admin-css'],
767
+			EVENT_ESPRESSO_VERSION
768
+		);
769
+		wp_enqueue_style('espresso_reg');
770
+		// script
771
+		wp_register_script(
772
+			'espresso_reg',
773
+			REG_ASSETS_URL . 'espresso_registrations_admin.js',
774
+			['jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'],
775
+			EVENT_ESPRESSO_VERSION,
776
+			true
777
+		);
778
+		wp_enqueue_script('espresso_reg');
779
+	}
780
+
781
+
782
+	/**
783
+	 * @throws EE_Error
784
+	 * @throws InvalidArgumentException
785
+	 * @throws InvalidDataTypeException
786
+	 * @throws InvalidInterfaceException
787
+	 * @throws ReflectionException
788
+	 * @since 4.10.2.p
789
+	 */
790
+	public function load_scripts_styles_edit_attendee()
791
+	{
792
+		// stuff to only show up on our attendee edit details page.
793
+		$attendee_details_translations = [
794
+			'att_publish_text' => sprintf(
795
+			/* translators: The date and time */
796
+				wp_strip_all_tags(__('Created on: %s', 'event_espresso')),
797
+				'<b>' . $this->_cpt_model_obj->get_datetime('ATT_created') . '</b>'
798
+			),
799
+		];
800
+		wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations);
801
+		wp_enqueue_script('jquery-validate');
802
+	}
803
+
804
+
805
+	/**
806
+	 * @throws EE_Error
807
+	 * @throws InvalidArgumentException
808
+	 * @throws InvalidDataTypeException
809
+	 * @throws InvalidInterfaceException
810
+	 * @throws ReflectionException
811
+	 * @since 4.10.2.p
812
+	 */
813
+	public function load_scripts_styles_view_registration()
814
+	{
815
+		$this->_set_registration_object();
816
+		// styles
817
+		wp_enqueue_style('espresso-ui-theme');
818
+		// scripts
819
+		$this->_get_reg_custom_questions_form($this->_registration->ID());
820
+		$this->_reg_custom_questions_form->wp_enqueue_scripts();
821
+	}
822
+
823
+
824
+	public function load_scripts_styles_contact_list()
825
+	{
826
+		wp_dequeue_style('espresso_reg');
827
+		wp_register_style(
828
+			'espresso_att',
829
+			REG_ASSETS_URL . 'espresso_attendees_admin.css',
830
+			['ee-admin-css'],
831
+			EVENT_ESPRESSO_VERSION
832
+		);
833
+		wp_enqueue_style('espresso_att');
834
+	}
835
+
836
+
837
+	public function load_scripts_styles_new_registration()
838
+	{
839
+		wp_register_script(
840
+			'ee-spco-for-admin',
841
+			REG_ASSETS_URL . 'spco_for_admin.js',
842
+			['underscore', 'jquery'],
843
+			EVENT_ESPRESSO_VERSION,
844
+			true
845
+		);
846
+		wp_enqueue_script('ee-spco-for-admin');
847
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
848
+		EE_Form_Section_Proper::wp_enqueue_scripts();
849
+		EED_Ticket_Selector::load_tckt_slctr_assets();
850
+		EE_Datepicker_Input::enqueue_styles_and_scripts();
851
+	}
852
+
853
+
854
+	public function AHEE__EE_Admin_Page__route_admin_request_resend_registration()
855
+	{
856
+		add_filter('FHEE_load_EE_messages', '__return_true');
857
+	}
858
+
859
+
860
+	public function AHEE__EE_Admin_Page__route_admin_request_approve_registration()
861
+	{
862
+		add_filter('FHEE_load_EE_messages', '__return_true');
863
+	}
864
+
865
+
866
+	/**
867
+	 * @throws EE_Error
868
+	 * @throws InvalidArgumentException
869
+	 * @throws InvalidDataTypeException
870
+	 * @throws InvalidInterfaceException
871
+	 * @throws ReflectionException
872
+	 * @since 4.10.2.p
873
+	 */
874
+	protected function _set_list_table_views_default()
875
+	{
876
+		// for notification related bulk actions we need to make sure only active messengers have an option.
877
+		EED_Messages::set_autoloaders();
878
+		/** @type EE_Message_Resource_Manager $message_resource_manager */
879
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
880
+		$active_mts               = $message_resource_manager->list_of_active_message_types();
881
+		// key= bulk_action_slug, value= message type.
882
+		$match_array = [
883
+			'approve_registrations'    => 'registration',
884
+			'decline_registrations'    => 'declined_registration',
885
+			'pending_registrations'    => 'pending_approval',
886
+			'no_approve_registrations' => 'not_approved_registration',
887
+			'cancel_registrations'     => 'cancelled_registration',
888
+		];
889
+		$can_send    = $this->capabilities->current_user_can(
890
+			'ee_send_message',
891
+			'batch_send_messages'
892
+		);
893
+		/** setup reg status bulk actions **/
894
+		$def_reg_status_actions['approve_registrations'] = esc_html__('Approve Registrations', 'event_espresso');
895
+		if ($can_send && in_array($match_array['approve_registrations'], $active_mts, true)) {
896
+			$def_reg_status_actions['approve_and_notify_registrations'] = esc_html__(
897
+				'Approve and Notify Registrations',
898
+				'event_espresso'
899
+			);
900
+		}
901
+		$def_reg_status_actions['decline_registrations'] = esc_html__('Decline Registrations', 'event_espresso');
902
+		if ($can_send && in_array($match_array['decline_registrations'], $active_mts, true)) {
903
+			$def_reg_status_actions['decline_and_notify_registrations'] = esc_html__(
904
+				'Decline and Notify Registrations',
905
+				'event_espresso'
906
+			);
907
+		}
908
+		$def_reg_status_actions['pending_registrations'] = esc_html__(
909
+			'Set Registrations to Pending Payment',
910
+			'event_espresso'
911
+		);
912
+		if ($can_send && in_array($match_array['pending_registrations'], $active_mts, true)) {
913
+			$def_reg_status_actions['pending_and_notify_registrations'] = esc_html__(
914
+				'Set Registrations to Pending Payment and Notify',
915
+				'event_espresso'
916
+			);
917
+		}
918
+		$def_reg_status_actions['no_approve_registrations'] = esc_html__(
919
+			'Set Registrations to Not Approved',
920
+			'event_espresso'
921
+		);
922
+		if ($can_send && in_array($match_array['no_approve_registrations'], $active_mts, true)) {
923
+			$def_reg_status_actions['no_approve_and_notify_registrations'] = esc_html__(
924
+				'Set Registrations to Not Approved and Notify',
925
+				'event_espresso'
926
+			);
927
+		}
928
+		$def_reg_status_actions['cancel_registrations'] = esc_html__('Cancel Registrations', 'event_espresso');
929
+		if ($can_send && in_array($match_array['cancel_registrations'], $active_mts, true)) {
930
+			$def_reg_status_actions['cancel_and_notify_registrations'] = esc_html__(
931
+				'Cancel Registrations and Notify',
932
+				'event_espresso'
933
+			);
934
+		}
935
+		$def_reg_status_actions = apply_filters(
936
+			'FHEE__Registrations_Admin_Page___set_list_table_views_default__def_reg_status_actions_array',
937
+			$def_reg_status_actions,
938
+			$active_mts,
939
+			$can_send
940
+		);
941
+
942
+		$current_time = current_time('timestamp');
943
+		$this->_views = [
944
+			'all'   => [
945
+				'slug'        => 'all',
946
+				'label'       => esc_html__('View All Registrations', 'event_espresso'),
947
+				'count'       => 0,
948
+				'bulk_action' => array_merge(
949
+					$def_reg_status_actions,
950
+					[
951
+						'trash_registrations' => esc_html__('Trash Registrations', 'event_espresso'),
952
+					]
953
+				),
954
+			],
955
+			'today' => [
956
+				'slug'        => 'today',
957
+				'label'       => sprintf(
958
+					esc_html__('Today - %s', 'event_espresso'),
959
+					date('M d, Y', $current_time)
960
+				),
961
+				'count'       => 0,
962
+				'bulk_action' => array_merge(
963
+					$def_reg_status_actions,
964
+					[
965
+						'trash_registrations' => esc_html__('Trash Registrations', 'event_espresso'),
966
+					]
967
+				),
968
+			],
969
+			'yesterday' => [
970
+				'slug'        => 'yesterday',
971
+				'label'       => sprintf(
972
+					esc_html__('Yesterday - %s', 'event_espresso'),
973
+					date('M d, Y', $current_time - DAY_IN_SECONDS)
974
+				),
975
+				'count'       => 0,
976
+				'bulk_action' => array_merge(
977
+					$def_reg_status_actions,
978
+					[
979
+						'trash_registrations' => esc_html__('Trash Registrations', 'event_espresso'),
980
+					]
981
+				),
982
+			],
983
+			'month' => [
984
+				'slug'        => 'month',
985
+				'label'       => esc_html__('This Month', 'event_espresso'),
986
+				'count'       => 0,
987
+				'bulk_action' => array_merge(
988
+					$def_reg_status_actions,
989
+					[
990
+						'trash_registrations' => esc_html__('Trash Registrations', 'event_espresso'),
991
+					]
992
+				),
993
+			],
994
+		];
995
+		if (
996
+			$this->capabilities->current_user_can(
997
+				'ee_delete_registrations',
998
+				'espresso_registrations_delete_registration'
999
+			)
1000
+		) {
1001
+			$this->_views['incomplete'] = [
1002
+				'slug'        => 'incomplete',
1003
+				'label'       => esc_html__('Incomplete', 'event_espresso'),
1004
+				'count'       => 0,
1005
+				'bulk_action' => [
1006
+					'trash_registrations' => esc_html__('Trash Registrations', 'event_espresso'),
1007
+				],
1008
+			];
1009
+			$this->_views['trash']      = [
1010
+				'slug'        => 'trash',
1011
+				'label'       => esc_html__('Trash', 'event_espresso'),
1012
+				'count'       => 0,
1013
+				'bulk_action' => [
1014
+					'restore_registrations' => esc_html__('Restore Registrations', 'event_espresso'),
1015
+					'delete_registrations'  => esc_html__('Delete Registrations Permanently', 'event_espresso'),
1016
+				],
1017
+			];
1018
+		}
1019
+	}
1020
+
1021
+
1022
+	protected function _set_list_table_views_contact_list()
1023
+	{
1024
+		$this->_views = [
1025
+			'in_use' => [
1026
+				'slug'        => 'in_use',
1027
+				'label'       => esc_html__('In Use', 'event_espresso'),
1028
+				'count'       => 0,
1029
+				'bulk_action' => [
1030
+					'trash_attendees' => esc_html__('Move to Trash', 'event_espresso'),
1031
+				],
1032
+			],
1033
+		];
1034
+		if (
1035
+			$this->capabilities->current_user_can(
1036
+				'ee_delete_contacts',
1037
+				'espresso_registrations_trash_attendees'
1038
+			)
1039
+		) {
1040
+			$this->_views['trash'] = [
1041
+				'slug'        => 'trash',
1042
+				'label'       => esc_html__('Trash', 'event_espresso'),
1043
+				'count'       => 0,
1044
+				'bulk_action' => [
1045
+					'restore_attendees' => esc_html__('Restore from Trash', 'event_espresso'),
1046
+				],
1047
+			];
1048
+		}
1049
+	}
1050
+
1051
+
1052
+	/**
1053
+	 * @return array
1054
+	 * @throws EE_Error
1055
+	 */
1056
+	protected function _registration_legend_items()
1057
+	{
1058
+		$fc_items = [
1059
+			'star-icon'        => [
1060
+				'class' => 'dashicons dashicons-star-filled gold-icon',
1061
+				'desc'  => esc_html__('This is the Primary Registrant', 'event_espresso'),
1062
+			],
1063
+			'view_details'     => [
1064
+				'class' => 'dashicons dashicons-clipboard',
1065
+				'desc'  => esc_html__('View Registration Details', 'event_espresso'),
1066
+			],
1067
+			'edit_attendee'    => [
1068
+				'class' => 'dashicons dashicons-admin-users',
1069
+				'desc'  => esc_html__('Edit Contact Details', 'event_espresso'),
1070
+			],
1071
+			'view_transaction' => [
1072
+				'class' => 'dashicons dashicons-cart',
1073
+				'desc'  => esc_html__('View Transaction Details', 'event_espresso'),
1074
+			],
1075
+			'view_invoice'     => [
1076
+				'class' => 'dashicons dashicons-media-spreadsheet',
1077
+				'desc'  => esc_html__('View Transaction Invoice', 'event_espresso'),
1078
+			],
1079
+		];
1080
+		if (
1081
+			$this->capabilities->current_user_can(
1082
+				'ee_send_message',
1083
+				'espresso_registrations_resend_registration'
1084
+			)
1085
+		) {
1086
+			$fc_items['resend_registration'] = [
1087
+				'class' => 'dashicons dashicons-email-alt',
1088
+				'desc'  => esc_html__('Resend Registration Details', 'event_espresso'),
1089
+			];
1090
+		} else {
1091
+			$fc_items['blank'] = ['class' => 'blank', 'desc' => ''];
1092
+		}
1093
+		if (
1094
+			$this->capabilities->current_user_can(
1095
+				'ee_read_global_messages',
1096
+				'view_filtered_messages'
1097
+			)
1098
+		) {
1099
+			$related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for');
1100
+			if (is_array($related_for_icon) && isset($related_for_icon['css_class'], $related_for_icon['label'])) {
1101
+				$fc_items['view_related_messages'] = [
1102
+					'class' => $related_for_icon['css_class'],
1103
+					'desc'  => $related_for_icon['label'],
1104
+				];
1105
+			}
1106
+		}
1107
+		$sc_items = [
1108
+			'approved_status'   => [
1109
+				'class' => 'ee-status-legend ee-status-bg--' . EEM_Registration::status_id_approved,
1110
+				'desc'  => EEH_Template::pretty_status(
1111
+					EEM_Registration::status_id_approved,
1112
+					false,
1113
+					'sentence'
1114
+				),
1115
+			],
1116
+			'pending_status'    => [
1117
+				'class' => 'ee-status-legend ee-status-bg--' . EEM_Registration::status_id_pending_payment,
1118
+				'desc'  => EEH_Template::pretty_status(
1119
+					EEM_Registration::status_id_pending_payment,
1120
+					false,
1121
+					'sentence'
1122
+				),
1123
+			],
1124
+			'wait_list'         => [
1125
+				'class' => 'ee-status-legend ee-status-bg--' . EEM_Registration::status_id_wait_list,
1126
+				'desc'  => EEH_Template::pretty_status(
1127
+					EEM_Registration::status_id_wait_list,
1128
+					false,
1129
+					'sentence'
1130
+				),
1131
+			],
1132
+			'incomplete_status' => [
1133
+				'class' => 'ee-status-legend ee-status-bg--' . EEM_Registration::status_id_incomplete,
1134
+				'desc'  => EEH_Template::pretty_status(
1135
+					EEM_Registration::status_id_incomplete,
1136
+					false,
1137
+					'sentence'
1138
+				),
1139
+			],
1140
+			'not_approved'      => [
1141
+				'class' => 'ee-status-legend ee-status-bg--' . EEM_Registration::status_id_not_approved,
1142
+				'desc'  => EEH_Template::pretty_status(
1143
+					EEM_Registration::status_id_not_approved,
1144
+					false,
1145
+					'sentence'
1146
+				),
1147
+			],
1148
+			'declined_status'   => [
1149
+				'class' => 'ee-status-legend ee-status-bg--' . EEM_Registration::status_id_declined,
1150
+				'desc'  => EEH_Template::pretty_status(
1151
+					EEM_Registration::status_id_declined,
1152
+					false,
1153
+					'sentence'
1154
+				),
1155
+			],
1156
+			'cancelled_status'  => [
1157
+				'class' => 'ee-status-legend ee-status-bg--' . EEM_Registration::status_id_cancelled,
1158
+				'desc'  => EEH_Template::pretty_status(
1159
+					EEM_Registration::status_id_cancelled,
1160
+					false,
1161
+					'sentence'
1162
+				),
1163
+			],
1164
+		];
1165
+		return array_merge($fc_items, $sc_items);
1166
+	}
1167
+
1168
+
1169
+
1170
+	/***************************************        REGISTRATION OVERVIEW        **************************************/
1171
+
1172
+
1173
+	/**
1174
+	 * @throws DomainException
1175
+	 * @throws EE_Error
1176
+	 * @throws InvalidArgumentException
1177
+	 * @throws InvalidDataTypeException
1178
+	 * @throws InvalidInterfaceException
1179
+	 */
1180
+	protected function _registrations_overview_list_table()
1181
+	{
1182
+		$this->appendAddNewRegistrationButtonToPageTitle();
1183
+		$header_text                  = '';
1184
+		$admin_page_header_decorators = [
1185
+			'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader',
1186
+			'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader',
1187
+			'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader',
1188
+			'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader',
1189
+		];
1190
+		foreach ($admin_page_header_decorators as $admin_page_header_decorator) {
1191
+			$filter_header_decorator = $this->loader->getNew($admin_page_header_decorator);
1192
+			$header_text             = $filter_header_decorator->getHeaderText($header_text);
1193
+		}
1194
+		$this->_template_args['before_list_table'] = $header_text;
1195
+		$this->_template_args['after_list_table']  = $this->_display_legend($this->_registration_legend_items());
1196
+		$this->display_admin_list_table_page_with_no_sidebar();
1197
+	}
1198
+
1199
+
1200
+	/**
1201
+	 * @throws EE_Error
1202
+	 * @throws InvalidArgumentException
1203
+	 * @throws InvalidDataTypeException
1204
+	 * @throws InvalidInterfaceException
1205
+	 */
1206
+	private function appendAddNewRegistrationButtonToPageTitle()
1207
+	{
1208
+		$EVT_ID = $this->request->getRequestParam('event_id', 0, 'int');
1209
+		if (
1210
+			$EVT_ID
1211
+			&& $this->capabilities->current_user_can(
1212
+				'ee_edit_registrations',
1213
+				'espresso_registrations_new_registration',
1214
+				$EVT_ID
1215
+			)
1216
+		) {
1217
+			$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
1218
+					'new_registration',
1219
+					'add-registrant',
1220
+					['event_id' => $EVT_ID],
1221
+					'add-new-h2'
1222
+				);
1223
+		}
1224
+	}
1225
+
1226
+
1227
+	/**
1228
+	 * This sets the _registration property for the registration details screen
1229
+	 *
1230
+	 * @return void
1231
+	 * @throws EE_Error
1232
+	 * @throws InvalidArgumentException
1233
+	 * @throws InvalidDataTypeException
1234
+	 * @throws InvalidInterfaceException
1235
+	 * @throws ReflectionException
1236
+	 */
1237
+	private function _set_registration_object()
1238
+	{
1239
+		// get out if we've already set the object
1240
+		if ($this->_registration instanceof EE_Registration) {
1241
+			return;
1242
+		}
1243
+		$REG_ID = $this->request->getRequestParam('_REG_ID', 0, 'int');
1244
+		if ($this->_registration = $this->getRegistrationModel()->get_one_by_ID($REG_ID)) {
1245
+			return;
1246
+		}
1247
+		$error_msg = sprintf(
1248
+			esc_html__(
1249
+				'An error occurred and the details for Registration ID #%s could not be retrieved.',
1250
+				'event_espresso'
1251
+			),
1252
+			$REG_ID
1253
+		);
1254
+		EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
1255
+		$this->_registration = null;
1256
+	}
1257
+
1258
+
1259
+	/**
1260
+	 * Used to retrieve registrations for the list table.
1261
+	 *
1262
+	 * @param int  $per_page
1263
+	 * @param bool $count
1264
+	 * @param bool $this_month
1265
+	 * @param bool $today
1266
+	 * @param bool $yesterday
1267
+	 * @return EE_Registration[]|int
1268
+	 * @throws EE_Error
1269
+	 * @throws ReflectionException
1270
+	 */
1271
+	public function get_registrations(
1272
+		int $per_page = 10,
1273
+		bool $count = false,
1274
+		bool $this_month = false,
1275
+		bool $today = false,
1276
+		bool $yesterday = false
1277
+	) {
1278
+		if ($this_month) {
1279
+			$this->request->setRequestParam('status', 'month');
1280
+		}
1281
+		if ($today) {
1282
+			$this->request->setRequestParam('status', 'today');
1283
+		}
1284
+		if ($yesterday) {
1285
+			$this->request->setRequestParam('status', 'yesterday');
1286
+		}
1287
+		$query_params = $this->_get_registration_query_parameters([], $per_page, $count);
1288
+		/**
1289
+		 * Override the default groupby added by EEM_Base so that sorts with multiple order bys work as expected
1290
+		 *
1291
+		 * @link https://events.codebasehq.com/projects/event-espresso/tickets/10093
1292
+		 * @see  https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
1293
+		 *                      or if you have the development copy of EE you can view this at the path:
1294
+		 *                      /docs/G--Model-System/model-query-params.md
1295
+		 */
1296
+		$query_params['group_by'] = '';
1297
+
1298
+		return $count
1299
+			? $this->getRegistrationModel()->count($query_params)
1300
+			/** @type EE_Registration[] */
1301
+			: $this->getRegistrationModel()->get_all($query_params);
1302
+	}
1303
+
1304
+
1305
+	/**
1306
+	 * Retrieves the query parameters to be used by the Registration model for getting registrations.
1307
+	 * Note: this listens to values on the request for some query parameters.
1308
+	 *
1309
+	 * @param array $request
1310
+	 * @param int   $per_page
1311
+	 * @param bool  $count
1312
+	 * @return array
1313
+	 * @throws EE_Error
1314
+	 * @throws InvalidArgumentException
1315
+	 * @throws InvalidDataTypeException
1316
+	 * @throws InvalidInterfaceException
1317
+	 */
1318
+	protected function _get_registration_query_parameters(
1319
+		array $request = [],
1320
+		int $per_page = 10,
1321
+		bool $count = false
1322
+	): array {
1323
+		/** @var EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder $list_table_query_builder */
1324
+		$list_table_query_builder = $this->loader->getNew(
1325
+			'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder',
1326
+			[null, null, $request]
1327
+		);
1328
+		return $list_table_query_builder->getQueryParams($per_page, $count);
1329
+	}
1330
+
1331
+
1332
+	public function get_registration_status_array(): array
1333
+	{
1334
+		return self::$_reg_status;
1335
+	}
1336
+
1337
+
1338
+
1339
+
1340
+	/***************************************        REGISTRATION DETAILS        ***************************************/
1341
+	/**
1342
+	 * generates HTML for the View Registration Details Admin page
1343
+	 *
1344
+	 * @return void
1345
+	 * @throws DomainException
1346
+	 * @throws EE_Error
1347
+	 * @throws InvalidArgumentException
1348
+	 * @throws InvalidDataTypeException
1349
+	 * @throws InvalidInterfaceException
1350
+	 * @throws EntityNotFoundException
1351
+	 * @throws ReflectionException
1352
+	 */
1353
+	protected function _registration_details()
1354
+	{
1355
+		$this->_template_args = [];
1356
+		$this->_set_registration_object();
1357
+		if (is_object($this->_registration)) {
1358
+			$transaction                                   = $this->_registration->transaction()
1359
+				? $this->_registration->transaction()
1360
+				: EE_Transaction::new_instance();
1361
+			$this->_session                                = $transaction->session_data();
1362
+			$event_id                                      = $this->_registration->event_ID();
1363
+			$this->_template_args['reg_nmbr']['value']     = $this->_registration->ID();
1364
+			$this->_template_args['reg_nmbr']['label']     = esc_html__('Registration Number', 'event_espresso');
1365
+			$this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime('REG_date');
1366
+			$this->_template_args['reg_datetime']['label'] = esc_html__('Date', 'event_espresso');
1367
+			$this->_template_args['grand_total']           = $transaction->total();
1368
+			$this->_template_args['currency_sign']         = EE_Registry::instance()->CFG->currency->sign;
1369
+			// link back to overview
1370
+			$this->_template_args['reg_overview_url']            = REG_ADMIN_URL;
1371
+			$this->_template_args['registration']                = $this->_registration;
1372
+			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(
1373
+				[
1374
+					'action'   => 'default',
1375
+					'event_id' => $event_id,
1376
+				],
1377
+				REG_ADMIN_URL
1378
+			);
1379
+			$this->_template_args['filtered_transactions_link']  = EE_Admin_Page::add_query_args_and_nonce(
1380
+				[
1381
+					'action' => 'default',
1382
+					'EVT_ID' => $event_id,
1383
+					'page'   => 'espresso_transactions',
1384
+				],
1385
+				admin_url('admin.php')
1386
+			);
1387
+			$this->_template_args['event_link']                  = EE_Admin_Page::add_query_args_and_nonce(
1388
+				[
1389
+					'page'   => 'espresso_events',
1390
+					'action' => 'edit',
1391
+					'post'   => $event_id,
1392
+				],
1393
+				admin_url('admin.php')
1394
+			);
1395
+			// next and previous links
1396
+			$next_reg                                      = $this->_registration->next(
1397
+				null,
1398
+				[],
1399
+				'REG_ID'
1400
+			);
1401
+			$this->_template_args['next_registration']     = $next_reg
1402
+				? $this->_next_link(
1403
+					EE_Admin_Page::add_query_args_and_nonce(
1404
+						[
1405
+							'action'  => 'view_registration',
1406
+							'_REG_ID' => $next_reg['REG_ID'],
1407
+						],
1408
+						REG_ADMIN_URL
1409
+					),
1410
+					'dashicons dashicons-arrow-right ee-icon-size-22'
1411
+				)
1412
+				: '';
1413
+			$previous_reg                                  = $this->_registration->previous(
1414
+				null,
1415
+				[],
1416
+				'REG_ID'
1417
+			);
1418
+			$this->_template_args['previous_registration'] = $previous_reg
1419
+				? $this->_previous_link(
1420
+					EE_Admin_Page::add_query_args_and_nonce(
1421
+						[
1422
+							'action'  => 'view_registration',
1423
+							'_REG_ID' => $previous_reg['REG_ID'],
1424
+						],
1425
+						REG_ADMIN_URL
1426
+					),
1427
+					'dashicons dashicons-arrow-left ee-icon-size-22'
1428
+				)
1429
+				: '';
1430
+			// grab header
1431
+			$template_path                             = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php';
1432
+			$this->_template_args['REG_ID']            = $this->_registration->ID();
1433
+			$this->_template_args['admin_page_header'] = EEH_Template::display_template(
1434
+				$template_path,
1435
+				$this->_template_args,
1436
+				true
1437
+			);
1438
+		} else {
1439
+			$this->_template_args['admin_page_header'] = '';
1440
+			$this->_display_espresso_notices();
1441
+		}
1442
+		// the details template wrapper
1443
+		$this->display_admin_page_with_sidebar();
1444
+	}
1445
+
1446
+
1447
+	/**
1448
+	 * @throws EE_Error
1449
+	 * @throws InvalidArgumentException
1450
+	 * @throws InvalidDataTypeException
1451
+	 * @throws InvalidInterfaceException
1452
+	 * @throws ReflectionException
1453
+	 * @since 4.10.2.p
1454
+	 */
1455
+	protected function _registration_details_metaboxes()
1456
+	{
1457
+		do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this);
1458
+		$this->_set_registration_object();
1459
+		$attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null;
1460
+		$this->addMetaBox(
1461
+			'edit-reg-status-mbox',
1462
+			esc_html__('Registration Status', 'event_espresso'),
1463
+			[$this, 'set_reg_status_buttons_metabox'],
1464
+			$this->_wp_page_slug
1465
+		);
1466
+		$this->addMetaBox(
1467
+			'edit-reg-details-mbox',
1468
+			'<span>' . esc_html__('Registration Details', 'event_espresso')
1469
+			. '&nbsp;<span class="dashicons dashicons-clipboard"></span></span>',
1470
+			[$this, '_reg_details_meta_box'],
1471
+			$this->_wp_page_slug
1472
+		);
1473
+		if (
1474
+			$attendee instanceof EE_Attendee
1475
+			&& $this->capabilities->current_user_can(
1476
+				'ee_read_registration',
1477
+				'edit-reg-questions-mbox',
1478
+				$this->_registration->ID()
1479
+			)
1480
+		) {
1481
+			$this->addMetaBox(
1482
+				'edit-reg-questions-mbox',
1483
+				esc_html__('Registration Form Answers', 'event_espresso'),
1484
+				[$this, '_reg_questions_meta_box'],
1485
+				$this->_wp_page_slug
1486
+			);
1487
+		}
1488
+		$this->addMetaBox(
1489
+			'edit-reg-registrant-mbox',
1490
+			esc_html__('Contact Details', 'event_espresso'),
1491
+			[$this, '_reg_registrant_side_meta_box'],
1492
+			$this->_wp_page_slug,
1493
+			'side'
1494
+		);
1495
+		if ($this->_registration->group_size() > 1) {
1496
+			$this->addMetaBox(
1497
+				'edit-reg-attendees-mbox',
1498
+				esc_html__('Other Registrations in this Transaction', 'event_espresso'),
1499
+				[$this, '_reg_attendees_meta_box'],
1500
+				$this->_wp_page_slug
1501
+			);
1502
+		}
1503
+	}
1504
+
1505
+
1506
+	/**
1507
+	 * set_reg_status_buttons_metabox
1508
+	 *
1509
+	 * @return void
1510
+	 * @throws EE_Error
1511
+	 * @throws EntityNotFoundException
1512
+	 * @throws InvalidArgumentException
1513
+	 * @throws InvalidDataTypeException
1514
+	 * @throws InvalidInterfaceException
1515
+	 * @throws ReflectionException
1516
+	 */
1517
+	public function set_reg_status_buttons_metabox()
1518
+	{
1519
+		$this->_set_registration_object();
1520
+		$change_reg_status_form = $this->_generate_reg_status_change_form();
1521
+		$output                 = $change_reg_status_form->form_open(
1522
+			self::add_query_args_and_nonce(
1523
+				[
1524
+					'action' => 'change_reg_status',
1525
+				],
1526
+				REG_ADMIN_URL
1527
+			)
1528
+		);
1529
+		$output                 .= $change_reg_status_form->get_html();
1530
+		$output                 .= $change_reg_status_form->form_close();
1531
+		echo wp_kses($output, AllowedTags::getWithFormTags());
1532
+	}
1533
+
1534
+
1535
+	/**
1536
+	 * @return EE_Form_Section_Proper
1537
+	 * @throws EE_Error
1538
+	 * @throws InvalidArgumentException
1539
+	 * @throws InvalidDataTypeException
1540
+	 * @throws InvalidInterfaceException
1541
+	 * @throws EntityNotFoundException
1542
+	 * @throws ReflectionException
1543
+	 */
1544
+	protected function _generate_reg_status_change_form()
1545
+	{
1546
+		$reg_status_change_form_array = [
1547
+			'name'            => 'reg_status_change_form',
1548
+			'html_id'         => 'reg-status-change-form',
1549
+			'layout_strategy' => new EE_Admin_Two_Column_Layout(),
1550
+			'subsections'     => [
1551
+				'return' => new EE_Hidden_Input(
1552
+					[
1553
+						'name'    => 'return',
1554
+						'default' => 'view_registration',
1555
+					]
1556
+				),
1557
+				'REG_ID' => new EE_Hidden_Input(
1558
+					[
1559
+						'name'    => 'REG_ID',
1560
+						'default' => $this->_registration->ID(),
1561
+					]
1562
+				),
1563
+			],
1564
+		];
1565
+		if (
1566
+			$this->capabilities->current_user_can(
1567
+				'ee_edit_registration',
1568
+				'toggle_registration_status',
1569
+				$this->_registration->ID()
1570
+			)
1571
+		) {
1572
+			$reg_status_change_form_array['subsections']['reg_status']         = new EE_Select_Input(
1573
+				$this->_get_reg_statuses(),
1574
+				[
1575
+					'html_label_text' => esc_html__('Change Registration Status to', 'event_espresso'),
1576
+					'default'         => $this->_registration->status_ID(),
1577
+				]
1578
+			);
1579
+			$reg_status_change_form_array['subsections']['send_notifications'] = new EE_Yes_No_Input(
1580
+				[
1581
+					'html_label_text' => esc_html__('Send Related Messages', 'event_espresso'),
1582
+					'default'         => false,
1583
+					'html_help_text'  => esc_html__(
1584
+						'If set to "Yes", then the related messages will be sent to the registrant.',
1585
+						'event_espresso'
1586
+					),
1587
+				]
1588
+			);
1589
+			$reg_status_change_form_array['subsections']['submit']             = new EE_Submit_Input(
1590
+				[
1591
+					'html_class'      => 'button--primary',
1592
+					'html_label_text' => '&nbsp;',
1593
+					'default'         => esc_html__('Update Registration Status', 'event_espresso'),
1594
+				]
1595
+			);
1596
+		}
1597
+		return new EE_Form_Section_Proper($reg_status_change_form_array);
1598
+	}
1599
+
1600
+
1601
+	/**
1602
+	 * Returns an array of all the buttons for the various statuses and switch status actions
1603
+	 *
1604
+	 * @return array
1605
+	 * @throws EE_Error
1606
+	 * @throws InvalidArgumentException
1607
+	 * @throws InvalidDataTypeException
1608
+	 * @throws InvalidInterfaceException
1609
+	 * @throws EntityNotFoundException
1610
+	 * @throws ReflectionException
1611
+	 */
1612
+	protected function _get_reg_statuses()
1613
+	{
1614
+		$reg_status_array = $this->getRegistrationModel()->reg_status_array();
1615
+		unset($reg_status_array[ EEM_Registration::status_id_incomplete ]);
1616
+		// get current reg status
1617
+		$current_status = $this->_registration->status_ID();
1618
+		// is registration for free event? This will determine whether to display the pending payment option
1619
+		if (
1620
+			$current_status !== EEM_Registration::status_id_pending_payment
1621
+			&& EEH_Money::compare_floats($this->_registration->ticket()->price(), 0.00)
1622
+		) {
1623
+			unset($reg_status_array[ EEM_Registration::status_id_pending_payment ]);
1624
+		}
1625
+		return $this->getStatusModel()->localized_status($reg_status_array, false, 'sentence');
1626
+	}
1627
+
1628
+
1629
+	/**
1630
+	 * This method is used when using _REG_ID from request which may or may not be an array of reg_ids.
1631
+	 *
1632
+	 * @param bool $status REG status given for changing registrations to.
1633
+	 * @param bool $notify Whether to send messages notifications or not.
1634
+	 * @return array (array with reg_id(s) updated and whether update was successful.
1635
+	 * @throws DomainException
1636
+	 * @throws EE_Error
1637
+	 * @throws EntityNotFoundException
1638
+	 * @throws InvalidArgumentException
1639
+	 * @throws InvalidDataTypeException
1640
+	 * @throws InvalidInterfaceException
1641
+	 * @throws ReflectionException
1642
+	 * @throws RuntimeException
1643
+	 */
1644
+	protected function _set_registration_status_from_request($status = false, $notify = false)
1645
+	{
1646
+		$REG_IDs = $this->request->requestParamIsSet('reg_status_change_form')
1647
+			? $this->request->getRequestParam('reg_status_change_form[REG_ID]', [], 'int', true)
1648
+			: $this->request->getRequestParam('_REG_ID', [], 'int', true);
1649
+		// sanitize $REG_IDs
1650
+		$REG_IDs = array_map('absint', $REG_IDs);
1651
+		// and remove empty entries
1652
+		$REG_IDs = array_filter($REG_IDs);
1653
+
1654
+		$result = $this->_set_registration_status($REG_IDs, $status, $notify);
1655
+
1656
+		/**
1657
+		 * Set and filter $_req_data['_REG_ID'] for any potential future messages notifications.
1658
+		 * Currently this value is used downstream by the _process_resend_registration method.
1659
+		 *
1660
+		 * @param int|array                $registration_ids The registration ids that have had their status changed successfully.
1661
+		 * @param bool                     $status           The status registrations were changed to.
1662
+		 * @param bool                     $success          If the status was changed successfully for all registrations.
1663
+		 * @param Registrations_Admin_Page $admin_page
1664
+		 */
1665
+		$REG_ID = apply_filters(
1666
+			'FHEE__Registrations_Admin_Page___set_registration_status_from_request__REG_IDs',
1667
+			$result['REG_ID'],
1668
+			$status,
1669
+			$result['success'],
1670
+			$this
1671
+		);
1672
+		$this->request->setRequestParam('_REG_ID', $REG_ID);
1673
+
1674
+		// notify?
1675
+		if (
1676
+			$notify
1677
+			&& $result['success']
1678
+			&& ! empty($REG_ID)
1679
+			&& $this->capabilities->current_user_can(
1680
+				'ee_send_message',
1681
+				'espresso_registrations_resend_registration'
1682
+			)
1683
+		) {
1684
+			$this->_process_resend_registration();
1685
+		}
1686
+		return $result;
1687
+	}
1688
+
1689
+
1690
+	/**
1691
+	 * Set the registration status for the given reg_id (which may or may not be an array, it gets typecast to an
1692
+	 * array). Note, this method does NOT take care of possible notifications.  That is required by calling code.
1693
+	 *
1694
+	 * @param array  $REG_IDs
1695
+	 * @param string $status
1696
+	 * @param bool   $notify Used to indicate whether notification was requested or not.  This determines the context
1697
+	 *                       slug sent with setting the registration status.
1698
+	 * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as
1699
+	 * @throws EE_Error
1700
+	 * @throws InvalidArgumentException
1701
+	 * @throws InvalidDataTypeException
1702
+	 * @throws InvalidInterfaceException
1703
+	 * @throws ReflectionException
1704
+	 * @throws RuntimeException
1705
+	 * @throws EntityNotFoundException
1706
+	 * @throws DomainException
1707
+	 */
1708
+	protected function _set_registration_status($REG_IDs = [], $status = '', $notify = false)
1709
+	{
1710
+		$success = false;
1711
+		// typecast $REG_IDs
1712
+		$REG_IDs = (array) $REG_IDs;
1713
+		if (! empty($REG_IDs)) {
1714
+			$success = true;
1715
+			// set default status if none is passed
1716
+			$status         = $status ?: EEM_Registration::status_id_pending_payment;
1717
+			$status_context = $notify
1718
+				? Domain::CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN_NOTIFY
1719
+				: Domain::CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN;
1720
+			// loop through REG_ID's and change status
1721
+			foreach ($REG_IDs as $REG_ID) {
1722
+				$registration = $this->getRegistrationModel()->get_one_by_ID($REG_ID);
1723
+				if ($registration instanceof EE_Registration) {
1724
+					$registration->set_status(
1725
+						$status,
1726
+						false,
1727
+						new Context(
1728
+							$status_context,
1729
+							esc_html__(
1730
+								'Manually triggered status change on a Registration Admin Page route.',
1731
+								'event_espresso'
1732
+							)
1733
+						)
1734
+					);
1735
+					$result = $registration->save();
1736
+					// verifying explicit fails because update *may* just return 0 for 0 rows affected
1737
+					$success = $result !== false ? $success : false;
1738
+				}
1739
+			}
1740
+		}
1741
+
1742
+		// return $success and processed registrations
1743
+		return ['REG_ID' => $REG_IDs, 'success' => $success];
1744
+	}
1745
+
1746
+
1747
+	/**
1748
+	 * Common logic for setting up success message and redirecting to appropriate route
1749
+	 *
1750
+	 * @param string $STS_ID status id for the registration changed to
1751
+	 * @param bool   $notify indicates whether the _set_registration_status_from_request does notifications or not.
1752
+	 * @return void
1753
+	 * @throws DomainException
1754
+	 * @throws EE_Error
1755
+	 * @throws EntityNotFoundException
1756
+	 * @throws InvalidArgumentException
1757
+	 * @throws InvalidDataTypeException
1758
+	 * @throws InvalidInterfaceException
1759
+	 * @throws ReflectionException
1760
+	 * @throws RuntimeException
1761
+	 */
1762
+	protected function _reg_status_change_return($STS_ID, $notify = false)
1763
+	{
1764
+		$result  = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify)
1765
+			: ['success' => false];
1766
+		$success = isset($result['success']) && $result['success'];
1767
+		// setup success message
1768
+		if ($success) {
1769
+			if (is_array($result['REG_ID']) && count($result['REG_ID']) === 1) {
1770
+				$msg = sprintf(
1771
+					esc_html__('Registration status has been set to %s', 'event_espresso'),
1772
+					EEH_Template::pretty_status($STS_ID, false, 'lower')
1773
+				);
1774
+			} else {
1775
+				$msg = sprintf(
1776
+					esc_html__('Registrations have been set to %s.', 'event_espresso'),
1777
+					EEH_Template::pretty_status($STS_ID, false, 'lower')
1778
+				);
1779
+			}
1780
+			EE_Error::add_success($msg);
1781
+		} else {
1782
+			EE_Error::add_error(
1783
+				esc_html__(
1784
+					'Something went wrong, and the status was not changed',
1785
+					'event_espresso'
1786
+				),
1787
+				__FILE__,
1788
+				__LINE__,
1789
+				__FUNCTION__
1790
+			);
1791
+		}
1792
+		$return = $this->request->getRequestParam('return');
1793
+		$route  = $return === 'view_registration'
1794
+			? ['action' => 'view_registration', '_REG_ID' => reset($result['REG_ID'])]
1795
+			: ['action' => 'default'];
1796
+		$route  = $this->mergeExistingRequestParamsWithRedirectArgs($route);
1797
+		$this->_redirect_after_action($success, '', '', $route, true);
1798
+	}
1799
+
1800
+
1801
+	/**
1802
+	 * incoming reg status change from reg details page.
1803
+	 *
1804
+	 * @return void
1805
+	 * @throws EE_Error
1806
+	 * @throws EntityNotFoundException
1807
+	 * @throws InvalidArgumentException
1808
+	 * @throws InvalidDataTypeException
1809
+	 * @throws InvalidInterfaceException
1810
+	 * @throws ReflectionException
1811
+	 * @throws RuntimeException
1812
+	 * @throws DomainException
1813
+	 */
1814
+	protected function _change_reg_status()
1815
+	{
1816
+		$this->request->setRequestParam('return', 'view_registration');
1817
+		// set notify based on whether the send notifications toggle is set or not
1818
+		$notify     = $this->request->getRequestParam('reg_status_change_form[send_notifications]', false, 'bool');
1819
+		$reg_status = $this->request->getRequestParam('reg_status_change_form[reg_status]', '');
1820
+		$this->request->setRequestParam('reg_status_change_form[reg_status]', $reg_status);
1821
+		switch ($reg_status) {
1822
+			case EEM_Registration::status_id_approved:
1823
+			case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence'):
1824
+				$this->approve_registration($notify);
1825
+				break;
1826
+			case EEM_Registration::status_id_pending_payment:
1827
+			case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence'):
1828
+				$this->pending_registration($notify);
1829
+				break;
1830
+			case EEM_Registration::status_id_not_approved:
1831
+			case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence'):
1832
+				$this->not_approve_registration($notify);
1833
+				break;
1834
+			case EEM_Registration::status_id_declined:
1835
+			case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence'):
1836
+				$this->decline_registration($notify);
1837
+				break;
1838
+			case EEM_Registration::status_id_cancelled:
1839
+			case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence'):
1840
+				$this->cancel_registration($notify);
1841
+				break;
1842
+			case EEM_Registration::status_id_wait_list:
1843
+			case EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence'):
1844
+				$this->wait_list_registration($notify);
1845
+				break;
1846
+			case EEM_Registration::status_id_incomplete:
1847
+			default:
1848
+				$this->request->unSetRequestParam('return');
1849
+				$this->_reg_status_change_return('');
1850
+				break;
1851
+		}
1852
+	}
1853
+
1854
+
1855
+	/**
1856
+	 * Callback for bulk action routes.
1857
+	 * Note: although we could just register the singular route callbacks for each bulk action route as well, this
1858
+	 * method was chosen so there is one central place all the registration status bulk actions are going through.
1859
+	 * Potentially, this provides an easier place to locate logic that is specific to these bulk actions (as opposed to
1860
+	 * when an action is happening on just a single registration).
1861
+	 *
1862
+	 * @param      $action
1863
+	 * @param bool $notify
1864
+	 */
1865
+	protected function bulk_action_on_registrations($action, $notify = false)
1866
+	{
1867
+		do_action(
1868
+			'AHEE__Registrations_Admin_Page__bulk_action_on_registrations__before_execution',
1869
+			$this,
1870
+			$action,
1871
+			$notify
1872
+		);
1873
+		$method = $action . '_registration';
1874
+		if (method_exists($this, $method)) {
1875
+			$this->$method($notify);
1876
+		}
1877
+	}
1878
+
1879
+
1880
+	/**
1881
+	 * approve_registration
1882
+	 *
1883
+	 * @param bool $notify whether or not to notify the registrant about their approval.
1884
+	 * @return void
1885
+	 * @throws EE_Error
1886
+	 * @throws EntityNotFoundException
1887
+	 * @throws InvalidArgumentException
1888
+	 * @throws InvalidDataTypeException
1889
+	 * @throws InvalidInterfaceException
1890
+	 * @throws ReflectionException
1891
+	 * @throws RuntimeException
1892
+	 * @throws DomainException
1893
+	 */
1894
+	protected function approve_registration($notify = false)
1895
+	{
1896
+		$this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify);
1897
+	}
1898
+
1899
+
1900
+	/**
1901
+	 * decline_registration
1902
+	 *
1903
+	 * @param bool $notify whether or not to notify the registrant about their status change.
1904
+	 * @return void
1905
+	 * @throws EE_Error
1906
+	 * @throws EntityNotFoundException
1907
+	 * @throws InvalidArgumentException
1908
+	 * @throws InvalidDataTypeException
1909
+	 * @throws InvalidInterfaceException
1910
+	 * @throws ReflectionException
1911
+	 * @throws RuntimeException
1912
+	 * @throws DomainException
1913
+	 */
1914
+	protected function decline_registration($notify = false)
1915
+	{
1916
+		$this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify);
1917
+	}
1918
+
1919
+
1920
+	/**
1921
+	 * cancel_registration
1922
+	 *
1923
+	 * @param bool $notify whether or not to notify the registrant about their status change.
1924
+	 * @return void
1925
+	 * @throws EE_Error
1926
+	 * @throws EntityNotFoundException
1927
+	 * @throws InvalidArgumentException
1928
+	 * @throws InvalidDataTypeException
1929
+	 * @throws InvalidInterfaceException
1930
+	 * @throws ReflectionException
1931
+	 * @throws RuntimeException
1932
+	 * @throws DomainException
1933
+	 */
1934
+	protected function cancel_registration($notify = false)
1935
+	{
1936
+		$this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify);
1937
+	}
1938
+
1939
+
1940
+	/**
1941
+	 * not_approve_registration
1942
+	 *
1943
+	 * @param bool $notify whether or not to notify the registrant about their status change.
1944
+	 * @return void
1945
+	 * @throws EE_Error
1946
+	 * @throws EntityNotFoundException
1947
+	 * @throws InvalidArgumentException
1948
+	 * @throws InvalidDataTypeException
1949
+	 * @throws InvalidInterfaceException
1950
+	 * @throws ReflectionException
1951
+	 * @throws RuntimeException
1952
+	 * @throws DomainException
1953
+	 */
1954
+	protected function not_approve_registration($notify = false)
1955
+	{
1956
+		$this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify);
1957
+	}
1958
+
1959
+
1960
+	/**
1961
+	 * decline_registration
1962
+	 *
1963
+	 * @param bool $notify whether or not to notify the registrant about their status change.
1964
+	 * @return void
1965
+	 * @throws EE_Error
1966
+	 * @throws EntityNotFoundException
1967
+	 * @throws InvalidArgumentException
1968
+	 * @throws InvalidDataTypeException
1969
+	 * @throws InvalidInterfaceException
1970
+	 * @throws ReflectionException
1971
+	 * @throws RuntimeException
1972
+	 * @throws DomainException
1973
+	 */
1974
+	protected function pending_registration($notify = false)
1975
+	{
1976
+		$this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify);
1977
+	}
1978
+
1979
+
1980
+	/**
1981
+	 * waitlist_registration
1982
+	 *
1983
+	 * @param bool $notify whether or not to notify the registrant about their status change.
1984
+	 * @return void
1985
+	 * @throws EE_Error
1986
+	 * @throws EntityNotFoundException
1987
+	 * @throws InvalidArgumentException
1988
+	 * @throws InvalidDataTypeException
1989
+	 * @throws InvalidInterfaceException
1990
+	 * @throws ReflectionException
1991
+	 * @throws RuntimeException
1992
+	 * @throws DomainException
1993
+	 */
1994
+	protected function wait_list_registration($notify = false)
1995
+	{
1996
+		$this->_reg_status_change_return(EEM_Registration::status_id_wait_list, $notify);
1997
+	}
1998
+
1999
+
2000
+	/**
2001
+	 * generates HTML for the Registration main meta box
2002
+	 *
2003
+	 * @return void
2004
+	 * @throws DomainException
2005
+	 * @throws EE_Error
2006
+	 * @throws InvalidArgumentException
2007
+	 * @throws InvalidDataTypeException
2008
+	 * @throws InvalidInterfaceException
2009
+	 * @throws ReflectionException
2010
+	 * @throws EntityNotFoundException
2011
+	 */
2012
+	public function _reg_details_meta_box()
2013
+	{
2014
+		EEH_Autoloader::register_line_item_display_autoloaders();
2015
+		EEH_Autoloader::register_line_item_filter_autoloaders();
2016
+		EE_Registry::instance()->load_helper('Line_Item');
2017
+		$transaction    = $this->_registration->transaction() ? $this->_registration->transaction()
2018
+			: EE_Transaction::new_instance();
2019
+		$this->_session = $transaction->session_data();
2020
+		$filters        = new EE_Line_Item_Filter_Collection();
2021
+		$filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration));
2022
+		$filters->add(new EE_Non_Zero_Line_Item_Filter());
2023
+		$line_item_filter_processor              = new EE_Line_Item_Filter_Processor(
2024
+			$filters,
2025
+			$transaction->total_line_item()
2026
+		);
2027
+		$filtered_line_item_tree                 = $line_item_filter_processor->process();
2028
+		$line_item_display                       = new EE_Line_Item_Display(
2029
+			'reg_admin_table',
2030
+			'EE_Admin_Table_Registration_Line_Item_Display_Strategy'
2031
+		);
2032
+		$this->_template_args['line_item_table'] = $line_item_display->display_line_item(
2033
+			$filtered_line_item_tree,
2034
+			['EE_Registration' => $this->_registration]
2035
+		);
2036
+		$attendee                                = $this->_registration->attendee();
2037
+		if (
2038
+			$this->capabilities->current_user_can(
2039
+				'ee_read_transaction',
2040
+				'espresso_transactions_view_transaction'
2041
+			)
2042
+		) {
2043
+			$this->_template_args['view_transaction_button'] = EEH_Template::get_button_or_link(
2044
+				EE_Admin_Page::add_query_args_and_nonce(
2045
+					[
2046
+						'action' => 'view_transaction',
2047
+						'TXN_ID' => $transaction->ID(),
2048
+					],
2049
+					TXN_ADMIN_URL
2050
+				),
2051
+				esc_html__(' View Transaction', 'event_espresso'),
2052
+				'button button--secondary right',
2053
+				'dashicons dashicons-cart'
2054
+			);
2055
+		} else {
2056
+			$this->_template_args['view_transaction_button'] = '';
2057
+		}
2058
+		if (
2059
+			$attendee instanceof EE_Attendee
2060
+			&& $this->capabilities->current_user_can(
2061
+				'ee_send_message',
2062
+				'espresso_registrations_resend_registration'
2063
+			)
2064
+		) {
2065
+			$this->_template_args['resend_registration_button'] = EEH_Template::get_button_or_link(
2066
+				EE_Admin_Page::add_query_args_and_nonce(
2067
+					[
2068
+						'action'      => 'resend_registration',
2069
+						'_REG_ID'     => $this->_registration->ID(),
2070
+						'redirect_to' => 'view_registration',
2071
+					],
2072
+					REG_ADMIN_URL
2073
+				),
2074
+				esc_html__(' Resend Registration', 'event_espresso'),
2075
+				'button button--secondary right',
2076
+				'dashicons dashicons-email-alt'
2077
+			);
2078
+		} else {
2079
+			$this->_template_args['resend_registration_button'] = '';
2080
+		}
2081
+		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
2082
+		$payment                               = $transaction->get_first_related('Payment');
2083
+		$payment                               = ! $payment instanceof EE_Payment
2084
+			? EE_Payment::new_instance()
2085
+			: $payment;
2086
+		$payment_method                        = $payment->get_first_related('Payment_Method');
2087
+		$payment_method                        = ! $payment_method instanceof EE_Payment_Method
2088
+			? EE_Payment_Method::new_instance()
2089
+			: $payment_method;
2090
+		$reg_details                           = [
2091
+			'payment_method'       => $payment_method->name(),
2092
+			'response_msg'         => $payment->gateway_response(),
2093
+			'registration_id'      => $this->_registration->get('REG_code'),
2094
+			'registration_session' => $this->_registration->session_ID(),
2095
+			'ip_address'           => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '',
2096
+			'user_agent'           => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '',
2097
+		];
2098
+		if (isset($reg_details['registration_id'])) {
2099
+			$this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id'];
2100
+			$this->_template_args['reg_details']['registration_id']['label'] = esc_html__(
2101
+				'Registration ID',
2102
+				'event_espresso'
2103
+			);
2104
+			$this->_template_args['reg_details']['registration_id']['class'] = 'regular-text';
2105
+		}
2106
+		if (isset($reg_details['payment_method'])) {
2107
+			$this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method'];
2108
+			$this->_template_args['reg_details']['payment_method']['label'] = esc_html__(
2109
+				'Most Recent Payment Method',
2110
+				'event_espresso'
2111
+			);
2112
+			$this->_template_args['reg_details']['payment_method']['class'] = 'regular-text';
2113
+			$this->_template_args['reg_details']['response_msg']['value']   = $reg_details['response_msg'];
2114
+			$this->_template_args['reg_details']['response_msg']['label']   = esc_html__(
2115
+				'Payment method response',
2116
+				'event_espresso'
2117
+			);
2118
+			$this->_template_args['reg_details']['response_msg']['class']   = 'regular-text';
2119
+		}
2120
+		$this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session'];
2121
+		$this->_template_args['reg_details']['registration_session']['label'] = esc_html__(
2122
+			'Registration Session',
2123
+			'event_espresso'
2124
+		);
2125
+		$this->_template_args['reg_details']['registration_session']['class'] = 'regular-text';
2126
+		$this->_template_args['reg_details']['ip_address']['value']           = $reg_details['ip_address'];
2127
+		$this->_template_args['reg_details']['ip_address']['label']           = esc_html__(
2128
+			'Registration placed from IP',
2129
+			'event_espresso'
2130
+		);
2131
+		$this->_template_args['reg_details']['ip_address']['class']           = 'regular-text';
2132
+		$this->_template_args['reg_details']['user_agent']['value']           = $reg_details['user_agent'];
2133
+		$this->_template_args['reg_details']['user_agent']['label']           = esc_html__(
2134
+			'Registrant User Agent',
2135
+			'event_espresso'
2136
+		);
2137
+		$this->_template_args['reg_details']['user_agent']['class']           = 'large-text';
2138
+		$this->_template_args['event_link']                                   = EE_Admin_Page::add_query_args_and_nonce(
2139
+			[
2140
+				'action'   => 'default',
2141
+				'event_id' => $this->_registration->event_ID(),
2142
+			],
2143
+			REG_ADMIN_URL
2144
+		);
2145
+
2146
+		$this->_template_args['REG_ID']   = $this->_registration->ID();
2147
+		$this->_template_args['event_id'] = $this->_registration->event_ID();
2148
+
2149
+		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php';
2150
+		EEH_Template::display_template($template_path, $this->_template_args); // already escaped
2151
+	}
2152
+
2153
+
2154
+	/**
2155
+	 * generates HTML for the Registration Questions meta box.
2156
+	 * If pre-4.8.32.rc.000 hooks are used, uses old methods (with its filters),
2157
+	 * otherwise uses new forms system
2158
+	 *
2159
+	 * @return void
2160
+	 * @throws DomainException
2161
+	 * @throws EE_Error
2162
+	 * @throws InvalidArgumentException
2163
+	 * @throws InvalidDataTypeException
2164
+	 * @throws InvalidInterfaceException
2165
+	 * @throws ReflectionException
2166
+	 */
2167
+	public function _reg_questions_meta_box()
2168
+	{
2169
+		// allow someone to override this method entirely
2170
+		if (
2171
+			apply_filters(
2172
+				'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default',
2173
+				true,
2174
+				$this,
2175
+				$this->_registration
2176
+			)
2177
+		) {
2178
+			$form = $this->_get_reg_custom_questions_form(
2179
+				$this->_registration->ID()
2180
+			);
2181
+
2182
+			$this->_template_args['att_questions'] = count($form->subforms()) > 0
2183
+				? $form->get_html_and_js()
2184
+				: '';
2185
+
2186
+			$this->_template_args['reg_questions_form_action'] = 'edit_registration';
2187
+			$this->_template_args['REG_ID']                    = $this->_registration->ID();
2188
+			$template_path                                     =
2189
+				REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
2190
+			EEH_Template::display_template($template_path, $this->_template_args);
2191
+		}
2192
+	}
2193
+
2194
+
2195
+	/**
2196
+	 * form_before_question_group
2197
+	 *
2198
+	 * @param string $output
2199
+	 * @return        string
2200
+	 * @deprecated    as of 4.8.32.rc.000
2201
+	 */
2202
+	public function form_before_question_group($output)
2203
+	{
2204
+		EE_Error::doing_it_wrong(
2205
+			__CLASS__ . '::' . __FUNCTION__,
2206
+			esc_html__(
2207
+				'This method would have been protected but was used on a filter callback so needed to be public. Please discontinue usage as it will be removed soon.',
2208
+				'event_espresso'
2209
+			),
2210
+			'4.8.32.rc.000'
2211
+		);
2212
+		return '
2213 2213
 	<table class="form-table ee-width-100">
2214 2214
 		<tbody>
2215 2215
 			';
2216
-    }
2217
-
2218
-
2219
-    /**
2220
-     * form_after_question_group
2221
-     *
2222
-     * @param string $output
2223
-     * @return        string
2224
-     * @deprecated    as of 4.8.32.rc.000
2225
-     */
2226
-    public function form_after_question_group($output)
2227
-    {
2228
-        EE_Error::doing_it_wrong(
2229
-            __CLASS__ . '::' . __FUNCTION__,
2230
-            esc_html__(
2231
-                'This method would have been protected but was used on a filter callback so needed to be public. Please discontinue usage as it will be removed soon.',
2232
-                'event_espresso'
2233
-            ),
2234
-            '4.8.32.rc.000'
2235
-        );
2236
-        return '
2216
+	}
2217
+
2218
+
2219
+	/**
2220
+	 * form_after_question_group
2221
+	 *
2222
+	 * @param string $output
2223
+	 * @return        string
2224
+	 * @deprecated    as of 4.8.32.rc.000
2225
+	 */
2226
+	public function form_after_question_group($output)
2227
+	{
2228
+		EE_Error::doing_it_wrong(
2229
+			__CLASS__ . '::' . __FUNCTION__,
2230
+			esc_html__(
2231
+				'This method would have been protected but was used on a filter callback so needed to be public. Please discontinue usage as it will be removed soon.',
2232
+				'event_espresso'
2233
+			),
2234
+			'4.8.32.rc.000'
2235
+		);
2236
+		return '
2237 2237
 			<tr class="hide-if-no-js">
2238 2238
 				<th> </th>
2239 2239
 				<td class="reg-admin-edit-attendee-question-td">
2240 2240
 					<a class="reg-admin-edit-attendee-question-lnk" href="#" aria-label="'
2241
-               . esc_attr__('click to edit question', 'event_espresso')
2242
-               . '">
2241
+			   . esc_attr__('click to edit question', 'event_espresso')
2242
+			   . '">
2243 2243
 						<span class="reg-admin-edit-question-group-spn lt-grey-txt">'
2244
-               . esc_html__('edit the above question group', 'event_espresso')
2245
-               . '</span>
2244
+			   . esc_html__('edit the above question group', 'event_espresso')
2245
+			   . '</span>
2246 2246
 						<div class="dashicons dashicons-edit"></div>
2247 2247
 					</a>
2248 2248
 				</td>
@@ -2250,642 +2250,642 @@  discard block
 block discarded – undo
2250 2250
 		</tbody>
2251 2251
 	</table>
2252 2252
 ';
2253
-    }
2254
-
2255
-
2256
-    /**
2257
-     * form_form_field_label_wrap
2258
-     *
2259
-     * @param string $label
2260
-     * @return        string
2261
-     * @deprecated    as of 4.8.32.rc.000
2262
-     */
2263
-    public function form_form_field_label_wrap($label)
2264
-    {
2265
-        EE_Error::doing_it_wrong(
2266
-            __CLASS__ . '::' . __FUNCTION__,
2267
-            esc_html__(
2268
-                'This method would have been protected but was used on a filter callback so needed to be public. Please discontinue usage as it will be removed soon.',
2269
-                'event_espresso'
2270
-            ),
2271
-            '4.8.32.rc.000'
2272
-        );
2273
-        return '
2253
+	}
2254
+
2255
+
2256
+	/**
2257
+	 * form_form_field_label_wrap
2258
+	 *
2259
+	 * @param string $label
2260
+	 * @return        string
2261
+	 * @deprecated    as of 4.8.32.rc.000
2262
+	 */
2263
+	public function form_form_field_label_wrap($label)
2264
+	{
2265
+		EE_Error::doing_it_wrong(
2266
+			__CLASS__ . '::' . __FUNCTION__,
2267
+			esc_html__(
2268
+				'This method would have been protected but was used on a filter callback so needed to be public. Please discontinue usage as it will be removed soon.',
2269
+				'event_espresso'
2270
+			),
2271
+			'4.8.32.rc.000'
2272
+		);
2273
+		return '
2274 2274
 			<tr>
2275 2275
 				<th>
2276 2276
 					' . $label . '
2277 2277
 				</th>';
2278
-    }
2279
-
2280
-
2281
-    /**
2282
-     * form_form_field_input__wrap
2283
-     *
2284
-     * @param string $input
2285
-     * @return        string
2286
-     * @deprecated    as of 4.8.32.rc.000
2287
-     */
2288
-    public function form_form_field_input__wrap($input)
2289
-    {
2290
-        EE_Error::doing_it_wrong(
2291
-            __CLASS__ . '::' . __FUNCTION__,
2292
-            esc_html__(
2293
-                'This method would have been protected but was used on a filter callback so needed to be public. Please discontinue usage as it will be removed soon.',
2294
-                'event_espresso'
2295
-            ),
2296
-            '4.8.32.rc.000'
2297
-        );
2298
-        return '
2278
+	}
2279
+
2280
+
2281
+	/**
2282
+	 * form_form_field_input__wrap
2283
+	 *
2284
+	 * @param string $input
2285
+	 * @return        string
2286
+	 * @deprecated    as of 4.8.32.rc.000
2287
+	 */
2288
+	public function form_form_field_input__wrap($input)
2289
+	{
2290
+		EE_Error::doing_it_wrong(
2291
+			__CLASS__ . '::' . __FUNCTION__,
2292
+			esc_html__(
2293
+				'This method would have been protected but was used on a filter callback so needed to be public. Please discontinue usage as it will be removed soon.',
2294
+				'event_espresso'
2295
+			),
2296
+			'4.8.32.rc.000'
2297
+		);
2298
+		return '
2299 2299
 				<td class="reg-admin-attendee-questions-input-td disabled-input">
2300 2300
 					' . $input . '
2301 2301
 				</td>
2302 2302
 			</tr>';
2303
-    }
2304
-
2305
-
2306
-    /**
2307
-     * Updates the registration's custom questions according to the form info, if the form is submitted.
2308
-     * If it's not a post, the "view_registrations" route will be called next on the SAME request
2309
-     * to display the page
2310
-     *
2311
-     * @return void
2312
-     * @throws EE_Error
2313
-     * @throws InvalidArgumentException
2314
-     * @throws InvalidDataTypeException
2315
-     * @throws InvalidInterfaceException
2316
-     * @throws ReflectionException
2317
-     */
2318
-    protected function _update_attendee_registration_form()
2319
-    {
2320
-        do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this);
2321
-        if ($_SERVER['REQUEST_METHOD'] === 'POST') {
2322
-            $REG_ID  = $this->request->getRequestParam('_REG_ID', 0, 'int');
2323
-            $success = $this->_save_reg_custom_questions_form($REG_ID);
2324
-            if ($success) {
2325
-                $what  = esc_html__('Registration Form', 'event_espresso');
2326
-                $route = $REG_ID
2327
-                    ? ['action' => 'view_registration', '_REG_ID' => $REG_ID]
2328
-                    : ['action' => 'default'];
2329
-                $this->_redirect_after_action(true, $what, esc_html__('updated', 'event_espresso'), $route);
2330
-            }
2331
-        }
2332
-    }
2333
-
2334
-
2335
-    /**
2336
-     * Gets the form for saving registrations custom questions (if done
2337
-     * previously retrieves the cached form object, which may have validation errors in it)
2338
-     *
2339
-     * @param int $REG_ID
2340
-     * @return EE_Registration_Custom_Questions_Form
2341
-     * @throws EE_Error
2342
-     * @throws InvalidArgumentException
2343
-     * @throws InvalidDataTypeException
2344
-     * @throws InvalidInterfaceException
2345
-     * @throws ReflectionException
2346
-     */
2347
-    protected function _get_reg_custom_questions_form($REG_ID)
2348
-    {
2349
-        if (! $this->_reg_custom_questions_form) {
2350
-            require_once(REG_ADMIN . 'form_sections/EE_Registration_Custom_Questions_Form.form.php');
2351
-            $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(
2352
-                $this->getRegistrationModel()->get_one_by_ID($REG_ID)
2353
-            );
2354
-            $this->_reg_custom_questions_form->_construct_finalize(null, null);
2355
-        }
2356
-        return $this->_reg_custom_questions_form;
2357
-    }
2358
-
2359
-
2360
-    /**
2361
-     * Saves
2362
-     *
2363
-     * @param bool $REG_ID
2364
-     * @return bool
2365
-     * @throws EE_Error
2366
-     * @throws InvalidArgumentException
2367
-     * @throws InvalidDataTypeException
2368
-     * @throws InvalidInterfaceException
2369
-     * @throws ReflectionException
2370
-     */
2371
-    private function _save_reg_custom_questions_form($REG_ID = 0)
2372
-    {
2373
-        if (! $REG_ID) {
2374
-            EE_Error::add_error(
2375
-                esc_html__(
2376
-                    'An error occurred. No registration ID was received.',
2377
-                    'event_espresso'
2378
-                ),
2379
-                __FILE__,
2380
-                __FUNCTION__,
2381
-                __LINE__
2382
-            );
2383
-        }
2384
-        $form = $this->_get_reg_custom_questions_form($REG_ID);
2385
-        $form->receive_form_submission($this->request->requestParams());
2386
-        $success = false;
2387
-        if ($form->is_valid()) {
2388
-            foreach ($form->subforms() as $question_group_form) {
2389
-                foreach ($question_group_form->inputs() as $question_id => $input) {
2390
-                    $where_conditions    = [
2391
-                        'QST_ID' => $question_id,
2392
-                        'REG_ID' => $REG_ID,
2393
-                    ];
2394
-                    $possibly_new_values = [
2395
-                        'ANS_value' => $input->normalized_value(),
2396
-                    ];
2397
-                    $answer              = EEM_Answer::instance()->get_one([$where_conditions]);
2398
-                    if ($answer instanceof EE_Answer) {
2399
-                        $success = $answer->save($possibly_new_values);
2400
-                    } else {
2401
-                        // insert it then
2402
-                        $cols_n_vals = array_merge($where_conditions, $possibly_new_values);
2403
-                        $answer      = EE_Answer::new_instance($cols_n_vals);
2404
-                        $success     = $answer->save();
2405
-                    }
2406
-                }
2407
-            }
2408
-        } else {
2409
-            EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__);
2410
-        }
2411
-        return $success;
2412
-    }
2413
-
2414
-
2415
-    /**
2416
-     * generates HTML for the Registration main meta box
2417
-     *
2418
-     * @return void
2419
-     * @throws DomainException
2420
-     * @throws EE_Error
2421
-     * @throws InvalidArgumentException
2422
-     * @throws InvalidDataTypeException
2423
-     * @throws InvalidInterfaceException
2424
-     * @throws ReflectionException
2425
-     */
2426
-    public function _reg_attendees_meta_box()
2427
-    {
2428
-        $REG = $this->getRegistrationModel();
2429
-        // get all other registrations on this transaction, and cache
2430
-        // the attendees for them so we don't have to run another query using force_join
2431
-        $registrations                           = $REG->get_all(
2432
-            [
2433
-                [
2434
-                    'TXN_ID' => $this->_registration->transaction_ID(),
2435
-                    'REG_ID' => ['!=', $this->_registration->ID()],
2436
-                ],
2437
-                'force_join'               => ['Attendee'],
2438
-                'default_where_conditions' => 'other_models_only',
2439
-            ]
2440
-        );
2441
-        $this->_template_args['attendees']       = [];
2442
-        $this->_template_args['attendee_notice'] = '';
2443
-        if (
2444
-            empty($registrations)
2445
-            || (is_array($registrations)
2446
-                && ! EEH_Array::get_one_item_from_array($registrations))
2447
-        ) {
2448
-            EE_Error::add_error(
2449
-                esc_html__(
2450
-                    'There are no records attached to this registration. Something may have gone wrong with the registration',
2451
-                    'event_espresso'
2452
-                ),
2453
-                __FILE__,
2454
-                __FUNCTION__,
2455
-                __LINE__
2456
-            );
2457
-            $this->_template_args['attendee_notice'] = EE_Error::get_notices();
2458
-        } else {
2459
-            $att_nmbr = 1;
2460
-            foreach ($registrations as $registration) {
2461
-                /* @var $registration EE_Registration */
2462
-                $attendee                                                      = $registration->attendee()
2463
-                    ? $registration->attendee()
2464
-                    : $this->getAttendeeModel()->create_default_object();
2465
-                $this->_template_args['attendees'][ $att_nmbr ]['STS_ID']      = $registration->status_ID();
2466
-                $this->_template_args['attendees'][ $att_nmbr ]['fname']       = $attendee->fname();
2467
-                $this->_template_args['attendees'][ $att_nmbr ]['lname']       = $attendee->lname();
2468
-                $this->_template_args['attendees'][ $att_nmbr ]['email']       = $attendee->email();
2469
-                $this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();
2470
-                $this->_template_args['attendees'][ $att_nmbr ]['address']     = implode(
2471
-                    ', ',
2472
-                    $attendee->full_address_as_array()
2473
-                );
2474
-                $this->_template_args['attendees'][ $att_nmbr ]['att_link']    = self::add_query_args_and_nonce(
2475
-                    [
2476
-                        'action' => 'edit_attendee',
2477
-                        'post'   => $attendee->ID(),
2478
-                    ],
2479
-                    REG_ADMIN_URL
2480
-                );
2481
-                $this->_template_args['attendees'][ $att_nmbr ]['event_name']  =
2482
-                    $registration->event_obj() instanceof EE_Event
2483
-                        ? $registration->event_obj()->name()
2484
-                        : '';
2485
-                $att_nmbr++;
2486
-            }
2487
-            $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
2488
-        }
2489
-        $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php';
2490
-        EEH_Template::display_template($template_path, $this->_template_args);
2491
-    }
2492
-
2493
-
2494
-    /**
2495
-     * generates HTML for the Edit Registration side meta box
2496
-     *
2497
-     * @return void
2498
-     * @throws DomainException
2499
-     * @throws EE_Error
2500
-     * @throws InvalidArgumentException
2501
-     * @throws InvalidDataTypeException
2502
-     * @throws InvalidInterfaceException
2503
-     * @throws ReflectionException
2504
-     */
2505
-    public function _reg_registrant_side_meta_box()
2506
-    {
2507
-        /*@var $attendee EE_Attendee */
2508
-        $att_check = $this->_registration->attendee();
2509
-        $attendee  = $att_check instanceof EE_Attendee
2510
-            ? $att_check
2511
-            : $this->getAttendeeModel()->create_default_object();
2512
-        // now let's determine if this is not the primary registration.  If it isn't then we set the
2513
-        // primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the
2514
-        // primary registration object (that way we know if we need to show create button or not)
2515
-        if (! $this->_registration->is_primary_registrant()) {
2516
-            $primary_registration = $this->_registration->get_primary_registration();
2517
-            $primary_attendee     = $primary_registration instanceof EE_Registration ? $primary_registration->attendee()
2518
-                : null;
2519
-            if (! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) {
2520
-                // in here?  This means the displayed registration is not the primary registrant but ALREADY HAS its own
2521
-                // custom attendee object so let's not worry about the primary reg.
2522
-                $primary_registration = null;
2523
-            }
2524
-        } else {
2525
-            $primary_registration = null;
2526
-        }
2527
-        $this->_template_args['ATT_ID']            = $attendee->ID();
2528
-        $this->_template_args['fname']             = $attendee->fname();
2529
-        $this->_template_args['lname']             = $attendee->lname();
2530
-        $this->_template_args['email']             = $attendee->email();
2531
-        $this->_template_args['phone']             = $attendee->phone();
2532
-        $this->_template_args['formatted_address'] = EEH_Address::format($attendee);
2533
-        // edit link
2534
-        $this->_template_args['att_edit_link']  = EE_Admin_Page::add_query_args_and_nonce(
2535
-            [
2536
-                'action' => 'edit_attendee',
2537
-                'post'   => $attendee->ID(),
2538
-            ],
2539
-            REG_ADMIN_URL
2540
-        );
2541
-        $this->_template_args['att_edit_title'] = esc_html__('View details for this contact.', 'event_espresso');
2542
-        $this->_template_args['att_edit_label'] = esc_html__('View/Edit Contact', 'event_espresso');
2543
-        // create link
2544
-        $this->_template_args['create_link']  = $primary_registration instanceof EE_Registration
2545
-            ? EE_Admin_Page::add_query_args_and_nonce(
2546
-                [
2547
-                    'action'  => 'duplicate_attendee',
2548
-                    '_REG_ID' => $this->_registration->ID(),
2549
-                ],
2550
-                REG_ADMIN_URL
2551
-            ) : '';
2552
-        $this->_template_args['create_label'] = esc_html__('Create Contact', 'event_espresso');
2553
-        $this->_template_args['att_check']    = $att_check;
2554
-        $template_path                        =
2555
-            REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php';
2556
-        EEH_Template::display_template($template_path, $this->_template_args);
2557
-    }
2558
-
2559
-
2560
-    /**
2561
-     * trash or restore registrations
2562
-     *
2563
-     * @param boolean $trash whether to archive or restore
2564
-     * @return void
2565
-     * @throws DomainException
2566
-     * @throws EE_Error
2567
-     * @throws EntityNotFoundException
2568
-     * @throws InvalidArgumentException
2569
-     * @throws InvalidDataTypeException
2570
-     * @throws InvalidInterfaceException
2571
-     * @throws ReflectionException
2572
-     * @throws RuntimeException
2573
-     * @throws UnexpectedEntityException
2574
-     */
2575
-    protected function _trash_or_restore_registrations($trash = true)
2576
-    {
2577
-        // if empty _REG_ID then get out because there's nothing to do
2578
-        $REG_IDs = $this->request->getRequestParam('_REG_ID', [], 'int', true);
2579
-        if (empty($REG_IDs)) {
2580
-            EE_Error::add_error(
2581
-                sprintf(
2582
-                    esc_html__(
2583
-                        'In order to %1$s registrations you must select which ones you wish to %1$s by clicking the checkboxes.',
2584
-                        'event_espresso'
2585
-                    ),
2586
-                    $trash ? 'trash' : 'restore'
2587
-                ),
2588
-                __FILE__,
2589
-                __LINE__,
2590
-                __FUNCTION__
2591
-            );
2592
-            $this->_redirect_after_action(false, '', '', [], true);
2593
-        }
2594
-        $success        = 0;
2595
-        $overwrite_msgs = false;
2596
-        // Checkboxes
2597
-        $reg_count = count($REG_IDs);
2598
-        // cycle thru checkboxes
2599
-        foreach ($REG_IDs as $REG_ID) {
2600
-            /** @var EE_Registration $REG */
2601
-            $REG      = $this->getRegistrationModel()->get_one_by_ID($REG_ID);
2602
-            $payments = $REG->registration_payments();
2603
-            if (! empty($payments)) {
2604
-                $name           = $REG->attendee() instanceof EE_Attendee
2605
-                    ? $REG->attendee()->full_name()
2606
-                    : esc_html__('Unknown Attendee', 'event_espresso');
2607
-                $overwrite_msgs = true;
2608
-                EE_Error::add_error(
2609
-                    sprintf(
2610
-                        esc_html__(
2611
-                            'The registration for %s could not be trashed because it has payments attached to the related transaction.  If you wish to trash this registration you must first delete the payments on the related transaction.',
2612
-                            'event_espresso'
2613
-                        ),
2614
-                        $name
2615
-                    ),
2616
-                    __FILE__,
2617
-                    __FUNCTION__,
2618
-                    __LINE__
2619
-                );
2620
-                // can't trash this registration because it has payments.
2621
-                continue;
2622
-            }
2623
-            $updated = $trash ? $REG->delete() : $REG->restore();
2624
-            if ($updated) {
2625
-                $success++;
2626
-            }
2627
-        }
2628
-        $this->_redirect_after_action(
2629
-            $success === $reg_count, // were ALL registrations affected?
2630
-            $success > 1
2631
-                ? esc_html__('Registrations', 'event_espresso')
2632
-                : esc_html__('Registration', 'event_espresso'),
2633
-            $trash
2634
-                ? esc_html__('moved to the trash', 'event_espresso')
2635
-                : esc_html__('restored', 'event_espresso'),
2636
-            $this->mergeExistingRequestParamsWithRedirectArgs(['action' => 'default']),
2637
-            $overwrite_msgs
2638
-        );
2639
-    }
2640
-
2641
-
2642
-    /**
2643
-     * This is used to permanently delete registrations.  Note, this will handle not only deleting permanently the
2644
-     * registration but also.
2645
-     * 1. Removing relations to EE_Attendee
2646
-     * 2. Deleting permanently the related transaction, but ONLY if all related registrations to the transaction are
2647
-     * ALSO trashed.
2648
-     * 3. Deleting permanently any related Line items but only if the above conditions are met.
2649
-     * 4. Removing relationships between all tickets and the related registrations
2650
-     * 5. Deleting permanently any related Answers (and the answers for other related registrations that were deleted.)
2651
-     * 6. Deleting permanently any related Checkins.
2652
-     *
2653
-     * @return void
2654
-     * @throws EE_Error
2655
-     * @throws InvalidArgumentException
2656
-     * @throws InvalidDataTypeException
2657
-     * @throws InvalidInterfaceException
2658
-     * @throws ReflectionException
2659
-     */
2660
-    protected function _delete_registrations()
2661
-    {
2662
-        $REG_MDL = $this->getRegistrationModel();
2663
-        $success = 0;
2664
-        // Checkboxes
2665
-        $REG_IDs = $this->request->getRequestParam('_REG_ID', [], 'int', true);
2666
-
2667
-        if (! empty($REG_IDs)) {
2668
-            // if array has more than one element than success message should be plural
2669
-            $success = count($REG_IDs) > 1 ? 2 : 1;
2670
-            // cycle thru checkboxes
2671
-            foreach ($REG_IDs as $REG_ID) {
2672
-                $REG = $REG_MDL->get_one_by_ID($REG_ID);
2673
-                if (! $REG instanceof EE_Registration) {
2674
-                    continue;
2675
-                }
2676
-                $deleted = $this->_delete_registration($REG);
2677
-                if (! $deleted) {
2678
-                    $success = 0;
2679
-                }
2680
-            }
2681
-        }
2682
-
2683
-        $what        = $success > 1
2684
-            ? esc_html__('Registrations', 'event_espresso')
2685
-            : esc_html__('Registration', 'event_espresso');
2686
-        $action_desc = esc_html__('permanently deleted.', 'event_espresso');
2687
-        $this->_redirect_after_action(
2688
-            $success,
2689
-            $what,
2690
-            $action_desc,
2691
-            $this->mergeExistingRequestParamsWithRedirectArgs(['action' => 'default']),
2692
-            true
2693
-        );
2694
-    }
2695
-
2696
-
2697
-    /**
2698
-     * handles the permanent deletion of a registration.  See comments with _delete_registrations() for details on what
2699
-     * models get affected.
2700
-     *
2701
-     * @param EE_Registration $REG registration to be deleted permanently
2702
-     * @return bool true = successful deletion, false = fail.
2703
-     * @throws EE_Error
2704
-     * @throws InvalidArgumentException
2705
-     * @throws InvalidDataTypeException
2706
-     * @throws InvalidInterfaceException
2707
-     * @throws ReflectionException
2708
-     */
2709
-    protected function _delete_registration(EE_Registration $REG)
2710
-    {
2711
-        // first we start with the transaction... ultimately, we WILL not delete permanently if there are any related
2712
-        // registrations on the transaction that are NOT trashed.
2713
-        $TXN = $REG->transaction();
2714
-        if (! $TXN instanceof EE_Transaction) {
2715
-            EE_Error::add_error(
2716
-                sprintf(
2717
-                    esc_html__(
2718
-                        'Unable to permanently delete registration %d because its related transaction has already been deleted. If you can restore the related transaction to the database then this registration can be deleted.',
2719
-                        'event_espresso'
2720
-                    ),
2721
-                    $REG->id()
2722
-                ),
2723
-                __FILE__,
2724
-                __FUNCTION__,
2725
-                __LINE__
2726
-            );
2727
-            return false;
2728
-        }
2729
-        $REGS        = $TXN->get_many_related('Registration');
2730
-        $all_trashed = true;
2731
-        foreach ($REGS as $registration) {
2732
-            if (! $registration->get('REG_deleted')) {
2733
-                $all_trashed = false;
2734
-            }
2735
-        }
2736
-        if (! $all_trashed) {
2737
-            EE_Error::add_error(
2738
-                esc_html__(
2739
-                    'Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well.  These registrations will be permanently deleted in the same action.',
2740
-                    'event_espresso'
2741
-                ),
2742
-                __FILE__,
2743
-                __FUNCTION__,
2744
-                __LINE__
2745
-            );
2746
-            return false;
2747
-        }
2748
-        // k made it here so that means we can delete all the related transactions and their answers (but let's do them
2749
-        // separately from THIS one).
2750
-        foreach ($REGS as $registration) {
2751
-            // delete related answers
2752
-            $registration->delete_related_permanently('Answer');
2753
-            // remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact)
2754
-            $attendee = $registration->get_first_related('Attendee');
2755
-            if ($attendee instanceof EE_Attendee) {
2756
-                $registration->_remove_relation_to($attendee, 'Attendee');
2757
-            }
2758
-            // now remove relationships to tickets on this registration.
2759
-            $registration->_remove_relations('Ticket');
2760
-            // now delete permanently the checkins related to this registration.
2761
-            $registration->delete_related_permanently('Checkin');
2762
-            if ($registration->ID() === $REG->ID()) {
2763
-                continue;
2764
-            } //we don't want to delete permanently the existing registration just yet.
2765
-            // remove relation to transaction for these registrations if NOT the existing registrations
2766
-            $registration->_remove_relations('Transaction');
2767
-            // delete permanently any related messages.
2768
-            $registration->delete_related_permanently('Message');
2769
-            // now delete this registration permanently
2770
-            $registration->delete_permanently();
2771
-        }
2772
-        // now all related registrations on the transaction are handled.  So let's just handle this registration itself
2773
-        // (the transaction and line items should be all that's left).
2774
-        // delete the line items related to the transaction for this registration.
2775
-        $TXN->delete_related_permanently('Line_Item');
2776
-        // we need to remove all the relationships on the transaction
2777
-        $TXN->delete_related_permanently('Payment');
2778
-        $TXN->delete_related_permanently('Extra_Meta');
2779
-        $TXN->delete_related_permanently('Message');
2780
-        // now we can delete this REG permanently (and the transaction of course)
2781
-        $REG->delete_related_permanently('Transaction');
2782
-        return $REG->delete_permanently();
2783
-    }
2784
-
2785
-
2786
-    /**
2787
-     *    generates HTML for the Register New Attendee Admin page
2788
-     *
2789
-     * @throws DomainException
2790
-     * @throws EE_Error
2791
-     * @throws InvalidArgumentException
2792
-     * @throws InvalidDataTypeException
2793
-     * @throws InvalidInterfaceException
2794
-     * @throws ReflectionException
2795
-     */
2796
-    public function new_registration()
2797
-    {
2798
-        if (! $this->_set_reg_event()) {
2799
-            throw new EE_Error(
2800
-                esc_html__(
2801
-                    'Unable to continue with registering because there is no Event ID in the request',
2802
-                    'event_espresso'
2803
-                )
2804
-            );
2805
-        }
2806
-        /** @var CurrentPage $current_page */
2807
-        $current_page = $this->loader->getShared(CurrentPage::class);
2808
-        $current_page->setEspressoPage(true);
2809
-        // gotta start with a clean slate if we're not coming here via ajax
2810
-        if (
2811
-            ! $this->request->isAjax()
2812
-            && (
2813
-                ! $this->request->requestParamIsSet('processing_registration')
2814
-                || $this->request->requestParamIsSet('step_error')
2815
-            )
2816
-        ) {
2817
-            EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2818
-        }
2819
-        $this->_template_args['event_name'] = '';
2820
-        // event name
2821
-        if ($this->_reg_event) {
2822
-            $this->_template_args['event_name'] = $this->_reg_event->name();
2823
-            $edit_event_url                     = self::add_query_args_and_nonce(
2824
-                [
2825
-                    'action' => 'edit',
2826
-                    'post'   => $this->_reg_event->ID(),
2827
-                ],
2828
-                EVENTS_ADMIN_URL
2829
-            );
2830
-            $edit_event_lnk                     = '<a href="'
2831
-                                                  . $edit_event_url
2832
-                                                  . '" aria-label="'
2833
-                                                  . esc_attr__('Edit ', 'event_espresso')
2834
-                                                  . $this->_reg_event->name()
2835
-                                                  . '">'
2836
-                                                  . esc_html__('Edit Event', 'event_espresso')
2837
-                                                  . '</a>';
2838
-            $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'
2839
-                                                   . $edit_event_lnk
2840
-                                                   . '</span>';
2841
-        }
2842
-        $this->_template_args['step_content'] = $this->_get_registration_step_content();
2843
-        if ($this->request->isAjax()) {
2844
-            $this->_return_json();
2845
-        }
2846
-        // grab header
2847
-        $template_path                              =
2848
-            REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php';
2849
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
2850
-            $template_path,
2851
-            $this->_template_args,
2852
-            true
2853
-        );
2854
-        // $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
2855
-        // the details template wrapper
2856
-        $this->display_admin_page_with_sidebar();
2857
-    }
2858
-
2859
-
2860
-    /**
2861
-     * This returns the content for a registration step
2862
-     *
2863
-     * @return string html
2864
-     * @throws DomainException
2865
-     * @throws EE_Error
2866
-     * @throws InvalidArgumentException
2867
-     * @throws InvalidDataTypeException
2868
-     * @throws InvalidInterfaceException
2869
-     * @throws ReflectionException
2870
-     */
2871
-    protected function _get_registration_step_content()
2872
-    {
2873
-        if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) {
2874
-            $warning_msg = sprintf(
2875
-                esc_html__(
2876
-                    '%2$sWARNING!!!%3$s%1$sPlease do not use the back button to return to this page for the purpose of adding another registration.%1$sThis can result in lost and/or corrupted data.%1$sIf you wish to add another registration, then please click the%1$s%7$s"Add Another New Registration to Event"%8$s button%1$son the Transaction details page, after you are redirected.%1$s%1$s%4$s redirecting in %5$s seconds %6$s',
2877
-                    'event_espresso'
2878
-                ),
2879
-                '<br />',
2880
-                '<h3 class="important-notice">',
2881
-                '</h3>',
2882
-                '<div class="float-right">',
2883
-                '<span id="redirect_timer" class="important-notice">30</span>',
2884
-                '</div>',
2885
-                '<b>',
2886
-                '</b>'
2887
-            );
2888
-            return '
2303
+	}
2304
+
2305
+
2306
+	/**
2307
+	 * Updates the registration's custom questions according to the form info, if the form is submitted.
2308
+	 * If it's not a post, the "view_registrations" route will be called next on the SAME request
2309
+	 * to display the page
2310
+	 *
2311
+	 * @return void
2312
+	 * @throws EE_Error
2313
+	 * @throws InvalidArgumentException
2314
+	 * @throws InvalidDataTypeException
2315
+	 * @throws InvalidInterfaceException
2316
+	 * @throws ReflectionException
2317
+	 */
2318
+	protected function _update_attendee_registration_form()
2319
+	{
2320
+		do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this);
2321
+		if ($_SERVER['REQUEST_METHOD'] === 'POST') {
2322
+			$REG_ID  = $this->request->getRequestParam('_REG_ID', 0, 'int');
2323
+			$success = $this->_save_reg_custom_questions_form($REG_ID);
2324
+			if ($success) {
2325
+				$what  = esc_html__('Registration Form', 'event_espresso');
2326
+				$route = $REG_ID
2327
+					? ['action' => 'view_registration', '_REG_ID' => $REG_ID]
2328
+					: ['action' => 'default'];
2329
+				$this->_redirect_after_action(true, $what, esc_html__('updated', 'event_espresso'), $route);
2330
+			}
2331
+		}
2332
+	}
2333
+
2334
+
2335
+	/**
2336
+	 * Gets the form for saving registrations custom questions (if done
2337
+	 * previously retrieves the cached form object, which may have validation errors in it)
2338
+	 *
2339
+	 * @param int $REG_ID
2340
+	 * @return EE_Registration_Custom_Questions_Form
2341
+	 * @throws EE_Error
2342
+	 * @throws InvalidArgumentException
2343
+	 * @throws InvalidDataTypeException
2344
+	 * @throws InvalidInterfaceException
2345
+	 * @throws ReflectionException
2346
+	 */
2347
+	protected function _get_reg_custom_questions_form($REG_ID)
2348
+	{
2349
+		if (! $this->_reg_custom_questions_form) {
2350
+			require_once(REG_ADMIN . 'form_sections/EE_Registration_Custom_Questions_Form.form.php');
2351
+			$this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(
2352
+				$this->getRegistrationModel()->get_one_by_ID($REG_ID)
2353
+			);
2354
+			$this->_reg_custom_questions_form->_construct_finalize(null, null);
2355
+		}
2356
+		return $this->_reg_custom_questions_form;
2357
+	}
2358
+
2359
+
2360
+	/**
2361
+	 * Saves
2362
+	 *
2363
+	 * @param bool $REG_ID
2364
+	 * @return bool
2365
+	 * @throws EE_Error
2366
+	 * @throws InvalidArgumentException
2367
+	 * @throws InvalidDataTypeException
2368
+	 * @throws InvalidInterfaceException
2369
+	 * @throws ReflectionException
2370
+	 */
2371
+	private function _save_reg_custom_questions_form($REG_ID = 0)
2372
+	{
2373
+		if (! $REG_ID) {
2374
+			EE_Error::add_error(
2375
+				esc_html__(
2376
+					'An error occurred. No registration ID was received.',
2377
+					'event_espresso'
2378
+				),
2379
+				__FILE__,
2380
+				__FUNCTION__,
2381
+				__LINE__
2382
+			);
2383
+		}
2384
+		$form = $this->_get_reg_custom_questions_form($REG_ID);
2385
+		$form->receive_form_submission($this->request->requestParams());
2386
+		$success = false;
2387
+		if ($form->is_valid()) {
2388
+			foreach ($form->subforms() as $question_group_form) {
2389
+				foreach ($question_group_form->inputs() as $question_id => $input) {
2390
+					$where_conditions    = [
2391
+						'QST_ID' => $question_id,
2392
+						'REG_ID' => $REG_ID,
2393
+					];
2394
+					$possibly_new_values = [
2395
+						'ANS_value' => $input->normalized_value(),
2396
+					];
2397
+					$answer              = EEM_Answer::instance()->get_one([$where_conditions]);
2398
+					if ($answer instanceof EE_Answer) {
2399
+						$success = $answer->save($possibly_new_values);
2400
+					} else {
2401
+						// insert it then
2402
+						$cols_n_vals = array_merge($where_conditions, $possibly_new_values);
2403
+						$answer      = EE_Answer::new_instance($cols_n_vals);
2404
+						$success     = $answer->save();
2405
+					}
2406
+				}
2407
+			}
2408
+		} else {
2409
+			EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__);
2410
+		}
2411
+		return $success;
2412
+	}
2413
+
2414
+
2415
+	/**
2416
+	 * generates HTML for the Registration main meta box
2417
+	 *
2418
+	 * @return void
2419
+	 * @throws DomainException
2420
+	 * @throws EE_Error
2421
+	 * @throws InvalidArgumentException
2422
+	 * @throws InvalidDataTypeException
2423
+	 * @throws InvalidInterfaceException
2424
+	 * @throws ReflectionException
2425
+	 */
2426
+	public function _reg_attendees_meta_box()
2427
+	{
2428
+		$REG = $this->getRegistrationModel();
2429
+		// get all other registrations on this transaction, and cache
2430
+		// the attendees for them so we don't have to run another query using force_join
2431
+		$registrations                           = $REG->get_all(
2432
+			[
2433
+				[
2434
+					'TXN_ID' => $this->_registration->transaction_ID(),
2435
+					'REG_ID' => ['!=', $this->_registration->ID()],
2436
+				],
2437
+				'force_join'               => ['Attendee'],
2438
+				'default_where_conditions' => 'other_models_only',
2439
+			]
2440
+		);
2441
+		$this->_template_args['attendees']       = [];
2442
+		$this->_template_args['attendee_notice'] = '';
2443
+		if (
2444
+			empty($registrations)
2445
+			|| (is_array($registrations)
2446
+				&& ! EEH_Array::get_one_item_from_array($registrations))
2447
+		) {
2448
+			EE_Error::add_error(
2449
+				esc_html__(
2450
+					'There are no records attached to this registration. Something may have gone wrong with the registration',
2451
+					'event_espresso'
2452
+				),
2453
+				__FILE__,
2454
+				__FUNCTION__,
2455
+				__LINE__
2456
+			);
2457
+			$this->_template_args['attendee_notice'] = EE_Error::get_notices();
2458
+		} else {
2459
+			$att_nmbr = 1;
2460
+			foreach ($registrations as $registration) {
2461
+				/* @var $registration EE_Registration */
2462
+				$attendee                                                      = $registration->attendee()
2463
+					? $registration->attendee()
2464
+					: $this->getAttendeeModel()->create_default_object();
2465
+				$this->_template_args['attendees'][ $att_nmbr ]['STS_ID']      = $registration->status_ID();
2466
+				$this->_template_args['attendees'][ $att_nmbr ]['fname']       = $attendee->fname();
2467
+				$this->_template_args['attendees'][ $att_nmbr ]['lname']       = $attendee->lname();
2468
+				$this->_template_args['attendees'][ $att_nmbr ]['email']       = $attendee->email();
2469
+				$this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();
2470
+				$this->_template_args['attendees'][ $att_nmbr ]['address']     = implode(
2471
+					', ',
2472
+					$attendee->full_address_as_array()
2473
+				);
2474
+				$this->_template_args['attendees'][ $att_nmbr ]['att_link']    = self::add_query_args_and_nonce(
2475
+					[
2476
+						'action' => 'edit_attendee',
2477
+						'post'   => $attendee->ID(),
2478
+					],
2479
+					REG_ADMIN_URL
2480
+				);
2481
+				$this->_template_args['attendees'][ $att_nmbr ]['event_name']  =
2482
+					$registration->event_obj() instanceof EE_Event
2483
+						? $registration->event_obj()->name()
2484
+						: '';
2485
+				$att_nmbr++;
2486
+			}
2487
+			$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
2488
+		}
2489
+		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php';
2490
+		EEH_Template::display_template($template_path, $this->_template_args);
2491
+	}
2492
+
2493
+
2494
+	/**
2495
+	 * generates HTML for the Edit Registration side meta box
2496
+	 *
2497
+	 * @return void
2498
+	 * @throws DomainException
2499
+	 * @throws EE_Error
2500
+	 * @throws InvalidArgumentException
2501
+	 * @throws InvalidDataTypeException
2502
+	 * @throws InvalidInterfaceException
2503
+	 * @throws ReflectionException
2504
+	 */
2505
+	public function _reg_registrant_side_meta_box()
2506
+	{
2507
+		/*@var $attendee EE_Attendee */
2508
+		$att_check = $this->_registration->attendee();
2509
+		$attendee  = $att_check instanceof EE_Attendee
2510
+			? $att_check
2511
+			: $this->getAttendeeModel()->create_default_object();
2512
+		// now let's determine if this is not the primary registration.  If it isn't then we set the
2513
+		// primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the
2514
+		// primary registration object (that way we know if we need to show create button or not)
2515
+		if (! $this->_registration->is_primary_registrant()) {
2516
+			$primary_registration = $this->_registration->get_primary_registration();
2517
+			$primary_attendee     = $primary_registration instanceof EE_Registration ? $primary_registration->attendee()
2518
+				: null;
2519
+			if (! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) {
2520
+				// in here?  This means the displayed registration is not the primary registrant but ALREADY HAS its own
2521
+				// custom attendee object so let's not worry about the primary reg.
2522
+				$primary_registration = null;
2523
+			}
2524
+		} else {
2525
+			$primary_registration = null;
2526
+		}
2527
+		$this->_template_args['ATT_ID']            = $attendee->ID();
2528
+		$this->_template_args['fname']             = $attendee->fname();
2529
+		$this->_template_args['lname']             = $attendee->lname();
2530
+		$this->_template_args['email']             = $attendee->email();
2531
+		$this->_template_args['phone']             = $attendee->phone();
2532
+		$this->_template_args['formatted_address'] = EEH_Address::format($attendee);
2533
+		// edit link
2534
+		$this->_template_args['att_edit_link']  = EE_Admin_Page::add_query_args_and_nonce(
2535
+			[
2536
+				'action' => 'edit_attendee',
2537
+				'post'   => $attendee->ID(),
2538
+			],
2539
+			REG_ADMIN_URL
2540
+		);
2541
+		$this->_template_args['att_edit_title'] = esc_html__('View details for this contact.', 'event_espresso');
2542
+		$this->_template_args['att_edit_label'] = esc_html__('View/Edit Contact', 'event_espresso');
2543
+		// create link
2544
+		$this->_template_args['create_link']  = $primary_registration instanceof EE_Registration
2545
+			? EE_Admin_Page::add_query_args_and_nonce(
2546
+				[
2547
+					'action'  => 'duplicate_attendee',
2548
+					'_REG_ID' => $this->_registration->ID(),
2549
+				],
2550
+				REG_ADMIN_URL
2551
+			) : '';
2552
+		$this->_template_args['create_label'] = esc_html__('Create Contact', 'event_espresso');
2553
+		$this->_template_args['att_check']    = $att_check;
2554
+		$template_path                        =
2555
+			REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php';
2556
+		EEH_Template::display_template($template_path, $this->_template_args);
2557
+	}
2558
+
2559
+
2560
+	/**
2561
+	 * trash or restore registrations
2562
+	 *
2563
+	 * @param boolean $trash whether to archive or restore
2564
+	 * @return void
2565
+	 * @throws DomainException
2566
+	 * @throws EE_Error
2567
+	 * @throws EntityNotFoundException
2568
+	 * @throws InvalidArgumentException
2569
+	 * @throws InvalidDataTypeException
2570
+	 * @throws InvalidInterfaceException
2571
+	 * @throws ReflectionException
2572
+	 * @throws RuntimeException
2573
+	 * @throws UnexpectedEntityException
2574
+	 */
2575
+	protected function _trash_or_restore_registrations($trash = true)
2576
+	{
2577
+		// if empty _REG_ID then get out because there's nothing to do
2578
+		$REG_IDs = $this->request->getRequestParam('_REG_ID', [], 'int', true);
2579
+		if (empty($REG_IDs)) {
2580
+			EE_Error::add_error(
2581
+				sprintf(
2582
+					esc_html__(
2583
+						'In order to %1$s registrations you must select which ones you wish to %1$s by clicking the checkboxes.',
2584
+						'event_espresso'
2585
+					),
2586
+					$trash ? 'trash' : 'restore'
2587
+				),
2588
+				__FILE__,
2589
+				__LINE__,
2590
+				__FUNCTION__
2591
+			);
2592
+			$this->_redirect_after_action(false, '', '', [], true);
2593
+		}
2594
+		$success        = 0;
2595
+		$overwrite_msgs = false;
2596
+		// Checkboxes
2597
+		$reg_count = count($REG_IDs);
2598
+		// cycle thru checkboxes
2599
+		foreach ($REG_IDs as $REG_ID) {
2600
+			/** @var EE_Registration $REG */
2601
+			$REG      = $this->getRegistrationModel()->get_one_by_ID($REG_ID);
2602
+			$payments = $REG->registration_payments();
2603
+			if (! empty($payments)) {
2604
+				$name           = $REG->attendee() instanceof EE_Attendee
2605
+					? $REG->attendee()->full_name()
2606
+					: esc_html__('Unknown Attendee', 'event_espresso');
2607
+				$overwrite_msgs = true;
2608
+				EE_Error::add_error(
2609
+					sprintf(
2610
+						esc_html__(
2611
+							'The registration for %s could not be trashed because it has payments attached to the related transaction.  If you wish to trash this registration you must first delete the payments on the related transaction.',
2612
+							'event_espresso'
2613
+						),
2614
+						$name
2615
+					),
2616
+					__FILE__,
2617
+					__FUNCTION__,
2618
+					__LINE__
2619
+				);
2620
+				// can't trash this registration because it has payments.
2621
+				continue;
2622
+			}
2623
+			$updated = $trash ? $REG->delete() : $REG->restore();
2624
+			if ($updated) {
2625
+				$success++;
2626
+			}
2627
+		}
2628
+		$this->_redirect_after_action(
2629
+			$success === $reg_count, // were ALL registrations affected?
2630
+			$success > 1
2631
+				? esc_html__('Registrations', 'event_espresso')
2632
+				: esc_html__('Registration', 'event_espresso'),
2633
+			$trash
2634
+				? esc_html__('moved to the trash', 'event_espresso')
2635
+				: esc_html__('restored', 'event_espresso'),
2636
+			$this->mergeExistingRequestParamsWithRedirectArgs(['action' => 'default']),
2637
+			$overwrite_msgs
2638
+		);
2639
+	}
2640
+
2641
+
2642
+	/**
2643
+	 * This is used to permanently delete registrations.  Note, this will handle not only deleting permanently the
2644
+	 * registration but also.
2645
+	 * 1. Removing relations to EE_Attendee
2646
+	 * 2. Deleting permanently the related transaction, but ONLY if all related registrations to the transaction are
2647
+	 * ALSO trashed.
2648
+	 * 3. Deleting permanently any related Line items but only if the above conditions are met.
2649
+	 * 4. Removing relationships between all tickets and the related registrations
2650
+	 * 5. Deleting permanently any related Answers (and the answers for other related registrations that were deleted.)
2651
+	 * 6. Deleting permanently any related Checkins.
2652
+	 *
2653
+	 * @return void
2654
+	 * @throws EE_Error
2655
+	 * @throws InvalidArgumentException
2656
+	 * @throws InvalidDataTypeException
2657
+	 * @throws InvalidInterfaceException
2658
+	 * @throws ReflectionException
2659
+	 */
2660
+	protected function _delete_registrations()
2661
+	{
2662
+		$REG_MDL = $this->getRegistrationModel();
2663
+		$success = 0;
2664
+		// Checkboxes
2665
+		$REG_IDs = $this->request->getRequestParam('_REG_ID', [], 'int', true);
2666
+
2667
+		if (! empty($REG_IDs)) {
2668
+			// if array has more than one element than success message should be plural
2669
+			$success = count($REG_IDs) > 1 ? 2 : 1;
2670
+			// cycle thru checkboxes
2671
+			foreach ($REG_IDs as $REG_ID) {
2672
+				$REG = $REG_MDL->get_one_by_ID($REG_ID);
2673
+				if (! $REG instanceof EE_Registration) {
2674
+					continue;
2675
+				}
2676
+				$deleted = $this->_delete_registration($REG);
2677
+				if (! $deleted) {
2678
+					$success = 0;
2679
+				}
2680
+			}
2681
+		}
2682
+
2683
+		$what        = $success > 1
2684
+			? esc_html__('Registrations', 'event_espresso')
2685
+			: esc_html__('Registration', 'event_espresso');
2686
+		$action_desc = esc_html__('permanently deleted.', 'event_espresso');
2687
+		$this->_redirect_after_action(
2688
+			$success,
2689
+			$what,
2690
+			$action_desc,
2691
+			$this->mergeExistingRequestParamsWithRedirectArgs(['action' => 'default']),
2692
+			true
2693
+		);
2694
+	}
2695
+
2696
+
2697
+	/**
2698
+	 * handles the permanent deletion of a registration.  See comments with _delete_registrations() for details on what
2699
+	 * models get affected.
2700
+	 *
2701
+	 * @param EE_Registration $REG registration to be deleted permanently
2702
+	 * @return bool true = successful deletion, false = fail.
2703
+	 * @throws EE_Error
2704
+	 * @throws InvalidArgumentException
2705
+	 * @throws InvalidDataTypeException
2706
+	 * @throws InvalidInterfaceException
2707
+	 * @throws ReflectionException
2708
+	 */
2709
+	protected function _delete_registration(EE_Registration $REG)
2710
+	{
2711
+		// first we start with the transaction... ultimately, we WILL not delete permanently if there are any related
2712
+		// registrations on the transaction that are NOT trashed.
2713
+		$TXN = $REG->transaction();
2714
+		if (! $TXN instanceof EE_Transaction) {
2715
+			EE_Error::add_error(
2716
+				sprintf(
2717
+					esc_html__(
2718
+						'Unable to permanently delete registration %d because its related transaction has already been deleted. If you can restore the related transaction to the database then this registration can be deleted.',
2719
+						'event_espresso'
2720
+					),
2721
+					$REG->id()
2722
+				),
2723
+				__FILE__,
2724
+				__FUNCTION__,
2725
+				__LINE__
2726
+			);
2727
+			return false;
2728
+		}
2729
+		$REGS        = $TXN->get_many_related('Registration');
2730
+		$all_trashed = true;
2731
+		foreach ($REGS as $registration) {
2732
+			if (! $registration->get('REG_deleted')) {
2733
+				$all_trashed = false;
2734
+			}
2735
+		}
2736
+		if (! $all_trashed) {
2737
+			EE_Error::add_error(
2738
+				esc_html__(
2739
+					'Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well.  These registrations will be permanently deleted in the same action.',
2740
+					'event_espresso'
2741
+				),
2742
+				__FILE__,
2743
+				__FUNCTION__,
2744
+				__LINE__
2745
+			);
2746
+			return false;
2747
+		}
2748
+		// k made it here so that means we can delete all the related transactions and their answers (but let's do them
2749
+		// separately from THIS one).
2750
+		foreach ($REGS as $registration) {
2751
+			// delete related answers
2752
+			$registration->delete_related_permanently('Answer');
2753
+			// remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact)
2754
+			$attendee = $registration->get_first_related('Attendee');
2755
+			if ($attendee instanceof EE_Attendee) {
2756
+				$registration->_remove_relation_to($attendee, 'Attendee');
2757
+			}
2758
+			// now remove relationships to tickets on this registration.
2759
+			$registration->_remove_relations('Ticket');
2760
+			// now delete permanently the checkins related to this registration.
2761
+			$registration->delete_related_permanently('Checkin');
2762
+			if ($registration->ID() === $REG->ID()) {
2763
+				continue;
2764
+			} //we don't want to delete permanently the existing registration just yet.
2765
+			// remove relation to transaction for these registrations if NOT the existing registrations
2766
+			$registration->_remove_relations('Transaction');
2767
+			// delete permanently any related messages.
2768
+			$registration->delete_related_permanently('Message');
2769
+			// now delete this registration permanently
2770
+			$registration->delete_permanently();
2771
+		}
2772
+		// now all related registrations on the transaction are handled.  So let's just handle this registration itself
2773
+		// (the transaction and line items should be all that's left).
2774
+		// delete the line items related to the transaction for this registration.
2775
+		$TXN->delete_related_permanently('Line_Item');
2776
+		// we need to remove all the relationships on the transaction
2777
+		$TXN->delete_related_permanently('Payment');
2778
+		$TXN->delete_related_permanently('Extra_Meta');
2779
+		$TXN->delete_related_permanently('Message');
2780
+		// now we can delete this REG permanently (and the transaction of course)
2781
+		$REG->delete_related_permanently('Transaction');
2782
+		return $REG->delete_permanently();
2783
+	}
2784
+
2785
+
2786
+	/**
2787
+	 *    generates HTML for the Register New Attendee Admin page
2788
+	 *
2789
+	 * @throws DomainException
2790
+	 * @throws EE_Error
2791
+	 * @throws InvalidArgumentException
2792
+	 * @throws InvalidDataTypeException
2793
+	 * @throws InvalidInterfaceException
2794
+	 * @throws ReflectionException
2795
+	 */
2796
+	public function new_registration()
2797
+	{
2798
+		if (! $this->_set_reg_event()) {
2799
+			throw new EE_Error(
2800
+				esc_html__(
2801
+					'Unable to continue with registering because there is no Event ID in the request',
2802
+					'event_espresso'
2803
+				)
2804
+			);
2805
+		}
2806
+		/** @var CurrentPage $current_page */
2807
+		$current_page = $this->loader->getShared(CurrentPage::class);
2808
+		$current_page->setEspressoPage(true);
2809
+		// gotta start with a clean slate if we're not coming here via ajax
2810
+		if (
2811
+			! $this->request->isAjax()
2812
+			&& (
2813
+				! $this->request->requestParamIsSet('processing_registration')
2814
+				|| $this->request->requestParamIsSet('step_error')
2815
+			)
2816
+		) {
2817
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2818
+		}
2819
+		$this->_template_args['event_name'] = '';
2820
+		// event name
2821
+		if ($this->_reg_event) {
2822
+			$this->_template_args['event_name'] = $this->_reg_event->name();
2823
+			$edit_event_url                     = self::add_query_args_and_nonce(
2824
+				[
2825
+					'action' => 'edit',
2826
+					'post'   => $this->_reg_event->ID(),
2827
+				],
2828
+				EVENTS_ADMIN_URL
2829
+			);
2830
+			$edit_event_lnk                     = '<a href="'
2831
+												  . $edit_event_url
2832
+												  . '" aria-label="'
2833
+												  . esc_attr__('Edit ', 'event_espresso')
2834
+												  . $this->_reg_event->name()
2835
+												  . '">'
2836
+												  . esc_html__('Edit Event', 'event_espresso')
2837
+												  . '</a>';
2838
+			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'
2839
+												   . $edit_event_lnk
2840
+												   . '</span>';
2841
+		}
2842
+		$this->_template_args['step_content'] = $this->_get_registration_step_content();
2843
+		if ($this->request->isAjax()) {
2844
+			$this->_return_json();
2845
+		}
2846
+		// grab header
2847
+		$template_path                              =
2848
+			REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php';
2849
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
2850
+			$template_path,
2851
+			$this->_template_args,
2852
+			true
2853
+		);
2854
+		// $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
2855
+		// the details template wrapper
2856
+		$this->display_admin_page_with_sidebar();
2857
+	}
2858
+
2859
+
2860
+	/**
2861
+	 * This returns the content for a registration step
2862
+	 *
2863
+	 * @return string html
2864
+	 * @throws DomainException
2865
+	 * @throws EE_Error
2866
+	 * @throws InvalidArgumentException
2867
+	 * @throws InvalidDataTypeException
2868
+	 * @throws InvalidInterfaceException
2869
+	 * @throws ReflectionException
2870
+	 */
2871
+	protected function _get_registration_step_content()
2872
+	{
2873
+		if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) {
2874
+			$warning_msg = sprintf(
2875
+				esc_html__(
2876
+					'%2$sWARNING!!!%3$s%1$sPlease do not use the back button to return to this page for the purpose of adding another registration.%1$sThis can result in lost and/or corrupted data.%1$sIf you wish to add another registration, then please click the%1$s%7$s"Add Another New Registration to Event"%8$s button%1$son the Transaction details page, after you are redirected.%1$s%1$s%4$s redirecting in %5$s seconds %6$s',
2877
+					'event_espresso'
2878
+				),
2879
+				'<br />',
2880
+				'<h3 class="important-notice">',
2881
+				'</h3>',
2882
+				'<div class="float-right">',
2883
+				'<span id="redirect_timer" class="important-notice">30</span>',
2884
+				'</div>',
2885
+				'<b>',
2886
+				'</b>'
2887
+			);
2888
+			return '
2889 2889
 	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div>
2890 2890
 	<script >
2891 2891
 		// WHOAH !!! it appears that someone is using the back button from the Transaction admin page
@@ -2898,848 +2898,848 @@  discard block
 block discarded – undo
2898 2898
 	        }
2899 2899
 	    }, 800 );
2900 2900
 	</script >';
2901
-        }
2902
-        $template_args = [
2903
-            'title'                    => '',
2904
-            'content'                  => '',
2905
-            'step_button_text'         => '',
2906
-            'show_notification_toggle' => false,
2907
-        ];
2908
-        // to indicate we're processing a new registration
2909
-        $hidden_fields = [
2910
-            'processing_registration' => [
2911
-                'type'  => 'hidden',
2912
-                'value' => 0,
2913
-            ],
2914
-            'event_id'                => [
2915
-                'type'  => 'hidden',
2916
-                'value' => $this->_reg_event->ID(),
2917
-            ],
2918
-        ];
2919
-        // if the cart is empty then we know we're at step one, so we'll display the ticket selector
2920
-        $cart = EE_Registry::instance()->SSN->cart();
2921
-        $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2922
-        switch ($step) {
2923
-            case 'ticket':
2924
-                $hidden_fields['processing_registration']['value'] = 1;
2925
-                $template_args['title']                            = esc_html__(
2926
-                    'Step One: Select the Ticket for this registration',
2927
-                    'event_espresso'
2928
-                );
2929
-                $template_args['content']                          =
2930
-                    EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event);
2931
-                $template_args['content']                          .= '</div>';
2932
-                $template_args['step_button_text']                 = esc_html__(
2933
-                    'Add Tickets and Continue to Registrant Details',
2934
-                    'event_espresso'
2935
-                );
2936
-                $template_args['show_notification_toggle']         = false;
2937
-                break;
2938
-            case 'questions':
2939
-                $hidden_fields['processing_registration']['value'] = 2;
2940
-                $template_args['title']                            = esc_html__(
2941
-                    'Step Two: Add Registrant Details for this Registration',
2942
-                    'event_espresso'
2943
-                );
2944
-                // in theory, we should be able to run EED_SPCO at this point
2945
-                // because the cart should have been set up properly by the first process_reg_step run.
2946
-                $template_args['content']                  =
2947
-                    EED_Single_Page_Checkout::registration_checkout_for_admin();
2948
-                $template_args['step_button_text']         = esc_html__(
2949
-                    'Save Registration and Continue to Details',
2950
-                    'event_espresso'
2951
-                );
2952
-                $template_args['show_notification_toggle'] = true;
2953
-                break;
2954
-        }
2955
-        // we come back to the process_registration_step route.
2956
-        $this->_set_add_edit_form_tags('process_reg_step', $hidden_fields);
2957
-        return EEH_Template::display_template(
2958
-            REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php',
2959
-            $template_args,
2960
-            true
2961
-        );
2962
-    }
2963
-
2964
-
2965
-    /**
2966
-     * set_reg_event
2967
-     *
2968
-     * @return bool
2969
-     * @throws EE_Error
2970
-     * @throws InvalidArgumentException
2971
-     * @throws InvalidDataTypeException
2972
-     * @throws InvalidInterfaceException
2973
-     * @throws ReflectionException
2974
-     */
2975
-    private function _set_reg_event()
2976
-    {
2977
-        if (is_object($this->_reg_event)) {
2978
-            return true;
2979
-        }
2980
-
2981
-        $EVT_ID = $this->request->getRequestParam('event_id', 0, 'int');
2982
-        if (! $EVT_ID) {
2983
-            return false;
2984
-        }
2985
-        $this->_reg_event = $this->getEventModel()->get_one_by_ID($EVT_ID);
2986
-        return true;
2987
-    }
2988
-
2989
-
2990
-    /**
2991
-     * process_reg_step
2992
-     *
2993
-     * @return void
2994
-     * @throws DomainException
2995
-     * @throws EE_Error
2996
-     * @throws InvalidArgumentException
2997
-     * @throws InvalidDataTypeException
2998
-     * @throws InvalidInterfaceException
2999
-     * @throws ReflectionException
3000
-     * @throws RuntimeException
3001
-     */
3002
-    public function process_reg_step()
3003
-    {
3004
-        EE_System::do_not_cache();
3005
-        $this->_set_reg_event();
3006
-        /** @var CurrentPage $current_page */
3007
-        $current_page = $this->loader->getShared(CurrentPage::class);
3008
-        $current_page->setEspressoPage(true);
3009
-        $this->request->setRequestParam('uts', time());
3010
-        // what step are we on?
3011
-        $cart = EE_Registry::instance()->SSN->cart();
3012
-        $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
3013
-        // if doing ajax then we need to verify the nonce
3014
-        if ($this->request->isAjax()) {
3015
-            $nonce = $this->request->getRequestParam($this->_req_nonce, '');
3016
-            $this->_verify_nonce($nonce, $this->_req_nonce);
3017
-        }
3018
-        switch ($step) {
3019
-            case 'ticket':
3020
-                // process ticket selection
3021
-                $success = EED_Ticket_Selector::instance()->process_ticket_selections();
3022
-                if ($success) {
3023
-                    EE_Error::add_success(
3024
-                        esc_html__(
3025
-                            'Tickets Selected. Now complete the registration.',
3026
-                            'event_espresso'
3027
-                        )
3028
-                    );
3029
-                } else {
3030
-                    $this->request->setRequestParam('step_error', true);
3031
-                    $query_args['step_error'] = $this->request->getRequestParam('step_error', true, 'bool');
3032
-                }
3033
-                if ($this->request->isAjax()) {
3034
-                    $this->new_registration(); // display next step
3035
-                } else {
3036
-                    $query_args = [
3037
-                        'action'                  => 'new_registration',
3038
-                        'processing_registration' => 1,
3039
-                        'event_id'                => $this->_reg_event->ID(),
3040
-                        'uts'                     => time(),
3041
-                    ];
3042
-                    $this->_redirect_after_action(
3043
-                        false,
3044
-                        '',
3045
-                        '',
3046
-                        $query_args,
3047
-                        true
3048
-                    );
3049
-                }
3050
-                break;
3051
-            case 'questions':
3052
-                if (! $this->request->requestParamIsSet('txn_reg_status_change[send_notifications]')) {
3053
-                    add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15);
3054
-                }
3055
-                // process registration
3056
-                $transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin();
3057
-                if ($cart instanceof EE_Cart) {
3058
-                    $grand_total = $cart->get_grand_total();
3059
-                    if ($grand_total instanceof EE_Line_Item) {
3060
-                        $grand_total->save_this_and_descendants_to_txn();
3061
-                    }
3062
-                }
3063
-                if (! $transaction instanceof EE_Transaction) {
3064
-                    $query_args = [
3065
-                        'action'                  => 'new_registration',
3066
-                        'processing_registration' => 2,
3067
-                        'event_id'                => $this->_reg_event->ID(),
3068
-                        'uts'                     => time(),
3069
-                    ];
3070
-                    if ($this->request->isAjax()) {
3071
-                        // display registration form again because there are errors (maybe validation?)
3072
-                        $this->new_registration();
3073
-                        return;
3074
-                    }
3075
-                    $this->_redirect_after_action(
3076
-                        false,
3077
-                        '',
3078
-                        '',
3079
-                        $query_args,
3080
-                        true
3081
-                    );
3082
-                    return;
3083
-                }
3084
-                // maybe update status, and make sure to save transaction if not done already
3085
-                if (! $transaction->update_status_based_on_total_paid()) {
3086
-                    $transaction->save();
3087
-                }
3088
-                EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
3089
-                $query_args = [
3090
-                    'action'        => 'redirect_to_txn',
3091
-                    'TXN_ID'        => $transaction->ID(),
3092
-                    'EVT_ID'        => $this->_reg_event->ID(),
3093
-                    'event_name'    => urlencode($this->_reg_event->name()),
3094
-                    'redirect_from' => 'new_registration',
3095
-                ];
3096
-                $this->_redirect_after_action(false, '', '', $query_args, true);
3097
-                break;
3098
-        }
3099
-        // what are you looking here for?  Should be nothing to do at this point.
3100
-    }
3101
-
3102
-
3103
-    /**
3104
-     * redirect_to_txn
3105
-     *
3106
-     * @return void
3107
-     * @throws EE_Error
3108
-     * @throws InvalidArgumentException
3109
-     * @throws InvalidDataTypeException
3110
-     * @throws InvalidInterfaceException
3111
-     * @throws ReflectionException
3112
-     */
3113
-    public function redirect_to_txn()
3114
-    {
3115
-        EE_System::do_not_cache();
3116
-        EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
3117
-        $query_args = [
3118
-            'action' => 'view_transaction',
3119
-            'TXN_ID' => $this->request->getRequestParam('TXN_ID', 0, 'int'),
3120
-            'page'   => 'espresso_transactions',
3121
-        ];
3122
-        if ($this->request->requestParamIsSet('EVT_ID') && $this->request->requestParamIsSet('redirect_from')) {
3123
-            $query_args['EVT_ID']        = $this->request->getRequestParam('EVT_ID', 0, 'int');
3124
-            $query_args['event_name']    = urlencode($this->request->getRequestParam('event_name'));
3125
-            $query_args['redirect_from'] = $this->request->getRequestParam('redirect_from');
3126
-        }
3127
-        EE_Error::add_success(
3128
-            esc_html__(
3129
-                'Registration Created.  Please review the transaction and add any payments as necessary',
3130
-                'event_espresso'
3131
-            )
3132
-        );
3133
-        $this->_redirect_after_action(false, '', '', $query_args, true);
3134
-    }
3135
-
3136
-
3137
-    /**
3138
-     * generates HTML for the Attendee Contact List
3139
-     *
3140
-     * @return void
3141
-     * @throws DomainException
3142
-     * @throws EE_Error
3143
-     */
3144
-    protected function _attendee_contact_list_table()
3145
-    {
3146
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3147
-        $this->_search_btn_label = esc_html__('Contacts', 'event_espresso');
3148
-        $this->display_admin_list_table_page_with_no_sidebar();
3149
-    }
3150
-
3151
-
3152
-    /**
3153
-     * get_attendees
3154
-     *
3155
-     * @param      $per_page
3156
-     * @param bool $count whether to return count or data.
3157
-     * @param bool $trash
3158
-     * @return array|int
3159
-     * @throws EE_Error
3160
-     * @throws InvalidArgumentException
3161
-     * @throws InvalidDataTypeException
3162
-     * @throws InvalidInterfaceException
3163
-     * @throws ReflectionException
3164
-     */
3165
-    public function get_attendees($per_page, $count = false, $trash = false)
3166
-    {
3167
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3168
-        require_once(REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php');
3169
-        $orderby = $this->request->getRequestParam('orderby');
3170
-        switch ($orderby) {
3171
-            case 'ATT_ID':
3172
-            case 'ATT_fname':
3173
-            case 'ATT_email':
3174
-            case 'ATT_city':
3175
-            case 'STA_ID':
3176
-            case 'CNT_ID':
3177
-                break;
3178
-            case 'Registration_Count':
3179
-                $orderby = 'Registration_Count';
3180
-                break;
3181
-            default:
3182
-                $orderby = 'ATT_lname';
3183
-        }
3184
-        $sort         = $this->request->getRequestParam('order', 'ASC');
3185
-        $current_page = $this->request->getRequestParam('paged', 1, 'int');
3186
-        $per_page     = absint($per_page) ? $per_page : 10;
3187
-        $per_page     = $this->request->getRequestParam('perpage', $per_page, 'int');
3188
-        $_where       = [];
3189
-        $search_term  = $this->request->getRequestParam('s');
3190
-        if ($search_term) {
3191
-            $search_term  = '%' . $search_term . '%';
3192
-            $_where['OR'] = [
3193
-                'Registration.Event.EVT_name'       => ['LIKE', $search_term],
3194
-                'Registration.Event.EVT_desc'       => ['LIKE', $search_term],
3195
-                'Registration.Event.EVT_short_desc' => ['LIKE', $search_term],
3196
-                'ATT_fname'                         => ['LIKE', $search_term],
3197
-                'ATT_lname'                         => ['LIKE', $search_term],
3198
-                'ATT_short_bio'                     => ['LIKE', $search_term],
3199
-                'ATT_email'                         => ['LIKE', $search_term],
3200
-                'ATT_address'                       => ['LIKE', $search_term],
3201
-                'ATT_address2'                      => ['LIKE', $search_term],
3202
-                'ATT_city'                          => ['LIKE', $search_term],
3203
-                'Country.CNT_name'                  => ['LIKE', $search_term],
3204
-                'State.STA_name'                    => ['LIKE', $search_term],
3205
-                'ATT_phone'                         => ['LIKE', $search_term],
3206
-                'Registration.REG_final_price'      => ['LIKE', $search_term],
3207
-                'Registration.REG_code'             => ['LIKE', $search_term],
3208
-                'Registration.REG_group_size'       => ['LIKE', $search_term],
3209
-            ];
3210
-        }
3211
-        $offset     = ($current_page - 1) * $per_page;
3212
-        $limit      = $count ? null : [$offset, $per_page];
3213
-        $query_args = [
3214
-            $_where,
3215
-            'extra_selects' => ['Registration_Count' => ['Registration.REG_ID', 'count', '%d']],
3216
-            'limit'         => $limit,
3217
-        ];
3218
-        if (! $count) {
3219
-            $query_args['order_by'] = [$orderby => $sort];
3220
-        }
3221
-        $query_args[0]['status'] = $trash ? ['!=', 'publish'] : ['IN', ['publish']];
3222
-        return $count
3223
-            ? $this->getAttendeeModel()->count($query_args, 'ATT_ID', true)
3224
-            : $this->getAttendeeModel()->get_all($query_args);
3225
-    }
3226
-
3227
-
3228
-    /**
3229
-     * This is just taking care of resending the registration confirmation
3230
-     *
3231
-     * @return void
3232
-     * @throws EE_Error
3233
-     * @throws InvalidArgumentException
3234
-     * @throws InvalidDataTypeException
3235
-     * @throws InvalidInterfaceException
3236
-     * @throws ReflectionException
3237
-     */
3238
-    protected function _resend_registration()
3239
-    {
3240
-        $this->_process_resend_registration();
3241
-        $REG_ID      = $this->request->getRequestParam('_REG_ID', 0, 'int');
3242
-        $redirect_to = $this->request->getRequestParam('redirect_to');
3243
-        $query_args  = $redirect_to
3244
-            ? ['action' => $redirect_to, '_REG_ID' => $REG_ID]
3245
-            : ['action' => 'default'];
3246
-        $this->_redirect_after_action(false, '', '', $query_args, true);
3247
-    }
3248
-
3249
-
3250
-    /**
3251
-     * Creates a registration report, but accepts the name of a method to use for preparing the query parameters
3252
-     * to use when selecting registrations
3253
-     *
3254
-     * @param string $method_name_for_getting_query_params the name of the method (on this class) to use for preparing
3255
-     *                                                     the query parameters from the request
3256
-     * @return void ends the request with a redirect or download
3257
-     */
3258
-    public function _registrations_report_base($method_name_for_getting_query_params)
3259
-    {
3260
-        $EVT_ID = $this->request->requestParamIsSet('EVT_ID')
3261
-            ? $this->request->getRequestParam('EVT_ID', 0, DataType::INT)
3262
-            : null;
3263
-        if (! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
3264
-            $return_url    = $this->request->getRequestParam('return_url', '', DataType::URL);
3265
-            $filters       = $this->request->getRequestParam('filters', [], DataType::STRING, true);
3266
-            $report_params = $this->$method_name_for_getting_query_params($filters);
3267
-            $use_filters   = $this->request->getRequestParam('use_filters', false, DataType::BOOL);
3268
-            wp_redirect(
3269
-                EE_Admin_Page::add_query_args_and_nonce(
3270
-                    [
3271
-                        'page'        => EED_Batch::PAGE_SLUG,
3272
-                        'batch'       => EED_Batch::batch_file_job,
3273
-                        'EVT_ID'      => $EVT_ID,
3274
-                        'filters'     => urlencode(serialize($report_params)),
3275
-                        'use_filters' => urlencode($use_filters),
3276
-                        'job_handler' => urlencode('EventEspresso\core\libraries\batch\JobHandlers\RegistrationsReport'),
3277
-                        'return_url'  => urlencode($return_url),
3278
-                    ]
3279
-                )
3280
-            );
3281
-        } else {
3282
-            // Pull the current request params
3283
-            $request_args = $this->request->requestParams();
3284
-            // Set the required request_args to be passed to the export
3285
-            $required_request_args = [
3286
-                'export' => 'report',
3287
-                'action' => 'registrations_report_for_event',
3288
-                'EVT_ID' => $EVT_ID,
3289
-            ];
3290
-            // Merge required request args, overriding any currently set
3291
-            $request_args = array_merge($request_args, $required_request_args);
3292
-            if (is_readable(EE_CLASSES . 'EE_Export.class.php')) {
3293
-                require_once(EE_CLASSES . 'EE_Export.class.php');
3294
-                $EE_Export = EE_Export::instance($request_args);
3295
-                $EE_Export->export();
3296
-            }
3297
-        }
3298
-    }
3299
-
3300
-
3301
-    /**
3302
-     * Creates a registration report using only query parameters in the request
3303
-     *
3304
-     * @return void
3305
-     */
3306
-    public function _registrations_report()
3307
-    {
3308
-        $this->_registrations_report_base('_get_registration_query_parameters');
3309
-    }
3310
-
3311
-
3312
-    public function _contact_list_export()
3313
-    {
3314
-        if (is_readable(EE_CLASSES . 'EE_Export.class.php')) {
3315
-            require_once(EE_CLASSES . 'EE_Export.class.php');
3316
-            $EE_Export = EE_Export::instance($this->request->requestParams());
3317
-            $EE_Export->export_attendees();
3318
-        }
3319
-    }
3320
-
3321
-
3322
-    public function _contact_list_report()
3323
-    {
3324
-        if (! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
3325
-            wp_redirect(
3326
-                EE_Admin_Page::add_query_args_and_nonce(
3327
-                    [
3328
-                        'page'        => EED_Batch::PAGE_SLUG,
3329
-                        'batch'       => EED_Batch::batch_file_job,
3330
-                        'job_handler' => urlencode('EventEspresso\core\libraries\batch\JobHandlers\AttendeesReport'),
3331
-                        'return_url'  => urlencode($this->request->getRequestParam('return_url', '', DataType::URL)),
3332
-                    ]
3333
-                )
3334
-            );
3335
-        } else {
3336
-            if (is_readable(EE_CLASSES . 'EE_Export.class.php')) {
3337
-                require_once(EE_CLASSES . 'EE_Export.class.php');
3338
-                $EE_Export = EE_Export::instance($this->request->requestParams());
3339
-                $EE_Export->report_attendees();
3340
-            }
3341
-        }
3342
-    }
3343
-
3344
-
3345
-
3346
-
3347
-
3348
-    /***************************************        ATTENDEE DETAILS        ***************************************/
3349
-    /**
3350
-     * This duplicates the attendee object for the given incoming registration id and attendee_id.
3351
-     *
3352
-     * @return void
3353
-     * @throws EE_Error
3354
-     * @throws InvalidArgumentException
3355
-     * @throws InvalidDataTypeException
3356
-     * @throws InvalidInterfaceException
3357
-     * @throws ReflectionException
3358
-     */
3359
-    protected function _duplicate_attendee()
3360
-    {
3361
-        $REG_ID = $this->request->getRequestParam('_REG_ID', 0, 'int');
3362
-        $action = $this->request->getRequestParam('return', 'default');
3363
-        // verify we have necessary info
3364
-        if (! $REG_ID) {
3365
-            EE_Error::add_error(
3366
-                esc_html__(
3367
-                    'Unable to create the contact for the registration because the required parameters are not present (_REG_ID )',
3368
-                    'event_espresso'
3369
-                ),
3370
-                __FILE__,
3371
-                __LINE__,
3372
-                __FUNCTION__
3373
-            );
3374
-            $query_args = ['action' => $action];
3375
-            $this->_redirect_after_action('', '', '', $query_args, true);
3376
-        }
3377
-        // okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration.
3378
-        $registration = $this->getRegistrationModel()->get_one_by_ID($REG_ID);
3379
-        if (! $registration instanceof EE_Registration) {
3380
-            throw new RuntimeException(
3381
-                sprintf(
3382
-                    esc_html__(
3383
-                        'Unable to create the contact because a valid registration could not be retrieved for REG ID: %1$d',
3384
-                        'event_espresso'
3385
-                    ),
3386
-                    $REG_ID
3387
-                )
3388
-            );
3389
-        }
3390
-        $attendee = $registration->attendee();
3391
-        // remove relation of existing attendee on registration
3392
-        $registration->_remove_relation_to($attendee, 'Attendee');
3393
-        // new attendee
3394
-        $new_attendee = clone $attendee;
3395
-        $new_attendee->set('ATT_ID', 0);
3396
-        $new_attendee->save();
3397
-        // add new attendee to reg
3398
-        $registration->_add_relation_to($new_attendee, 'Attendee');
3399
-        EE_Error::add_success(
3400
-            esc_html__(
3401
-                'New Contact record created.  Now make any edits you wish to make for this contact.',
3402
-                'event_espresso'
3403
-            )
3404
-        );
3405
-        // redirect to edit page for attendee
3406
-        $query_args = ['post' => $new_attendee->ID(), 'action' => 'edit_attendee'];
3407
-        $this->_redirect_after_action('', '', '', $query_args, true);
3408
-    }
3409
-
3410
-
3411
-    /**
3412
-     * Callback invoked by parent EE_Admin_CPT class hooked in on `save_post` wp hook.
3413
-     *
3414
-     * @param int     $post_id
3415
-     * @param WP_Post $post
3416
-     * @throws DomainException
3417
-     * @throws EE_Error
3418
-     * @throws InvalidArgumentException
3419
-     * @throws InvalidDataTypeException
3420
-     * @throws InvalidInterfaceException
3421
-     * @throws LogicException
3422
-     * @throws InvalidFormSubmissionException
3423
-     * @throws ReflectionException
3424
-     */
3425
-    protected function _insert_update_cpt_item($post_id, $post)
3426
-    {
3427
-        $success  = true;
3428
-        $attendee = $post instanceof WP_Post && $post->post_type === 'espresso_attendees'
3429
-            ? $this->getAttendeeModel()->get_one_by_ID($post_id)
3430
-            : null;
3431
-        // for attendee updates
3432
-        if ($attendee instanceof EE_Attendee) {
3433
-            // note we should only be UPDATING attendees at this point.
3434
-            $fname          = $this->request->getRequestParam('ATT_fname', '');
3435
-            $lname          = $this->request->getRequestParam('ATT_lname', '');
3436
-            $updated_fields = [
3437
-                'ATT_fname'     => $fname,
3438
-                'ATT_lname'     => $lname,
3439
-                'ATT_full_name' => "{$fname} {$lname}",
3440
-                'ATT_address'   => $this->request->getRequestParam('ATT_address', ''),
3441
-                'ATT_address2'  => $this->request->getRequestParam('ATT_address2', ''),
3442
-                'ATT_city'      => $this->request->getRequestParam('ATT_city', ''),
3443
-                'STA_ID'        => $this->request->getRequestParam('STA_ID', ''),
3444
-                'CNT_ISO'       => $this->request->getRequestParam('CNT_ISO', ''),
3445
-                'ATT_zip'       => $this->request->getRequestParam('ATT_zip', ''),
3446
-            ];
3447
-            foreach ($updated_fields as $field => $value) {
3448
-                $attendee->set($field, $value);
3449
-            }
3450
-
3451
-            // process contact details metabox form handler (which will also save the attendee)
3452
-            $contact_details_form = $this->getAttendeeContactDetailsMetaboxFormHandler($attendee);
3453
-            $success              = $contact_details_form->process($this->request->requestParams());
3454
-
3455
-            $attendee_update_callbacks = apply_filters(
3456
-                'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update',
3457
-                []
3458
-            );
3459
-            foreach ($attendee_update_callbacks as $a_callback) {
3460
-                if (false === call_user_func_array($a_callback, [$attendee, $this->request->requestParams()])) {
3461
-                    throw new EE_Error(
3462
-                        sprintf(
3463
-                            esc_html__(
3464
-                                'The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback.  Please check the spelling.',
3465
-                                'event_espresso'
3466
-                            ),
3467
-                            $a_callback
3468
-                        )
3469
-                    );
3470
-                }
3471
-            }
3472
-        }
3473
-
3474
-        if ($success === false) {
3475
-            EE_Error::add_error(
3476
-                esc_html__(
3477
-                    'Something went wrong with updating the meta table data for the registration.',
3478
-                    'event_espresso'
3479
-                ),
3480
-                __FILE__,
3481
-                __FUNCTION__,
3482
-                __LINE__
3483
-            );
3484
-        }
3485
-    }
3486
-
3487
-
3488
-    public function trash_cpt_item($post_id)
3489
-    {
3490
-    }
3491
-
3492
-
3493
-    public function delete_cpt_item($post_id)
3494
-    {
3495
-    }
3496
-
3497
-
3498
-    public function restore_cpt_item($post_id)
3499
-    {
3500
-    }
3501
-
3502
-
3503
-    protected function _restore_cpt_item($post_id, $revision_id)
3504
-    {
3505
-    }
3506
-
3507
-
3508
-    /**
3509
-     * @throws EE_Error
3510
-     * @throws ReflectionException
3511
-     * @since 4.10.2.p
3512
-     */
3513
-    public function attendee_editor_metaboxes()
3514
-    {
3515
-        $this->verify_cpt_object();
3516
-        remove_meta_box(
3517
-            'postexcerpt',
3518
-            $this->_cpt_routes[ $this->_req_action ],
3519
-            'normal'
3520
-        );
3521
-        remove_meta_box('commentstatusdiv', $this->_cpt_routes[ $this->_req_action ], 'normal');
3522
-        if (post_type_supports('espresso_attendees', 'excerpt')) {
3523
-            $this->addMetaBox(
3524
-                'postexcerpt',
3525
-                esc_html__('Short Biography', 'event_espresso'),
3526
-                'post_excerpt_meta_box',
3527
-                $this->_cpt_routes[ $this->_req_action ]
3528
-            );
3529
-        }
3530
-        if (post_type_supports('espresso_attendees', 'comments')) {
3531
-            $this->addMetaBox(
3532
-                'commentsdiv',
3533
-                esc_html__('Notes on the Contact', 'event_espresso'),
3534
-                'post_comment_meta_box',
3535
-                $this->_cpt_routes[ $this->_req_action ],
3536
-                'normal',
3537
-                'core'
3538
-            );
3539
-        }
3540
-        $this->addMetaBox(
3541
-            'attendee_contact_info',
3542
-            esc_html__('Contact Info', 'event_espresso'),
3543
-            [$this, 'attendee_contact_info'],
3544
-            $this->_cpt_routes[ $this->_req_action ],
3545
-            'side',
3546
-            'core'
3547
-        );
3548
-        $this->addMetaBox(
3549
-            'attendee_details_address',
3550
-            esc_html__('Address Details', 'event_espresso'),
3551
-            [$this, 'attendee_address_details'],
3552
-            $this->_cpt_routes[ $this->_req_action ],
3553
-            'normal',
3554
-            'core'
3555
-        );
3556
-        $this->addMetaBox(
3557
-            'attendee_registrations',
3558
-            esc_html__('Registrations for this Contact', 'event_espresso'),
3559
-            [$this, 'attendee_registrations_meta_box'],
3560
-            $this->_cpt_routes[ $this->_req_action ]
3561
-        );
3562
-    }
3563
-
3564
-
3565
-    /**
3566
-     * Metabox for attendee contact info
3567
-     *
3568
-     * @param WP_Post $post wp post object
3569
-     * @return void attendee contact info ( and form )
3570
-     * @throws EE_Error
3571
-     * @throws InvalidArgumentException
3572
-     * @throws InvalidDataTypeException
3573
-     * @throws InvalidInterfaceException
3574
-     * @throws LogicException
3575
-     * @throws DomainException
3576
-     */
3577
-    public function attendee_contact_info($post)
3578
-    {
3579
-        // get attendee object ( should already have it )
3580
-        $form = $this->getAttendeeContactDetailsMetaboxFormHandler($this->_cpt_model_obj);
3581
-        $form->enqueueStylesAndScripts();
3582
-        echo wp_kses($form->display(), AllowedTags::getWithFormTags());
3583
-    }
3584
-
3585
-
3586
-    /**
3587
-     * Return form handler for the contact details metabox
3588
-     *
3589
-     * @param EE_Attendee $attendee
3590
-     * @return AttendeeContactDetailsMetaboxFormHandler
3591
-     * @throws DomainException
3592
-     * @throws InvalidArgumentException
3593
-     * @throws InvalidDataTypeException
3594
-     * @throws InvalidInterfaceException
3595
-     */
3596
-    protected function getAttendeeContactDetailsMetaboxFormHandler(EE_Attendee $attendee)
3597
-    {
3598
-        return new AttendeeContactDetailsMetaboxFormHandler($attendee, EE_Registry::instance());
3599
-    }
3600
-
3601
-
3602
-    /**
3603
-     * Metabox for attendee details
3604
-     *
3605
-     * @param WP_Post $post wp post object
3606
-     * @throws EE_Error
3607
-     * @throws ReflectionException
3608
-     */
3609
-    public function attendee_address_details($post)
3610
-    {
3611
-        // get attendee object (should already have it)
3612
-        $this->_template_args['attendee']     = $this->_cpt_model_obj;
3613
-        $this->_template_args['state_html']   = EEH_Form_Fields::generate_form_input(
3614
-            new EE_Question_Form_Input(
3615
-                EE_Question::new_instance(
3616
-                    [
3617
-                        'QST_ID'           => 0,
3618
-                        'QST_display_text' => esc_html__('State/Province', 'event_espresso'),
3619
-                        'QST_system'       => 'admin-state',
3620
-                    ]
3621
-                ),
3622
-                EE_Answer::new_instance(
3623
-                    [
3624
-                        'ANS_ID'    => 0,
3625
-                        'ANS_value' => $this->_cpt_model_obj->state_ID(),
3626
-                    ]
3627
-                ),
3628
-                [
3629
-                    'input_id'       => 'STA_ID',
3630
-                    'input_name'     => 'STA_ID',
3631
-                    'input_prefix'   => '',
3632
-                    'append_qstn_id' => false,
3633
-                ]
3634
-            )
3635
-        );
3636
-        $this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input(
3637
-            new EE_Question_Form_Input(
3638
-                EE_Question::new_instance(
3639
-                    [
3640
-                        'QST_ID'           => 0,
3641
-                        'QST_display_text' => esc_html__('Country', 'event_espresso'),
3642
-                        'QST_system'       => 'admin-country',
3643
-                    ]
3644
-                ),
3645
-                EE_Answer::new_instance(
3646
-                    [
3647
-                        'ANS_ID'    => 0,
3648
-                        'ANS_value' => $this->_cpt_model_obj->country_ID(),
3649
-                    ]
3650
-                ),
3651
-                [
3652
-                    'input_id'       => 'CNT_ISO',
3653
-                    'input_name'     => 'CNT_ISO',
3654
-                    'input_prefix'   => '',
3655
-                    'append_qstn_id' => false,
3656
-                ]
3657
-            )
3658
-        );
3659
-        $template                             =
3660
-            REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php';
3661
-        EEH_Template::display_template($template, $this->_template_args);
3662
-    }
3663
-
3664
-
3665
-    /**
3666
-     * _attendee_details
3667
-     *
3668
-     * @param $post
3669
-     * @return void
3670
-     * @throws DomainException
3671
-     * @throws EE_Error
3672
-     * @throws InvalidArgumentException
3673
-     * @throws InvalidDataTypeException
3674
-     * @throws InvalidInterfaceException
3675
-     * @throws ReflectionException
3676
-     */
3677
-    public function attendee_registrations_meta_box($post)
3678
-    {
3679
-        $this->_template_args['attendee']      = $this->_cpt_model_obj;
3680
-        $this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration');
3681
-        $template                              =
3682
-            REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php';
3683
-        EEH_Template::display_template($template, $this->_template_args);
3684
-    }
3685
-
3686
-
3687
-    /**
3688
-     * add in the form fields for the attendee edit
3689
-     *
3690
-     * @param WP_Post $post wp post object
3691
-     * @return void echos html for new form.
3692
-     * @throws DomainException
3693
-     */
3694
-    public function after_title_form_fields($post)
3695
-    {
3696
-        if ($post->post_type === 'espresso_attendees') {
3697
-            $template                  = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php';
3698
-            $template_args['attendee'] = $this->_cpt_model_obj;
3699
-            EEH_Template::display_template($template, $template_args);
3700
-        }
3701
-    }
3702
-
3703
-
3704
-    /**
3705
-     * _trash_or_restore_attendee
3706
-     *
3707
-     * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE)
3708
-     * @return void
3709
-     * @throws EE_Error
3710
-     * @throws InvalidArgumentException
3711
-     * @throws InvalidDataTypeException
3712
-     * @throws InvalidInterfaceException
3713
-     * @throws ReflectionException
3714
-     */
3715
-    protected function _trash_or_restore_attendees($trash = true)
3716
-    {
3717
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3718
-        $status = $trash ? 'trash' : 'publish';
3719
-        // Checkboxes
3720
-        if ($this->request->requestParamIsSet('checkbox')) {
3721
-            $ATT_IDs = $this->request->getRequestParam('checkbox', [], 'int', true);
3722
-            // if array has more than one element than success message should be plural
3723
-            $success = count($ATT_IDs) > 1 ? 2 : 1;
3724
-            // cycle thru checkboxes
3725
-            foreach ($ATT_IDs as $ATT_ID) {
3726
-                $updated = $this->getAttendeeModel()->update_by_ID(['status' => $status], $ATT_ID);
3727
-                if (! $updated) {
3728
-                    $success = 0;
3729
-                }
3730
-            }
3731
-        } else {
3732
-            // grab single id and delete
3733
-            $ATT_ID = $this->request->getRequestParam('ATT_ID', 0, 'int');
3734
-            // update attendee
3735
-            $success = $this->getAttendeeModel()->update_by_ID(['status' => $status], $ATT_ID) ? 1 : 0;
3736
-        }
3737
-        $what        = $success > 1
3738
-            ? esc_html__('Contacts', 'event_espresso')
3739
-            : esc_html__('Contact', 'event_espresso');
3740
-        $action_desc = $trash
3741
-            ? esc_html__('moved to the trash', 'event_espresso')
3742
-            : esc_html__('restored', 'event_espresso');
3743
-        $this->_redirect_after_action($success, $what, $action_desc, ['action' => 'contact_list']);
3744
-    }
2901
+		}
2902
+		$template_args = [
2903
+			'title'                    => '',
2904
+			'content'                  => '',
2905
+			'step_button_text'         => '',
2906
+			'show_notification_toggle' => false,
2907
+		];
2908
+		// to indicate we're processing a new registration
2909
+		$hidden_fields = [
2910
+			'processing_registration' => [
2911
+				'type'  => 'hidden',
2912
+				'value' => 0,
2913
+			],
2914
+			'event_id'                => [
2915
+				'type'  => 'hidden',
2916
+				'value' => $this->_reg_event->ID(),
2917
+			],
2918
+		];
2919
+		// if the cart is empty then we know we're at step one, so we'll display the ticket selector
2920
+		$cart = EE_Registry::instance()->SSN->cart();
2921
+		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2922
+		switch ($step) {
2923
+			case 'ticket':
2924
+				$hidden_fields['processing_registration']['value'] = 1;
2925
+				$template_args['title']                            = esc_html__(
2926
+					'Step One: Select the Ticket for this registration',
2927
+					'event_espresso'
2928
+				);
2929
+				$template_args['content']                          =
2930
+					EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event);
2931
+				$template_args['content']                          .= '</div>';
2932
+				$template_args['step_button_text']                 = esc_html__(
2933
+					'Add Tickets and Continue to Registrant Details',
2934
+					'event_espresso'
2935
+				);
2936
+				$template_args['show_notification_toggle']         = false;
2937
+				break;
2938
+			case 'questions':
2939
+				$hidden_fields['processing_registration']['value'] = 2;
2940
+				$template_args['title']                            = esc_html__(
2941
+					'Step Two: Add Registrant Details for this Registration',
2942
+					'event_espresso'
2943
+				);
2944
+				// in theory, we should be able to run EED_SPCO at this point
2945
+				// because the cart should have been set up properly by the first process_reg_step run.
2946
+				$template_args['content']                  =
2947
+					EED_Single_Page_Checkout::registration_checkout_for_admin();
2948
+				$template_args['step_button_text']         = esc_html__(
2949
+					'Save Registration and Continue to Details',
2950
+					'event_espresso'
2951
+				);
2952
+				$template_args['show_notification_toggle'] = true;
2953
+				break;
2954
+		}
2955
+		// we come back to the process_registration_step route.
2956
+		$this->_set_add_edit_form_tags('process_reg_step', $hidden_fields);
2957
+		return EEH_Template::display_template(
2958
+			REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php',
2959
+			$template_args,
2960
+			true
2961
+		);
2962
+	}
2963
+
2964
+
2965
+	/**
2966
+	 * set_reg_event
2967
+	 *
2968
+	 * @return bool
2969
+	 * @throws EE_Error
2970
+	 * @throws InvalidArgumentException
2971
+	 * @throws InvalidDataTypeException
2972
+	 * @throws InvalidInterfaceException
2973
+	 * @throws ReflectionException
2974
+	 */
2975
+	private function _set_reg_event()
2976
+	{
2977
+		if (is_object($this->_reg_event)) {
2978
+			return true;
2979
+		}
2980
+
2981
+		$EVT_ID = $this->request->getRequestParam('event_id', 0, 'int');
2982
+		if (! $EVT_ID) {
2983
+			return false;
2984
+		}
2985
+		$this->_reg_event = $this->getEventModel()->get_one_by_ID($EVT_ID);
2986
+		return true;
2987
+	}
2988
+
2989
+
2990
+	/**
2991
+	 * process_reg_step
2992
+	 *
2993
+	 * @return void
2994
+	 * @throws DomainException
2995
+	 * @throws EE_Error
2996
+	 * @throws InvalidArgumentException
2997
+	 * @throws InvalidDataTypeException
2998
+	 * @throws InvalidInterfaceException
2999
+	 * @throws ReflectionException
3000
+	 * @throws RuntimeException
3001
+	 */
3002
+	public function process_reg_step()
3003
+	{
3004
+		EE_System::do_not_cache();
3005
+		$this->_set_reg_event();
3006
+		/** @var CurrentPage $current_page */
3007
+		$current_page = $this->loader->getShared(CurrentPage::class);
3008
+		$current_page->setEspressoPage(true);
3009
+		$this->request->setRequestParam('uts', time());
3010
+		// what step are we on?
3011
+		$cart = EE_Registry::instance()->SSN->cart();
3012
+		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
3013
+		// if doing ajax then we need to verify the nonce
3014
+		if ($this->request->isAjax()) {
3015
+			$nonce = $this->request->getRequestParam($this->_req_nonce, '');
3016
+			$this->_verify_nonce($nonce, $this->_req_nonce);
3017
+		}
3018
+		switch ($step) {
3019
+			case 'ticket':
3020
+				// process ticket selection
3021
+				$success = EED_Ticket_Selector::instance()->process_ticket_selections();
3022
+				if ($success) {
3023
+					EE_Error::add_success(
3024
+						esc_html__(
3025
+							'Tickets Selected. Now complete the registration.',
3026
+							'event_espresso'
3027
+						)
3028
+					);
3029
+				} else {
3030
+					$this->request->setRequestParam('step_error', true);
3031
+					$query_args['step_error'] = $this->request->getRequestParam('step_error', true, 'bool');
3032
+				}
3033
+				if ($this->request->isAjax()) {
3034
+					$this->new_registration(); // display next step
3035
+				} else {
3036
+					$query_args = [
3037
+						'action'                  => 'new_registration',
3038
+						'processing_registration' => 1,
3039
+						'event_id'                => $this->_reg_event->ID(),
3040
+						'uts'                     => time(),
3041
+					];
3042
+					$this->_redirect_after_action(
3043
+						false,
3044
+						'',
3045
+						'',
3046
+						$query_args,
3047
+						true
3048
+					);
3049
+				}
3050
+				break;
3051
+			case 'questions':
3052
+				if (! $this->request->requestParamIsSet('txn_reg_status_change[send_notifications]')) {
3053
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15);
3054
+				}
3055
+				// process registration
3056
+				$transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin();
3057
+				if ($cart instanceof EE_Cart) {
3058
+					$grand_total = $cart->get_grand_total();
3059
+					if ($grand_total instanceof EE_Line_Item) {
3060
+						$grand_total->save_this_and_descendants_to_txn();
3061
+					}
3062
+				}
3063
+				if (! $transaction instanceof EE_Transaction) {
3064
+					$query_args = [
3065
+						'action'                  => 'new_registration',
3066
+						'processing_registration' => 2,
3067
+						'event_id'                => $this->_reg_event->ID(),
3068
+						'uts'                     => time(),
3069
+					];
3070
+					if ($this->request->isAjax()) {
3071
+						// display registration form again because there are errors (maybe validation?)
3072
+						$this->new_registration();
3073
+						return;
3074
+					}
3075
+					$this->_redirect_after_action(
3076
+						false,
3077
+						'',
3078
+						'',
3079
+						$query_args,
3080
+						true
3081
+					);
3082
+					return;
3083
+				}
3084
+				// maybe update status, and make sure to save transaction if not done already
3085
+				if (! $transaction->update_status_based_on_total_paid()) {
3086
+					$transaction->save();
3087
+				}
3088
+				EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
3089
+				$query_args = [
3090
+					'action'        => 'redirect_to_txn',
3091
+					'TXN_ID'        => $transaction->ID(),
3092
+					'EVT_ID'        => $this->_reg_event->ID(),
3093
+					'event_name'    => urlencode($this->_reg_event->name()),
3094
+					'redirect_from' => 'new_registration',
3095
+				];
3096
+				$this->_redirect_after_action(false, '', '', $query_args, true);
3097
+				break;
3098
+		}
3099
+		// what are you looking here for?  Should be nothing to do at this point.
3100
+	}
3101
+
3102
+
3103
+	/**
3104
+	 * redirect_to_txn
3105
+	 *
3106
+	 * @return void
3107
+	 * @throws EE_Error
3108
+	 * @throws InvalidArgumentException
3109
+	 * @throws InvalidDataTypeException
3110
+	 * @throws InvalidInterfaceException
3111
+	 * @throws ReflectionException
3112
+	 */
3113
+	public function redirect_to_txn()
3114
+	{
3115
+		EE_System::do_not_cache();
3116
+		EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
3117
+		$query_args = [
3118
+			'action' => 'view_transaction',
3119
+			'TXN_ID' => $this->request->getRequestParam('TXN_ID', 0, 'int'),
3120
+			'page'   => 'espresso_transactions',
3121
+		];
3122
+		if ($this->request->requestParamIsSet('EVT_ID') && $this->request->requestParamIsSet('redirect_from')) {
3123
+			$query_args['EVT_ID']        = $this->request->getRequestParam('EVT_ID', 0, 'int');
3124
+			$query_args['event_name']    = urlencode($this->request->getRequestParam('event_name'));
3125
+			$query_args['redirect_from'] = $this->request->getRequestParam('redirect_from');
3126
+		}
3127
+		EE_Error::add_success(
3128
+			esc_html__(
3129
+				'Registration Created.  Please review the transaction and add any payments as necessary',
3130
+				'event_espresso'
3131
+			)
3132
+		);
3133
+		$this->_redirect_after_action(false, '', '', $query_args, true);
3134
+	}
3135
+
3136
+
3137
+	/**
3138
+	 * generates HTML for the Attendee Contact List
3139
+	 *
3140
+	 * @return void
3141
+	 * @throws DomainException
3142
+	 * @throws EE_Error
3143
+	 */
3144
+	protected function _attendee_contact_list_table()
3145
+	{
3146
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3147
+		$this->_search_btn_label = esc_html__('Contacts', 'event_espresso');
3148
+		$this->display_admin_list_table_page_with_no_sidebar();
3149
+	}
3150
+
3151
+
3152
+	/**
3153
+	 * get_attendees
3154
+	 *
3155
+	 * @param      $per_page
3156
+	 * @param bool $count whether to return count or data.
3157
+	 * @param bool $trash
3158
+	 * @return array|int
3159
+	 * @throws EE_Error
3160
+	 * @throws InvalidArgumentException
3161
+	 * @throws InvalidDataTypeException
3162
+	 * @throws InvalidInterfaceException
3163
+	 * @throws ReflectionException
3164
+	 */
3165
+	public function get_attendees($per_page, $count = false, $trash = false)
3166
+	{
3167
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3168
+		require_once(REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php');
3169
+		$orderby = $this->request->getRequestParam('orderby');
3170
+		switch ($orderby) {
3171
+			case 'ATT_ID':
3172
+			case 'ATT_fname':
3173
+			case 'ATT_email':
3174
+			case 'ATT_city':
3175
+			case 'STA_ID':
3176
+			case 'CNT_ID':
3177
+				break;
3178
+			case 'Registration_Count':
3179
+				$orderby = 'Registration_Count';
3180
+				break;
3181
+			default:
3182
+				$orderby = 'ATT_lname';
3183
+		}
3184
+		$sort         = $this->request->getRequestParam('order', 'ASC');
3185
+		$current_page = $this->request->getRequestParam('paged', 1, 'int');
3186
+		$per_page     = absint($per_page) ? $per_page : 10;
3187
+		$per_page     = $this->request->getRequestParam('perpage', $per_page, 'int');
3188
+		$_where       = [];
3189
+		$search_term  = $this->request->getRequestParam('s');
3190
+		if ($search_term) {
3191
+			$search_term  = '%' . $search_term . '%';
3192
+			$_where['OR'] = [
3193
+				'Registration.Event.EVT_name'       => ['LIKE', $search_term],
3194
+				'Registration.Event.EVT_desc'       => ['LIKE', $search_term],
3195
+				'Registration.Event.EVT_short_desc' => ['LIKE', $search_term],
3196
+				'ATT_fname'                         => ['LIKE', $search_term],
3197
+				'ATT_lname'                         => ['LIKE', $search_term],
3198
+				'ATT_short_bio'                     => ['LIKE', $search_term],
3199
+				'ATT_email'                         => ['LIKE', $search_term],
3200
+				'ATT_address'                       => ['LIKE', $search_term],
3201
+				'ATT_address2'                      => ['LIKE', $search_term],
3202
+				'ATT_city'                          => ['LIKE', $search_term],
3203
+				'Country.CNT_name'                  => ['LIKE', $search_term],
3204
+				'State.STA_name'                    => ['LIKE', $search_term],
3205
+				'ATT_phone'                         => ['LIKE', $search_term],
3206
+				'Registration.REG_final_price'      => ['LIKE', $search_term],
3207
+				'Registration.REG_code'             => ['LIKE', $search_term],
3208
+				'Registration.REG_group_size'       => ['LIKE', $search_term],
3209
+			];
3210
+		}
3211
+		$offset     = ($current_page - 1) * $per_page;
3212
+		$limit      = $count ? null : [$offset, $per_page];
3213
+		$query_args = [
3214
+			$_where,
3215
+			'extra_selects' => ['Registration_Count' => ['Registration.REG_ID', 'count', '%d']],
3216
+			'limit'         => $limit,
3217
+		];
3218
+		if (! $count) {
3219
+			$query_args['order_by'] = [$orderby => $sort];
3220
+		}
3221
+		$query_args[0]['status'] = $trash ? ['!=', 'publish'] : ['IN', ['publish']];
3222
+		return $count
3223
+			? $this->getAttendeeModel()->count($query_args, 'ATT_ID', true)
3224
+			: $this->getAttendeeModel()->get_all($query_args);
3225
+	}
3226
+
3227
+
3228
+	/**
3229
+	 * This is just taking care of resending the registration confirmation
3230
+	 *
3231
+	 * @return void
3232
+	 * @throws EE_Error
3233
+	 * @throws InvalidArgumentException
3234
+	 * @throws InvalidDataTypeException
3235
+	 * @throws InvalidInterfaceException
3236
+	 * @throws ReflectionException
3237
+	 */
3238
+	protected function _resend_registration()
3239
+	{
3240
+		$this->_process_resend_registration();
3241
+		$REG_ID      = $this->request->getRequestParam('_REG_ID', 0, 'int');
3242
+		$redirect_to = $this->request->getRequestParam('redirect_to');
3243
+		$query_args  = $redirect_to
3244
+			? ['action' => $redirect_to, '_REG_ID' => $REG_ID]
3245
+			: ['action' => 'default'];
3246
+		$this->_redirect_after_action(false, '', '', $query_args, true);
3247
+	}
3248
+
3249
+
3250
+	/**
3251
+	 * Creates a registration report, but accepts the name of a method to use for preparing the query parameters
3252
+	 * to use when selecting registrations
3253
+	 *
3254
+	 * @param string $method_name_for_getting_query_params the name of the method (on this class) to use for preparing
3255
+	 *                                                     the query parameters from the request
3256
+	 * @return void ends the request with a redirect or download
3257
+	 */
3258
+	public function _registrations_report_base($method_name_for_getting_query_params)
3259
+	{
3260
+		$EVT_ID = $this->request->requestParamIsSet('EVT_ID')
3261
+			? $this->request->getRequestParam('EVT_ID', 0, DataType::INT)
3262
+			: null;
3263
+		if (! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
3264
+			$return_url    = $this->request->getRequestParam('return_url', '', DataType::URL);
3265
+			$filters       = $this->request->getRequestParam('filters', [], DataType::STRING, true);
3266
+			$report_params = $this->$method_name_for_getting_query_params($filters);
3267
+			$use_filters   = $this->request->getRequestParam('use_filters', false, DataType::BOOL);
3268
+			wp_redirect(
3269
+				EE_Admin_Page::add_query_args_and_nonce(
3270
+					[
3271
+						'page'        => EED_Batch::PAGE_SLUG,
3272
+						'batch'       => EED_Batch::batch_file_job,
3273
+						'EVT_ID'      => $EVT_ID,
3274
+						'filters'     => urlencode(serialize($report_params)),
3275
+						'use_filters' => urlencode($use_filters),
3276
+						'job_handler' => urlencode('EventEspresso\core\libraries\batch\JobHandlers\RegistrationsReport'),
3277
+						'return_url'  => urlencode($return_url),
3278
+					]
3279
+				)
3280
+			);
3281
+		} else {
3282
+			// Pull the current request params
3283
+			$request_args = $this->request->requestParams();
3284
+			// Set the required request_args to be passed to the export
3285
+			$required_request_args = [
3286
+				'export' => 'report',
3287
+				'action' => 'registrations_report_for_event',
3288
+				'EVT_ID' => $EVT_ID,
3289
+			];
3290
+			// Merge required request args, overriding any currently set
3291
+			$request_args = array_merge($request_args, $required_request_args);
3292
+			if (is_readable(EE_CLASSES . 'EE_Export.class.php')) {
3293
+				require_once(EE_CLASSES . 'EE_Export.class.php');
3294
+				$EE_Export = EE_Export::instance($request_args);
3295
+				$EE_Export->export();
3296
+			}
3297
+		}
3298
+	}
3299
+
3300
+
3301
+	/**
3302
+	 * Creates a registration report using only query parameters in the request
3303
+	 *
3304
+	 * @return void
3305
+	 */
3306
+	public function _registrations_report()
3307
+	{
3308
+		$this->_registrations_report_base('_get_registration_query_parameters');
3309
+	}
3310
+
3311
+
3312
+	public function _contact_list_export()
3313
+	{
3314
+		if (is_readable(EE_CLASSES . 'EE_Export.class.php')) {
3315
+			require_once(EE_CLASSES . 'EE_Export.class.php');
3316
+			$EE_Export = EE_Export::instance($this->request->requestParams());
3317
+			$EE_Export->export_attendees();
3318
+		}
3319
+	}
3320
+
3321
+
3322
+	public function _contact_list_report()
3323
+	{
3324
+		if (! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
3325
+			wp_redirect(
3326
+				EE_Admin_Page::add_query_args_and_nonce(
3327
+					[
3328
+						'page'        => EED_Batch::PAGE_SLUG,
3329
+						'batch'       => EED_Batch::batch_file_job,
3330
+						'job_handler' => urlencode('EventEspresso\core\libraries\batch\JobHandlers\AttendeesReport'),
3331
+						'return_url'  => urlencode($this->request->getRequestParam('return_url', '', DataType::URL)),
3332
+					]
3333
+				)
3334
+			);
3335
+		} else {
3336
+			if (is_readable(EE_CLASSES . 'EE_Export.class.php')) {
3337
+				require_once(EE_CLASSES . 'EE_Export.class.php');
3338
+				$EE_Export = EE_Export::instance($this->request->requestParams());
3339
+				$EE_Export->report_attendees();
3340
+			}
3341
+		}
3342
+	}
3343
+
3344
+
3345
+
3346
+
3347
+
3348
+	/***************************************        ATTENDEE DETAILS        ***************************************/
3349
+	/**
3350
+	 * This duplicates the attendee object for the given incoming registration id and attendee_id.
3351
+	 *
3352
+	 * @return void
3353
+	 * @throws EE_Error
3354
+	 * @throws InvalidArgumentException
3355
+	 * @throws InvalidDataTypeException
3356
+	 * @throws InvalidInterfaceException
3357
+	 * @throws ReflectionException
3358
+	 */
3359
+	protected function _duplicate_attendee()
3360
+	{
3361
+		$REG_ID = $this->request->getRequestParam('_REG_ID', 0, 'int');
3362
+		$action = $this->request->getRequestParam('return', 'default');
3363
+		// verify we have necessary info
3364
+		if (! $REG_ID) {
3365
+			EE_Error::add_error(
3366
+				esc_html__(
3367
+					'Unable to create the contact for the registration because the required parameters are not present (_REG_ID )',
3368
+					'event_espresso'
3369
+				),
3370
+				__FILE__,
3371
+				__LINE__,
3372
+				__FUNCTION__
3373
+			);
3374
+			$query_args = ['action' => $action];
3375
+			$this->_redirect_after_action('', '', '', $query_args, true);
3376
+		}
3377
+		// okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration.
3378
+		$registration = $this->getRegistrationModel()->get_one_by_ID($REG_ID);
3379
+		if (! $registration instanceof EE_Registration) {
3380
+			throw new RuntimeException(
3381
+				sprintf(
3382
+					esc_html__(
3383
+						'Unable to create the contact because a valid registration could not be retrieved for REG ID: %1$d',
3384
+						'event_espresso'
3385
+					),
3386
+					$REG_ID
3387
+				)
3388
+			);
3389
+		}
3390
+		$attendee = $registration->attendee();
3391
+		// remove relation of existing attendee on registration
3392
+		$registration->_remove_relation_to($attendee, 'Attendee');
3393
+		// new attendee
3394
+		$new_attendee = clone $attendee;
3395
+		$new_attendee->set('ATT_ID', 0);
3396
+		$new_attendee->save();
3397
+		// add new attendee to reg
3398
+		$registration->_add_relation_to($new_attendee, 'Attendee');
3399
+		EE_Error::add_success(
3400
+			esc_html__(
3401
+				'New Contact record created.  Now make any edits you wish to make for this contact.',
3402
+				'event_espresso'
3403
+			)
3404
+		);
3405
+		// redirect to edit page for attendee
3406
+		$query_args = ['post' => $new_attendee->ID(), 'action' => 'edit_attendee'];
3407
+		$this->_redirect_after_action('', '', '', $query_args, true);
3408
+	}
3409
+
3410
+
3411
+	/**
3412
+	 * Callback invoked by parent EE_Admin_CPT class hooked in on `save_post` wp hook.
3413
+	 *
3414
+	 * @param int     $post_id
3415
+	 * @param WP_Post $post
3416
+	 * @throws DomainException
3417
+	 * @throws EE_Error
3418
+	 * @throws InvalidArgumentException
3419
+	 * @throws InvalidDataTypeException
3420
+	 * @throws InvalidInterfaceException
3421
+	 * @throws LogicException
3422
+	 * @throws InvalidFormSubmissionException
3423
+	 * @throws ReflectionException
3424
+	 */
3425
+	protected function _insert_update_cpt_item($post_id, $post)
3426
+	{
3427
+		$success  = true;
3428
+		$attendee = $post instanceof WP_Post && $post->post_type === 'espresso_attendees'
3429
+			? $this->getAttendeeModel()->get_one_by_ID($post_id)
3430
+			: null;
3431
+		// for attendee updates
3432
+		if ($attendee instanceof EE_Attendee) {
3433
+			// note we should only be UPDATING attendees at this point.
3434
+			$fname          = $this->request->getRequestParam('ATT_fname', '');
3435
+			$lname          = $this->request->getRequestParam('ATT_lname', '');
3436
+			$updated_fields = [
3437
+				'ATT_fname'     => $fname,
3438
+				'ATT_lname'     => $lname,
3439
+				'ATT_full_name' => "{$fname} {$lname}",
3440
+				'ATT_address'   => $this->request->getRequestParam('ATT_address', ''),
3441
+				'ATT_address2'  => $this->request->getRequestParam('ATT_address2', ''),
3442
+				'ATT_city'      => $this->request->getRequestParam('ATT_city', ''),
3443
+				'STA_ID'        => $this->request->getRequestParam('STA_ID', ''),
3444
+				'CNT_ISO'       => $this->request->getRequestParam('CNT_ISO', ''),
3445
+				'ATT_zip'       => $this->request->getRequestParam('ATT_zip', ''),
3446
+			];
3447
+			foreach ($updated_fields as $field => $value) {
3448
+				$attendee->set($field, $value);
3449
+			}
3450
+
3451
+			// process contact details metabox form handler (which will also save the attendee)
3452
+			$contact_details_form = $this->getAttendeeContactDetailsMetaboxFormHandler($attendee);
3453
+			$success              = $contact_details_form->process($this->request->requestParams());
3454
+
3455
+			$attendee_update_callbacks = apply_filters(
3456
+				'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update',
3457
+				[]
3458
+			);
3459
+			foreach ($attendee_update_callbacks as $a_callback) {
3460
+				if (false === call_user_func_array($a_callback, [$attendee, $this->request->requestParams()])) {
3461
+					throw new EE_Error(
3462
+						sprintf(
3463
+							esc_html__(
3464
+								'The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback.  Please check the spelling.',
3465
+								'event_espresso'
3466
+							),
3467
+							$a_callback
3468
+						)
3469
+					);
3470
+				}
3471
+			}
3472
+		}
3473
+
3474
+		if ($success === false) {
3475
+			EE_Error::add_error(
3476
+				esc_html__(
3477
+					'Something went wrong with updating the meta table data for the registration.',
3478
+					'event_espresso'
3479
+				),
3480
+				__FILE__,
3481
+				__FUNCTION__,
3482
+				__LINE__
3483
+			);
3484
+		}
3485
+	}
3486
+
3487
+
3488
+	public function trash_cpt_item($post_id)
3489
+	{
3490
+	}
3491
+
3492
+
3493
+	public function delete_cpt_item($post_id)
3494
+	{
3495
+	}
3496
+
3497
+
3498
+	public function restore_cpt_item($post_id)
3499
+	{
3500
+	}
3501
+
3502
+
3503
+	protected function _restore_cpt_item($post_id, $revision_id)
3504
+	{
3505
+	}
3506
+
3507
+
3508
+	/**
3509
+	 * @throws EE_Error
3510
+	 * @throws ReflectionException
3511
+	 * @since 4.10.2.p
3512
+	 */
3513
+	public function attendee_editor_metaboxes()
3514
+	{
3515
+		$this->verify_cpt_object();
3516
+		remove_meta_box(
3517
+			'postexcerpt',
3518
+			$this->_cpt_routes[ $this->_req_action ],
3519
+			'normal'
3520
+		);
3521
+		remove_meta_box('commentstatusdiv', $this->_cpt_routes[ $this->_req_action ], 'normal');
3522
+		if (post_type_supports('espresso_attendees', 'excerpt')) {
3523
+			$this->addMetaBox(
3524
+				'postexcerpt',
3525
+				esc_html__('Short Biography', 'event_espresso'),
3526
+				'post_excerpt_meta_box',
3527
+				$this->_cpt_routes[ $this->_req_action ]
3528
+			);
3529
+		}
3530
+		if (post_type_supports('espresso_attendees', 'comments')) {
3531
+			$this->addMetaBox(
3532
+				'commentsdiv',
3533
+				esc_html__('Notes on the Contact', 'event_espresso'),
3534
+				'post_comment_meta_box',
3535
+				$this->_cpt_routes[ $this->_req_action ],
3536
+				'normal',
3537
+				'core'
3538
+			);
3539
+		}
3540
+		$this->addMetaBox(
3541
+			'attendee_contact_info',
3542
+			esc_html__('Contact Info', 'event_espresso'),
3543
+			[$this, 'attendee_contact_info'],
3544
+			$this->_cpt_routes[ $this->_req_action ],
3545
+			'side',
3546
+			'core'
3547
+		);
3548
+		$this->addMetaBox(
3549
+			'attendee_details_address',
3550
+			esc_html__('Address Details', 'event_espresso'),
3551
+			[$this, 'attendee_address_details'],
3552
+			$this->_cpt_routes[ $this->_req_action ],
3553
+			'normal',
3554
+			'core'
3555
+		);
3556
+		$this->addMetaBox(
3557
+			'attendee_registrations',
3558
+			esc_html__('Registrations for this Contact', 'event_espresso'),
3559
+			[$this, 'attendee_registrations_meta_box'],
3560
+			$this->_cpt_routes[ $this->_req_action ]
3561
+		);
3562
+	}
3563
+
3564
+
3565
+	/**
3566
+	 * Metabox for attendee contact info
3567
+	 *
3568
+	 * @param WP_Post $post wp post object
3569
+	 * @return void attendee contact info ( and form )
3570
+	 * @throws EE_Error
3571
+	 * @throws InvalidArgumentException
3572
+	 * @throws InvalidDataTypeException
3573
+	 * @throws InvalidInterfaceException
3574
+	 * @throws LogicException
3575
+	 * @throws DomainException
3576
+	 */
3577
+	public function attendee_contact_info($post)
3578
+	{
3579
+		// get attendee object ( should already have it )
3580
+		$form = $this->getAttendeeContactDetailsMetaboxFormHandler($this->_cpt_model_obj);
3581
+		$form->enqueueStylesAndScripts();
3582
+		echo wp_kses($form->display(), AllowedTags::getWithFormTags());
3583
+	}
3584
+
3585
+
3586
+	/**
3587
+	 * Return form handler for the contact details metabox
3588
+	 *
3589
+	 * @param EE_Attendee $attendee
3590
+	 * @return AttendeeContactDetailsMetaboxFormHandler
3591
+	 * @throws DomainException
3592
+	 * @throws InvalidArgumentException
3593
+	 * @throws InvalidDataTypeException
3594
+	 * @throws InvalidInterfaceException
3595
+	 */
3596
+	protected function getAttendeeContactDetailsMetaboxFormHandler(EE_Attendee $attendee)
3597
+	{
3598
+		return new AttendeeContactDetailsMetaboxFormHandler($attendee, EE_Registry::instance());
3599
+	}
3600
+
3601
+
3602
+	/**
3603
+	 * Metabox for attendee details
3604
+	 *
3605
+	 * @param WP_Post $post wp post object
3606
+	 * @throws EE_Error
3607
+	 * @throws ReflectionException
3608
+	 */
3609
+	public function attendee_address_details($post)
3610
+	{
3611
+		// get attendee object (should already have it)
3612
+		$this->_template_args['attendee']     = $this->_cpt_model_obj;
3613
+		$this->_template_args['state_html']   = EEH_Form_Fields::generate_form_input(
3614
+			new EE_Question_Form_Input(
3615
+				EE_Question::new_instance(
3616
+					[
3617
+						'QST_ID'           => 0,
3618
+						'QST_display_text' => esc_html__('State/Province', 'event_espresso'),
3619
+						'QST_system'       => 'admin-state',
3620
+					]
3621
+				),
3622
+				EE_Answer::new_instance(
3623
+					[
3624
+						'ANS_ID'    => 0,
3625
+						'ANS_value' => $this->_cpt_model_obj->state_ID(),
3626
+					]
3627
+				),
3628
+				[
3629
+					'input_id'       => 'STA_ID',
3630
+					'input_name'     => 'STA_ID',
3631
+					'input_prefix'   => '',
3632
+					'append_qstn_id' => false,
3633
+				]
3634
+			)
3635
+		);
3636
+		$this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input(
3637
+			new EE_Question_Form_Input(
3638
+				EE_Question::new_instance(
3639
+					[
3640
+						'QST_ID'           => 0,
3641
+						'QST_display_text' => esc_html__('Country', 'event_espresso'),
3642
+						'QST_system'       => 'admin-country',
3643
+					]
3644
+				),
3645
+				EE_Answer::new_instance(
3646
+					[
3647
+						'ANS_ID'    => 0,
3648
+						'ANS_value' => $this->_cpt_model_obj->country_ID(),
3649
+					]
3650
+				),
3651
+				[
3652
+					'input_id'       => 'CNT_ISO',
3653
+					'input_name'     => 'CNT_ISO',
3654
+					'input_prefix'   => '',
3655
+					'append_qstn_id' => false,
3656
+				]
3657
+			)
3658
+		);
3659
+		$template                             =
3660
+			REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php';
3661
+		EEH_Template::display_template($template, $this->_template_args);
3662
+	}
3663
+
3664
+
3665
+	/**
3666
+	 * _attendee_details
3667
+	 *
3668
+	 * @param $post
3669
+	 * @return void
3670
+	 * @throws DomainException
3671
+	 * @throws EE_Error
3672
+	 * @throws InvalidArgumentException
3673
+	 * @throws InvalidDataTypeException
3674
+	 * @throws InvalidInterfaceException
3675
+	 * @throws ReflectionException
3676
+	 */
3677
+	public function attendee_registrations_meta_box($post)
3678
+	{
3679
+		$this->_template_args['attendee']      = $this->_cpt_model_obj;
3680
+		$this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration');
3681
+		$template                              =
3682
+			REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php';
3683
+		EEH_Template::display_template($template, $this->_template_args);
3684
+	}
3685
+
3686
+
3687
+	/**
3688
+	 * add in the form fields for the attendee edit
3689
+	 *
3690
+	 * @param WP_Post $post wp post object
3691
+	 * @return void echos html for new form.
3692
+	 * @throws DomainException
3693
+	 */
3694
+	public function after_title_form_fields($post)
3695
+	{
3696
+		if ($post->post_type === 'espresso_attendees') {
3697
+			$template                  = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php';
3698
+			$template_args['attendee'] = $this->_cpt_model_obj;
3699
+			EEH_Template::display_template($template, $template_args);
3700
+		}
3701
+	}
3702
+
3703
+
3704
+	/**
3705
+	 * _trash_or_restore_attendee
3706
+	 *
3707
+	 * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE)
3708
+	 * @return void
3709
+	 * @throws EE_Error
3710
+	 * @throws InvalidArgumentException
3711
+	 * @throws InvalidDataTypeException
3712
+	 * @throws InvalidInterfaceException
3713
+	 * @throws ReflectionException
3714
+	 */
3715
+	protected function _trash_or_restore_attendees($trash = true)
3716
+	{
3717
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3718
+		$status = $trash ? 'trash' : 'publish';
3719
+		// Checkboxes
3720
+		if ($this->request->requestParamIsSet('checkbox')) {
3721
+			$ATT_IDs = $this->request->getRequestParam('checkbox', [], 'int', true);
3722
+			// if array has more than one element than success message should be plural
3723
+			$success = count($ATT_IDs) > 1 ? 2 : 1;
3724
+			// cycle thru checkboxes
3725
+			foreach ($ATT_IDs as $ATT_ID) {
3726
+				$updated = $this->getAttendeeModel()->update_by_ID(['status' => $status], $ATT_ID);
3727
+				if (! $updated) {
3728
+					$success = 0;
3729
+				}
3730
+			}
3731
+		} else {
3732
+			// grab single id and delete
3733
+			$ATT_ID = $this->request->getRequestParam('ATT_ID', 0, 'int');
3734
+			// update attendee
3735
+			$success = $this->getAttendeeModel()->update_by_ID(['status' => $status], $ATT_ID) ? 1 : 0;
3736
+		}
3737
+		$what        = $success > 1
3738
+			? esc_html__('Contacts', 'event_espresso')
3739
+			: esc_html__('Contact', 'event_espresso');
3740
+		$action_desc = $trash
3741
+			? esc_html__('moved to the trash', 'event_espresso')
3742
+			: esc_html__('restored', 'event_espresso');
3743
+		$this->_redirect_after_action($success, $what, $action_desc, ['action' => 'contact_list']);
3744
+	}
3745 3745
 }
Please login to merge, or discard this patch.
Spacing   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      */
95 95
     protected function getRegistrationModel()
96 96
     {
97
-        if (! $this->registration_model instanceof EEM_Registration) {
97
+        if ( ! $this->registration_model instanceof EEM_Registration) {
98 98
             $this->registration_model = $this->loader->getShared('EEM_Registration');
99 99
         }
100 100
         return $this->registration_model;
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      */
111 111
     protected function getAttendeeModel()
112 112
     {
113
-        if (! $this->attendee_model instanceof EEM_Attendee) {
113
+        if ( ! $this->attendee_model instanceof EEM_Attendee) {
114 114
             $this->attendee_model = $this->loader->getShared('EEM_Attendee');
115 115
         }
116 116
         return $this->attendee_model;
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      */
127 127
     protected function getEventModel()
128 128
     {
129
-        if (! $this->event_model instanceof EEM_Event) {
129
+        if ( ! $this->event_model instanceof EEM_Event) {
130 130
             $this->event_model = $this->loader->getShared('EEM_Event');
131 131
         }
132 132
         return $this->event_model;
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      */
143 143
     protected function getStatusModel()
144 144
     {
145
-        if (! $this->status_model instanceof EEM_Status) {
145
+        if ( ! $this->status_model instanceof EEM_Status) {
146 146
             $this->status_model = $this->loader->getShared('EEM_Status');
147 147
         }
148 148
         return $this->status_model;
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
         // style
763 763
         wp_register_style(
764 764
             'espresso_reg',
765
-            REG_ASSETS_URL . 'espresso_registrations_admin.css',
765
+            REG_ASSETS_URL.'espresso_registrations_admin.css',
766 766
             ['ee-admin-css'],
767 767
             EVENT_ESPRESSO_VERSION
768 768
         );
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
         // script
771 771
         wp_register_script(
772 772
             'espresso_reg',
773
-            REG_ASSETS_URL . 'espresso_registrations_admin.js',
773
+            REG_ASSETS_URL.'espresso_registrations_admin.js',
774 774
             ['jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'],
775 775
             EVENT_ESPRESSO_VERSION,
776 776
             true
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
             'att_publish_text' => sprintf(
795 795
             /* translators: The date and time */
796 796
                 wp_strip_all_tags(__('Created on: %s', 'event_espresso')),
797
-                '<b>' . $this->_cpt_model_obj->get_datetime('ATT_created') . '</b>'
797
+                '<b>'.$this->_cpt_model_obj->get_datetime('ATT_created').'</b>'
798 798
             ),
799 799
         ];
800 800
         wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations);
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
         wp_dequeue_style('espresso_reg');
827 827
         wp_register_style(
828 828
             'espresso_att',
829
-            REG_ASSETS_URL . 'espresso_attendees_admin.css',
829
+            REG_ASSETS_URL.'espresso_attendees_admin.css',
830 830
             ['ee-admin-css'],
831 831
             EVENT_ESPRESSO_VERSION
832 832
         );
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
     {
839 839
         wp_register_script(
840 840
             'ee-spco-for-admin',
841
-            REG_ASSETS_URL . 'spco_for_admin.js',
841
+            REG_ASSETS_URL.'spco_for_admin.js',
842 842
             ['underscore', 'jquery'],
843 843
             EVENT_ESPRESSO_VERSION,
844 844
             true
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
             'no_approve_registrations' => 'not_approved_registration',
887 887
             'cancel_registrations'     => 'cancelled_registration',
888 888
         ];
889
-        $can_send    = $this->capabilities->current_user_can(
889
+        $can_send = $this->capabilities->current_user_can(
890 890
             'ee_send_message',
891 891
             'batch_send_messages'
892 892
         );
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
                     'trash_registrations' => esc_html__('Trash Registrations', 'event_espresso'),
1007 1007
                 ],
1008 1008
             ];
1009
-            $this->_views['trash']      = [
1009
+            $this->_views['trash'] = [
1010 1010
                 'slug'        => 'trash',
1011 1011
                 'label'       => esc_html__('Trash', 'event_espresso'),
1012 1012
                 'count'       => 0,
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
         }
1107 1107
         $sc_items = [
1108 1108
             'approved_status'   => [
1109
-                'class' => 'ee-status-legend ee-status-bg--' . EEM_Registration::status_id_approved,
1109
+                'class' => 'ee-status-legend ee-status-bg--'.EEM_Registration::status_id_approved,
1110 1110
                 'desc'  => EEH_Template::pretty_status(
1111 1111
                     EEM_Registration::status_id_approved,
1112 1112
                     false,
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
                 ),
1115 1115
             ],
1116 1116
             'pending_status'    => [
1117
-                'class' => 'ee-status-legend ee-status-bg--' . EEM_Registration::status_id_pending_payment,
1117
+                'class' => 'ee-status-legend ee-status-bg--'.EEM_Registration::status_id_pending_payment,
1118 1118
                 'desc'  => EEH_Template::pretty_status(
1119 1119
                     EEM_Registration::status_id_pending_payment,
1120 1120
                     false,
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
                 ),
1123 1123
             ],
1124 1124
             'wait_list'         => [
1125
-                'class' => 'ee-status-legend ee-status-bg--' . EEM_Registration::status_id_wait_list,
1125
+                'class' => 'ee-status-legend ee-status-bg--'.EEM_Registration::status_id_wait_list,
1126 1126
                 'desc'  => EEH_Template::pretty_status(
1127 1127
                     EEM_Registration::status_id_wait_list,
1128 1128
                     false,
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
                 ),
1131 1131
             ],
1132 1132
             'incomplete_status' => [
1133
-                'class' => 'ee-status-legend ee-status-bg--' . EEM_Registration::status_id_incomplete,
1133
+                'class' => 'ee-status-legend ee-status-bg--'.EEM_Registration::status_id_incomplete,
1134 1134
                 'desc'  => EEH_Template::pretty_status(
1135 1135
                     EEM_Registration::status_id_incomplete,
1136 1136
                     false,
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
                 ),
1139 1139
             ],
1140 1140
             'not_approved'      => [
1141
-                'class' => 'ee-status-legend ee-status-bg--' . EEM_Registration::status_id_not_approved,
1141
+                'class' => 'ee-status-legend ee-status-bg--'.EEM_Registration::status_id_not_approved,
1142 1142
                 'desc'  => EEH_Template::pretty_status(
1143 1143
                     EEM_Registration::status_id_not_approved,
1144 1144
                     false,
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
                 ),
1147 1147
             ],
1148 1148
             'declined_status'   => [
1149
-                'class' => 'ee-status-legend ee-status-bg--' . EEM_Registration::status_id_declined,
1149
+                'class' => 'ee-status-legend ee-status-bg--'.EEM_Registration::status_id_declined,
1150 1150
                 'desc'  => EEH_Template::pretty_status(
1151 1151
                     EEM_Registration::status_id_declined,
1152 1152
                     false,
@@ -1154,7 +1154,7 @@  discard block
 block discarded – undo
1154 1154
                 ),
1155 1155
             ],
1156 1156
             'cancelled_status'  => [
1157
-                'class' => 'ee-status-legend ee-status-bg--' . EEM_Registration::status_id_cancelled,
1157
+                'class' => 'ee-status-legend ee-status-bg--'.EEM_Registration::status_id_cancelled,
1158 1158
                 'desc'  => EEH_Template::pretty_status(
1159 1159
                     EEM_Registration::status_id_cancelled,
1160 1160
                     false,
@@ -1214,7 +1214,7 @@  discard block
 block discarded – undo
1214 1214
                 $EVT_ID
1215 1215
             )
1216 1216
         ) {
1217
-            $this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
1217
+            $this->_admin_page_title .= ' '.$this->get_action_link_or_button(
1218 1218
                     'new_registration',
1219 1219
                     'add-registrant',
1220 1220
                     ['event_id' => $EVT_ID],
@@ -1376,7 +1376,7 @@  discard block
 block discarded – undo
1376 1376
                 ],
1377 1377
                 REG_ADMIN_URL
1378 1378
             );
1379
-            $this->_template_args['filtered_transactions_link']  = EE_Admin_Page::add_query_args_and_nonce(
1379
+            $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce(
1380 1380
                 [
1381 1381
                     'action' => 'default',
1382 1382
                     'EVT_ID' => $event_id,
@@ -1384,7 +1384,7 @@  discard block
 block discarded – undo
1384 1384
                 ],
1385 1385
                 admin_url('admin.php')
1386 1386
             );
1387
-            $this->_template_args['event_link']                  = EE_Admin_Page::add_query_args_and_nonce(
1387
+            $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(
1388 1388
                 [
1389 1389
                     'page'   => 'espresso_events',
1390 1390
                     'action' => 'edit',
@@ -1393,12 +1393,12 @@  discard block
 block discarded – undo
1393 1393
                 admin_url('admin.php')
1394 1394
             );
1395 1395
             // next and previous links
1396
-            $next_reg                                      = $this->_registration->next(
1396
+            $next_reg = $this->_registration->next(
1397 1397
                 null,
1398 1398
                 [],
1399 1399
                 'REG_ID'
1400 1400
             );
1401
-            $this->_template_args['next_registration']     = $next_reg
1401
+            $this->_template_args['next_registration'] = $next_reg
1402 1402
                 ? $this->_next_link(
1403 1403
                     EE_Admin_Page::add_query_args_and_nonce(
1404 1404
                         [
@@ -1410,7 +1410,7 @@  discard block
 block discarded – undo
1410 1410
                     'dashicons dashicons-arrow-right ee-icon-size-22'
1411 1411
                 )
1412 1412
                 : '';
1413
-            $previous_reg                                  = $this->_registration->previous(
1413
+            $previous_reg = $this->_registration->previous(
1414 1414
                 null,
1415 1415
                 [],
1416 1416
                 'REG_ID'
@@ -1428,7 +1428,7 @@  discard block
 block discarded – undo
1428 1428
                 )
1429 1429
                 : '';
1430 1430
             // grab header
1431
-            $template_path                             = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php';
1431
+            $template_path                             = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php';
1432 1432
             $this->_template_args['REG_ID']            = $this->_registration->ID();
1433 1433
             $this->_template_args['admin_page_header'] = EEH_Template::display_template(
1434 1434
                 $template_path,
@@ -1465,7 +1465,7 @@  discard block
 block discarded – undo
1465 1465
         );
1466 1466
         $this->addMetaBox(
1467 1467
             'edit-reg-details-mbox',
1468
-            '<span>' . esc_html__('Registration Details', 'event_espresso')
1468
+            '<span>'.esc_html__('Registration Details', 'event_espresso')
1469 1469
             . '&nbsp;<span class="dashicons dashicons-clipboard"></span></span>',
1470 1470
             [$this, '_reg_details_meta_box'],
1471 1471
             $this->_wp_page_slug
@@ -1569,7 +1569,7 @@  discard block
 block discarded – undo
1569 1569
                 $this->_registration->ID()
1570 1570
             )
1571 1571
         ) {
1572
-            $reg_status_change_form_array['subsections']['reg_status']         = new EE_Select_Input(
1572
+            $reg_status_change_form_array['subsections']['reg_status'] = new EE_Select_Input(
1573 1573
                 $this->_get_reg_statuses(),
1574 1574
                 [
1575 1575
                     'html_label_text' => esc_html__('Change Registration Status to', 'event_espresso'),
@@ -1586,7 +1586,7 @@  discard block
 block discarded – undo
1586 1586
                     ),
1587 1587
                 ]
1588 1588
             );
1589
-            $reg_status_change_form_array['subsections']['submit']             = new EE_Submit_Input(
1589
+            $reg_status_change_form_array['subsections']['submit'] = new EE_Submit_Input(
1590 1590
                 [
1591 1591
                     'html_class'      => 'button--primary',
1592 1592
                     'html_label_text' => '&nbsp;',
@@ -1612,7 +1612,7 @@  discard block
 block discarded – undo
1612 1612
     protected function _get_reg_statuses()
1613 1613
     {
1614 1614
         $reg_status_array = $this->getRegistrationModel()->reg_status_array();
1615
-        unset($reg_status_array[ EEM_Registration::status_id_incomplete ]);
1615
+        unset($reg_status_array[EEM_Registration::status_id_incomplete]);
1616 1616
         // get current reg status
1617 1617
         $current_status = $this->_registration->status_ID();
1618 1618
         // is registration for free event? This will determine whether to display the pending payment option
@@ -1620,7 +1620,7 @@  discard block
 block discarded – undo
1620 1620
             $current_status !== EEM_Registration::status_id_pending_payment
1621 1621
             && EEH_Money::compare_floats($this->_registration->ticket()->price(), 0.00)
1622 1622
         ) {
1623
-            unset($reg_status_array[ EEM_Registration::status_id_pending_payment ]);
1623
+            unset($reg_status_array[EEM_Registration::status_id_pending_payment]);
1624 1624
         }
1625 1625
         return $this->getStatusModel()->localized_status($reg_status_array, false, 'sentence');
1626 1626
     }
@@ -1710,7 +1710,7 @@  discard block
 block discarded – undo
1710 1710
         $success = false;
1711 1711
         // typecast $REG_IDs
1712 1712
         $REG_IDs = (array) $REG_IDs;
1713
-        if (! empty($REG_IDs)) {
1713
+        if ( ! empty($REG_IDs)) {
1714 1714
             $success = true;
1715 1715
             // set default status if none is passed
1716 1716
             $status         = $status ?: EEM_Registration::status_id_pending_payment;
@@ -1870,7 +1870,7 @@  discard block
 block discarded – undo
1870 1870
             $action,
1871 1871
             $notify
1872 1872
         );
1873
-        $method = $action . '_registration';
1873
+        $method = $action.'_registration';
1874 1874
         if (method_exists($this, $method)) {
1875 1875
             $this->$method($notify);
1876 1876
         }
@@ -2020,7 +2020,7 @@  discard block
 block discarded – undo
2020 2020
         $filters        = new EE_Line_Item_Filter_Collection();
2021 2021
         $filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration));
2022 2022
         $filters->add(new EE_Non_Zero_Line_Item_Filter());
2023
-        $line_item_filter_processor              = new EE_Line_Item_Filter_Processor(
2023
+        $line_item_filter_processor = new EE_Line_Item_Filter_Processor(
2024 2024
             $filters,
2025 2025
             $transaction->total_line_item()
2026 2026
         );
@@ -2033,7 +2033,7 @@  discard block
 block discarded – undo
2033 2033
             $filtered_line_item_tree,
2034 2034
             ['EE_Registration' => $this->_registration]
2035 2035
         );
2036
-        $attendee                                = $this->_registration->attendee();
2036
+        $attendee = $this->_registration->attendee();
2037 2037
         if (
2038 2038
             $this->capabilities->current_user_can(
2039 2039
                 'ee_read_transaction',
@@ -2115,7 +2115,7 @@  discard block
 block discarded – undo
2115 2115
                 'Payment method response',
2116 2116
                 'event_espresso'
2117 2117
             );
2118
-            $this->_template_args['reg_details']['response_msg']['class']   = 'regular-text';
2118
+            $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text';
2119 2119
         }
2120 2120
         $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session'];
2121 2121
         $this->_template_args['reg_details']['registration_session']['label'] = esc_html__(
@@ -2146,7 +2146,7 @@  discard block
 block discarded – undo
2146 2146
         $this->_template_args['REG_ID']   = $this->_registration->ID();
2147 2147
         $this->_template_args['event_id'] = $this->_registration->event_ID();
2148 2148
 
2149
-        $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php';
2149
+        $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php';
2150 2150
         EEH_Template::display_template($template_path, $this->_template_args); // already escaped
2151 2151
     }
2152 2152
 
@@ -2186,7 +2186,7 @@  discard block
 block discarded – undo
2186 2186
             $this->_template_args['reg_questions_form_action'] = 'edit_registration';
2187 2187
             $this->_template_args['REG_ID']                    = $this->_registration->ID();
2188 2188
             $template_path                                     =
2189
-                REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
2189
+                REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php';
2190 2190
             EEH_Template::display_template($template_path, $this->_template_args);
2191 2191
         }
2192 2192
     }
@@ -2202,7 +2202,7 @@  discard block
 block discarded – undo
2202 2202
     public function form_before_question_group($output)
2203 2203
     {
2204 2204
         EE_Error::doing_it_wrong(
2205
-            __CLASS__ . '::' . __FUNCTION__,
2205
+            __CLASS__.'::'.__FUNCTION__,
2206 2206
             esc_html__(
2207 2207
                 'This method would have been protected but was used on a filter callback so needed to be public. Please discontinue usage as it will be removed soon.',
2208 2208
                 'event_espresso'
@@ -2226,7 +2226,7 @@  discard block
 block discarded – undo
2226 2226
     public function form_after_question_group($output)
2227 2227
     {
2228 2228
         EE_Error::doing_it_wrong(
2229
-            __CLASS__ . '::' . __FUNCTION__,
2229
+            __CLASS__.'::'.__FUNCTION__,
2230 2230
             esc_html__(
2231 2231
                 'This method would have been protected but was used on a filter callback so needed to be public. Please discontinue usage as it will be removed soon.',
2232 2232
                 'event_espresso'
@@ -2263,7 +2263,7 @@  discard block
 block discarded – undo
2263 2263
     public function form_form_field_label_wrap($label)
2264 2264
     {
2265 2265
         EE_Error::doing_it_wrong(
2266
-            __CLASS__ . '::' . __FUNCTION__,
2266
+            __CLASS__.'::'.__FUNCTION__,
2267 2267
             esc_html__(
2268 2268
                 'This method would have been protected but was used on a filter callback so needed to be public. Please discontinue usage as it will be removed soon.',
2269 2269
                 'event_espresso'
@@ -2273,7 +2273,7 @@  discard block
 block discarded – undo
2273 2273
         return '
2274 2274
 			<tr>
2275 2275
 				<th>
2276
-					' . $label . '
2276
+					' . $label.'
2277 2277
 				</th>';
2278 2278
     }
2279 2279
 
@@ -2288,7 +2288,7 @@  discard block
 block discarded – undo
2288 2288
     public function form_form_field_input__wrap($input)
2289 2289
     {
2290 2290
         EE_Error::doing_it_wrong(
2291
-            __CLASS__ . '::' . __FUNCTION__,
2291
+            __CLASS__.'::'.__FUNCTION__,
2292 2292
             esc_html__(
2293 2293
                 'This method would have been protected but was used on a filter callback so needed to be public. Please discontinue usage as it will be removed soon.',
2294 2294
                 'event_espresso'
@@ -2297,7 +2297,7 @@  discard block
 block discarded – undo
2297 2297
         );
2298 2298
         return '
2299 2299
 				<td class="reg-admin-attendee-questions-input-td disabled-input">
2300
-					' . $input . '
2300
+					' . $input.'
2301 2301
 				</td>
2302 2302
 			</tr>';
2303 2303
     }
@@ -2346,8 +2346,8 @@  discard block
 block discarded – undo
2346 2346
      */
2347 2347
     protected function _get_reg_custom_questions_form($REG_ID)
2348 2348
     {
2349
-        if (! $this->_reg_custom_questions_form) {
2350
-            require_once(REG_ADMIN . 'form_sections/EE_Registration_Custom_Questions_Form.form.php');
2349
+        if ( ! $this->_reg_custom_questions_form) {
2350
+            require_once(REG_ADMIN.'form_sections/EE_Registration_Custom_Questions_Form.form.php');
2351 2351
             $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(
2352 2352
                 $this->getRegistrationModel()->get_one_by_ID($REG_ID)
2353 2353
             );
@@ -2370,7 +2370,7 @@  discard block
 block discarded – undo
2370 2370
      */
2371 2371
     private function _save_reg_custom_questions_form($REG_ID = 0)
2372 2372
     {
2373
-        if (! $REG_ID) {
2373
+        if ( ! $REG_ID) {
2374 2374
             EE_Error::add_error(
2375 2375
                 esc_html__(
2376 2376
                     'An error occurred. No registration ID was received.',
@@ -2387,7 +2387,7 @@  discard block
 block discarded – undo
2387 2387
         if ($form->is_valid()) {
2388 2388
             foreach ($form->subforms() as $question_group_form) {
2389 2389
                 foreach ($question_group_form->inputs() as $question_id => $input) {
2390
-                    $where_conditions    = [
2390
+                    $where_conditions = [
2391 2391
                         'QST_ID' => $question_id,
2392 2392
                         'REG_ID' => $REG_ID,
2393 2393
                     ];
@@ -2428,7 +2428,7 @@  discard block
 block discarded – undo
2428 2428
         $REG = $this->getRegistrationModel();
2429 2429
         // get all other registrations on this transaction, and cache
2430 2430
         // the attendees for them so we don't have to run another query using force_join
2431
-        $registrations                           = $REG->get_all(
2431
+        $registrations = $REG->get_all(
2432 2432
             [
2433 2433
                 [
2434 2434
                     'TXN_ID' => $this->_registration->transaction_ID(),
@@ -2462,23 +2462,23 @@  discard block
 block discarded – undo
2462 2462
                 $attendee                                                      = $registration->attendee()
2463 2463
                     ? $registration->attendee()
2464 2464
                     : $this->getAttendeeModel()->create_default_object();
2465
-                $this->_template_args['attendees'][ $att_nmbr ]['STS_ID']      = $registration->status_ID();
2466
-                $this->_template_args['attendees'][ $att_nmbr ]['fname']       = $attendee->fname();
2467
-                $this->_template_args['attendees'][ $att_nmbr ]['lname']       = $attendee->lname();
2468
-                $this->_template_args['attendees'][ $att_nmbr ]['email']       = $attendee->email();
2469
-                $this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();
2470
-                $this->_template_args['attendees'][ $att_nmbr ]['address']     = implode(
2465
+                $this->_template_args['attendees'][$att_nmbr]['STS_ID']      = $registration->status_ID();
2466
+                $this->_template_args['attendees'][$att_nmbr]['fname']       = $attendee->fname();
2467
+                $this->_template_args['attendees'][$att_nmbr]['lname']       = $attendee->lname();
2468
+                $this->_template_args['attendees'][$att_nmbr]['email']       = $attendee->email();
2469
+                $this->_template_args['attendees'][$att_nmbr]['final_price'] = $registration->final_price();
2470
+                $this->_template_args['attendees'][$att_nmbr]['address']     = implode(
2471 2471
                     ', ',
2472 2472
                     $attendee->full_address_as_array()
2473 2473
                 );
2474
-                $this->_template_args['attendees'][ $att_nmbr ]['att_link']    = self::add_query_args_and_nonce(
2474
+                $this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(
2475 2475
                     [
2476 2476
                         'action' => 'edit_attendee',
2477 2477
                         'post'   => $attendee->ID(),
2478 2478
                     ],
2479 2479
                     REG_ADMIN_URL
2480 2480
                 );
2481
-                $this->_template_args['attendees'][ $att_nmbr ]['event_name']  =
2481
+                $this->_template_args['attendees'][$att_nmbr]['event_name'] =
2482 2482
                     $registration->event_obj() instanceof EE_Event
2483 2483
                         ? $registration->event_obj()->name()
2484 2484
                         : '';
@@ -2486,7 +2486,7 @@  discard block
 block discarded – undo
2486 2486
             }
2487 2487
             $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
2488 2488
         }
2489
-        $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php';
2489
+        $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php';
2490 2490
         EEH_Template::display_template($template_path, $this->_template_args);
2491 2491
     }
2492 2492
 
@@ -2512,11 +2512,11 @@  discard block
 block discarded – undo
2512 2512
         // now let's determine if this is not the primary registration.  If it isn't then we set the
2513 2513
         // primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the
2514 2514
         // primary registration object (that way we know if we need to show create button or not)
2515
-        if (! $this->_registration->is_primary_registrant()) {
2515
+        if ( ! $this->_registration->is_primary_registrant()) {
2516 2516
             $primary_registration = $this->_registration->get_primary_registration();
2517 2517
             $primary_attendee     = $primary_registration instanceof EE_Registration ? $primary_registration->attendee()
2518 2518
                 : null;
2519
-            if (! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) {
2519
+            if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) {
2520 2520
                 // in here?  This means the displayed registration is not the primary registrant but ALREADY HAS its own
2521 2521
                 // custom attendee object so let's not worry about the primary reg.
2522 2522
                 $primary_registration = null;
@@ -2531,7 +2531,7 @@  discard block
 block discarded – undo
2531 2531
         $this->_template_args['phone']             = $attendee->phone();
2532 2532
         $this->_template_args['formatted_address'] = EEH_Address::format($attendee);
2533 2533
         // edit link
2534
-        $this->_template_args['att_edit_link']  = EE_Admin_Page::add_query_args_and_nonce(
2534
+        $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(
2535 2535
             [
2536 2536
                 'action' => 'edit_attendee',
2537 2537
                 'post'   => $attendee->ID(),
@@ -2541,7 +2541,7 @@  discard block
 block discarded – undo
2541 2541
         $this->_template_args['att_edit_title'] = esc_html__('View details for this contact.', 'event_espresso');
2542 2542
         $this->_template_args['att_edit_label'] = esc_html__('View/Edit Contact', 'event_espresso');
2543 2543
         // create link
2544
-        $this->_template_args['create_link']  = $primary_registration instanceof EE_Registration
2544
+        $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration
2545 2545
             ? EE_Admin_Page::add_query_args_and_nonce(
2546 2546
                 [
2547 2547
                     'action'  => 'duplicate_attendee',
@@ -2552,7 +2552,7 @@  discard block
 block discarded – undo
2552 2552
         $this->_template_args['create_label'] = esc_html__('Create Contact', 'event_espresso');
2553 2553
         $this->_template_args['att_check']    = $att_check;
2554 2554
         $template_path                        =
2555
-            REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php';
2555
+            REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php';
2556 2556
         EEH_Template::display_template($template_path, $this->_template_args);
2557 2557
     }
2558 2558
 
@@ -2600,7 +2600,7 @@  discard block
 block discarded – undo
2600 2600
             /** @var EE_Registration $REG */
2601 2601
             $REG      = $this->getRegistrationModel()->get_one_by_ID($REG_ID);
2602 2602
             $payments = $REG->registration_payments();
2603
-            if (! empty($payments)) {
2603
+            if ( ! empty($payments)) {
2604 2604
                 $name           = $REG->attendee() instanceof EE_Attendee
2605 2605
                     ? $REG->attendee()->full_name()
2606 2606
                     : esc_html__('Unknown Attendee', 'event_espresso');
@@ -2664,17 +2664,17 @@  discard block
 block discarded – undo
2664 2664
         // Checkboxes
2665 2665
         $REG_IDs = $this->request->getRequestParam('_REG_ID', [], 'int', true);
2666 2666
 
2667
-        if (! empty($REG_IDs)) {
2667
+        if ( ! empty($REG_IDs)) {
2668 2668
             // if array has more than one element than success message should be plural
2669 2669
             $success = count($REG_IDs) > 1 ? 2 : 1;
2670 2670
             // cycle thru checkboxes
2671 2671
             foreach ($REG_IDs as $REG_ID) {
2672 2672
                 $REG = $REG_MDL->get_one_by_ID($REG_ID);
2673
-                if (! $REG instanceof EE_Registration) {
2673
+                if ( ! $REG instanceof EE_Registration) {
2674 2674
                     continue;
2675 2675
                 }
2676 2676
                 $deleted = $this->_delete_registration($REG);
2677
-                if (! $deleted) {
2677
+                if ( ! $deleted) {
2678 2678
                     $success = 0;
2679 2679
                 }
2680 2680
             }
@@ -2711,7 +2711,7 @@  discard block
 block discarded – undo
2711 2711
         // first we start with the transaction... ultimately, we WILL not delete permanently if there are any related
2712 2712
         // registrations on the transaction that are NOT trashed.
2713 2713
         $TXN = $REG->transaction();
2714
-        if (! $TXN instanceof EE_Transaction) {
2714
+        if ( ! $TXN instanceof EE_Transaction) {
2715 2715
             EE_Error::add_error(
2716 2716
                 sprintf(
2717 2717
                     esc_html__(
@@ -2729,11 +2729,11 @@  discard block
 block discarded – undo
2729 2729
         $REGS        = $TXN->get_many_related('Registration');
2730 2730
         $all_trashed = true;
2731 2731
         foreach ($REGS as $registration) {
2732
-            if (! $registration->get('REG_deleted')) {
2732
+            if ( ! $registration->get('REG_deleted')) {
2733 2733
                 $all_trashed = false;
2734 2734
             }
2735 2735
         }
2736
-        if (! $all_trashed) {
2736
+        if ( ! $all_trashed) {
2737 2737
             EE_Error::add_error(
2738 2738
                 esc_html__(
2739 2739
                     'Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well.  These registrations will be permanently deleted in the same action.',
@@ -2795,7 +2795,7 @@  discard block
 block discarded – undo
2795 2795
      */
2796 2796
     public function new_registration()
2797 2797
     {
2798
-        if (! $this->_set_reg_event()) {
2798
+        if ( ! $this->_set_reg_event()) {
2799 2799
             throw new EE_Error(
2800 2800
                 esc_html__(
2801 2801
                     'Unable to continue with registering because there is no Event ID in the request',
@@ -2827,7 +2827,7 @@  discard block
 block discarded – undo
2827 2827
                 ],
2828 2828
                 EVENTS_ADMIN_URL
2829 2829
             );
2830
-            $edit_event_lnk                     = '<a href="'
2830
+            $edit_event_lnk = '<a href="'
2831 2831
                                                   . $edit_event_url
2832 2832
                                                   . '" aria-label="'
2833 2833
                                                   . esc_attr__('Edit ', 'event_espresso')
@@ -2845,7 +2845,7 @@  discard block
 block discarded – undo
2845 2845
         }
2846 2846
         // grab header
2847 2847
         $template_path                              =
2848
-            REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php';
2848
+            REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php';
2849 2849
         $this->_template_args['admin_page_content'] = EEH_Template::display_template(
2850 2850
             $template_path,
2851 2851
             $this->_template_args,
@@ -2886,7 +2886,7 @@  discard block
 block discarded – undo
2886 2886
                 '</b>'
2887 2887
             );
2888 2888
             return '
2889
-	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div>
2889
+	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg.'</p></div>
2890 2890
 	<script >
2891 2891
 		// WHOAH !!! it appears that someone is using the back button from the Transaction admin page
2892 2892
 		// after just adding a new registration... we gotta try to put a stop to that !!!
@@ -2928,7 +2928,7 @@  discard block
 block discarded – undo
2928 2928
                 );
2929 2929
                 $template_args['content']                          =
2930 2930
                     EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event);
2931
-                $template_args['content']                          .= '</div>';
2931
+                $template_args['content'] .= '</div>';
2932 2932
                 $template_args['step_button_text']                 = esc_html__(
2933 2933
                     'Add Tickets and Continue to Registrant Details',
2934 2934
                     'event_espresso'
@@ -2955,7 +2955,7 @@  discard block
 block discarded – undo
2955 2955
         // we come back to the process_registration_step route.
2956 2956
         $this->_set_add_edit_form_tags('process_reg_step', $hidden_fields);
2957 2957
         return EEH_Template::display_template(
2958
-            REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php',
2958
+            REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php',
2959 2959
             $template_args,
2960 2960
             true
2961 2961
         );
@@ -2979,7 +2979,7 @@  discard block
 block discarded – undo
2979 2979
         }
2980 2980
 
2981 2981
         $EVT_ID = $this->request->getRequestParam('event_id', 0, 'int');
2982
-        if (! $EVT_ID) {
2982
+        if ( ! $EVT_ID) {
2983 2983
             return false;
2984 2984
         }
2985 2985
         $this->_reg_event = $this->getEventModel()->get_one_by_ID($EVT_ID);
@@ -3049,7 +3049,7 @@  discard block
 block discarded – undo
3049 3049
                 }
3050 3050
                 break;
3051 3051
             case 'questions':
3052
-                if (! $this->request->requestParamIsSet('txn_reg_status_change[send_notifications]')) {
3052
+                if ( ! $this->request->requestParamIsSet('txn_reg_status_change[send_notifications]')) {
3053 3053
                     add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15);
3054 3054
                 }
3055 3055
                 // process registration
@@ -3060,7 +3060,7 @@  discard block
 block discarded – undo
3060 3060
                         $grand_total->save_this_and_descendants_to_txn();
3061 3061
                     }
3062 3062
                 }
3063
-                if (! $transaction instanceof EE_Transaction) {
3063
+                if ( ! $transaction instanceof EE_Transaction) {
3064 3064
                     $query_args = [
3065 3065
                         'action'                  => 'new_registration',
3066 3066
                         'processing_registration' => 2,
@@ -3082,7 +3082,7 @@  discard block
 block discarded – undo
3082 3082
                     return;
3083 3083
                 }
3084 3084
                 // maybe update status, and make sure to save transaction if not done already
3085
-                if (! $transaction->update_status_based_on_total_paid()) {
3085
+                if ( ! $transaction->update_status_based_on_total_paid()) {
3086 3086
                     $transaction->save();
3087 3087
                 }
3088 3088
                 EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
@@ -3165,7 +3165,7 @@  discard block
 block discarded – undo
3165 3165
     public function get_attendees($per_page, $count = false, $trash = false)
3166 3166
     {
3167 3167
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3168
-        require_once(REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php');
3168
+        require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php');
3169 3169
         $orderby = $this->request->getRequestParam('orderby');
3170 3170
         switch ($orderby) {
3171 3171
             case 'ATT_ID':
@@ -3188,7 +3188,7 @@  discard block
 block discarded – undo
3188 3188
         $_where       = [];
3189 3189
         $search_term  = $this->request->getRequestParam('s');
3190 3190
         if ($search_term) {
3191
-            $search_term  = '%' . $search_term . '%';
3191
+            $search_term  = '%'.$search_term.'%';
3192 3192
             $_where['OR'] = [
3193 3193
                 'Registration.Event.EVT_name'       => ['LIKE', $search_term],
3194 3194
                 'Registration.Event.EVT_desc'       => ['LIKE', $search_term],
@@ -3215,7 +3215,7 @@  discard block
 block discarded – undo
3215 3215
             'extra_selects' => ['Registration_Count' => ['Registration.REG_ID', 'count', '%d']],
3216 3216
             'limit'         => $limit,
3217 3217
         ];
3218
-        if (! $count) {
3218
+        if ( ! $count) {
3219 3219
             $query_args['order_by'] = [$orderby => $sort];
3220 3220
         }
3221 3221
         $query_args[0]['status'] = $trash ? ['!=', 'publish'] : ['IN', ['publish']];
@@ -3260,7 +3260,7 @@  discard block
 block discarded – undo
3260 3260
         $EVT_ID = $this->request->requestParamIsSet('EVT_ID')
3261 3261
             ? $this->request->getRequestParam('EVT_ID', 0, DataType::INT)
3262 3262
             : null;
3263
-        if (! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
3263
+        if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
3264 3264
             $return_url    = $this->request->getRequestParam('return_url', '', DataType::URL);
3265 3265
             $filters       = $this->request->getRequestParam('filters', [], DataType::STRING, true);
3266 3266
             $report_params = $this->$method_name_for_getting_query_params($filters);
@@ -3289,8 +3289,8 @@  discard block
 block discarded – undo
3289 3289
             ];
3290 3290
             // Merge required request args, overriding any currently set
3291 3291
             $request_args = array_merge($request_args, $required_request_args);
3292
-            if (is_readable(EE_CLASSES . 'EE_Export.class.php')) {
3293
-                require_once(EE_CLASSES . 'EE_Export.class.php');
3292
+            if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
3293
+                require_once(EE_CLASSES.'EE_Export.class.php');
3294 3294
                 $EE_Export = EE_Export::instance($request_args);
3295 3295
                 $EE_Export->export();
3296 3296
             }
@@ -3311,8 +3311,8 @@  discard block
 block discarded – undo
3311 3311
 
3312 3312
     public function _contact_list_export()
3313 3313
     {
3314
-        if (is_readable(EE_CLASSES . 'EE_Export.class.php')) {
3315
-            require_once(EE_CLASSES . 'EE_Export.class.php');
3314
+        if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
3315
+            require_once(EE_CLASSES.'EE_Export.class.php');
3316 3316
             $EE_Export = EE_Export::instance($this->request->requestParams());
3317 3317
             $EE_Export->export_attendees();
3318 3318
         }
@@ -3321,7 +3321,7 @@  discard block
 block discarded – undo
3321 3321
 
3322 3322
     public function _contact_list_report()
3323 3323
     {
3324
-        if (! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
3324
+        if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
3325 3325
             wp_redirect(
3326 3326
                 EE_Admin_Page::add_query_args_and_nonce(
3327 3327
                     [
@@ -3333,8 +3333,8 @@  discard block
 block discarded – undo
3333 3333
                 )
3334 3334
             );
3335 3335
         } else {
3336
-            if (is_readable(EE_CLASSES . 'EE_Export.class.php')) {
3337
-                require_once(EE_CLASSES . 'EE_Export.class.php');
3336
+            if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
3337
+                require_once(EE_CLASSES.'EE_Export.class.php');
3338 3338
                 $EE_Export = EE_Export::instance($this->request->requestParams());
3339 3339
                 $EE_Export->report_attendees();
3340 3340
             }
@@ -3361,7 +3361,7 @@  discard block
 block discarded – undo
3361 3361
         $REG_ID = $this->request->getRequestParam('_REG_ID', 0, 'int');
3362 3362
         $action = $this->request->getRequestParam('return', 'default');
3363 3363
         // verify we have necessary info
3364
-        if (! $REG_ID) {
3364
+        if ( ! $REG_ID) {
3365 3365
             EE_Error::add_error(
3366 3366
                 esc_html__(
3367 3367
                     'Unable to create the contact for the registration because the required parameters are not present (_REG_ID )',
@@ -3376,7 +3376,7 @@  discard block
 block discarded – undo
3376 3376
         }
3377 3377
         // okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration.
3378 3378
         $registration = $this->getRegistrationModel()->get_one_by_ID($REG_ID);
3379
-        if (! $registration instanceof EE_Registration) {
3379
+        if ( ! $registration instanceof EE_Registration) {
3380 3380
             throw new RuntimeException(
3381 3381
                 sprintf(
3382 3382
                     esc_html__(
@@ -3515,16 +3515,16 @@  discard block
 block discarded – undo
3515 3515
         $this->verify_cpt_object();
3516 3516
         remove_meta_box(
3517 3517
             'postexcerpt',
3518
-            $this->_cpt_routes[ $this->_req_action ],
3518
+            $this->_cpt_routes[$this->_req_action],
3519 3519
             'normal'
3520 3520
         );
3521
-        remove_meta_box('commentstatusdiv', $this->_cpt_routes[ $this->_req_action ], 'normal');
3521
+        remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal');
3522 3522
         if (post_type_supports('espresso_attendees', 'excerpt')) {
3523 3523
             $this->addMetaBox(
3524 3524
                 'postexcerpt',
3525 3525
                 esc_html__('Short Biography', 'event_espresso'),
3526 3526
                 'post_excerpt_meta_box',
3527
-                $this->_cpt_routes[ $this->_req_action ]
3527
+                $this->_cpt_routes[$this->_req_action]
3528 3528
             );
3529 3529
         }
3530 3530
         if (post_type_supports('espresso_attendees', 'comments')) {
@@ -3532,7 +3532,7 @@  discard block
 block discarded – undo
3532 3532
                 'commentsdiv',
3533 3533
                 esc_html__('Notes on the Contact', 'event_espresso'),
3534 3534
                 'post_comment_meta_box',
3535
-                $this->_cpt_routes[ $this->_req_action ],
3535
+                $this->_cpt_routes[$this->_req_action],
3536 3536
                 'normal',
3537 3537
                 'core'
3538 3538
             );
@@ -3541,7 +3541,7 @@  discard block
 block discarded – undo
3541 3541
             'attendee_contact_info',
3542 3542
             esc_html__('Contact Info', 'event_espresso'),
3543 3543
             [$this, 'attendee_contact_info'],
3544
-            $this->_cpt_routes[ $this->_req_action ],
3544
+            $this->_cpt_routes[$this->_req_action],
3545 3545
             'side',
3546 3546
             'core'
3547 3547
         );
@@ -3549,7 +3549,7 @@  discard block
 block discarded – undo
3549 3549
             'attendee_details_address',
3550 3550
             esc_html__('Address Details', 'event_espresso'),
3551 3551
             [$this, 'attendee_address_details'],
3552
-            $this->_cpt_routes[ $this->_req_action ],
3552
+            $this->_cpt_routes[$this->_req_action],
3553 3553
             'normal',
3554 3554
             'core'
3555 3555
         );
@@ -3557,7 +3557,7 @@  discard block
 block discarded – undo
3557 3557
             'attendee_registrations',
3558 3558
             esc_html__('Registrations for this Contact', 'event_espresso'),
3559 3559
             [$this, 'attendee_registrations_meta_box'],
3560
-            $this->_cpt_routes[ $this->_req_action ]
3560
+            $this->_cpt_routes[$this->_req_action]
3561 3561
         );
3562 3562
     }
3563 3563
 
@@ -3656,8 +3656,8 @@  discard block
 block discarded – undo
3656 3656
                 ]
3657 3657
             )
3658 3658
         );
3659
-        $template                             =
3660
-            REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php';
3659
+        $template =
3660
+            REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php';
3661 3661
         EEH_Template::display_template($template, $this->_template_args);
3662 3662
     }
3663 3663
 
@@ -3679,7 +3679,7 @@  discard block
 block discarded – undo
3679 3679
         $this->_template_args['attendee']      = $this->_cpt_model_obj;
3680 3680
         $this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration');
3681 3681
         $template                              =
3682
-            REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php';
3682
+            REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php';
3683 3683
         EEH_Template::display_template($template, $this->_template_args);
3684 3684
     }
3685 3685
 
@@ -3694,7 +3694,7 @@  discard block
 block discarded – undo
3694 3694
     public function after_title_form_fields($post)
3695 3695
     {
3696 3696
         if ($post->post_type === 'espresso_attendees') {
3697
-            $template                  = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php';
3697
+            $template                  = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php';
3698 3698
             $template_args['attendee'] = $this->_cpt_model_obj;
3699 3699
             EEH_Template::display_template($template, $template_args);
3700 3700
         }
@@ -3724,7 +3724,7 @@  discard block
 block discarded – undo
3724 3724
             // cycle thru checkboxes
3725 3725
             foreach ($ATT_IDs as $ATT_ID) {
3726 3726
                 $updated = $this->getAttendeeModel()->update_by_ID(['status' => $status], $ATT_ID);
3727
-                if (! $updated) {
3727
+                if ( ! $updated) {
3728 3728
                     $success = 0;
3729 3729
                 }
3730 3730
             }
Please login to merge, or discard this patch.
admin_pages/registrations/EE_Registrations_List_Table.class.php 2 patches
Indentation   +992 added lines, -992 removed lines patch added patch discarded remove patch
@@ -16,562 +16,562 @@  discard block
 block discarded – undo
16 16
  */
17 17
 class EE_Registrations_List_Table extends EE_Admin_List_Table
18 18
 {
19
-    /**
20
-     * @var Registrations_Admin_Page
21
-     */
22
-    protected EE_Admin_Page $_admin_page;
23
-
24
-    protected RegistrationsListTableUserCapabilities $caps_handler;
25
-
26
-    private array $_status;
27
-
28
-    /**
29
-     * An array of transaction details for the related transaction to the registration being processed.
30
-     * This is set via the _set_related_details method.
31
-     *
32
-     * @var array
33
-     */
34
-    protected array $_transaction_details = [];
35
-
36
-    /**
37
-     * An array of event details for the related event to the registration being processed.
38
-     * This is set via the _set_related_details method.
39
-     *
40
-     * @var array
41
-     */
42
-    protected array $_event_details = [];
43
-
44
-    private int $EVT_ID = 0;
45
-
46
-
47
-    /**
48
-     * @param Registrations_Admin_Page $admin_page
49
-     */
50
-    public function __construct(Registrations_Admin_Page $admin_page)
51
-    {
52
-        $this->caps_handler = new RegistrationsListTableUserCapabilities(EE_Registry::instance()->CAP);
53
-        parent::__construct($admin_page);
54
-        $this->EVT_ID = $this->request->getRequestParam('event_id', 0, DataType::INTEGER);
55
-        $req_data     = $admin_page->get_request_data();
56
-        if ($this->EVT_ID) {
57
-            $extra_query_args = [];
58
-            foreach ($admin_page->get_views() as $view_details) {
59
-                $extra_query_args[ $view_details['slug'] ] = ['event_id' => $this->EVT_ID];
60
-            }
61
-            $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args);
62
-        }
63
-        $this->_status = $this->_admin_page->get_registration_status_array();
64
-    }
65
-
66
-
67
-    /**
68
-     * @return void
69
-     * @throws EE_Error
70
-     * @throws ReflectionException
71
-     */
72
-    protected function _setup_data()
73
-    {
74
-        $this->_data           = $this->_admin_page->get_registrations($this->_per_page);
75
-        $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, true);
76
-    }
77
-
78
-
79
-    /**
80
-     * @return void
81
-     */
82
-    protected function _set_properties()
83
-    {
84
-        $return_url = $this->getReturnUrl();
85
-        $req_data   = $this->_admin_page->get_request_data();
86
-
87
-        $this->_wp_list_args = [
88
-            'singular' => esc_html__('registration', 'event_espresso'),
89
-            'plural'   => esc_html__('registrations', 'event_espresso'),
90
-            'ajax'     => true,
91
-            'screen'   => $this->_admin_page->get_current_screen()->id,
92
-        ];
93
-
94
-        $DTT_ID = $req_data['DTT_ID'] ?? 0;
95
-        $DTT_ID = $req_data['datetime_id'] ?? $DTT_ID;
96
-        $DTT_ID = (int) $DTT_ID;
97
-
98
-        if ($this->EVT_ID) {
99
-            $this->_columns = [
100
-                'cb'               => '<input type="checkbox" />', // Render a checkbox instead of text
101
-                'id'               => esc_html__('ID', 'event_espresso'),
102
-                'ATT_fname'        => esc_html__('Name', 'event_espresso'),
103
-                'ATT_email'        => esc_html__('Email', 'event_espresso'),
104
-                '_REG_date'        => esc_html__('Reg Date', 'event_espresso'),
105
-                'PRC_amount'       => esc_html__('TKT Price', 'event_espresso'),
106
-                '_REG_final_price' => esc_html__('Final Price', 'event_espresso'),
107
-                'TXN_total'        => esc_html__('Total Txn', 'event_espresso'),
108
-                'TXN_paid'         => esc_html__('Paid', 'event_espresso'),
109
-                'actions'          => $this->actionsColumnHeader(),
110
-            ];
111
-        } else {
112
-            $this->_columns = [
113
-                'cb'               => '<input type="checkbox" />', // Render a checkbox instead of text
114
-                'id'               => esc_html__('ID', 'event_espresso'),
115
-                'ATT_fname'        => esc_html__('Name', 'event_espresso'),
116
-                '_REG_date'        => esc_html__('TXN Date', 'event_espresso'),
117
-                'event_name'       => esc_html__('Event', 'event_espresso'),
118
-                'DTT_EVT_start'    => esc_html__('Event Date', 'event_espresso'),
119
-                '_REG_final_price' => esc_html__('Price', 'event_espresso'),
120
-                '_REG_paid'        => esc_html__('Paid', 'event_espresso'),
121
-                'actions'          => $this->actionsColumnHeader(),
122
-            ];
123
-        }
124
-
125
-        $csv_report = RegistrationsCsvReportParams::getRequestParams($return_url, $req_data, $this->EVT_ID, $DTT_ID);
126
-        if (! empty($csv_report)) {
127
-            $this->_bottom_buttons['csv_reg_report'] = $csv_report;
128
-        }
129
-
130
-        $this->_primary_column   = 'id';
131
-        $this->_sortable_columns = [
132
-            '_REG_date'     => ['_REG_date' => true],   // true means its already sorted
133
-            /**
134
-             * Allows users to change the default sort if they wish.
135
-             * Returning a falsey on this filter will result in the default sort to be by firstname rather than last
136
-             * name.
137
-             */
138
-            'ATT_fname'     => [
139
-                'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name',
140
-                true,
141
-                $this,
142
-            ]
143
-                ? ['ATT_lname' => false]
144
-                : ['ATT_fname' => false],
145
-            'event_name'    => ['event_name' => false],
146
-            'DTT_EVT_start' => ['DTT_EVT_start' => false],
147
-            'id'            => ['REG_ID' => false],
148
-        ];
149
-        $this->_hidden_columns   = [];
150
-    }
151
-
152
-
153
-    /**
154
-     * This simply sets up the row class for the table rows.
155
-     * Allows for easier overriding of child methods for setting up sorting.
156
-     *
157
-     * @param EE_Registration $item the current item
158
-     * @return string
159
-     */
160
-    protected function _get_row_class($item): string
161
-    {
162
-        $class = parent::_get_row_class($item);
163
-        if ($this->_has_checkbox_column) {
164
-            $class .= ' has-checkbox-column';
165
-        }
166
-        return $class;
167
-    }
168
-
169
-
170
-    /**
171
-     * Set the $_transaction_details property if not set yet.
172
-     *
173
-     * @param EE_Registration $registration
174
-     * @throws EE_Error
175
-     * @throws InvalidArgumentException
176
-     * @throws ReflectionException
177
-     * @throws InvalidDataTypeException
178
-     * @throws InvalidInterfaceException
179
-     */
180
-    protected function _set_related_details(EE_Registration $registration)
181
-    {
182
-        $transaction                = $registration->transaction();
183
-        $status                     = $transaction->status_ID();
184
-        $this->_transaction_details = [
185
-            'transaction' => $transaction,
186
-            'status'      => $status,
187
-            'id'          => $transaction->ID(),
188
-            'title_attr'  => sprintf(
189
-                esc_html__('View Transaction Details (%s)', 'event_espresso'),
190
-                EEH_Template::pretty_status($status, false, 'sentence')
191
-            ),
192
-        ];
193
-        try {
194
-            $event = $registration->event();
195
-        } catch (EntityNotFoundException $e) {
196
-            $event = null;
197
-        }
198
-        $status               = $event instanceof EE_Event
199
-            ? $event->get_active_status()
200
-            : EE_Datetime::inactive;
201
-        $this->_event_details = [
202
-            'event'      => $event,
203
-            'status'     => $status,
204
-            'id'         => $event instanceof EE_Event
205
-                ? $event->ID()
206
-                : 0,
207
-            'title_attr' => sprintf(
208
-                esc_html__('Edit Event (%s)', 'event_espresso'),
209
-                EEH_Template::pretty_status($status, false, 'sentence')
210
-            ),
211
-        ];
212
-    }
213
-
214
-
215
-    /**
216
-     * @return array
217
-     * @throws EE_Error
218
-     * @throws ReflectionException
219
-     */
220
-    protected function _get_table_filters()
221
-    {
222
-        $filters = [];
223
-        // todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as
224
-        // methods.
225
-        $cur_date     = $this->request->getRequestParam('month_range', '');
226
-        $cur_category = $this->request->getRequestParam('EVT_CAT', -1, DataType::INTEGER);
227
-        $reg_status   = $this->request->getRequestParam('_reg_status', '');
228
-        $filters[]    = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category);
229
-        $filters[]    = EEH_Form_Fields::generate_event_category_dropdown($cur_category);
230
-        $status       = [];
231
-        $status[]     = ['id' => 0, 'text' => esc_html__('Select Status', 'event_espresso')];
232
-        foreach ($this->_status as $key => $value) {
233
-            $status[] = ['id' => $key, 'text' => $value];
234
-        }
235
-        if ($this->_view !== 'incomplete') {
236
-            $filters[] = EEH_Form_Fields::select_input(
237
-                '_reg_status',
238
-                $status,
239
-                $reg_status ? strtoupper($reg_status) : ''
240
-            );
241
-        }
242
-        foreach (['event_id', 'datetime_id', 'ticket_id'] as $filter_key) {
243
-            if ($this->request->requestParamIsSet($filter_key)) {
244
-                $filters[] = EEH_Form_Fields::hidden_input(
245
-                    $filter_key,
246
-                    $this->request->getRequestParam($filter_key),
247
-                    'reg_' . $filter_key
248
-                );
249
-            }
250
-        }
251
-        return $filters;
252
-    }
253
-
254
-
255
-    /**
256
-     * @return void
257
-     * @throws EE_Error
258
-     * @throws InvalidArgumentException
259
-     * @throws InvalidDataTypeException
260
-     * @throws InvalidInterfaceException
261
-     * @throws ReflectionException
262
-     */
263
-    protected function _add_view_counts()
264
-    {
265
-        $this->_views['all']['count']       = $this->_total_registrations();
266
-        $this->_views['today']['count']     = $this->_total_registrations_today();
267
-        $this->_views['yesterday']['count'] = $this->totalRegistrationsYesterday();
268
-        $this->_views['month']['count']     = $this->_total_registrations_this_month();
269
-        if ($this->caps_handler->userCanTrashRegistrations()) {
270
-            $this->_views['incomplete']['count'] = $this->_total_registrations('incomplete');
271
-            $this->_views['trash']['count']      = $this->_total_registrations('trash');
272
-        }
273
-    }
274
-
275
-
276
-    /**
277
-     * @param string $view
278
-     * @return int
279
-     * @throws EE_Error
280
-     * @throws ReflectionException
281
-     */
282
-    protected function _total_registrations(string $view = ''): int
283
-    {
284
-        $_where = [];
285
-        if ($this->EVT_ID) {
286
-            $_where['EVT_ID'] = $this->EVT_ID;
287
-        }
288
-        switch ($view) {
289
-            case 'trash':
290
-                return EEM_Registration::instance()->count_deleted([$_where]);
291
-            case 'incomplete':
292
-                $_where['STS_ID'] = EEM_Registration::status_id_incomplete;
293
-                break;
294
-            default:
295
-                $_where['STS_ID'] = ['!=', EEM_Registration::status_id_incomplete];
296
-        }
297
-        return EEM_Registration::instance()->count([$_where]);
298
-    }
299
-
300
-
301
-    /**
302
-     * @return int
303
-     * @throws EE_Error
304
-     * @throws ReflectionException
305
-     */
306
-    protected function _total_registrations_this_month(): int
307
-    {
308
-        $current_time   = current_time('timestamp');
309
-        $year_and_month = date('Y-m', $current_time);
310
-        $days_in_month  = date('t', $current_time);
311
-
312
-        $start_date = "$year_and_month-01";
313
-        $end_date   = "$year_and_month-$days_in_month";
314
-
315
-        return $this->totalRegistrationsForDateRange($start_date, $end_date);
316
-    }
317
-
318
-
319
-    /**
320
-     * @return int
321
-     * @throws EE_Error
322
-     * @throws ReflectionException
323
-     */
324
-    protected function _total_registrations_today(): int
325
-    {
326
-        $today = date('Y-m-d', current_time('timestamp'));
327
-        return $this->totalRegistrationsForDateRange($today, $today);
328
-    }
329
-
330
-
331
-    /**
332
-     * @return int
333
-     * @throws EE_Error
334
-     * @throws ReflectionException
335
-     */
336
-    protected function totalRegistrationsYesterday(): int
337
-    {
338
-        $yesterday    = date('Y-m-d', current_time('timestamp') - DAY_IN_SECONDS);
339
-        return $this->totalRegistrationsForDateRange($yesterday, $yesterday);
340
-    }
341
-
342
-
343
-    /**
344
-     * @param string $start_date earlier date string in format 'Y-m-d'
345
-     * @param string $end_date   later date string in format 'Y-m-d'
346
-     * @return int
347
-     * @throws EE_Error
348
-     * @throws ReflectionException
349
-     */
350
-    private function totalRegistrationsForDateRange(string $start_date, string $end_date): int
351
-    {
352
-        $where = [
353
-            'REG_date' => [
354
-                'BETWEEN',
355
-                [
356
-                    EEM_Registration::instance()->convert_datetime_for_query(
357
-                        'REG_date',
358
-                        "$start_date 00:00:00",
359
-                        'Y-m-d H:i:s'
360
-                    ),
361
-                    EEM_Registration::instance()->convert_datetime_for_query(
362
-                        'REG_date',
363
-                        "$end_date  23:59:59",
364
-                        'Y-m-d H:i:s'
365
-                    ),
366
-                ],
367
-            ],
368
-            'STS_ID'   => ['!=', EEM_Registration::status_id_incomplete],
369
-        ];
370
-        if ($this->EVT_ID) {
371
-            $where['EVT_ID'] = $this->EVT_ID;
372
-        }
373
-        return EEM_Registration::instance()->count([$where]);
374
-    }
375
-
376
-
377
-    /**
378
-     * @param EE_Registration $item
379
-     * @return string
380
-     * @throws EE_Error
381
-     * @throws InvalidArgumentException
382
-     * @throws InvalidDataTypeException
383
-     * @throws InvalidInterfaceException
384
-     * @throws ReflectionException
385
-     */
386
-    public function column_cb($item): string
387
-    {
388
-        /** checkbox/lock **/
389
-        $REG_ID        = $item->ID();
390
-        $transaction   = $item->transaction();
391
-        $payment_count = $transaction->count_related('Payment');
392
-
393
-        $content = '<input type="checkbox" name="_REG_ID[]" value="' . $REG_ID . '" />';
394
-        $content .= $payment_count > 0 || ! $this->caps_handler->userCanEditRegistration($item)
395
-            ? '<span class="ee-locked-entity dashicons dashicons-lock ee-aria-tooltip ee-aria-tooltip--big-box"
19
+	/**
20
+	 * @var Registrations_Admin_Page
21
+	 */
22
+	protected EE_Admin_Page $_admin_page;
23
+
24
+	protected RegistrationsListTableUserCapabilities $caps_handler;
25
+
26
+	private array $_status;
27
+
28
+	/**
29
+	 * An array of transaction details for the related transaction to the registration being processed.
30
+	 * This is set via the _set_related_details method.
31
+	 *
32
+	 * @var array
33
+	 */
34
+	protected array $_transaction_details = [];
35
+
36
+	/**
37
+	 * An array of event details for the related event to the registration being processed.
38
+	 * This is set via the _set_related_details method.
39
+	 *
40
+	 * @var array
41
+	 */
42
+	protected array $_event_details = [];
43
+
44
+	private int $EVT_ID = 0;
45
+
46
+
47
+	/**
48
+	 * @param Registrations_Admin_Page $admin_page
49
+	 */
50
+	public function __construct(Registrations_Admin_Page $admin_page)
51
+	{
52
+		$this->caps_handler = new RegistrationsListTableUserCapabilities(EE_Registry::instance()->CAP);
53
+		parent::__construct($admin_page);
54
+		$this->EVT_ID = $this->request->getRequestParam('event_id', 0, DataType::INTEGER);
55
+		$req_data     = $admin_page->get_request_data();
56
+		if ($this->EVT_ID) {
57
+			$extra_query_args = [];
58
+			foreach ($admin_page->get_views() as $view_details) {
59
+				$extra_query_args[ $view_details['slug'] ] = ['event_id' => $this->EVT_ID];
60
+			}
61
+			$this->_views = $admin_page->get_list_table_view_RLs($extra_query_args);
62
+		}
63
+		$this->_status = $this->_admin_page->get_registration_status_array();
64
+	}
65
+
66
+
67
+	/**
68
+	 * @return void
69
+	 * @throws EE_Error
70
+	 * @throws ReflectionException
71
+	 */
72
+	protected function _setup_data()
73
+	{
74
+		$this->_data           = $this->_admin_page->get_registrations($this->_per_page);
75
+		$this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, true);
76
+	}
77
+
78
+
79
+	/**
80
+	 * @return void
81
+	 */
82
+	protected function _set_properties()
83
+	{
84
+		$return_url = $this->getReturnUrl();
85
+		$req_data   = $this->_admin_page->get_request_data();
86
+
87
+		$this->_wp_list_args = [
88
+			'singular' => esc_html__('registration', 'event_espresso'),
89
+			'plural'   => esc_html__('registrations', 'event_espresso'),
90
+			'ajax'     => true,
91
+			'screen'   => $this->_admin_page->get_current_screen()->id,
92
+		];
93
+
94
+		$DTT_ID = $req_data['DTT_ID'] ?? 0;
95
+		$DTT_ID = $req_data['datetime_id'] ?? $DTT_ID;
96
+		$DTT_ID = (int) $DTT_ID;
97
+
98
+		if ($this->EVT_ID) {
99
+			$this->_columns = [
100
+				'cb'               => '<input type="checkbox" />', // Render a checkbox instead of text
101
+				'id'               => esc_html__('ID', 'event_espresso'),
102
+				'ATT_fname'        => esc_html__('Name', 'event_espresso'),
103
+				'ATT_email'        => esc_html__('Email', 'event_espresso'),
104
+				'_REG_date'        => esc_html__('Reg Date', 'event_espresso'),
105
+				'PRC_amount'       => esc_html__('TKT Price', 'event_espresso'),
106
+				'_REG_final_price' => esc_html__('Final Price', 'event_espresso'),
107
+				'TXN_total'        => esc_html__('Total Txn', 'event_espresso'),
108
+				'TXN_paid'         => esc_html__('Paid', 'event_espresso'),
109
+				'actions'          => $this->actionsColumnHeader(),
110
+			];
111
+		} else {
112
+			$this->_columns = [
113
+				'cb'               => '<input type="checkbox" />', // Render a checkbox instead of text
114
+				'id'               => esc_html__('ID', 'event_espresso'),
115
+				'ATT_fname'        => esc_html__('Name', 'event_espresso'),
116
+				'_REG_date'        => esc_html__('TXN Date', 'event_espresso'),
117
+				'event_name'       => esc_html__('Event', 'event_espresso'),
118
+				'DTT_EVT_start'    => esc_html__('Event Date', 'event_espresso'),
119
+				'_REG_final_price' => esc_html__('Price', 'event_espresso'),
120
+				'_REG_paid'        => esc_html__('Paid', 'event_espresso'),
121
+				'actions'          => $this->actionsColumnHeader(),
122
+			];
123
+		}
124
+
125
+		$csv_report = RegistrationsCsvReportParams::getRequestParams($return_url, $req_data, $this->EVT_ID, $DTT_ID);
126
+		if (! empty($csv_report)) {
127
+			$this->_bottom_buttons['csv_reg_report'] = $csv_report;
128
+		}
129
+
130
+		$this->_primary_column   = 'id';
131
+		$this->_sortable_columns = [
132
+			'_REG_date'     => ['_REG_date' => true],   // true means its already sorted
133
+			/**
134
+			 * Allows users to change the default sort if they wish.
135
+			 * Returning a falsey on this filter will result in the default sort to be by firstname rather than last
136
+			 * name.
137
+			 */
138
+			'ATT_fname'     => [
139
+				'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name',
140
+				true,
141
+				$this,
142
+			]
143
+				? ['ATT_lname' => false]
144
+				: ['ATT_fname' => false],
145
+			'event_name'    => ['event_name' => false],
146
+			'DTT_EVT_start' => ['DTT_EVT_start' => false],
147
+			'id'            => ['REG_ID' => false],
148
+		];
149
+		$this->_hidden_columns   = [];
150
+	}
151
+
152
+
153
+	/**
154
+	 * This simply sets up the row class for the table rows.
155
+	 * Allows for easier overriding of child methods for setting up sorting.
156
+	 *
157
+	 * @param EE_Registration $item the current item
158
+	 * @return string
159
+	 */
160
+	protected function _get_row_class($item): string
161
+	{
162
+		$class = parent::_get_row_class($item);
163
+		if ($this->_has_checkbox_column) {
164
+			$class .= ' has-checkbox-column';
165
+		}
166
+		return $class;
167
+	}
168
+
169
+
170
+	/**
171
+	 * Set the $_transaction_details property if not set yet.
172
+	 *
173
+	 * @param EE_Registration $registration
174
+	 * @throws EE_Error
175
+	 * @throws InvalidArgumentException
176
+	 * @throws ReflectionException
177
+	 * @throws InvalidDataTypeException
178
+	 * @throws InvalidInterfaceException
179
+	 */
180
+	protected function _set_related_details(EE_Registration $registration)
181
+	{
182
+		$transaction                = $registration->transaction();
183
+		$status                     = $transaction->status_ID();
184
+		$this->_transaction_details = [
185
+			'transaction' => $transaction,
186
+			'status'      => $status,
187
+			'id'          => $transaction->ID(),
188
+			'title_attr'  => sprintf(
189
+				esc_html__('View Transaction Details (%s)', 'event_espresso'),
190
+				EEH_Template::pretty_status($status, false, 'sentence')
191
+			),
192
+		];
193
+		try {
194
+			$event = $registration->event();
195
+		} catch (EntityNotFoundException $e) {
196
+			$event = null;
197
+		}
198
+		$status               = $event instanceof EE_Event
199
+			? $event->get_active_status()
200
+			: EE_Datetime::inactive;
201
+		$this->_event_details = [
202
+			'event'      => $event,
203
+			'status'     => $status,
204
+			'id'         => $event instanceof EE_Event
205
+				? $event->ID()
206
+				: 0,
207
+			'title_attr' => sprintf(
208
+				esc_html__('Edit Event (%s)', 'event_espresso'),
209
+				EEH_Template::pretty_status($status, false, 'sentence')
210
+			),
211
+		];
212
+	}
213
+
214
+
215
+	/**
216
+	 * @return array
217
+	 * @throws EE_Error
218
+	 * @throws ReflectionException
219
+	 */
220
+	protected function _get_table_filters()
221
+	{
222
+		$filters = [];
223
+		// todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as
224
+		// methods.
225
+		$cur_date     = $this->request->getRequestParam('month_range', '');
226
+		$cur_category = $this->request->getRequestParam('EVT_CAT', -1, DataType::INTEGER);
227
+		$reg_status   = $this->request->getRequestParam('_reg_status', '');
228
+		$filters[]    = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category);
229
+		$filters[]    = EEH_Form_Fields::generate_event_category_dropdown($cur_category);
230
+		$status       = [];
231
+		$status[]     = ['id' => 0, 'text' => esc_html__('Select Status', 'event_espresso')];
232
+		foreach ($this->_status as $key => $value) {
233
+			$status[] = ['id' => $key, 'text' => $value];
234
+		}
235
+		if ($this->_view !== 'incomplete') {
236
+			$filters[] = EEH_Form_Fields::select_input(
237
+				'_reg_status',
238
+				$status,
239
+				$reg_status ? strtoupper($reg_status) : ''
240
+			);
241
+		}
242
+		foreach (['event_id', 'datetime_id', 'ticket_id'] as $filter_key) {
243
+			if ($this->request->requestParamIsSet($filter_key)) {
244
+				$filters[] = EEH_Form_Fields::hidden_input(
245
+					$filter_key,
246
+					$this->request->getRequestParam($filter_key),
247
+					'reg_' . $filter_key
248
+				);
249
+			}
250
+		}
251
+		return $filters;
252
+	}
253
+
254
+
255
+	/**
256
+	 * @return void
257
+	 * @throws EE_Error
258
+	 * @throws InvalidArgumentException
259
+	 * @throws InvalidDataTypeException
260
+	 * @throws InvalidInterfaceException
261
+	 * @throws ReflectionException
262
+	 */
263
+	protected function _add_view_counts()
264
+	{
265
+		$this->_views['all']['count']       = $this->_total_registrations();
266
+		$this->_views['today']['count']     = $this->_total_registrations_today();
267
+		$this->_views['yesterday']['count'] = $this->totalRegistrationsYesterday();
268
+		$this->_views['month']['count']     = $this->_total_registrations_this_month();
269
+		if ($this->caps_handler->userCanTrashRegistrations()) {
270
+			$this->_views['incomplete']['count'] = $this->_total_registrations('incomplete');
271
+			$this->_views['trash']['count']      = $this->_total_registrations('trash');
272
+		}
273
+	}
274
+
275
+
276
+	/**
277
+	 * @param string $view
278
+	 * @return int
279
+	 * @throws EE_Error
280
+	 * @throws ReflectionException
281
+	 */
282
+	protected function _total_registrations(string $view = ''): int
283
+	{
284
+		$_where = [];
285
+		if ($this->EVT_ID) {
286
+			$_where['EVT_ID'] = $this->EVT_ID;
287
+		}
288
+		switch ($view) {
289
+			case 'trash':
290
+				return EEM_Registration::instance()->count_deleted([$_where]);
291
+			case 'incomplete':
292
+				$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
293
+				break;
294
+			default:
295
+				$_where['STS_ID'] = ['!=', EEM_Registration::status_id_incomplete];
296
+		}
297
+		return EEM_Registration::instance()->count([$_where]);
298
+	}
299
+
300
+
301
+	/**
302
+	 * @return int
303
+	 * @throws EE_Error
304
+	 * @throws ReflectionException
305
+	 */
306
+	protected function _total_registrations_this_month(): int
307
+	{
308
+		$current_time   = current_time('timestamp');
309
+		$year_and_month = date('Y-m', $current_time);
310
+		$days_in_month  = date('t', $current_time);
311
+
312
+		$start_date = "$year_and_month-01";
313
+		$end_date   = "$year_and_month-$days_in_month";
314
+
315
+		return $this->totalRegistrationsForDateRange($start_date, $end_date);
316
+	}
317
+
318
+
319
+	/**
320
+	 * @return int
321
+	 * @throws EE_Error
322
+	 * @throws ReflectionException
323
+	 */
324
+	protected function _total_registrations_today(): int
325
+	{
326
+		$today = date('Y-m-d', current_time('timestamp'));
327
+		return $this->totalRegistrationsForDateRange($today, $today);
328
+	}
329
+
330
+
331
+	/**
332
+	 * @return int
333
+	 * @throws EE_Error
334
+	 * @throws ReflectionException
335
+	 */
336
+	protected function totalRegistrationsYesterday(): int
337
+	{
338
+		$yesterday    = date('Y-m-d', current_time('timestamp') - DAY_IN_SECONDS);
339
+		return $this->totalRegistrationsForDateRange($yesterday, $yesterday);
340
+	}
341
+
342
+
343
+	/**
344
+	 * @param string $start_date earlier date string in format 'Y-m-d'
345
+	 * @param string $end_date   later date string in format 'Y-m-d'
346
+	 * @return int
347
+	 * @throws EE_Error
348
+	 * @throws ReflectionException
349
+	 */
350
+	private function totalRegistrationsForDateRange(string $start_date, string $end_date): int
351
+	{
352
+		$where = [
353
+			'REG_date' => [
354
+				'BETWEEN',
355
+				[
356
+					EEM_Registration::instance()->convert_datetime_for_query(
357
+						'REG_date',
358
+						"$start_date 00:00:00",
359
+						'Y-m-d H:i:s'
360
+					),
361
+					EEM_Registration::instance()->convert_datetime_for_query(
362
+						'REG_date',
363
+						"$end_date  23:59:59",
364
+						'Y-m-d H:i:s'
365
+					),
366
+				],
367
+			],
368
+			'STS_ID'   => ['!=', EEM_Registration::status_id_incomplete],
369
+		];
370
+		if ($this->EVT_ID) {
371
+			$where['EVT_ID'] = $this->EVT_ID;
372
+		}
373
+		return EEM_Registration::instance()->count([$where]);
374
+	}
375
+
376
+
377
+	/**
378
+	 * @param EE_Registration $item
379
+	 * @return string
380
+	 * @throws EE_Error
381
+	 * @throws InvalidArgumentException
382
+	 * @throws InvalidDataTypeException
383
+	 * @throws InvalidInterfaceException
384
+	 * @throws ReflectionException
385
+	 */
386
+	public function column_cb($item): string
387
+	{
388
+		/** checkbox/lock **/
389
+		$REG_ID        = $item->ID();
390
+		$transaction   = $item->transaction();
391
+		$payment_count = $transaction->count_related('Payment');
392
+
393
+		$content = '<input type="checkbox" name="_REG_ID[]" value="' . $REG_ID . '" />';
394
+		$content .= $payment_count > 0 || ! $this->caps_handler->userCanEditRegistration($item)
395
+			? '<span class="ee-locked-entity dashicons dashicons-lock ee-aria-tooltip ee-aria-tooltip--big-box"
396 396
                     aria-label="' . $this->lockedRegMessage() . '"></span>'
397
-            : '';
398
-        return $this->columnContent('cb', $content, 'center');
399
-    }
400
-
401
-
402
-    private function lockedRegMessage(): string
403
-    {
404
-        return esc_html__(
405
-            'This lock-icon means that this registration cannot be trashed.  Registrations that belong to a transaction that has payments cannot be trashed.  If you wish to trash this registration then you must delete all payments attached to the related transaction first.',
406
-            'event_espresso'
407
-        );
408
-    }
409
-
410
-
411
-    /**
412
-     * @param EE_Registration $registration
413
-     * @return string
414
-     * @throws EE_Error
415
-     * @throws InvalidArgumentException
416
-     * @throws InvalidDataTypeException
417
-     * @throws InvalidInterfaceException
418
-     * @throws ReflectionException
419
-     */
420
-    public function column_id(EE_Registration $registration): string
421
-    {
422
-        $content = '<span class="ee-entity-id">' . $registration->ID() . '</span>';
423
-        $content .= '<span class="show-on-mobile-view-only">';
424
-        $content .= $this->column_ATT_fname($registration, false);
425
-        $content .= '</span>';
426
-
427
-        return $this->columnContent('id', $content, 'end');
428
-    }
429
-
430
-
431
-    /**
432
-     * @param EE_Registration $registration
433
-     * @param bool            $prep_content
434
-     * @return string
435
-     * @throws EE_Error
436
-     * @throws ReflectionException
437
-     */
438
-    public function column_ATT_fname(EE_Registration $registration, bool $prep_content = true): string
439
-    {
440
-        $status         = esc_attr($registration->status_ID());
441
-        $pretty_status  = EEH_Template::pretty_status($status, false, 'sentence');
442
-        $prime_reg_star = $registration->count() === 1
443
-            ? '<sup><span class="dashicons dashicons-star-filled gold-icon"></span></sup>'
444
-            : '';
445
-
446
-        $group_count = '
397
+			: '';
398
+		return $this->columnContent('cb', $content, 'center');
399
+	}
400
+
401
+
402
+	private function lockedRegMessage(): string
403
+	{
404
+		return esc_html__(
405
+			'This lock-icon means that this registration cannot be trashed.  Registrations that belong to a transaction that has payments cannot be trashed.  If you wish to trash this registration then you must delete all payments attached to the related transaction first.',
406
+			'event_espresso'
407
+		);
408
+	}
409
+
410
+
411
+	/**
412
+	 * @param EE_Registration $registration
413
+	 * @return string
414
+	 * @throws EE_Error
415
+	 * @throws InvalidArgumentException
416
+	 * @throws InvalidDataTypeException
417
+	 * @throws InvalidInterfaceException
418
+	 * @throws ReflectionException
419
+	 */
420
+	public function column_id(EE_Registration $registration): string
421
+	{
422
+		$content = '<span class="ee-entity-id">' . $registration->ID() . '</span>';
423
+		$content .= '<span class="show-on-mobile-view-only">';
424
+		$content .= $this->column_ATT_fname($registration, false);
425
+		$content .= '</span>';
426
+
427
+		return $this->columnContent('id', $content, 'end');
428
+	}
429
+
430
+
431
+	/**
432
+	 * @param EE_Registration $registration
433
+	 * @param bool            $prep_content
434
+	 * @return string
435
+	 * @throws EE_Error
436
+	 * @throws ReflectionException
437
+	 */
438
+	public function column_ATT_fname(EE_Registration $registration, bool $prep_content = true): string
439
+	{
440
+		$status         = esc_attr($registration->status_ID());
441
+		$pretty_status  = EEH_Template::pretty_status($status, false, 'sentence');
442
+		$prime_reg_star = $registration->count() === 1
443
+			? '<sup><span class="dashicons dashicons-star-filled gold-icon"></span></sup>'
444
+			: '';
445
+
446
+		$group_count = '
447 447
             <span class="reg-count-group-size" >
448 448
                 ' . sprintf(
449
-                esc_html__('(%1$s / %2$s)', 'event_espresso'),
450
-                $registration->count(),
451
-                $registration->group_size()
452
-            ) . '
449
+				esc_html__('(%1$s / %2$s)', 'event_espresso'),
450
+				$registration->count(),
451
+				$registration->group_size()
452
+			) . '
453 453
             </span >';
454 454
 
455
-        $content = '
455
+		$content = '
456 456
         <div class="ee-layout-row">
457 457
             <span aria-label="' . $pretty_status . '"
458 458
                   class="ee-status-dot ee-status-bg--' . $status . ' ee-aria-tooltip"
459 459
             ></span>
460 460
             ' . $this->viewRegistrationLink($registration, $status)
461
-            . $prime_reg_star
462
-            . $group_count . '
461
+			. $prime_reg_star
462
+			. $group_count . '
463 463
             <span class="spacer"></span>
464 464
             <span>
465 465
                 ' . sprintf(
466
-                esc_html__('Reg Code: %s', 'event_espresso'),
467
-                $registration->get('REG_code')
468
-            ) . '
466
+				esc_html__('Reg Code: %s', 'event_espresso'),
467
+				$registration->get('REG_code')
468
+			) . '
469 469
             </span>
470 470
         </div>';
471 471
 
472
-        $url_params = ['_REG_ID' => $registration->ID()];
473
-        if ($this->EVT_ID) {
474
-            $url_params['event_id'] = $this->EVT_ID;
475
-        }
476
-        // trash/restore/delete actions
477
-        $actions = $this->trashRegistrationLink($registration, $url_params);
478
-        $actions = $this->restoreRegistrationLink($registration, $url_params, $actions);
479
-        $actions = $this->deleteRegistrationLink($registration, $url_params, $actions);
480
-
481
-        $content = sprintf('%1$s %2$s', $content, $this->row_actions($actions));
482
-
483
-        return $prep_content ? $this->columnContent('ATT_fname', $content) : $content;
484
-    }
485
-
486
-
487
-    /**
488
-     * @param EE_Registration $registration
489
-     * @param bool            $prep_content
490
-     * @return string
491
-     * @throws EE_Error
492
-     * @throws ReflectionException
493
-     */
494
-    public function column__REG_date(EE_Registration $registration, bool $prep_content = true): string
495
-    {
496
-        $this->_set_related_details($registration);
497
-        // Build row actions
498
-        $content = $this->caps_handler->userCanViewTransaction()
499
-            ? '<a class="ee-aria-tooltip ee-status-color--' . $this->_transaction_details['status'] . '" href="'
500
-            . $this->viewTransactionUrl()
501
-            . '" aria-label="'
502
-            . esc_attr($this->_transaction_details['title_attr'])
503
-            . '">'
504
-            . $registration->get_i18n_datetime('REG_date', 'M jS Y g:i a')
505
-            . '</a>'
506
-            : $registration->get_i18n_datetime('REG_date');
507
-
508
-        return $prep_content ? $this->columnContent('_REG_date', $content) : $content;
509
-    }
510
-
511
-
512
-    /**
513
-     * @param EE_Registration $registration
514
-     * @return string
515
-     * @throws EE_Error
516
-     * @throws InvalidArgumentException
517
-     * @throws InvalidDataTypeException
518
-     * @throws InvalidInterfaceException
519
-     * @throws ReflectionException
520
-     */
521
-    public function column_event_name(EE_Registration $registration): string
522
-    {
523
-        $this->_set_related_details($registration);
524
-        $EVT_ID                  = $registration->event_ID();
525
-        $event_name              = $registration->event_name();
526
-        $event_name              = $event_name ?: esc_html__("No Associated Event", 'event_espresso');
527
-        $event_name              = wp_trim_words($event_name, 30, '...');
528
-        $edit_event              = $this->editEventLink($EVT_ID, $event_name);
529
-        $actions['event_filter'] = $this->eventFilterLink($EVT_ID, $event_name);
530
-        $content                 = sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions));
531
-
532
-        return $this->columnContent('event_name', $content);
533
-    }
534
-
535
-
536
-    /**
537
-     * @param EE_Registration $registration
538
-     * @return string
539
-     * @throws EE_Error
540
-     * @throws InvalidArgumentException
541
-     * @throws InvalidDataTypeException
542
-     * @throws InvalidInterfaceException
543
-     * @throws ReflectionException
544
-     */
545
-    public function column_DTT_EVT_start(EE_Registration $registration): string
546
-    {
547
-        $datetime_strings = [];
548
-        $ticket           = $registration->ticket();
549
-        if ($ticket instanceof EE_Ticket) {
550
-            $remove_defaults = ['default_where_conditions' => 'none'];
551
-            $datetimes       = $ticket->datetimes($remove_defaults);
552
-            foreach ($datetimes as $datetime) {
553
-                $datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start', 'M jS Y g:i a');
554
-            }
555
-            $content = $this->generateDisplayForDatetimes($datetime_strings);
556
-        } else {
557
-            $content = esc_html__('There is no ticket on this registration', 'event_espresso');
558
-        }
559
-        return $this->columnContent('DTT_EVT_start', $content);
560
-    }
561
-
562
-
563
-    /**
564
-     * Receives an array of datetime strings to display and converts them to the html container for the column.
565
-     *
566
-     * @param array $datetime_strings
567
-     * @return string
568
-     */
569
-    public function generateDisplayForDatetimes(array $datetime_strings): string
570
-    {
571
-        // get first item for initial visibility
572
-        $content = (string) array_shift($datetime_strings);
573
-        if (! empty($datetime_strings)) {
574
-            $content .= '
472
+		$url_params = ['_REG_ID' => $registration->ID()];
473
+		if ($this->EVT_ID) {
474
+			$url_params['event_id'] = $this->EVT_ID;
475
+		}
476
+		// trash/restore/delete actions
477
+		$actions = $this->trashRegistrationLink($registration, $url_params);
478
+		$actions = $this->restoreRegistrationLink($registration, $url_params, $actions);
479
+		$actions = $this->deleteRegistrationLink($registration, $url_params, $actions);
480
+
481
+		$content = sprintf('%1$s %2$s', $content, $this->row_actions($actions));
482
+
483
+		return $prep_content ? $this->columnContent('ATT_fname', $content) : $content;
484
+	}
485
+
486
+
487
+	/**
488
+	 * @param EE_Registration $registration
489
+	 * @param bool            $prep_content
490
+	 * @return string
491
+	 * @throws EE_Error
492
+	 * @throws ReflectionException
493
+	 */
494
+	public function column__REG_date(EE_Registration $registration, bool $prep_content = true): string
495
+	{
496
+		$this->_set_related_details($registration);
497
+		// Build row actions
498
+		$content = $this->caps_handler->userCanViewTransaction()
499
+			? '<a class="ee-aria-tooltip ee-status-color--' . $this->_transaction_details['status'] . '" href="'
500
+			. $this->viewTransactionUrl()
501
+			. '" aria-label="'
502
+			. esc_attr($this->_transaction_details['title_attr'])
503
+			. '">'
504
+			. $registration->get_i18n_datetime('REG_date', 'M jS Y g:i a')
505
+			. '</a>'
506
+			: $registration->get_i18n_datetime('REG_date');
507
+
508
+		return $prep_content ? $this->columnContent('_REG_date', $content) : $content;
509
+	}
510
+
511
+
512
+	/**
513
+	 * @param EE_Registration $registration
514
+	 * @return string
515
+	 * @throws EE_Error
516
+	 * @throws InvalidArgumentException
517
+	 * @throws InvalidDataTypeException
518
+	 * @throws InvalidInterfaceException
519
+	 * @throws ReflectionException
520
+	 */
521
+	public function column_event_name(EE_Registration $registration): string
522
+	{
523
+		$this->_set_related_details($registration);
524
+		$EVT_ID                  = $registration->event_ID();
525
+		$event_name              = $registration->event_name();
526
+		$event_name              = $event_name ?: esc_html__("No Associated Event", 'event_espresso');
527
+		$event_name              = wp_trim_words($event_name, 30, '...');
528
+		$edit_event              = $this->editEventLink($EVT_ID, $event_name);
529
+		$actions['event_filter'] = $this->eventFilterLink($EVT_ID, $event_name);
530
+		$content                 = sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions));
531
+
532
+		return $this->columnContent('event_name', $content);
533
+	}
534
+
535
+
536
+	/**
537
+	 * @param EE_Registration $registration
538
+	 * @return string
539
+	 * @throws EE_Error
540
+	 * @throws InvalidArgumentException
541
+	 * @throws InvalidDataTypeException
542
+	 * @throws InvalidInterfaceException
543
+	 * @throws ReflectionException
544
+	 */
545
+	public function column_DTT_EVT_start(EE_Registration $registration): string
546
+	{
547
+		$datetime_strings = [];
548
+		$ticket           = $registration->ticket();
549
+		if ($ticket instanceof EE_Ticket) {
550
+			$remove_defaults = ['default_where_conditions' => 'none'];
551
+			$datetimes       = $ticket->datetimes($remove_defaults);
552
+			foreach ($datetimes as $datetime) {
553
+				$datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start', 'M jS Y g:i a');
554
+			}
555
+			$content = $this->generateDisplayForDatetimes($datetime_strings);
556
+		} else {
557
+			$content = esc_html__('There is no ticket on this registration', 'event_espresso');
558
+		}
559
+		return $this->columnContent('DTT_EVT_start', $content);
560
+	}
561
+
562
+
563
+	/**
564
+	 * Receives an array of datetime strings to display and converts them to the html container for the column.
565
+	 *
566
+	 * @param array $datetime_strings
567
+	 * @return string
568
+	 */
569
+	public function generateDisplayForDatetimes(array $datetime_strings): string
570
+	{
571
+		// get first item for initial visibility
572
+		$content = (string) array_shift($datetime_strings);
573
+		if (! empty($datetime_strings)) {
574
+			$content .= '
575 575
                 <div class="ee-registration-event-datetimes-container-wrap">
576 576
                     <button aria-label="' . esc_attr__('Click to view all dates', 'event_espresso') . '"
577 577
                           class="ee-aria-tooltip button button--secondary button--tiny button--icon-only ee-js ee-more-datetimes-toggle"
@@ -582,535 +582,535 @@  discard block
 block discarded – undo
582 582
                         ' . implode("", $datetime_strings) . '
583 583
                     </div>
584 584
                 </div>';
585
-        }
586
-        return $content;
587
-    }
588
-
589
-
590
-    /**
591
-     * @param EE_Registration $registration
592
-     * @return string
593
-     * @throws EE_Error
594
-     * @throws InvalidArgumentException
595
-     * @throws InvalidDataTypeException
596
-     * @throws InvalidInterfaceException
597
-     * @throws ReflectionException
598
-     */
599
-    public function column_ATT_email(EE_Registration $registration): string
600
-    {
601
-        $attendee = $registration->get_first_related('Attendee');
602
-        $content  = ! $attendee instanceof EE_Attendee
603
-            ? esc_html__('No attached contact record.', 'event_espresso')
604
-            : $attendee->email();
605
-        return $this->columnContent('ATT_email', $content);
606
-    }
607
-
608
-
609
-    /**
610
-     * @param EE_Registration $registration
611
-     * @return string
612
-     * @throws EE_Error
613
-     * @throws ReflectionException
614
-     */
615
-    public function column__REG_count(EE_Registration $registration): string
616
-    {
617
-        $content = sprintf(
618
-            esc_html__('%1$s / %2$s', 'event_espresso'),
619
-            $registration->count(),
620
-            $registration->group_size()
621
-        );
622
-        return $this->columnContent('_REG_count', $content);
623
-    }
624
-
625
-
626
-    /**
627
-     * @param EE_Registration $registration
628
-     * @return string
629
-     * @throws EE_Error
630
-     * @throws ReflectionException
631
-     */
632
-    public function column_PRC_amount(EE_Registration $registration): string
633
-    {
634
-        $ticket = $registration->ticket();
635
-
636
-        $content = $this->EVT_ID && $ticket instanceof EE_Ticket
637
-            ? '<div class="TKT_name">' . $ticket->name() . '</div>'
638
-            : '';
639
-
640
-        $payment_status = $registration->owes_monies_and_can_pay() ? 'TFL' : 'TCM';
641
-        $content        .= $registration->final_price() > 0
642
-            ? '<span class="reg-overview-paid-event-spn ee-status-color--' . $payment_status . '">
585
+		}
586
+		return $content;
587
+	}
588
+
589
+
590
+	/**
591
+	 * @param EE_Registration $registration
592
+	 * @return string
593
+	 * @throws EE_Error
594
+	 * @throws InvalidArgumentException
595
+	 * @throws InvalidDataTypeException
596
+	 * @throws InvalidInterfaceException
597
+	 * @throws ReflectionException
598
+	 */
599
+	public function column_ATT_email(EE_Registration $registration): string
600
+	{
601
+		$attendee = $registration->get_first_related('Attendee');
602
+		$content  = ! $attendee instanceof EE_Attendee
603
+			? esc_html__('No attached contact record.', 'event_espresso')
604
+			: $attendee->email();
605
+		return $this->columnContent('ATT_email', $content);
606
+	}
607
+
608
+
609
+	/**
610
+	 * @param EE_Registration $registration
611
+	 * @return string
612
+	 * @throws EE_Error
613
+	 * @throws ReflectionException
614
+	 */
615
+	public function column__REG_count(EE_Registration $registration): string
616
+	{
617
+		$content = sprintf(
618
+			esc_html__('%1$s / %2$s', 'event_espresso'),
619
+			$registration->count(),
620
+			$registration->group_size()
621
+		);
622
+		return $this->columnContent('_REG_count', $content);
623
+	}
624
+
625
+
626
+	/**
627
+	 * @param EE_Registration $registration
628
+	 * @return string
629
+	 * @throws EE_Error
630
+	 * @throws ReflectionException
631
+	 */
632
+	public function column_PRC_amount(EE_Registration $registration): string
633
+	{
634
+		$ticket = $registration->ticket();
635
+
636
+		$content = $this->EVT_ID && $ticket instanceof EE_Ticket
637
+			? '<div class="TKT_name">' . $ticket->name() . '</div>'
638
+			: '';
639
+
640
+		$payment_status = $registration->owes_monies_and_can_pay() ? 'TFL' : 'TCM';
641
+		$content        .= $registration->final_price() > 0
642
+			? '<span class="reg-overview-paid-event-spn ee-status-color--' . $payment_status . '">
643 643
                 ' . $registration->pretty_final_price() . '
644 644
                </span>'
645
-            // free event
646
-            : '<span class="reg-overview-free-event-spn">' . esc_html__('free', 'event_espresso') . '</span>';
647
-
648
-        return $this->columnContent('PRC_amount', $content, 'end');
649
-    }
650
-
651
-
652
-    /**
653
-     * @param EE_Registration $registration
654
-     * @return string
655
-     * @throws EE_Error
656
-     * @throws ReflectionException
657
-     */
658
-    public function column__REG_final_price(EE_Registration $registration): string
659
-    {
660
-        $ticket  = $registration->ticket();
661
-        $content = $this->EVT_ID || ! $ticket instanceof EE_Ticket
662
-            ? ''
663
-            : '<span class="TKT_name ee-status-color--' . $ticket->ticket_status() . '">' . $ticket->name() . '</span>';
664
-
665
-        $content .= '<span class="reg-overview-paid-event-spn">' . $registration->pretty_final_price() . '</span>';
666
-        return $this->columnContent('_REG_final_price', $content, 'end');
667
-    }
668
-
669
-
670
-    /**
671
-     * @param EE_Registration $registration
672
-     * @return string
673
-     * @throws EE_Error
674
-     * @throws ReflectionException
675
-     */
676
-    public function column__REG_paid(EE_Registration $registration): string
677
-    {
678
-        $payment_method      = $registration->payment_method();
679
-        $payment_method_name = $payment_method instanceof EE_Payment_Method
680
-            ? $payment_method->admin_name()
681
-            : esc_html__('Unknown', 'event_espresso');
682
-
683
-        $payment_status = $registration->owes_monies_and_can_pay() ? 'TFL' : 'TCM';
684
-        $content        = '
645
+			// free event
646
+			: '<span class="reg-overview-free-event-spn">' . esc_html__('free', 'event_espresso') . '</span>';
647
+
648
+		return $this->columnContent('PRC_amount', $content, 'end');
649
+	}
650
+
651
+
652
+	/**
653
+	 * @param EE_Registration $registration
654
+	 * @return string
655
+	 * @throws EE_Error
656
+	 * @throws ReflectionException
657
+	 */
658
+	public function column__REG_final_price(EE_Registration $registration): string
659
+	{
660
+		$ticket  = $registration->ticket();
661
+		$content = $this->EVT_ID || ! $ticket instanceof EE_Ticket
662
+			? ''
663
+			: '<span class="TKT_name ee-status-color--' . $ticket->ticket_status() . '">' . $ticket->name() . '</span>';
664
+
665
+		$content .= '<span class="reg-overview-paid-event-spn">' . $registration->pretty_final_price() . '</span>';
666
+		return $this->columnContent('_REG_final_price', $content, 'end');
667
+	}
668
+
669
+
670
+	/**
671
+	 * @param EE_Registration $registration
672
+	 * @return string
673
+	 * @throws EE_Error
674
+	 * @throws ReflectionException
675
+	 */
676
+	public function column__REG_paid(EE_Registration $registration): string
677
+	{
678
+		$payment_method      = $registration->payment_method();
679
+		$payment_method_name = $payment_method instanceof EE_Payment_Method
680
+			? $payment_method->admin_name()
681
+			: esc_html__('Unknown', 'event_espresso');
682
+
683
+		$payment_status = $registration->owes_monies_and_can_pay() ? 'TFL' : 'TCM';
684
+		$content        = '
685 685
             <span class="reg-overview-paid-event-spn ee-status-color--' . $payment_status . '">
686 686
                 ' . $registration->pretty_paid() . '
687 687
             </span>';
688
-        if ($registration->paid() > 0) {
689
-            $content .= '<span class="ee-status-text-small">'
690
-                . sprintf(
691
-                    esc_html__('...via %s', 'event_espresso'),
692
-                    $payment_method_name
693
-                )
694
-                . '</span>';
695
-        }
696
-        return $this->columnContent('_REG_paid', $content, 'end');
697
-    }
698
-
699
-
700
-    /**
701
-     * @param EE_Registration $registration
702
-     * @return string
703
-     * @throws EE_Error
704
-     * @throws EntityNotFoundException
705
-     * @throws InvalidArgumentException
706
-     * @throws InvalidDataTypeException
707
-     * @throws InvalidInterfaceException
708
-     * @throws ReflectionException
709
-     */
710
-    public function column_TXN_total(EE_Registration $registration): string
711
-    {
712
-        if ($registration->transaction()) {
713
-            $content = $this->caps_handler->userCanViewTransaction()
714
-                ? '
688
+		if ($registration->paid() > 0) {
689
+			$content .= '<span class="ee-status-text-small">'
690
+				. sprintf(
691
+					esc_html__('...via %s', 'event_espresso'),
692
+					$payment_method_name
693
+				)
694
+				. '</span>';
695
+		}
696
+		return $this->columnContent('_REG_paid', $content, 'end');
697
+	}
698
+
699
+
700
+	/**
701
+	 * @param EE_Registration $registration
702
+	 * @return string
703
+	 * @throws EE_Error
704
+	 * @throws EntityNotFoundException
705
+	 * @throws InvalidArgumentException
706
+	 * @throws InvalidDataTypeException
707
+	 * @throws InvalidInterfaceException
708
+	 * @throws ReflectionException
709
+	 */
710
+	public function column_TXN_total(EE_Registration $registration): string
711
+	{
712
+		if ($registration->transaction()) {
713
+			$content = $this->caps_handler->userCanViewTransaction()
714
+				? '
715 715
                     <a class="ee-aria-tooltip ee-status-color--' . $registration->transaction()->status_ID() . '"
716 716
                         href="' . $this->viewTransactionUrl() . '"
717 717
                         aria-label="' . esc_attr__('View Transaction', 'event_espresso') . '"
718 718
                     >
719 719
                         ' . $registration->transaction()->pretty_total() . '
720 720
                     </a>'
721
-                : $registration->transaction()->pretty_total();
722
-        } else {
723
-            $content = esc_html__("None", "event_espresso");
724
-        }
725
-        return $this->columnContent('TXN_total', $content, 'end');
726
-    }
727
-
728
-
729
-    /**
730
-     * @param EE_Registration $registration
731
-     * @return string
732
-     * @throws EE_Error
733
-     * @throws EntityNotFoundException
734
-     * @throws InvalidArgumentException
735
-     * @throws InvalidDataTypeException
736
-     * @throws InvalidInterfaceException
737
-     * @throws ReflectionException
738
-     */
739
-    public function column_TXN_paid(EE_Registration $registration): string
740
-    {
741
-        $content = '&nbsp;';
742
-        $align   = 'end';
743
-        if ($registration->count() === 1) {
744
-            $transaction = $registration->transaction()
745
-                ? $registration->transaction()
746
-                : EE_Transaction::new_instance();
747
-            if ($transaction->paid() >= $transaction->total()) {
748
-                $align   = 'center';
749
-                $content = '<span class="dashicons dashicons-yes green-icon"></span>';
750
-            } else {
751
-                $content = $this->caps_handler->userCanViewTransaction()
752
-                    ? '
721
+				: $registration->transaction()->pretty_total();
722
+		} else {
723
+			$content = esc_html__("None", "event_espresso");
724
+		}
725
+		return $this->columnContent('TXN_total', $content, 'end');
726
+	}
727
+
728
+
729
+	/**
730
+	 * @param EE_Registration $registration
731
+	 * @return string
732
+	 * @throws EE_Error
733
+	 * @throws EntityNotFoundException
734
+	 * @throws InvalidArgumentException
735
+	 * @throws InvalidDataTypeException
736
+	 * @throws InvalidInterfaceException
737
+	 * @throws ReflectionException
738
+	 */
739
+	public function column_TXN_paid(EE_Registration $registration): string
740
+	{
741
+		$content = '&nbsp;';
742
+		$align   = 'end';
743
+		if ($registration->count() === 1) {
744
+			$transaction = $registration->transaction()
745
+				? $registration->transaction()
746
+				: EE_Transaction::new_instance();
747
+			if ($transaction->paid() >= $transaction->total()) {
748
+				$align   = 'center';
749
+				$content = '<span class="dashicons dashicons-yes green-icon"></span>';
750
+			} else {
751
+				$content = $this->caps_handler->userCanViewTransaction()
752
+					? '
753 753
                     <a class="ee-aria-tooltip ee-status-color--' . $transaction->status_ID() . '"
754 754
                         href="' . $this->viewTransactionUrl() . '"
755 755
                         aria-label="' . esc_attr__('View Transaction', 'event_espresso') . '"
756 756
                     >
757 757
                         ' . $registration->transaction()->pretty_paid() . '
758 758
                     </a>'
759
-                    : $registration->transaction()->pretty_paid();
760
-            }
761
-        }
762
-        return $this->columnContent('TXN_paid', $content, $align);
763
-    }
764
-
765
-
766
-    /**
767
-     * @param EE_Registration $registration
768
-     * @return string
769
-     * @throws EE_Error
770
-     * @throws InvalidArgumentException
771
-     * @throws InvalidDataTypeException
772
-     * @throws InvalidInterfaceException
773
-     * @throws ReflectionException
774
-     */
775
-    public function column_actions(EE_Registration $registration): string
776
-    {
777
-        $attendee = $registration->attendee();
778
-        $this->_set_related_details($registration);
779
-
780
-        // Build and filter row actions
781
-        $actions = apply_filters(
782
-            'FHEE__EE_Registrations_List_Table__column_actions__actions',
783
-            [
784
-                'view_lnk'               => $this->viewRegistrationAction($registration),
785
-                'edit_lnk'               => $this->editContactAction($registration, $attendee),
786
-                'resend_reg_lnk'         => $this->resendRegistrationMessageAction($registration, $attendee),
787
-                'view_txn_lnk'           => $this->viewTransactionAction(),
788
-                'dl_invoice_lnk'         => $this->viewTransactionInvoiceAction($registration, $attendee),
789
-                'filtered_messages_link' => $this->viewNotificationsAction($registration),
790
-            ],
791
-            $registration,
792
-            $this
793
-        );
794
-
795
-        $content = $this->_action_string(
796
-            implode('', $actions),
797
-            $registration,
798
-            'div',
799
-            'reg-overview-actions ee-list-table-actions'
800
-        );
801
-
802
-        return $this->columnContent('actions', $this->actionsModalMenu($content));
803
-    }
804
-
805
-
806
-    /**
807
-     * @throws EE_Error
808
-     * @throws ReflectionException
809
-     */
810
-    private function viewRegistrationUrl(EE_Registration $registration): string
811
-    {
812
-        return EE_Admin_Page::add_query_args_and_nonce(
813
-            [
814
-                'action'  => 'view_registration',
815
-                '_REG_ID' => $registration->ID(),
816
-            ],
817
-            REG_ADMIN_URL
818
-        );
819
-    }
820
-
821
-
822
-    /**
823
-     * @throws EE_Error
824
-     * @throws ReflectionException
825
-     */
826
-    private function viewRegistrationLink(
827
-        EE_Registration $registration,
828
-        string $status
829
-    ): string {
830
-        $attendee      = $registration->attendee();
831
-        $attendee_name = $attendee instanceof EE_Attendee
832
-            ? $attendee->full_name()
833
-            : '';
834
-        return $this->caps_handler->userCanReadRegistration($registration)
835
-            ? '
759
+					: $registration->transaction()->pretty_paid();
760
+			}
761
+		}
762
+		return $this->columnContent('TXN_paid', $content, $align);
763
+	}
764
+
765
+
766
+	/**
767
+	 * @param EE_Registration $registration
768
+	 * @return string
769
+	 * @throws EE_Error
770
+	 * @throws InvalidArgumentException
771
+	 * @throws InvalidDataTypeException
772
+	 * @throws InvalidInterfaceException
773
+	 * @throws ReflectionException
774
+	 */
775
+	public function column_actions(EE_Registration $registration): string
776
+	{
777
+		$attendee = $registration->attendee();
778
+		$this->_set_related_details($registration);
779
+
780
+		// Build and filter row actions
781
+		$actions = apply_filters(
782
+			'FHEE__EE_Registrations_List_Table__column_actions__actions',
783
+			[
784
+				'view_lnk'               => $this->viewRegistrationAction($registration),
785
+				'edit_lnk'               => $this->editContactAction($registration, $attendee),
786
+				'resend_reg_lnk'         => $this->resendRegistrationMessageAction($registration, $attendee),
787
+				'view_txn_lnk'           => $this->viewTransactionAction(),
788
+				'dl_invoice_lnk'         => $this->viewTransactionInvoiceAction($registration, $attendee),
789
+				'filtered_messages_link' => $this->viewNotificationsAction($registration),
790
+			],
791
+			$registration,
792
+			$this
793
+		);
794
+
795
+		$content = $this->_action_string(
796
+			implode('', $actions),
797
+			$registration,
798
+			'div',
799
+			'reg-overview-actions ee-list-table-actions'
800
+		);
801
+
802
+		return $this->columnContent('actions', $this->actionsModalMenu($content));
803
+	}
804
+
805
+
806
+	/**
807
+	 * @throws EE_Error
808
+	 * @throws ReflectionException
809
+	 */
810
+	private function viewRegistrationUrl(EE_Registration $registration): string
811
+	{
812
+		return EE_Admin_Page::add_query_args_and_nonce(
813
+			[
814
+				'action'  => 'view_registration',
815
+				'_REG_ID' => $registration->ID(),
816
+			],
817
+			REG_ADMIN_URL
818
+		);
819
+	}
820
+
821
+
822
+	/**
823
+	 * @throws EE_Error
824
+	 * @throws ReflectionException
825
+	 */
826
+	private function viewRegistrationLink(
827
+		EE_Registration $registration,
828
+		string $status
829
+	): string {
830
+		$attendee      = $registration->attendee();
831
+		$attendee_name = $attendee instanceof EE_Attendee
832
+			? $attendee->full_name()
833
+			: '';
834
+		return $this->caps_handler->userCanReadRegistration($registration)
835
+			? '
836 836
             <a  href="' . $this->viewRegistrationUrl($registration) . '"
837 837
                 class="row-title ee-status-color--' . $status . ' ee-aria-tooltip"
838 838
                 aria-label="' . esc_attr__('View Registration Details', 'event_espresso') . '"
839 839
             >
840 840
                 ' . $attendee_name . '
841 841
             </a>'
842
-            : $attendee_name;
843
-    }
844
-
845
-
846
-    /**
847
-     * @throws EE_Error
848
-     * @throws ReflectionException
849
-     */
850
-    private function viewRegistrationAction(EE_Registration $registration): string
851
-    {
852
-        return $this->caps_handler->userCanReadRegistration($registration)
853
-            ? '
842
+			: $attendee_name;
843
+	}
844
+
845
+
846
+	/**
847
+	 * @throws EE_Error
848
+	 * @throws ReflectionException
849
+	 */
850
+	private function viewRegistrationAction(EE_Registration $registration): string
851
+	{
852
+		return $this->caps_handler->userCanReadRegistration($registration)
853
+			? '
854 854
             <a  href="' . $this->viewRegistrationUrl($registration) . '"
855 855
                 class="ee-aria-tooltip button button--icon-only"
856 856
                 aria-label="' . esc_attr__('View Registration Details', 'event_espresso') . '"
857 857
             >
858 858
                 <span class="dashicons dashicons-clipboard"></span>
859 859
             </a>'
860
-            : '';
861
-    }
862
-
863
-
864
-    private function editContactAction(EE_Registration $registration, ?EE_Attendee $attendee = null): string
865
-    {
866
-        if ($attendee instanceof EE_Attendee && $this->caps_handler->userCanEditContacts()) {
867
-            $edit_link_url = EE_Admin_Page::add_query_args_and_nonce(
868
-                [
869
-                    'action' => 'edit_attendee',
870
-                    'post'   => $registration->attendee_ID(),
871
-                ],
872
-                REG_ADMIN_URL
873
-            );
874
-            return '
860
+			: '';
861
+	}
862
+
863
+
864
+	private function editContactAction(EE_Registration $registration, ?EE_Attendee $attendee = null): string
865
+	{
866
+		if ($attendee instanceof EE_Attendee && $this->caps_handler->userCanEditContacts()) {
867
+			$edit_link_url = EE_Admin_Page::add_query_args_and_nonce(
868
+				[
869
+					'action' => 'edit_attendee',
870
+					'post'   => $registration->attendee_ID(),
871
+				],
872
+				REG_ADMIN_URL
873
+			);
874
+			return '
875 875
                 <a href="' . $edit_link_url . '"
876 876
                    aria-label="' . esc_attr__('Edit Contact Details', 'event_espresso') . '"
877 877
                    class="ee-aria-tooltip button button--secondary button--icon-only"
878 878
                 >
879 879
                     <span class="dashicons dashicons-admin-users"></span>
880 880
                 </a>';
881
-        }
882
-        return '';
883
-    }
884
-
885
-
886
-    /**
887
-     * @throws EE_Error
888
-     * @throws ReflectionException
889
-     */
890
-    private function resendRegistrationMessageAction(
891
-        EE_Registration $registration,
892
-        ?EE_Attendee $attendee = null
893
-    ): string {
894
-        if ($attendee instanceof EE_Attendee && $this->caps_handler->userCanResendMessage($registration)) {
895
-            $resend_reg_link_url = EE_Admin_Page::add_query_args_and_nonce(
896
-                [
897
-                    'action'  => 'resend_registration',
898
-                    '_REG_ID' => $registration->ID(),
899
-                ],
900
-                REG_ADMIN_URL,
901
-                true
902
-            );
903
-            return '
881
+		}
882
+		return '';
883
+	}
884
+
885
+
886
+	/**
887
+	 * @throws EE_Error
888
+	 * @throws ReflectionException
889
+	 */
890
+	private function resendRegistrationMessageAction(
891
+		EE_Registration $registration,
892
+		?EE_Attendee $attendee = null
893
+	): string {
894
+		if ($attendee instanceof EE_Attendee && $this->caps_handler->userCanResendMessage($registration)) {
895
+			$resend_reg_link_url = EE_Admin_Page::add_query_args_and_nonce(
896
+				[
897
+					'action'  => 'resend_registration',
898
+					'_REG_ID' => $registration->ID(),
899
+				],
900
+				REG_ADMIN_URL,
901
+				true
902
+			);
903
+			return '
904 904
 			    <a href="' . $resend_reg_link_url . '" aria-label="'
905
-                . esc_attr__('Resend Registration Details', 'event_espresso')
906
-                . '" class="ee-aria-tooltip button button--icon-only">
905
+				. esc_attr__('Resend Registration Details', 'event_espresso')
906
+				. '" class="ee-aria-tooltip button button--icon-only">
907 907
 			        <span class="dashicons dashicons-email-alt"></span>
908 908
 			    </a>';
909
-        }
910
-        return '';
911
-    }
912
-
913
-
914
-    private function viewTransactionUrl(): string
915
-    {
916
-        return EE_Admin_Page::add_query_args_and_nonce(
917
-            [
918
-                'action' => 'view_transaction',
919
-                'TXN_ID' => $this->_transaction_details['id'],
920
-            ],
921
-            TXN_ADMIN_URL
922
-        );
923
-    }
924
-
925
-
926
-    private function viewTransactionAction(): string
927
-    {
928
-        if ($this->caps_handler->userCanViewTransaction()) {
929
-            return '
909
+		}
910
+		return '';
911
+	}
912
+
913
+
914
+	private function viewTransactionUrl(): string
915
+	{
916
+		return EE_Admin_Page::add_query_args_and_nonce(
917
+			[
918
+				'action' => 'view_transaction',
919
+				'TXN_ID' => $this->_transaction_details['id'],
920
+			],
921
+			TXN_ADMIN_URL
922
+		);
923
+	}
924
+
925
+
926
+	private function viewTransactionAction(): string
927
+	{
928
+		if ($this->caps_handler->userCanViewTransaction()) {
929
+			return '
930 930
                 <a class="ee-aria-tooltip button button--icon-only"
931 931
                    href="' . $this->viewTransactionUrl() . '"
932 932
                    aria-label="' . $this->_transaction_details['title_attr'] . '"
933 933
                 >
934 934
                     <span class="dashicons dashicons-cart"></span>
935 935
                 </a>';
936
-        }
937
-        return '';
938
-    }
939
-
940
-
941
-    /**
942
-     * @throws EE_Error
943
-     * @throws ReflectionException
944
-     */
945
-    private function viewTransactionInvoiceAction(
946
-        EE_Registration $registration,
947
-        ?EE_Attendee $attendee = null
948
-    ): string {
949
-        // only show invoice link if message type is active.
950
-        if (
951
-            $attendee instanceof EE_Attendee
952
-            && $registration->is_primary_registrant()
953
-            && EEH_MSG_Template::is_mt_active('invoice')
954
-        ) {
955
-            return '
936
+		}
937
+		return '';
938
+	}
939
+
940
+
941
+	/**
942
+	 * @throws EE_Error
943
+	 * @throws ReflectionException
944
+	 */
945
+	private function viewTransactionInvoiceAction(
946
+		EE_Registration $registration,
947
+		?EE_Attendee $attendee = null
948
+	): string {
949
+		// only show invoice link if message type is active.
950
+		if (
951
+			$attendee instanceof EE_Attendee
952
+			&& $registration->is_primary_registrant()
953
+			&& EEH_MSG_Template::is_mt_active('invoice')
954
+		) {
955
+			return '
956 956
                 <a aria-label="' . esc_attr__('View Transaction Invoice', 'event_espresso')
957
-                . '" target="_blank" href="' . $registration->invoice_url() . '" class="ee-aria-tooltip button button--icon-only">
957
+				. '" target="_blank" href="' . $registration->invoice_url() . '" class="ee-aria-tooltip button button--icon-only">
958 958
                     <span class="dashicons dashicons-media-spreadsheet"></span>
959 959
                 </a>';
960
-        }
961
-        return '';
962
-    }
963
-
964
-
965
-    /**
966
-     * @throws ReflectionException
967
-     * @throws EE_Error
968
-     */
969
-    private function viewNotificationsAction(EE_Registration $registration): string
970
-    {
971
-        // message list table link (filtered by REG_ID
972
-        return $this->caps_handler->userCanReadGlobalMessages()
973
-            ? EEH_MSG_Template::get_message_action_link(
974
-                'see_notifications_for',
975
-                null,
976
-                ['_REG_ID' => $registration->ID()]
977
-            )
978
-            : '';
979
-    }
980
-
981
-
982
-    /**
983
-     * @throws EE_Error
984
-     * @throws ReflectionException
985
-     */
986
-    private function trashRegistrationLink(
987
-        EE_Registration $registration,
988
-        array $url_params
989
-    ): array {
990
-        $actions = [];
991
-        // can't trash what's already trashed
992
-        if ($this->_view === 'trash') {
993
-            return $actions;
994
-        }
995
-
996
-        // check caps
997
-        if (! $this->caps_handler->userCanTrashRegistration($registration)) {
998
-            return $actions;
999
-        }
1000
-
1001
-        // don't delete registrations that have payments applied
1002
-        $transaction   = $registration->transaction();
1003
-        $payment_count = $transaction instanceof EE_Transaction
1004
-            ? $transaction->count_related('Payment')
1005
-            : 0;
1006
-
1007
-        if ($payment_count > 0) {
1008
-            return $actions;
1009
-        }
1010
-
1011
-        $url_params['action'] = 'trash_registrations';
1012
-        $trash_link_url       = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL);
1013
-        $actions['trash']     = '
960
+		}
961
+		return '';
962
+	}
963
+
964
+
965
+	/**
966
+	 * @throws ReflectionException
967
+	 * @throws EE_Error
968
+	 */
969
+	private function viewNotificationsAction(EE_Registration $registration): string
970
+	{
971
+		// message list table link (filtered by REG_ID
972
+		return $this->caps_handler->userCanReadGlobalMessages()
973
+			? EEH_MSG_Template::get_message_action_link(
974
+				'see_notifications_for',
975
+				null,
976
+				['_REG_ID' => $registration->ID()]
977
+			)
978
+			: '';
979
+	}
980
+
981
+
982
+	/**
983
+	 * @throws EE_Error
984
+	 * @throws ReflectionException
985
+	 */
986
+	private function trashRegistrationLink(
987
+		EE_Registration $registration,
988
+		array $url_params
989
+	): array {
990
+		$actions = [];
991
+		// can't trash what's already trashed
992
+		if ($this->_view === 'trash') {
993
+			return $actions;
994
+		}
995
+
996
+		// check caps
997
+		if (! $this->caps_handler->userCanTrashRegistration($registration)) {
998
+			return $actions;
999
+		}
1000
+
1001
+		// don't delete registrations that have payments applied
1002
+		$transaction   = $registration->transaction();
1003
+		$payment_count = $transaction instanceof EE_Transaction
1004
+			? $transaction->count_related('Payment')
1005
+			: 0;
1006
+
1007
+		if ($payment_count > 0) {
1008
+			return $actions;
1009
+		}
1010
+
1011
+		$url_params['action'] = 'trash_registrations';
1012
+		$trash_link_url       = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL);
1013
+		$actions['trash']     = '
1014 1014
             <a class="ee-aria-tooltip"
1015 1015
                 href="' . $trash_link_url . '"
1016 1016
                 aria-label="' . esc_attr__('Trash Registration', 'event_espresso') . '"
1017 1017
             >
1018 1018
                 ' . esc_html__('Trash', 'event_espresso') . '
1019 1019
             </a>';
1020
-        return $actions;
1021
-    }
1022
-
1023
-
1024
-    /**
1025
-     * @throws EE_Error
1026
-     * @throws ReflectionException
1027
-     */
1028
-    private function restoreRegistrationLink(
1029
-        EE_Registration $registration,
1030
-        array $url_params,
1031
-        array $actions
1032
-    ): array {
1033
-        // can't restore what's not trashed
1034
-        if ($this->_view !== 'trash') {
1035
-            return $actions;
1036
-        }
1037
-
1038
-        // restore registration link
1039
-        if ($this->caps_handler->userCanRestoreRegistration($registration)) {
1040
-            $url_params['action'] = 'restore_registrations';
1041
-            $restore_link_url     = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL);
1042
-            $actions['restore']   = '
1020
+		return $actions;
1021
+	}
1022
+
1023
+
1024
+	/**
1025
+	 * @throws EE_Error
1026
+	 * @throws ReflectionException
1027
+	 */
1028
+	private function restoreRegistrationLink(
1029
+		EE_Registration $registration,
1030
+		array $url_params,
1031
+		array $actions
1032
+	): array {
1033
+		// can't restore what's not trashed
1034
+		if ($this->_view !== 'trash') {
1035
+			return $actions;
1036
+		}
1037
+
1038
+		// restore registration link
1039
+		if ($this->caps_handler->userCanRestoreRegistration($registration)) {
1040
+			$url_params['action'] = 'restore_registrations';
1041
+			$restore_link_url     = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL);
1042
+			$actions['restore']   = '
1043 1043
                 <a class="ee-aria-tooltip"
1044 1044
                     href="' . $restore_link_url . '"
1045 1045
                     aria-label="' . esc_attr__('Restore Registration', 'event_espresso') . '"
1046 1046
                 >
1047 1047
                     ' . esc_html__('Restore', 'event_espresso') . '
1048 1048
                 </a>';
1049
-        }
1050
-
1051
-        return $actions;
1052
-    }
1053
-
1054
-
1055
-    /**
1056
-     * @throws EE_Error
1057
-     * @throws ReflectionException
1058
-     */
1059
-    private function deleteRegistrationLink(
1060
-        EE_Registration $registration,
1061
-        array $url_params,
1062
-        array $actions
1063
-    ): array {
1064
-        if ($this->_view === 'trash' && $this->caps_handler->userCanDeleteRegistration($registration)) {
1065
-            $url_params['action'] = 'delete_registrations';
1066
-            $delete_link_url      = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL);
1067
-            $actions['delete']    = '
1049
+		}
1050
+
1051
+		return $actions;
1052
+	}
1053
+
1054
+
1055
+	/**
1056
+	 * @throws EE_Error
1057
+	 * @throws ReflectionException
1058
+	 */
1059
+	private function deleteRegistrationLink(
1060
+		EE_Registration $registration,
1061
+		array $url_params,
1062
+		array $actions
1063
+	): array {
1064
+		if ($this->_view === 'trash' && $this->caps_handler->userCanDeleteRegistration($registration)) {
1065
+			$url_params['action'] = 'delete_registrations';
1066
+			$delete_link_url      = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL);
1067
+			$actions['delete']    = '
1068 1068
                 <a class="ee-aria-tooltip"
1069 1069
                     href="' . $delete_link_url . '"
1070 1070
                     aria-label="' . esc_attr__('Delete Registration Permanently', 'event_espresso') . '"
1071 1071
                 >
1072 1072
                     ' . esc_html__('Delete', 'event_espresso') . '
1073 1073
                 </a>';
1074
-        }
1075
-        return $actions;
1076
-    }
1077
-
1078
-
1079
-    private function editEventLink(int $EVT_ID, string $event_name): string
1080
-    {
1081
-        if (! $EVT_ID || ! $this->caps_handler->userCanEditEvent($EVT_ID)) {
1082
-            return $event_name;
1083
-        }
1084
-        $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(
1085
-            ['action' => 'edit', 'post' => $EVT_ID],
1086
-            EVENTS_ADMIN_URL
1087
-        );
1088
-        return '
1074
+		}
1075
+		return $actions;
1076
+	}
1077
+
1078
+
1079
+	private function editEventLink(int $EVT_ID, string $event_name): string
1080
+	{
1081
+		if (! $EVT_ID || ! $this->caps_handler->userCanEditEvent($EVT_ID)) {
1082
+			return $event_name;
1083
+		}
1084
+		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(
1085
+			['action' => 'edit', 'post' => $EVT_ID],
1086
+			EVENTS_ADMIN_URL
1087
+		);
1088
+		return '
1089 1089
             <a class="ee-aria-tooltip ee-status-color--' . $this->_event_details['status'] . '"
1090 1090
                 href="' . $edit_event_url . '"
1091 1091
                 aria-label="' . esc_attr($this->_event_details['title_attr']) . '"
1092 1092
             >
1093 1093
                 ' . $event_name . '
1094 1094
             </a>';
1095
-    }
1095
+	}
1096 1096
 
1097 1097
 
1098
-    private function eventFilterLink(int $EVT_ID, string $event_name): string
1099
-    {
1100
-        if (! $EVT_ID) {
1101
-            return '';
1102
-        }
1103
-        $event_filter_url = EE_Admin_Page::add_query_args_and_nonce(['event_id' => $EVT_ID], REG_ADMIN_URL);
1104
-        return '
1098
+	private function eventFilterLink(int $EVT_ID, string $event_name): string
1099
+	{
1100
+		if (! $EVT_ID) {
1101
+			return '';
1102
+		}
1103
+		$event_filter_url = EE_Admin_Page::add_query_args_and_nonce(['event_id' => $EVT_ID], REG_ADMIN_URL);
1104
+		return '
1105 1105
             <a  class="ee-aria-tooltip ee-event-filter-link"
1106 1106
                 href="' . $event_filter_url . '"
1107 1107
                 aria-label="' . sprintf(
1108
-                esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'),
1109
-                $event_name
1110
-            ) . '"
1108
+				esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'),
1109
+				$event_name
1110
+			) . '"
1111 1111
             >
1112 1112
                 <span class="dashicons dashicons-groups dashicons--small"></span>'
1113
-            . esc_html__('View Registrations', 'event_espresso') . '
1113
+			. esc_html__('View Registrations', 'event_espresso') . '
1114 1114
             </a>';
1115
-    }
1115
+	}
1116 1116
 }
Please login to merge, or discard this patch.
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         if ($this->EVT_ID) {
57 57
             $extra_query_args = [];
58 58
             foreach ($admin_page->get_views() as $view_details) {
59
-                $extra_query_args[ $view_details['slug'] ] = ['event_id' => $this->EVT_ID];
59
+                $extra_query_args[$view_details['slug']] = ['event_id' => $this->EVT_ID];
60 60
             }
61 61
             $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args);
62 62
         }
@@ -123,13 +123,13 @@  discard block
 block discarded – undo
123 123
         }
124 124
 
125 125
         $csv_report = RegistrationsCsvReportParams::getRequestParams($return_url, $req_data, $this->EVT_ID, $DTT_ID);
126
-        if (! empty($csv_report)) {
126
+        if ( ! empty($csv_report)) {
127 127
             $this->_bottom_buttons['csv_reg_report'] = $csv_report;
128 128
         }
129 129
 
130 130
         $this->_primary_column   = 'id';
131 131
         $this->_sortable_columns = [
132
-            '_REG_date'     => ['_REG_date' => true],   // true means its already sorted
132
+            '_REG_date'     => ['_REG_date' => true], // true means its already sorted
133 133
             /**
134 134
              * Allows users to change the default sort if they wish.
135 135
              * Returning a falsey on this filter will result in the default sort to be by firstname rather than last
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
             'DTT_EVT_start' => ['DTT_EVT_start' => false],
147 147
             'id'            => ['REG_ID' => false],
148 148
         ];
149
-        $this->_hidden_columns   = [];
149
+        $this->_hidden_columns = [];
150 150
     }
151 151
 
152 152
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
                 $filters[] = EEH_Form_Fields::hidden_input(
245 245
                     $filter_key,
246 246
                     $this->request->getRequestParam($filter_key),
247
-                    'reg_' . $filter_key
247
+                    'reg_'.$filter_key
248 248
                 );
249 249
             }
250 250
         }
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
      */
336 336
     protected function totalRegistrationsYesterday(): int
337 337
     {
338
-        $yesterday    = date('Y-m-d', current_time('timestamp') - DAY_IN_SECONDS);
338
+        $yesterday = date('Y-m-d', current_time('timestamp') - DAY_IN_SECONDS);
339 339
         return $this->totalRegistrationsForDateRange($yesterday, $yesterday);
340 340
     }
341 341
 
@@ -390,10 +390,10 @@  discard block
 block discarded – undo
390 390
         $transaction   = $item->transaction();
391 391
         $payment_count = $transaction->count_related('Payment');
392 392
 
393
-        $content = '<input type="checkbox" name="_REG_ID[]" value="' . $REG_ID . '" />';
393
+        $content = '<input type="checkbox" name="_REG_ID[]" value="'.$REG_ID.'" />';
394 394
         $content .= $payment_count > 0 || ! $this->caps_handler->userCanEditRegistration($item)
395 395
             ? '<span class="ee-locked-entity dashicons dashicons-lock ee-aria-tooltip ee-aria-tooltip--big-box"
396
-                    aria-label="' . $this->lockedRegMessage() . '"></span>'
396
+                    aria-label="' . $this->lockedRegMessage().'"></span>'
397 397
             : '';
398 398
         return $this->columnContent('cb', $content, 'center');
399 399
     }
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
      */
420 420
     public function column_id(EE_Registration $registration): string
421 421
     {
422
-        $content = '<span class="ee-entity-id">' . $registration->ID() . '</span>';
422
+        $content = '<span class="ee-entity-id">'.$registration->ID().'</span>';
423 423
         $content .= '<span class="show-on-mobile-view-only">';
424 424
         $content .= $this->column_ATT_fname($registration, false);
425 425
         $content .= '</span>';
@@ -449,23 +449,23 @@  discard block
 block discarded – undo
449 449
                 esc_html__('(%1$s / %2$s)', 'event_espresso'),
450 450
                 $registration->count(),
451 451
                 $registration->group_size()
452
-            ) . '
452
+            ).'
453 453
             </span >';
454 454
 
455 455
         $content = '
456 456
         <div class="ee-layout-row">
457
-            <span aria-label="' . $pretty_status . '"
458
-                  class="ee-status-dot ee-status-bg--' . $status . ' ee-aria-tooltip"
457
+            <span aria-label="' . $pretty_status.'"
458
+                  class="ee-status-dot ee-status-bg--' . $status.' ee-aria-tooltip"
459 459
             ></span>
460 460
             ' . $this->viewRegistrationLink($registration, $status)
461 461
             . $prime_reg_star
462
-            . $group_count . '
462
+            . $group_count.'
463 463
             <span class="spacer"></span>
464 464
             <span>
465 465
                 ' . sprintf(
466 466
                 esc_html__('Reg Code: %s', 'event_espresso'),
467 467
                 $registration->get('REG_code')
468
-            ) . '
468
+            ).'
469 469
             </span>
470 470
         </div>';
471 471
 
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
         $this->_set_related_details($registration);
497 497
         // Build row actions
498 498
         $content = $this->caps_handler->userCanViewTransaction()
499
-            ? '<a class="ee-aria-tooltip ee-status-color--' . $this->_transaction_details['status'] . '" href="'
499
+            ? '<a class="ee-aria-tooltip ee-status-color--'.$this->_transaction_details['status'].'" href="'
500 500
             . $this->viewTransactionUrl()
501 501
             . '" aria-label="'
502 502
             . esc_attr($this->_transaction_details['title_attr'])
@@ -570,16 +570,16 @@  discard block
 block discarded – undo
570 570
     {
571 571
         // get first item for initial visibility
572 572
         $content = (string) array_shift($datetime_strings);
573
-        if (! empty($datetime_strings)) {
573
+        if ( ! empty($datetime_strings)) {
574 574
             $content .= '
575 575
                 <div class="ee-registration-event-datetimes-container-wrap">
576
-                    <button aria-label="' . esc_attr__('Click to view all dates', 'event_espresso') . '"
576
+                    <button aria-label="' . esc_attr__('Click to view all dates', 'event_espresso').'"
577 577
                           class="ee-aria-tooltip button button--secondary button--tiny button--icon-only ee-js ee-more-datetimes-toggle"
578 578
                     >
579 579
                         <span class="dashicons dashicons-admin-collapse"></span>
580 580
                     </button>
581 581
                     <div class="ee-registration-event-datetimes-container more-items hidden">
582
-                        ' . implode("", $datetime_strings) . '
582
+                        ' . implode("", $datetime_strings).'
583 583
                     </div>
584 584
                 </div>';
585 585
         }
@@ -634,16 +634,16 @@  discard block
 block discarded – undo
634 634
         $ticket = $registration->ticket();
635 635
 
636 636
         $content = $this->EVT_ID && $ticket instanceof EE_Ticket
637
-            ? '<div class="TKT_name">' . $ticket->name() . '</div>'
637
+            ? '<div class="TKT_name">'.$ticket->name().'</div>'
638 638
             : '';
639 639
 
640 640
         $payment_status = $registration->owes_monies_and_can_pay() ? 'TFL' : 'TCM';
641
-        $content        .= $registration->final_price() > 0
642
-            ? '<span class="reg-overview-paid-event-spn ee-status-color--' . $payment_status . '">
643
-                ' . $registration->pretty_final_price() . '
641
+        $content .= $registration->final_price() > 0
642
+            ? '<span class="reg-overview-paid-event-spn ee-status-color--'.$payment_status.'">
643
+                ' . $registration->pretty_final_price().'
644 644
                </span>'
645 645
             // free event
646
-            : '<span class="reg-overview-free-event-spn">' . esc_html__('free', 'event_espresso') . '</span>';
646
+            : '<span class="reg-overview-free-event-spn">'.esc_html__('free', 'event_espresso').'</span>';
647 647
 
648 648
         return $this->columnContent('PRC_amount', $content, 'end');
649 649
     }
@@ -660,9 +660,9 @@  discard block
 block discarded – undo
660 660
         $ticket  = $registration->ticket();
661 661
         $content = $this->EVT_ID || ! $ticket instanceof EE_Ticket
662 662
             ? ''
663
-            : '<span class="TKT_name ee-status-color--' . $ticket->ticket_status() . '">' . $ticket->name() . '</span>';
663
+            : '<span class="TKT_name ee-status-color--'.$ticket->ticket_status().'">'.$ticket->name().'</span>';
664 664
 
665
-        $content .= '<span class="reg-overview-paid-event-spn">' . $registration->pretty_final_price() . '</span>';
665
+        $content .= '<span class="reg-overview-paid-event-spn">'.$registration->pretty_final_price().'</span>';
666 666
         return $this->columnContent('_REG_final_price', $content, 'end');
667 667
     }
668 668
 
@@ -682,8 +682,8 @@  discard block
 block discarded – undo
682 682
 
683 683
         $payment_status = $registration->owes_monies_and_can_pay() ? 'TFL' : 'TCM';
684 684
         $content        = '
685
-            <span class="reg-overview-paid-event-spn ee-status-color--' . $payment_status . '">
686
-                ' . $registration->pretty_paid() . '
685
+            <span class="reg-overview-paid-event-spn ee-status-color--' . $payment_status.'">
686
+                ' . $registration->pretty_paid().'
687 687
             </span>';
688 688
         if ($registration->paid() > 0) {
689 689
             $content .= '<span class="ee-status-text-small">'
@@ -712,11 +712,11 @@  discard block
 block discarded – undo
712 712
         if ($registration->transaction()) {
713 713
             $content = $this->caps_handler->userCanViewTransaction()
714 714
                 ? '
715
-                    <a class="ee-aria-tooltip ee-status-color--' . $registration->transaction()->status_ID() . '"
716
-                        href="' . $this->viewTransactionUrl() . '"
717
-                        aria-label="' . esc_attr__('View Transaction', 'event_espresso') . '"
715
+                    <a class="ee-aria-tooltip ee-status-color--' . $registration->transaction()->status_ID().'"
716
+                        href="' . $this->viewTransactionUrl().'"
717
+                        aria-label="' . esc_attr__('View Transaction', 'event_espresso').'"
718 718
                     >
719
-                        ' . $registration->transaction()->pretty_total() . '
719
+                        ' . $registration->transaction()->pretty_total().'
720 720
                     </a>'
721 721
                 : $registration->transaction()->pretty_total();
722 722
         } else {
@@ -750,11 +750,11 @@  discard block
 block discarded – undo
750 750
             } else {
751 751
                 $content = $this->caps_handler->userCanViewTransaction()
752 752
                     ? '
753
-                    <a class="ee-aria-tooltip ee-status-color--' . $transaction->status_ID() . '"
754
-                        href="' . $this->viewTransactionUrl() . '"
755
-                        aria-label="' . esc_attr__('View Transaction', 'event_espresso') . '"
753
+                    <a class="ee-aria-tooltip ee-status-color--' . $transaction->status_ID().'"
754
+                        href="' . $this->viewTransactionUrl().'"
755
+                        aria-label="' . esc_attr__('View Transaction', 'event_espresso').'"
756 756
                     >
757
-                        ' . $registration->transaction()->pretty_paid() . '
757
+                        ' . $registration->transaction()->pretty_paid().'
758 758
                     </a>'
759 759
                     : $registration->transaction()->pretty_paid();
760 760
             }
@@ -833,11 +833,11 @@  discard block
 block discarded – undo
833 833
             : '';
834 834
         return $this->caps_handler->userCanReadRegistration($registration)
835 835
             ? '
836
-            <a  href="' . $this->viewRegistrationUrl($registration) . '"
837
-                class="row-title ee-status-color--' . $status . ' ee-aria-tooltip"
838
-                aria-label="' . esc_attr__('View Registration Details', 'event_espresso') . '"
836
+            <a  href="' . $this->viewRegistrationUrl($registration).'"
837
+                class="row-title ee-status-color--' . $status.' ee-aria-tooltip"
838
+                aria-label="' . esc_attr__('View Registration Details', 'event_espresso').'"
839 839
             >
840
-                ' . $attendee_name . '
840
+                ' . $attendee_name.'
841 841
             </a>'
842 842
             : $attendee_name;
843 843
     }
@@ -851,9 +851,9 @@  discard block
 block discarded – undo
851 851
     {
852 852
         return $this->caps_handler->userCanReadRegistration($registration)
853 853
             ? '
854
-            <a  href="' . $this->viewRegistrationUrl($registration) . '"
854
+            <a  href="' . $this->viewRegistrationUrl($registration).'"
855 855
                 class="ee-aria-tooltip button button--icon-only"
856
-                aria-label="' . esc_attr__('View Registration Details', 'event_espresso') . '"
856
+                aria-label="' . esc_attr__('View Registration Details', 'event_espresso').'"
857 857
             >
858 858
                 <span class="dashicons dashicons-clipboard"></span>
859 859
             </a>'
@@ -872,8 +872,8 @@  discard block
 block discarded – undo
872 872
                 REG_ADMIN_URL
873 873
             );
874 874
             return '
875
-                <a href="' . $edit_link_url . '"
876
-                   aria-label="' . esc_attr__('Edit Contact Details', 'event_espresso') . '"
875
+                <a href="' . $edit_link_url.'"
876
+                   aria-label="' . esc_attr__('Edit Contact Details', 'event_espresso').'"
877 877
                    class="ee-aria-tooltip button button--secondary button--icon-only"
878 878
                 >
879 879
                     <span class="dashicons dashicons-admin-users"></span>
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
                 true
902 902
             );
903 903
             return '
904
-			    <a href="' . $resend_reg_link_url . '" aria-label="'
904
+			    <a href="' . $resend_reg_link_url.'" aria-label="'
905 905
                 . esc_attr__('Resend Registration Details', 'event_espresso')
906 906
                 . '" class="ee-aria-tooltip button button--icon-only">
907 907
 			        <span class="dashicons dashicons-email-alt"></span>
@@ -928,8 +928,8 @@  discard block
 block discarded – undo
928 928
         if ($this->caps_handler->userCanViewTransaction()) {
929 929
             return '
930 930
                 <a class="ee-aria-tooltip button button--icon-only"
931
-                   href="' . $this->viewTransactionUrl() . '"
932
-                   aria-label="' . $this->_transaction_details['title_attr'] . '"
931
+                   href="' . $this->viewTransactionUrl().'"
932
+                   aria-label="' . $this->_transaction_details['title_attr'].'"
933 933
                 >
934 934
                     <span class="dashicons dashicons-cart"></span>
935 935
                 </a>';
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
         ) {
955 955
             return '
956 956
                 <a aria-label="' . esc_attr__('View Transaction Invoice', 'event_espresso')
957
-                . '" target="_blank" href="' . $registration->invoice_url() . '" class="ee-aria-tooltip button button--icon-only">
957
+                . '" target="_blank" href="'.$registration->invoice_url().'" class="ee-aria-tooltip button button--icon-only">
958 958
                     <span class="dashicons dashicons-media-spreadsheet"></span>
959 959
                 </a>';
960 960
         }
@@ -994,7 +994,7 @@  discard block
 block discarded – undo
994 994
         }
995 995
 
996 996
         // check caps
997
-        if (! $this->caps_handler->userCanTrashRegistration($registration)) {
997
+        if ( ! $this->caps_handler->userCanTrashRegistration($registration)) {
998 998
             return $actions;
999 999
         }
1000 1000
 
@@ -1012,10 +1012,10 @@  discard block
 block discarded – undo
1012 1012
         $trash_link_url       = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL);
1013 1013
         $actions['trash']     = '
1014 1014
             <a class="ee-aria-tooltip"
1015
-                href="' . $trash_link_url . '"
1016
-                aria-label="' . esc_attr__('Trash Registration', 'event_espresso') . '"
1015
+                href="' . $trash_link_url.'"
1016
+                aria-label="' . esc_attr__('Trash Registration', 'event_espresso').'"
1017 1017
             >
1018
-                ' . esc_html__('Trash', 'event_espresso') . '
1018
+                ' . esc_html__('Trash', 'event_espresso').'
1019 1019
             </a>';
1020 1020
         return $actions;
1021 1021
     }
@@ -1041,10 +1041,10 @@  discard block
 block discarded – undo
1041 1041
             $restore_link_url     = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL);
1042 1042
             $actions['restore']   = '
1043 1043
                 <a class="ee-aria-tooltip"
1044
-                    href="' . $restore_link_url . '"
1045
-                    aria-label="' . esc_attr__('Restore Registration', 'event_espresso') . '"
1044
+                    href="' . $restore_link_url.'"
1045
+                    aria-label="' . esc_attr__('Restore Registration', 'event_espresso').'"
1046 1046
                 >
1047
-                    ' . esc_html__('Restore', 'event_espresso') . '
1047
+                    ' . esc_html__('Restore', 'event_espresso').'
1048 1048
                 </a>';
1049 1049
         }
1050 1050
 
@@ -1066,10 +1066,10 @@  discard block
 block discarded – undo
1066 1066
             $delete_link_url      = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL);
1067 1067
             $actions['delete']    = '
1068 1068
                 <a class="ee-aria-tooltip"
1069
-                    href="' . $delete_link_url . '"
1070
-                    aria-label="' . esc_attr__('Delete Registration Permanently', 'event_espresso') . '"
1069
+                    href="' . $delete_link_url.'"
1070
+                    aria-label="' . esc_attr__('Delete Registration Permanently', 'event_espresso').'"
1071 1071
                 >
1072
-                    ' . esc_html__('Delete', 'event_espresso') . '
1072
+                    ' . esc_html__('Delete', 'event_espresso').'
1073 1073
                 </a>';
1074 1074
         }
1075 1075
         return $actions;
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
 
1079 1079
     private function editEventLink(int $EVT_ID, string $event_name): string
1080 1080
     {
1081
-        if (! $EVT_ID || ! $this->caps_handler->userCanEditEvent($EVT_ID)) {
1081
+        if ( ! $EVT_ID || ! $this->caps_handler->userCanEditEvent($EVT_ID)) {
1082 1082
             return $event_name;
1083 1083
         }
1084 1084
         $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(
@@ -1086,31 +1086,31 @@  discard block
 block discarded – undo
1086 1086
             EVENTS_ADMIN_URL
1087 1087
         );
1088 1088
         return '
1089
-            <a class="ee-aria-tooltip ee-status-color--' . $this->_event_details['status'] . '"
1090
-                href="' . $edit_event_url . '"
1091
-                aria-label="' . esc_attr($this->_event_details['title_attr']) . '"
1089
+            <a class="ee-aria-tooltip ee-status-color--' . $this->_event_details['status'].'"
1090
+                href="' . $edit_event_url.'"
1091
+                aria-label="' . esc_attr($this->_event_details['title_attr']).'"
1092 1092
             >
1093
-                ' . $event_name . '
1093
+                ' . $event_name.'
1094 1094
             </a>';
1095 1095
     }
1096 1096
 
1097 1097
 
1098 1098
     private function eventFilterLink(int $EVT_ID, string $event_name): string
1099 1099
     {
1100
-        if (! $EVT_ID) {
1100
+        if ( ! $EVT_ID) {
1101 1101
             return '';
1102 1102
         }
1103 1103
         $event_filter_url = EE_Admin_Page::add_query_args_and_nonce(['event_id' => $EVT_ID], REG_ADMIN_URL);
1104 1104
         return '
1105 1105
             <a  class="ee-aria-tooltip ee-event-filter-link"
1106
-                href="' . $event_filter_url . '"
1106
+                href="' . $event_filter_url.'"
1107 1107
                 aria-label="' . sprintf(
1108 1108
                 esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'),
1109 1109
                 $event_name
1110
-            ) . '"
1110
+            ).'"
1111 1111
             >
1112 1112
                 <span class="dashicons dashicons-groups dashicons--small"></span>'
1113
-            . esc_html__('View Registrations', 'event_espresso') . '
1113
+            . esc_html__('View Registrations', 'event_espresso').'
1114 1114
             </a>';
1115 1115
     }
1116 1116
 }
Please login to merge, or discard this patch.