Completed
Pull Request — Gutenberg/master (#499)
by Darren
53:58 queued 39:33
created
modules/thank_you_page/EED_Thank_You_Page.module.php 2 patches
Indentation   +894 added lines, -894 removed lines patch added patch discarded remove patch
@@ -10,718 +10,718 @@  discard block
 block discarded – undo
10 10
 class EED_Thank_You_Page extends EED_Module
11 11
 {
12 12
 
13
-    /**
14
-     * time in seconds to wait for the IPN to arrive before telling the registrant to bugger off ( 1200s = 20 minutes )
15
-     */
16
-    const IPN_wait_time = 1200;
17
-
18
-    /**
19
-     * The transaction specified by the reg_url_link passed from the Request, or from the Session
20
-     *
21
-     * @var EE_Transaction $_current_txn
22
-     */
23
-    private $_current_txn;
24
-
25
-    /**
26
-     * @var EE_Registration $_primary_registrant
27
-     */
28
-    private $_primary_registrant;
29
-
30
-    /**
31
-     * The reg_url_link passed from the Request, or from the Session
32
-     *
33
-     * @var string $_reg_url_link
34
-     */
35
-    private $_reg_url_link;
36
-
37
-    /**
38
-     * whether the incoming reg_url_link is for the primary registrant or not
39
-     *
40
-     * @var boolean $_is_primary
41
-     */
42
-    private $_is_primary;
43
-
44
-    /**
45
-     * The URL for revisiting the SPCO attendee information step
46
-     *
47
-     * @var string $_SPCO_attendee_information_url
48
-     */
49
-    private $_SPCO_attendee_information_url;
50
-
51
-    /**
52
-     * The URL for revisiting the SPCO payment options step
53
-     *
54
-     * @var string $_SPCO_payment_options_url
55
-     */
56
-    private $_SPCO_payment_options_url;
57
-
58
-    /**
59
-     * whether to display the Payment Options link
60
-     *
61
-     * @var boolean $_show_try_pay_again_link
62
-     */
63
-    private $_show_try_pay_again_link = false;
64
-
65
-    /**
66
-     * whether payments are allowed at this time
67
-     *
68
-     * @var boolean $_payments_closed
69
-     */
70
-    private $_payments_closed = false;
71
-
72
-    /**
73
-     * whether the selected payment method is Bank, Check , Invoice, etc
74
-     *
75
-     * @var boolean $_is_offline_payment_method
76
-     */
77
-    private $_is_offline_payment_method = true;
78
-
79
-
80
-    /**
81
-     * @return EED_Module|EED_Thank_You_Page
82
-     */
83
-    public static function instance()
84
-    {
85
-        return parent::get_instance(__CLASS__);
86
-    }
87
-
88
-
89
-    /**
90
-     * set_hooks - for hooking into EE Core, modules, etc
91
-     *
92
-     * @return void
93
-     */
94
-    public static function set_hooks()
95
-    {
96
-        add_action('wp_loaded', array('EED_Thank_You_Page', 'set_definitions'), 2);
97
-    }
98
-
99
-
100
-    /**
101
-     * set_hooks_admin - for hooking into EE Admin Core, modules, etc
102
-     *
103
-     * @return void
104
-     */
105
-    public static function set_hooks_admin()
106
-    {
107
-        // AJAX for IPN monitoring
108
-        add_filter('heartbeat_received', array('EED_Thank_You_Page', 'thank_you_page_IPN_monitor'), 10, 3);
109
-        add_filter(
110
-            'heartbeat_nopriv_received',
111
-            array('EED_Thank_You_Page', 'thank_you_page_IPN_monitor'),
112
-            10,
113
-            3
114
-        );
115
-        add_action(
116
-            'wp_ajax_espresso_resend_reg_confirmation_email',
117
-            array('EED_Thank_You_Page', 'resend_reg_confirmation_email'),
118
-            10,
119
-            2
120
-        );
121
-        add_action(
122
-            'wp_ajax_nopriv_espresso_resend_reg_confirmation_email',
123
-            array('EED_Thank_You_Page', 'resend_reg_confirmation_email'),
124
-            10,
125
-            2
126
-        );
127
-    }
128
-
129
-
130
-    /**
131
-     * set_definitions
132
-     *
133
-     * @return void
134
-     */
135
-    public static function set_definitions()
136
-    {
137
-        define('THANK_YOU_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS);
138
-        define('THANK_YOU_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)) . 'templates' . DS);
139
-    }
140
-
141
-
142
-    /**
143
-     * get_txn
144
-     *
145
-     * @return EE_Transaction
146
-     */
147
-    public function get_txn()
148
-    {
149
-        if ($this->_current_txn instanceof EE_Transaction) {
150
-            return $this->_current_txn;
151
-        }
152
-        $TXN_model = EE_Registry::instance()->load_model('Transaction');
153
-        if (! $TXN_model instanceof EEM_Transaction) {
154
-            EE_Error::add_error(
155
-                __('The transaction model could not be established.', 'event_espresso'),
156
-                __FILE__,
157
-                __FUNCTION__,
158
-                __LINE__
159
-            );
160
-            return null;
161
-        }
162
-        // get the transaction. yes, we may have just loaded it, but it may have been updated, or this may be via an ajax request
163
-        $this->_current_txn = $TXN_model->get_transaction_from_reg_url_link($this->_reg_url_link);
164
-        // verify TXN
165
-        if (WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction) {
166
-            EE_Error::add_error(
167
-                __(
168
-                    'No transaction information could be retrieved or the transaction data is not of the correct type.',
169
-                    'event_espresso'
170
-                ),
171
-                __FILE__,
172
-                __FUNCTION__,
173
-                __LINE__
174
-            );
175
-            return null;
176
-        }
177
-        return $this->_current_txn;
178
-    }
179
-
180
-
181
-    /**
182
-     * get_txn_payments
183
-     *
184
-     * @param int $since
185
-     * @return mixed array of EE_Payment || FALSE
186
-     * @throws \EE_Error
187
-     */
188
-    public function get_txn_payments($since = 0)
189
-    {
190
-        if (! $this->get_txn()) {
191
-            return false;
192
-        }
193
-        $args = array('order_by' => array('PAY_timestamp' => 'ASC'));
194
-        if ($since > 0) {
195
-            $args[0] = array('PAY_timestamp' => array('>', $since));
196
-        }
197
-        // get array of payments with most recent first
198
-        return $this->_current_txn->payments($args);
199
-    }
200
-
201
-
202
-    /**
203
-     * get_reg_url_link
204
-     *
205
-     * @return void
206
-     */
207
-    private function _get_reg_url_link()
208
-    {
209
-        if (! empty($this->_reg_url_link)) {
210
-            return;
211
-        }
212
-        // only do thank you page stuff if we have a REG_url_link in the url
213
-        if (WP_DEBUG && ! EE_Registry::instance()->REQ->is_set('e_reg_url_link')) {
214
-            EE_Error::add_error(
215
-                __(
216
-                    'No transaction information could be retrieved because the registration URL link is missing or invalid.',
217
-                    'event_espresso'
218
-                ),
219
-                __FILE__,
220
-                __FUNCTION__,
221
-                __LINE__
222
-            );
223
-            return;
224
-        }
225
-        // check for reg_url_link
226
-        $this->_reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link');
227
-    }
228
-
229
-
230
-    /**
231
-     * set_reg_url_link
232
-     *
233
-     * @param string $reg_url_link
234
-     */
235
-    public function set_reg_url_link($reg_url_link = null)
236
-    {
237
-        $this->_reg_url_link = ! empty($reg_url_link) ? $reg_url_link : $this->_reg_url_link;
238
-    }
239
-
240
-
241
-    /**
242
-     * run - initial module setup
243
-     * this method is primarily used for activating resources in the EE_Front_Controller thru the use of filters
244
-     *
245
-     * @param WP $WP
246
-     * @return void
247
-     * @throws \EE_Error
248
-     */
249
-    public function run($WP)
250
-    {
251
-    }
252
-
253
-
254
-    /**
255
-     * load_resources
256
-     *
257
-     * @return void
258
-     * @throws \EE_Error
259
-     */
260
-    public function load_resources()
261
-    {
262
-        $this->_get_reg_url_link();
263
-        // resend_reg_confirmation_email ?
264
-        if (EE_Registry::instance()->REQ->is_set('resend')) {
265
-            EED_Thank_You_Page::resend_reg_confirmation_email();
266
-        }
267
-        EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
268
-        $this->_translate_strings();
269
-        // load assets
270
-        add_action('wp_enqueue_scripts', array($this, 'load_js'), 10);
271
-    }
272
-
273
-
274
-    /**
275
-     * load_js
276
-     *
277
-     * @return void
278
-     */
279
-    protected function _translate_strings()
280
-    {
281
-        EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->_reg_url_link;
282
-        EE_Registry::$i18n_js_strings['initial_access'] = time();
283
-        EE_Registry::$i18n_js_strings['IPN_wait_time'] = EED_Thank_You_Page::IPN_wait_time;
284
-        EE_Registry::$i18n_js_strings['TXN_complete'] = EEM_Transaction::complete_status_code;
285
-        EE_Registry::$i18n_js_strings['TXN_incomplete'] = EEM_Transaction::incomplete_status_code;
286
-        EE_Registry::$i18n_js_strings['checking_for_new_payments'] = __(
287
-            'checking for new payments...',
288
-            'event_espresso'
289
-        );
290
-        EE_Registry::$i18n_js_strings['loading_payment_info'] = __(
291
-            'loading payment information...',
292
-            'event_espresso'
293
-        );
294
-        EE_Registry::$i18n_js_strings['server_error'] = __(
295
-            'An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again.',
296
-            'event_espresso'
297
-        );
298
-        EE_Registry::$i18n_js_strings['slow_IPN'] = apply_filters(
299
-            'EED_Thank_You_Page__load_js__slow_IPN',
300
-            sprintf(
301
-                __(
302
-                    '%sThe Payment Notification appears to be taking longer than usual to arrive. Maybe check back later or just wait for your payment and registration confirmation results to be sent to you via email. We apologize for any inconvenience this may have caused.%s',
303
-                    'event_espresso'
304
-                ),
305
-                '<div id="espresso-thank-you-page-slow-IPN-dv" class="ee-attention jst-left">',
306
-                '</div>'
307
-            )
308
-        );
309
-    }
310
-
311
-
312
-    /**
313
-     * load_js
314
-     *
315
-     * @return void
316
-     */
317
-    public function load_js()
318
-    {
319
-        wp_register_script(
320
-            'thank_you_page',
321
-            THANK_YOU_ASSETS_URL . 'thank_you_page.js',
322
-            array('espresso_core', 'heartbeat'),
323
-            EVENT_ESPRESSO_VERSION,
324
-            true
325
-        );
326
-        wp_enqueue_script('thank_you_page');
327
-        wp_enqueue_style('espresso_default');
328
-    }
329
-
330
-
331
-    /**
332
-     * init
333
-     *
334
-     * @return void
335
-     * @throws \EE_Error
336
-     */
337
-    public function init()
338
-    {
339
-        $this->_get_reg_url_link();
340
-        if (! $this->get_txn()) {
341
-            echo EEH_HTML::div(
342
-                EEH_HTML::h4(__('We\'re sorry...', 'event_espresso'), '', '') .
343
-                sprintf(
344
-                    __(
345
-                        'This is a system page for displaying transaction information after a purchase.%1$sYou are most likely seeing this notice because you have navigated to this page%1$sthrough some means other than completing a transaction.%1$sSorry for the disappointment, but you will most likely find nothing of interest here.%1$s%1$s',
346
-                        'event_espresso'
347
-                    ),
348
-                    '<br/>'
349
-                ),
350
-                '',
351
-                'ee-attention'
352
-            );
353
-            return null;
354
-        }
355
-        // if we've made it to the Thank You page, then let's toggle any "Failed" transactions to "Incomplete"
356
-        if ($this->_current_txn->status_ID() === EEM_Transaction::failed_status_code) {
357
-            $this->_current_txn->set_status(EEM_Transaction::incomplete_status_code);
358
-            $this->_current_txn->save();
359
-        }
360
-        $this->_primary_registrant = $this->_current_txn->primary_registration() instanceof EE_Registration
361
-            ? $this->_current_txn->primary_registration()
362
-            : null;
363
-        $this->_is_primary = $this->_primary_registrant->reg_url_link() === $this->_reg_url_link ? true : false;
364
-        $show_try_pay_again_link_default = apply_filters(
365
-            'AFEE__EED_Thank_You_Page__init__show_try_pay_again_link_default',
366
-            true
367
-        );
368
-        $this->_show_try_pay_again_link = $show_try_pay_again_link_default;
369
-        // txn status ?
370
-        if ($this->_current_txn->is_completed()) {
371
-            $this->_show_try_pay_again_link = $show_try_pay_again_link_default;
372
-        } elseif ($this->_current_txn->is_incomplete()
373
-            && ($this->_primary_registrant->is_approved()
374
-                || $this->_primary_registrant->is_pending_payment())
375
-        ) {
376
-            $this->_show_try_pay_again_link = true;
377
-        } elseif ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment()) {
378
-            // its pending
379
-            $this->_show_try_pay_again_link = isset(
380
-                EE_Registry::instance()->CFG->registration->show_pending_payment_options
381
-            )
382
-                                              && EE_Registry::instance()->CFG
383
-                                                  ->registration->show_pending_payment_options
384
-                ? true
385
-                : $show_try_pay_again_link_default;
386
-        }
387
-        $this->_payments_closed = ! $this->_current_txn->payment_method() instanceof EE_Payment_Method
388
-            ? true
389
-            : false;
390
-        $this->_is_offline_payment_method = false;
391
-        if (// if payment method is unknown
392
-            ! $this->_current_txn->payment_method() instanceof EE_Payment_Method
393
-            || (
394
-                // or is an offline payment method
395
-                $this->_current_txn->payment_method() instanceof EE_Payment_Method
396
-                && $this->_current_txn->payment_method()->is_off_line()
397
-            )
398
-        ) {
399
-            $this->_is_offline_payment_method = true;
400
-        }
401
-        // link to SPCO
402
-        $revisit_spco_url = add_query_arg(
403
-            array('ee' => '_register', 'revisit' => true, 'e_reg_url_link' => $this->_reg_url_link),
404
-            EE_Registry::instance()->CFG->core->reg_page_url()
405
-        );
406
-        // link to SPCO payment_options
407
-        $this->_SPCO_payment_options_url = $this->_primary_registrant instanceof EE_Registration
408
-            ? $this->_primary_registrant->payment_overview_url()
409
-            : add_query_arg(
410
-                array('step' => 'payment_options'),
411
-                $revisit_spco_url
412
-            );
413
-        // link to SPCO attendee_information
414
-        $this->_SPCO_attendee_information_url = $this->_primary_registrant instanceof EE_Registration
415
-            ? $this->_primary_registrant->edit_attendee_information_url()
416
-            : false;
417
-        do_action('AHEE__EED_Thank_You_Page__init_end', $this->_current_txn);
418
-        // set no cache headers and constants
419
-        EE_System::do_not_cache();
420
-    }
421
-
422
-
423
-    /**
424
-     * display_thank_you_page_results
425
-     *
426
-     * @return string
427
-     * @throws \EE_Error
428
-     */
429
-    public function thank_you_page_results()
430
-    {
431
-        $this->init();
432
-        if (! $this->_current_txn instanceof EE_Transaction) {
433
-            return EE_Error::get_notices();
434
-        }
435
-        // link to receipt
436
-        $template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url('html');
437
-        if (! empty($template_args['TXN_receipt_url'])) {
438
-            $template_args['order_conf_desc'] = __(
439
-                '%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation or click the button below to view / download / print a full description of your purchases and registration information.',
440
-                'event_espresso'
441
-            );
442
-        } else {
443
-            $template_args['order_conf_desc'] = __(
444
-                '%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation.',
445
-                'event_espresso'
446
-            );
447
-        }
448
-        $template_args['transaction'] = $this->_current_txn;
449
-        $template_args['revisit'] = EE_Registry::instance()->REQ->get('revisit', false);
450
-        add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_registration_details'));
451
-        if ($this->_is_primary && ! $this->_current_txn->is_free()) {
452
-            add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_ajax_content'));
453
-        }
454
-        return EEH_Template::locate_template(
455
-            THANK_YOU_TEMPLATES_PATH . 'thank-you-page-overview.template.php',
456
-            $template_args,
457
-            true,
458
-            true
459
-        );
460
-    }
461
-
462
-
463
-    /**
464
-     * thank_you_page_IPN_monitor
465
-     * this basically just pulls the TXN based on the reg_url_link sent from the server,
466
-     * then checks that the TXN status is not failed, and that no other errors have been generated.
467
-     * it also calculates the IPN wait time since the Thank You page was first loaded
468
-     *
469
-     * @param array $response
470
-     * @param array $data
471
-     * @return array
472
-     * @throws \EE_Error
473
-     */
474
-    public static function thank_you_page_IPN_monitor($response = array(), $data = array())
475
-    {
476
-        // does this heartbeat contain our data ?
477
-        if (! isset($data['espresso_thank_you_page'])) {
478
-            return $response;
479
-        }
480
-        // check for reg_url_link in the incoming heartbeat data
481
-        if (! isset($data['espresso_thank_you_page']['e_reg_url_link'])) {
482
-            $response['espresso_thank_you_page'] = array(
483
-                'errors' => ! empty($notices['errors'])
484
-                    ? $notices['errors']
485
-                    : __(
486
-                        'No transaction information could be retrieved because the registration URL link is missing or invalid.',
487
-                        'event_espresso'
488
-                    ),
489
-            );
490
-            return $response;
491
-        }
492
-        // kk heartbeat has our data
493
-        $response['espresso_thank_you_page'] = array();
494
-        // set_definitions, instantiate the thank you page class, and get the ball rolling
495
-        EED_Thank_You_Page::set_definitions();
496
-        /** @var $espresso_thank_you_page EED_Thank_You_Page */
497
-        $espresso_thank_you_page = EED_Thank_You_Page::instance();
498
-        $espresso_thank_you_page->set_reg_url_link($data['espresso_thank_you_page']['e_reg_url_link']);
499
-        $espresso_thank_you_page->init();
500
-        // get TXN
501
-        $TXN = $espresso_thank_you_page->get_txn();
502
-        // no TXN? then get out
503
-        if (! $TXN instanceof EE_Transaction) {
504
-            $notices = EE_Error::get_notices();
505
-            $response['espresso_thank_you_page'] = array(
506
-                'errors' => ! empty($notices['errors'])
507
-                    ? $notices['errors']
508
-                    : sprintf(
509
-                        __(
510
-                            'The information for your transaction could not be retrieved from the server or the transaction data received was invalid because of a technical reason. (%s)',
511
-                            'event_espresso'
512
-                        ),
513
-                        __LINE__
514
-                    ),
515
-            );
516
-            return $response;
517
-        }
518
-        // grab transient of TXN's status
519
-        $txn_status = isset($data['espresso_thank_you_page']['txn_status'])
520
-            ? $data['espresso_thank_you_page']['txn_status']
521
-            : null;
522
-        // has the TXN status changed since we last checked (or empty because this is the first time running through this code)?
523
-        if ($txn_status !== $TXN->status_ID()) {
524
-            // switch between two possible basic outcomes
525
-            switch ($TXN->status_ID()) {
526
-                // TXN has been updated in some way
527
-                case EEM_Transaction::overpaid_status_code:
528
-                case EEM_Transaction::complete_status_code:
529
-                case EEM_Transaction::incomplete_status_code:
530
-                    // send updated TXN results back to client,
531
-                    $response['espresso_thank_you_page'] = array(
532
-                        'transaction_details' => $espresso_thank_you_page->get_transaction_details(),
533
-                        'txn_status'          => $TXN->status_ID(),
534
-                    );
535
-                    break;
536
-                // or we have a bad TXN, or really slow IPN, so calculate the wait time and send that back...
537
-                case EEM_Transaction::failed_status_code:
538
-                default:
539
-                    // keep on waiting...
540
-                    return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']);
541
-            }
542
-            // or is the TXN still failed (never been updated) ???
543
-        } elseif ($TXN->failed()) {
544
-            // keep on waiting...
545
-            return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']);
546
-        }
547
-        // TXN is happening so let's get the payments now
548
-        // if we've already gotten payments then the heartbeat data will contain the timestamp of the last time we checked
549
-        $since = isset($data['espresso_thank_you_page']['get_payments_since'])
550
-            ? $data['espresso_thank_you_page']['get_payments_since']
551
-            : 0;
552
-        // then check for payments
553
-        $payments = $espresso_thank_you_page->get_txn_payments($since);
554
-        // has a payment been processed ?
555
-        if (! empty($payments) || $espresso_thank_you_page->_is_offline_payment_method) {
556
-            if ($since) {
557
-                $response['espresso_thank_you_page'] = array(
558
-                    'new_payments'        => $espresso_thank_you_page->get_new_payments($payments),
559
-                    'transaction_details' => $espresso_thank_you_page->get_transaction_details(),
560
-                    'txn_status'          => $TXN->status_ID(),
561
-                );
562
-            } else {
563
-                $response['espresso_thank_you_page']['payment_details'] = $espresso_thank_you_page->get_payment_details(
564
-                    $payments
565
-                );
566
-            }
567
-            // reset time to check for payments
568
-            $response['espresso_thank_you_page']['get_payments_since'] = time();
569
-        } else {
570
-            $response['espresso_thank_you_page']['get_payments_since'] = $since;
571
-        }
572
-        return $response;
573
-    }
574
-
575
-
576
-    /**
577
-     * _update_server_wait_time
578
-     *
579
-     * @param array $thank_you_page_data thank you page portion of the incoming JSON array from the WP heartbeat data
580
-     * @return array
581
-     * @throws \EE_Error
582
-     */
583
-    private function _update_server_wait_time($thank_you_page_data = array())
584
-    {
585
-        $response['espresso_thank_you_page'] = array(
586
-            'still_waiting' => isset($thank_you_page_data['initial_access'])
587
-                ? time() - $thank_you_page_data['initial_access']
588
-                : 0,
589
-            'txn_status'    => $this->_current_txn->status_ID(),
590
-        );
591
-        return $response;
592
-    }
593
-
594
-
595
-    /**
596
-     * get_registration_details
597
-     *
598
-     * @throws \EE_Error
599
-     */
600
-    public function get_registration_details()
601
-    {
602
-        // prepare variables for displaying
603
-        $template_args = array();
604
-        $template_args['transaction'] = $this->_current_txn;
605
-        $template_args['reg_url_link'] = $this->_reg_url_link;
606
-        $template_args['is_primary'] = $this->_is_primary;
607
-        $template_args['SPCO_attendee_information_url'] = $this->_SPCO_attendee_information_url;
608
-        $template_args['resend_reg_confirmation_url'] = add_query_arg(
609
-            array('token' => $this->_reg_url_link, 'resend_reg_confirmation' => 'true'),
610
-            EE_Registry::instance()->CFG->core->thank_you_page_url()
611
-        );
612
-        // verify template arguments
613
-        EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction');
614
-        EEH_Template_Validator::verify_isnt_null(
615
-            $template_args['SPCO_attendee_information_url'],
616
-            '$SPCO_attendee_information_url'
617
-        );
618
-        echo EEH_Template::locate_template(
619
-            THANK_YOU_TEMPLATES_PATH . 'thank-you-page-registration-details.template.php',
620
-            $template_args,
621
-            true,
622
-            true
623
-        );
624
-    }
625
-
626
-
627
-    /**
628
-     * resend_reg_confirmation_email
629
-     *
630
-     * @throws \EE_Error
631
-     */
632
-    public static function resend_reg_confirmation_email()
633
-    {
634
-        EE_Registry::instance()->load_core('Request_Handler');
635
-        $reg_url_link = EE_Registry::instance()->REQ->get('token');
636
-        // was a REG_ID passed ?
637
-        if ($reg_url_link) {
638
-            $registration = EE_Registry::instance()->load_model('Registration')->get_one(
639
-                array(array('REG_url_link' => $reg_url_link))
640
-            );
641
-            if ($registration instanceof EE_Registration) {
642
-                // resend email
643
-                EED_Messages::process_resend(array('_REG_ID' => $registration->ID()));
644
-            } else {
645
-                EE_Error::add_error(
646
-                    __(
647
-                        'The Registration Confirmation email could not be sent because a valid Registration could not be retrieved from the database.',
648
-                        'event_espresso'
649
-                    ),
650
-                    __FILE__,
651
-                    __FUNCTION__,
652
-                    __LINE__
653
-                );
654
-            }
655
-        } else {
656
-            EE_Error::add_error(
657
-                __(
658
-                    'The Registration Confirmation email could not be sent because a registration token is missing or invalid.',
659
-                    'event_espresso'
660
-                ),
661
-                __FILE__,
662
-                __FUNCTION__,
663
-                __LINE__
664
-            );
665
-        }
666
-        // request sent via AJAX ?
667
-        if (EE_FRONT_AJAX) {
668
-            echo wp_json_encode(EE_Error::get_notices(false));
669
-            die();
670
-            // or was JS disabled ?
671
-        } else {
672
-            // save errors so that they get picked up on the next request
673
-            EE_Error::get_notices(true, true);
674
-            wp_safe_redirect(
675
-                add_query_arg(
676
-                    array('e_reg_url_link' => $reg_url_link),
677
-                    EE_Registry::instance()->CFG->core->thank_you_page_url()
678
-                )
679
-            );
680
-        }
681
-    }
682
-
683
-
684
-    /**
685
-     * get_ajax_content
686
-     *
687
-     * @return void
688
-     * @throws \EE_Error
689
-     */
690
-    public function get_ajax_content()
691
-    {
692
-        if (! $this->get_txn()) {
693
-            return;
694
-        }
695
-        // first determine which event(s) require pre-approval or not
696
-        $events = array();
697
-        $events_requiring_pre_approval = array();
698
-        foreach ($this->_current_txn->registrations() as $registration) {
699
-            if ($registration instanceof EE_Registration) {
700
-                $event = $registration->event();
701
-                if ($event instanceof EE_Event) {
702
-                    if ($registration->is_not_approved() && $registration->event() instanceof EE_Event) {
703
-                        $events_requiring_pre_approval[ $event->ID() ] = $event;
704
-                    } else {
705
-                        $events[ $event->ID() ] = $event;
706
-                    }
707
-                }
708
-            }
709
-        }
710
-        $this->display_details_for_events_requiring_pre_approval($events_requiring_pre_approval);
711
-        $this->display_details_for_events($events);
712
-    }
713
-
714
-
715
-    /**
716
-     * display_details_for_events
717
-     *
718
-     * @param EE_Event[] $events
719
-     * @return void
720
-     */
721
-    public function display_details_for_events($events = array())
722
-    {
723
-        if (! empty($events)) {
724
-            ?>
13
+	/**
14
+	 * time in seconds to wait for the IPN to arrive before telling the registrant to bugger off ( 1200s = 20 minutes )
15
+	 */
16
+	const IPN_wait_time = 1200;
17
+
18
+	/**
19
+	 * The transaction specified by the reg_url_link passed from the Request, or from the Session
20
+	 *
21
+	 * @var EE_Transaction $_current_txn
22
+	 */
23
+	private $_current_txn;
24
+
25
+	/**
26
+	 * @var EE_Registration $_primary_registrant
27
+	 */
28
+	private $_primary_registrant;
29
+
30
+	/**
31
+	 * The reg_url_link passed from the Request, or from the Session
32
+	 *
33
+	 * @var string $_reg_url_link
34
+	 */
35
+	private $_reg_url_link;
36
+
37
+	/**
38
+	 * whether the incoming reg_url_link is for the primary registrant or not
39
+	 *
40
+	 * @var boolean $_is_primary
41
+	 */
42
+	private $_is_primary;
43
+
44
+	/**
45
+	 * The URL for revisiting the SPCO attendee information step
46
+	 *
47
+	 * @var string $_SPCO_attendee_information_url
48
+	 */
49
+	private $_SPCO_attendee_information_url;
50
+
51
+	/**
52
+	 * The URL for revisiting the SPCO payment options step
53
+	 *
54
+	 * @var string $_SPCO_payment_options_url
55
+	 */
56
+	private $_SPCO_payment_options_url;
57
+
58
+	/**
59
+	 * whether to display the Payment Options link
60
+	 *
61
+	 * @var boolean $_show_try_pay_again_link
62
+	 */
63
+	private $_show_try_pay_again_link = false;
64
+
65
+	/**
66
+	 * whether payments are allowed at this time
67
+	 *
68
+	 * @var boolean $_payments_closed
69
+	 */
70
+	private $_payments_closed = false;
71
+
72
+	/**
73
+	 * whether the selected payment method is Bank, Check , Invoice, etc
74
+	 *
75
+	 * @var boolean $_is_offline_payment_method
76
+	 */
77
+	private $_is_offline_payment_method = true;
78
+
79
+
80
+	/**
81
+	 * @return EED_Module|EED_Thank_You_Page
82
+	 */
83
+	public static function instance()
84
+	{
85
+		return parent::get_instance(__CLASS__);
86
+	}
87
+
88
+
89
+	/**
90
+	 * set_hooks - for hooking into EE Core, modules, etc
91
+	 *
92
+	 * @return void
93
+	 */
94
+	public static function set_hooks()
95
+	{
96
+		add_action('wp_loaded', array('EED_Thank_You_Page', 'set_definitions'), 2);
97
+	}
98
+
99
+
100
+	/**
101
+	 * set_hooks_admin - for hooking into EE Admin Core, modules, etc
102
+	 *
103
+	 * @return void
104
+	 */
105
+	public static function set_hooks_admin()
106
+	{
107
+		// AJAX for IPN monitoring
108
+		add_filter('heartbeat_received', array('EED_Thank_You_Page', 'thank_you_page_IPN_monitor'), 10, 3);
109
+		add_filter(
110
+			'heartbeat_nopriv_received',
111
+			array('EED_Thank_You_Page', 'thank_you_page_IPN_monitor'),
112
+			10,
113
+			3
114
+		);
115
+		add_action(
116
+			'wp_ajax_espresso_resend_reg_confirmation_email',
117
+			array('EED_Thank_You_Page', 'resend_reg_confirmation_email'),
118
+			10,
119
+			2
120
+		);
121
+		add_action(
122
+			'wp_ajax_nopriv_espresso_resend_reg_confirmation_email',
123
+			array('EED_Thank_You_Page', 'resend_reg_confirmation_email'),
124
+			10,
125
+			2
126
+		);
127
+	}
128
+
129
+
130
+	/**
131
+	 * set_definitions
132
+	 *
133
+	 * @return void
134
+	 */
135
+	public static function set_definitions()
136
+	{
137
+		define('THANK_YOU_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS);
138
+		define('THANK_YOU_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)) . 'templates' . DS);
139
+	}
140
+
141
+
142
+	/**
143
+	 * get_txn
144
+	 *
145
+	 * @return EE_Transaction
146
+	 */
147
+	public function get_txn()
148
+	{
149
+		if ($this->_current_txn instanceof EE_Transaction) {
150
+			return $this->_current_txn;
151
+		}
152
+		$TXN_model = EE_Registry::instance()->load_model('Transaction');
153
+		if (! $TXN_model instanceof EEM_Transaction) {
154
+			EE_Error::add_error(
155
+				__('The transaction model could not be established.', 'event_espresso'),
156
+				__FILE__,
157
+				__FUNCTION__,
158
+				__LINE__
159
+			);
160
+			return null;
161
+		}
162
+		// get the transaction. yes, we may have just loaded it, but it may have been updated, or this may be via an ajax request
163
+		$this->_current_txn = $TXN_model->get_transaction_from_reg_url_link($this->_reg_url_link);
164
+		// verify TXN
165
+		if (WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction) {
166
+			EE_Error::add_error(
167
+				__(
168
+					'No transaction information could be retrieved or the transaction data is not of the correct type.',
169
+					'event_espresso'
170
+				),
171
+				__FILE__,
172
+				__FUNCTION__,
173
+				__LINE__
174
+			);
175
+			return null;
176
+		}
177
+		return $this->_current_txn;
178
+	}
179
+
180
+
181
+	/**
182
+	 * get_txn_payments
183
+	 *
184
+	 * @param int $since
185
+	 * @return mixed array of EE_Payment || FALSE
186
+	 * @throws \EE_Error
187
+	 */
188
+	public function get_txn_payments($since = 0)
189
+	{
190
+		if (! $this->get_txn()) {
191
+			return false;
192
+		}
193
+		$args = array('order_by' => array('PAY_timestamp' => 'ASC'));
194
+		if ($since > 0) {
195
+			$args[0] = array('PAY_timestamp' => array('>', $since));
196
+		}
197
+		// get array of payments with most recent first
198
+		return $this->_current_txn->payments($args);
199
+	}
200
+
201
+
202
+	/**
203
+	 * get_reg_url_link
204
+	 *
205
+	 * @return void
206
+	 */
207
+	private function _get_reg_url_link()
208
+	{
209
+		if (! empty($this->_reg_url_link)) {
210
+			return;
211
+		}
212
+		// only do thank you page stuff if we have a REG_url_link in the url
213
+		if (WP_DEBUG && ! EE_Registry::instance()->REQ->is_set('e_reg_url_link')) {
214
+			EE_Error::add_error(
215
+				__(
216
+					'No transaction information could be retrieved because the registration URL link is missing or invalid.',
217
+					'event_espresso'
218
+				),
219
+				__FILE__,
220
+				__FUNCTION__,
221
+				__LINE__
222
+			);
223
+			return;
224
+		}
225
+		// check for reg_url_link
226
+		$this->_reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link');
227
+	}
228
+
229
+
230
+	/**
231
+	 * set_reg_url_link
232
+	 *
233
+	 * @param string $reg_url_link
234
+	 */
235
+	public function set_reg_url_link($reg_url_link = null)
236
+	{
237
+		$this->_reg_url_link = ! empty($reg_url_link) ? $reg_url_link : $this->_reg_url_link;
238
+	}
239
+
240
+
241
+	/**
242
+	 * run - initial module setup
243
+	 * this method is primarily used for activating resources in the EE_Front_Controller thru the use of filters
244
+	 *
245
+	 * @param WP $WP
246
+	 * @return void
247
+	 * @throws \EE_Error
248
+	 */
249
+	public function run($WP)
250
+	{
251
+	}
252
+
253
+
254
+	/**
255
+	 * load_resources
256
+	 *
257
+	 * @return void
258
+	 * @throws \EE_Error
259
+	 */
260
+	public function load_resources()
261
+	{
262
+		$this->_get_reg_url_link();
263
+		// resend_reg_confirmation_email ?
264
+		if (EE_Registry::instance()->REQ->is_set('resend')) {
265
+			EED_Thank_You_Page::resend_reg_confirmation_email();
266
+		}
267
+		EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
268
+		$this->_translate_strings();
269
+		// load assets
270
+		add_action('wp_enqueue_scripts', array($this, 'load_js'), 10);
271
+	}
272
+
273
+
274
+	/**
275
+	 * load_js
276
+	 *
277
+	 * @return void
278
+	 */
279
+	protected function _translate_strings()
280
+	{
281
+		EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->_reg_url_link;
282
+		EE_Registry::$i18n_js_strings['initial_access'] = time();
283
+		EE_Registry::$i18n_js_strings['IPN_wait_time'] = EED_Thank_You_Page::IPN_wait_time;
284
+		EE_Registry::$i18n_js_strings['TXN_complete'] = EEM_Transaction::complete_status_code;
285
+		EE_Registry::$i18n_js_strings['TXN_incomplete'] = EEM_Transaction::incomplete_status_code;
286
+		EE_Registry::$i18n_js_strings['checking_for_new_payments'] = __(
287
+			'checking for new payments...',
288
+			'event_espresso'
289
+		);
290
+		EE_Registry::$i18n_js_strings['loading_payment_info'] = __(
291
+			'loading payment information...',
292
+			'event_espresso'
293
+		);
294
+		EE_Registry::$i18n_js_strings['server_error'] = __(
295
+			'An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again.',
296
+			'event_espresso'
297
+		);
298
+		EE_Registry::$i18n_js_strings['slow_IPN'] = apply_filters(
299
+			'EED_Thank_You_Page__load_js__slow_IPN',
300
+			sprintf(
301
+				__(
302
+					'%sThe Payment Notification appears to be taking longer than usual to arrive. Maybe check back later or just wait for your payment and registration confirmation results to be sent to you via email. We apologize for any inconvenience this may have caused.%s',
303
+					'event_espresso'
304
+				),
305
+				'<div id="espresso-thank-you-page-slow-IPN-dv" class="ee-attention jst-left">',
306
+				'</div>'
307
+			)
308
+		);
309
+	}
310
+
311
+
312
+	/**
313
+	 * load_js
314
+	 *
315
+	 * @return void
316
+	 */
317
+	public function load_js()
318
+	{
319
+		wp_register_script(
320
+			'thank_you_page',
321
+			THANK_YOU_ASSETS_URL . 'thank_you_page.js',
322
+			array('espresso_core', 'heartbeat'),
323
+			EVENT_ESPRESSO_VERSION,
324
+			true
325
+		);
326
+		wp_enqueue_script('thank_you_page');
327
+		wp_enqueue_style('espresso_default');
328
+	}
329
+
330
+
331
+	/**
332
+	 * init
333
+	 *
334
+	 * @return void
335
+	 * @throws \EE_Error
336
+	 */
337
+	public function init()
338
+	{
339
+		$this->_get_reg_url_link();
340
+		if (! $this->get_txn()) {
341
+			echo EEH_HTML::div(
342
+				EEH_HTML::h4(__('We\'re sorry...', 'event_espresso'), '', '') .
343
+				sprintf(
344
+					__(
345
+						'This is a system page for displaying transaction information after a purchase.%1$sYou are most likely seeing this notice because you have navigated to this page%1$sthrough some means other than completing a transaction.%1$sSorry for the disappointment, but you will most likely find nothing of interest here.%1$s%1$s',
346
+						'event_espresso'
347
+					),
348
+					'<br/>'
349
+				),
350
+				'',
351
+				'ee-attention'
352
+			);
353
+			return null;
354
+		}
355
+		// if we've made it to the Thank You page, then let's toggle any "Failed" transactions to "Incomplete"
356
+		if ($this->_current_txn->status_ID() === EEM_Transaction::failed_status_code) {
357
+			$this->_current_txn->set_status(EEM_Transaction::incomplete_status_code);
358
+			$this->_current_txn->save();
359
+		}
360
+		$this->_primary_registrant = $this->_current_txn->primary_registration() instanceof EE_Registration
361
+			? $this->_current_txn->primary_registration()
362
+			: null;
363
+		$this->_is_primary = $this->_primary_registrant->reg_url_link() === $this->_reg_url_link ? true : false;
364
+		$show_try_pay_again_link_default = apply_filters(
365
+			'AFEE__EED_Thank_You_Page__init__show_try_pay_again_link_default',
366
+			true
367
+		);
368
+		$this->_show_try_pay_again_link = $show_try_pay_again_link_default;
369
+		// txn status ?
370
+		if ($this->_current_txn->is_completed()) {
371
+			$this->_show_try_pay_again_link = $show_try_pay_again_link_default;
372
+		} elseif ($this->_current_txn->is_incomplete()
373
+			&& ($this->_primary_registrant->is_approved()
374
+				|| $this->_primary_registrant->is_pending_payment())
375
+		) {
376
+			$this->_show_try_pay_again_link = true;
377
+		} elseif ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment()) {
378
+			// its pending
379
+			$this->_show_try_pay_again_link = isset(
380
+				EE_Registry::instance()->CFG->registration->show_pending_payment_options
381
+			)
382
+											  && EE_Registry::instance()->CFG
383
+												  ->registration->show_pending_payment_options
384
+				? true
385
+				: $show_try_pay_again_link_default;
386
+		}
387
+		$this->_payments_closed = ! $this->_current_txn->payment_method() instanceof EE_Payment_Method
388
+			? true
389
+			: false;
390
+		$this->_is_offline_payment_method = false;
391
+		if (// if payment method is unknown
392
+			! $this->_current_txn->payment_method() instanceof EE_Payment_Method
393
+			|| (
394
+				// or is an offline payment method
395
+				$this->_current_txn->payment_method() instanceof EE_Payment_Method
396
+				&& $this->_current_txn->payment_method()->is_off_line()
397
+			)
398
+		) {
399
+			$this->_is_offline_payment_method = true;
400
+		}
401
+		// link to SPCO
402
+		$revisit_spco_url = add_query_arg(
403
+			array('ee' => '_register', 'revisit' => true, 'e_reg_url_link' => $this->_reg_url_link),
404
+			EE_Registry::instance()->CFG->core->reg_page_url()
405
+		);
406
+		// link to SPCO payment_options
407
+		$this->_SPCO_payment_options_url = $this->_primary_registrant instanceof EE_Registration
408
+			? $this->_primary_registrant->payment_overview_url()
409
+			: add_query_arg(
410
+				array('step' => 'payment_options'),
411
+				$revisit_spco_url
412
+			);
413
+		// link to SPCO attendee_information
414
+		$this->_SPCO_attendee_information_url = $this->_primary_registrant instanceof EE_Registration
415
+			? $this->_primary_registrant->edit_attendee_information_url()
416
+			: false;
417
+		do_action('AHEE__EED_Thank_You_Page__init_end', $this->_current_txn);
418
+		// set no cache headers and constants
419
+		EE_System::do_not_cache();
420
+	}
421
+
422
+
423
+	/**
424
+	 * display_thank_you_page_results
425
+	 *
426
+	 * @return string
427
+	 * @throws \EE_Error
428
+	 */
429
+	public function thank_you_page_results()
430
+	{
431
+		$this->init();
432
+		if (! $this->_current_txn instanceof EE_Transaction) {
433
+			return EE_Error::get_notices();
434
+		}
435
+		// link to receipt
436
+		$template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url('html');
437
+		if (! empty($template_args['TXN_receipt_url'])) {
438
+			$template_args['order_conf_desc'] = __(
439
+				'%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation or click the button below to view / download / print a full description of your purchases and registration information.',
440
+				'event_espresso'
441
+			);
442
+		} else {
443
+			$template_args['order_conf_desc'] = __(
444
+				'%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation.',
445
+				'event_espresso'
446
+			);
447
+		}
448
+		$template_args['transaction'] = $this->_current_txn;
449
+		$template_args['revisit'] = EE_Registry::instance()->REQ->get('revisit', false);
450
+		add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_registration_details'));
451
+		if ($this->_is_primary && ! $this->_current_txn->is_free()) {
452
+			add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_ajax_content'));
453
+		}
454
+		return EEH_Template::locate_template(
455
+			THANK_YOU_TEMPLATES_PATH . 'thank-you-page-overview.template.php',
456
+			$template_args,
457
+			true,
458
+			true
459
+		);
460
+	}
461
+
462
+
463
+	/**
464
+	 * thank_you_page_IPN_monitor
465
+	 * this basically just pulls the TXN based on the reg_url_link sent from the server,
466
+	 * then checks that the TXN status is not failed, and that no other errors have been generated.
467
+	 * it also calculates the IPN wait time since the Thank You page was first loaded
468
+	 *
469
+	 * @param array $response
470
+	 * @param array $data
471
+	 * @return array
472
+	 * @throws \EE_Error
473
+	 */
474
+	public static function thank_you_page_IPN_monitor($response = array(), $data = array())
475
+	{
476
+		// does this heartbeat contain our data ?
477
+		if (! isset($data['espresso_thank_you_page'])) {
478
+			return $response;
479
+		}
480
+		// check for reg_url_link in the incoming heartbeat data
481
+		if (! isset($data['espresso_thank_you_page']['e_reg_url_link'])) {
482
+			$response['espresso_thank_you_page'] = array(
483
+				'errors' => ! empty($notices['errors'])
484
+					? $notices['errors']
485
+					: __(
486
+						'No transaction information could be retrieved because the registration URL link is missing or invalid.',
487
+						'event_espresso'
488
+					),
489
+			);
490
+			return $response;
491
+		}
492
+		// kk heartbeat has our data
493
+		$response['espresso_thank_you_page'] = array();
494
+		// set_definitions, instantiate the thank you page class, and get the ball rolling
495
+		EED_Thank_You_Page::set_definitions();
496
+		/** @var $espresso_thank_you_page EED_Thank_You_Page */
497
+		$espresso_thank_you_page = EED_Thank_You_Page::instance();
498
+		$espresso_thank_you_page->set_reg_url_link($data['espresso_thank_you_page']['e_reg_url_link']);
499
+		$espresso_thank_you_page->init();
500
+		// get TXN
501
+		$TXN = $espresso_thank_you_page->get_txn();
502
+		// no TXN? then get out
503
+		if (! $TXN instanceof EE_Transaction) {
504
+			$notices = EE_Error::get_notices();
505
+			$response['espresso_thank_you_page'] = array(
506
+				'errors' => ! empty($notices['errors'])
507
+					? $notices['errors']
508
+					: sprintf(
509
+						__(
510
+							'The information for your transaction could not be retrieved from the server or the transaction data received was invalid because of a technical reason. (%s)',
511
+							'event_espresso'
512
+						),
513
+						__LINE__
514
+					),
515
+			);
516
+			return $response;
517
+		}
518
+		// grab transient of TXN's status
519
+		$txn_status = isset($data['espresso_thank_you_page']['txn_status'])
520
+			? $data['espresso_thank_you_page']['txn_status']
521
+			: null;
522
+		// has the TXN status changed since we last checked (or empty because this is the first time running through this code)?
523
+		if ($txn_status !== $TXN->status_ID()) {
524
+			// switch between two possible basic outcomes
525
+			switch ($TXN->status_ID()) {
526
+				// TXN has been updated in some way
527
+				case EEM_Transaction::overpaid_status_code:
528
+				case EEM_Transaction::complete_status_code:
529
+				case EEM_Transaction::incomplete_status_code:
530
+					// send updated TXN results back to client,
531
+					$response['espresso_thank_you_page'] = array(
532
+						'transaction_details' => $espresso_thank_you_page->get_transaction_details(),
533
+						'txn_status'          => $TXN->status_ID(),
534
+					);
535
+					break;
536
+				// or we have a bad TXN, or really slow IPN, so calculate the wait time and send that back...
537
+				case EEM_Transaction::failed_status_code:
538
+				default:
539
+					// keep on waiting...
540
+					return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']);
541
+			}
542
+			// or is the TXN still failed (never been updated) ???
543
+		} elseif ($TXN->failed()) {
544
+			// keep on waiting...
545
+			return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']);
546
+		}
547
+		// TXN is happening so let's get the payments now
548
+		// if we've already gotten payments then the heartbeat data will contain the timestamp of the last time we checked
549
+		$since = isset($data['espresso_thank_you_page']['get_payments_since'])
550
+			? $data['espresso_thank_you_page']['get_payments_since']
551
+			: 0;
552
+		// then check for payments
553
+		$payments = $espresso_thank_you_page->get_txn_payments($since);
554
+		// has a payment been processed ?
555
+		if (! empty($payments) || $espresso_thank_you_page->_is_offline_payment_method) {
556
+			if ($since) {
557
+				$response['espresso_thank_you_page'] = array(
558
+					'new_payments'        => $espresso_thank_you_page->get_new_payments($payments),
559
+					'transaction_details' => $espresso_thank_you_page->get_transaction_details(),
560
+					'txn_status'          => $TXN->status_ID(),
561
+				);
562
+			} else {
563
+				$response['espresso_thank_you_page']['payment_details'] = $espresso_thank_you_page->get_payment_details(
564
+					$payments
565
+				);
566
+			}
567
+			// reset time to check for payments
568
+			$response['espresso_thank_you_page']['get_payments_since'] = time();
569
+		} else {
570
+			$response['espresso_thank_you_page']['get_payments_since'] = $since;
571
+		}
572
+		return $response;
573
+	}
574
+
575
+
576
+	/**
577
+	 * _update_server_wait_time
578
+	 *
579
+	 * @param array $thank_you_page_data thank you page portion of the incoming JSON array from the WP heartbeat data
580
+	 * @return array
581
+	 * @throws \EE_Error
582
+	 */
583
+	private function _update_server_wait_time($thank_you_page_data = array())
584
+	{
585
+		$response['espresso_thank_you_page'] = array(
586
+			'still_waiting' => isset($thank_you_page_data['initial_access'])
587
+				? time() - $thank_you_page_data['initial_access']
588
+				: 0,
589
+			'txn_status'    => $this->_current_txn->status_ID(),
590
+		);
591
+		return $response;
592
+	}
593
+
594
+
595
+	/**
596
+	 * get_registration_details
597
+	 *
598
+	 * @throws \EE_Error
599
+	 */
600
+	public function get_registration_details()
601
+	{
602
+		// prepare variables for displaying
603
+		$template_args = array();
604
+		$template_args['transaction'] = $this->_current_txn;
605
+		$template_args['reg_url_link'] = $this->_reg_url_link;
606
+		$template_args['is_primary'] = $this->_is_primary;
607
+		$template_args['SPCO_attendee_information_url'] = $this->_SPCO_attendee_information_url;
608
+		$template_args['resend_reg_confirmation_url'] = add_query_arg(
609
+			array('token' => $this->_reg_url_link, 'resend_reg_confirmation' => 'true'),
610
+			EE_Registry::instance()->CFG->core->thank_you_page_url()
611
+		);
612
+		// verify template arguments
613
+		EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction');
614
+		EEH_Template_Validator::verify_isnt_null(
615
+			$template_args['SPCO_attendee_information_url'],
616
+			'$SPCO_attendee_information_url'
617
+		);
618
+		echo EEH_Template::locate_template(
619
+			THANK_YOU_TEMPLATES_PATH . 'thank-you-page-registration-details.template.php',
620
+			$template_args,
621
+			true,
622
+			true
623
+		);
624
+	}
625
+
626
+
627
+	/**
628
+	 * resend_reg_confirmation_email
629
+	 *
630
+	 * @throws \EE_Error
631
+	 */
632
+	public static function resend_reg_confirmation_email()
633
+	{
634
+		EE_Registry::instance()->load_core('Request_Handler');
635
+		$reg_url_link = EE_Registry::instance()->REQ->get('token');
636
+		// was a REG_ID passed ?
637
+		if ($reg_url_link) {
638
+			$registration = EE_Registry::instance()->load_model('Registration')->get_one(
639
+				array(array('REG_url_link' => $reg_url_link))
640
+			);
641
+			if ($registration instanceof EE_Registration) {
642
+				// resend email
643
+				EED_Messages::process_resend(array('_REG_ID' => $registration->ID()));
644
+			} else {
645
+				EE_Error::add_error(
646
+					__(
647
+						'The Registration Confirmation email could not be sent because a valid Registration could not be retrieved from the database.',
648
+						'event_espresso'
649
+					),
650
+					__FILE__,
651
+					__FUNCTION__,
652
+					__LINE__
653
+				);
654
+			}
655
+		} else {
656
+			EE_Error::add_error(
657
+				__(
658
+					'The Registration Confirmation email could not be sent because a registration token is missing or invalid.',
659
+					'event_espresso'
660
+				),
661
+				__FILE__,
662
+				__FUNCTION__,
663
+				__LINE__
664
+			);
665
+		}
666
+		// request sent via AJAX ?
667
+		if (EE_FRONT_AJAX) {
668
+			echo wp_json_encode(EE_Error::get_notices(false));
669
+			die();
670
+			// or was JS disabled ?
671
+		} else {
672
+			// save errors so that they get picked up on the next request
673
+			EE_Error::get_notices(true, true);
674
+			wp_safe_redirect(
675
+				add_query_arg(
676
+					array('e_reg_url_link' => $reg_url_link),
677
+					EE_Registry::instance()->CFG->core->thank_you_page_url()
678
+				)
679
+			);
680
+		}
681
+	}
682
+
683
+
684
+	/**
685
+	 * get_ajax_content
686
+	 *
687
+	 * @return void
688
+	 * @throws \EE_Error
689
+	 */
690
+	public function get_ajax_content()
691
+	{
692
+		if (! $this->get_txn()) {
693
+			return;
694
+		}
695
+		// first determine which event(s) require pre-approval or not
696
+		$events = array();
697
+		$events_requiring_pre_approval = array();
698
+		foreach ($this->_current_txn->registrations() as $registration) {
699
+			if ($registration instanceof EE_Registration) {
700
+				$event = $registration->event();
701
+				if ($event instanceof EE_Event) {
702
+					if ($registration->is_not_approved() && $registration->event() instanceof EE_Event) {
703
+						$events_requiring_pre_approval[ $event->ID() ] = $event;
704
+					} else {
705
+						$events[ $event->ID() ] = $event;
706
+					}
707
+				}
708
+			}
709
+		}
710
+		$this->display_details_for_events_requiring_pre_approval($events_requiring_pre_approval);
711
+		$this->display_details_for_events($events);
712
+	}
713
+
714
+
715
+	/**
716
+	 * display_details_for_events
717
+	 *
718
+	 * @param EE_Event[] $events
719
+	 * @return void
720
+	 */
721
+	public function display_details_for_events($events = array())
722
+	{
723
+		if (! empty($events)) {
724
+			?>
725 725
             <div id="espresso-thank-you-page-ajax-content-dv">
726 726
                 <div id="espresso-thank-you-page-ajax-transaction-dv"></div>
727 727
                 <div id="espresso-thank-you-page-ajax-payment-dv"></div>
@@ -729,19 +729,19 @@  discard block
 block discarded – undo
729 729
                     <div id="ee-ajax-loading-dv" class="float-left lt-blue-text">
730 730
                         <span class="dashicons dashicons-upload"></span><span id="ee-ajax-loading-msg-spn">
731 731
                             <?php _e(
732
-                                'loading transaction and payment information...',
733
-                                'event_espresso'
734
-                            ); ?></span>
732
+								'loading transaction and payment information...',
733
+								'event_espresso'
734
+							); ?></span>
735 735
                     </div>
736 736
                     <?php if (! $this->_is_offline_payment_method && ! $this->_payments_closed) : ?>
737 737
                         <p id="ee-ajax-loading-pg" class="highlight-bg small-text clear">
738 738
                             <?php echo apply_filters(
739
-                                'EED_Thank_You_Page__get_ajax_content__waiting_for_IPN_msg',
740
-                                __(
741
-                                    'Some payment gateways can take 15 minutes or more to return their payment notification, so please be patient if you require payment confirmation as soon as possible. Please note that as soon as everything is finalized, we will send your full payment and registration confirmation results to you via email.',
742
-                                    'event_espresso'
743
-                                )
744
-                            ); ?>
739
+								'EED_Thank_You_Page__get_ajax_content__waiting_for_IPN_msg',
740
+								__(
741
+									'Some payment gateways can take 15 minutes or more to return their payment notification, so please be patient if you require payment confirmation as soon as possible. Please note that as soon as everything is finalized, we will send your full payment and registration confirmation results to you via email.',
742
+									'event_espresso'
743
+								)
744
+							); ?>
745 745
                             <br/>
746 746
                             <span class="jst-rght ee-block small-text lt-grey-text">
747 747
                                 <?php _e('current wait time ', 'event_espresso'); ?>
@@ -752,117 +752,117 @@  discard block
 block discarded – undo
752 752
                 <div class="clear"></div>
753 753
             </div>
754 754
             <?php
755
-        }
756
-    }
757
-
758
-
759
-    /**
760
-     * display_details_for_events_requiring_pre_approval
761
-     *
762
-     * @param EE_Event[] $events
763
-     * @return void
764
-     */
765
-    public function display_details_for_events_requiring_pre_approval($events = array())
766
-    {
767
-        if (! empty($events)) {
768
-            ?>
755
+		}
756
+	}
757
+
758
+
759
+	/**
760
+	 * display_details_for_events_requiring_pre_approval
761
+	 *
762
+	 * @param EE_Event[] $events
763
+	 * @return void
764
+	 */
765
+	public function display_details_for_events_requiring_pre_approval($events = array())
766
+	{
767
+		if (! empty($events)) {
768
+			?>
769 769
             <div id="espresso-thank-you-page-not-approved-message-dv">
770 770
                 <h4 class="orange-text"><?php _e('Important Notice:', 'event_espresso'); ?></h4>
771 771
                 <p id="events-requiring-pre-approval-pg" class="small-text">
772 772
                     <?php echo apply_filters(
773
-                        'AHEE__EED_Thank_You_Page__get_ajax_content__not_approved_message',
774
-                        __(
775
-                            'The following Event(s) you have registered for do not require payment at this time and will not be billed for during this transaction. Billing will only occur after all attendees have been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.',
776
-                            'event_espresso'
777
-                        )
778
-                    ); ?>
773
+						'AHEE__EED_Thank_You_Page__get_ajax_content__not_approved_message',
774
+						__(
775
+							'The following Event(s) you have registered for do not require payment at this time and will not be billed for during this transaction. Billing will only occur after all attendees have been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.',
776
+							'event_espresso'
777
+						)
778
+					); ?>
779 779
                 </p>
780 780
                 <ul class="events-requiring-pre-approval-ul">
781 781
                     <?php
782
-                    foreach ($events as $event) {
783
-                        if ($event instanceof EE_Event) {
784
-                            echo '<li><span class="dashicons dashicons-marker ee-icon-size-16 orange-text"></span>',
785
-                            $event->name(),
786
-                            '</li>';
787
-                        }
788
-                    } ?>
782
+					foreach ($events as $event) {
783
+						if ($event instanceof EE_Event) {
784
+							echo '<li><span class="dashicons dashicons-marker ee-icon-size-16 orange-text"></span>',
785
+							$event->name(),
786
+							'</li>';
787
+						}
788
+					} ?>
789 789
                 </ul>
790 790
                 <div class="clear"></div>
791 791
             </div>
792 792
             <?php
793
-        }
794
-    }
795
-
796
-
797
-    /**
798
-     * get_transaction_details
799
-     *
800
-     * @return string
801
-     * @throws \EE_Error
802
-     */
803
-    public function get_transaction_details()
804
-    {
805
-        // prepare variables for displaying
806
-        $template_args = array();
807
-        $template_args['transaction'] = $this->_current_txn;
808
-        $template_args['reg_url_link'] = $this->_reg_url_link;
809
-        $template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name(true);
810
-        // link to SPCO payment_options
811
-        $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link;
812
-        $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url;
813
-        // verify template arguments
814
-        EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction');
815
-        EEH_Template_Validator::verify_isnt_null(
816
-            $template_args['show_try_pay_again_link'],
817
-            '$show_try_pay_again_link'
818
-        );
819
-        EEH_Template_Validator::verify_isnt_null(
820
-            $template_args['SPCO_payment_options_url'],
821
-            '$SPCO_payment_options_url'
822
-        );
823
-        return EEH_Template::locate_template(
824
-            THANK_YOU_TEMPLATES_PATH . 'thank-you-page-transaction-details.template.php',
825
-            $template_args,
826
-            true,
827
-            true
828
-        );
829
-    }
830
-
831
-
832
-    /**
833
-     * get_payment_row_html
834
-     *
835
-     * @param EE_Payment $payment
836
-     * @return string
837
-     * @throws \EE_Error
838
-     */
839
-    public function get_payment_row_html($payment = null)
840
-    {
841
-        $html = '';
842
-        if ($payment instanceof EE_Payment) {
843
-            if ($payment->payment_method() instanceof EE_Payment_Method
844
-                && $payment->status() === EEM_Payment::status_id_failed
845
-                && $payment->payment_method()->is_off_site()
846
-            ) {
847
-                // considering the registrant has made it to the Thank You page,
848
-                // any failed payments may actually be pending and the IPN is just slow
849
-                // so let's
850
-                $payment->set_status(EEM_Payment::status_id_pending);
851
-            }
852
-            $payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined
853
-                ? '<br /><span class="small-text">' . $payment->gateway_response() . '</span>'
854
-                : '';
855
-            $html .= '
793
+		}
794
+	}
795
+
796
+
797
+	/**
798
+	 * get_transaction_details
799
+	 *
800
+	 * @return string
801
+	 * @throws \EE_Error
802
+	 */
803
+	public function get_transaction_details()
804
+	{
805
+		// prepare variables for displaying
806
+		$template_args = array();
807
+		$template_args['transaction'] = $this->_current_txn;
808
+		$template_args['reg_url_link'] = $this->_reg_url_link;
809
+		$template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name(true);
810
+		// link to SPCO payment_options
811
+		$template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link;
812
+		$template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url;
813
+		// verify template arguments
814
+		EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction');
815
+		EEH_Template_Validator::verify_isnt_null(
816
+			$template_args['show_try_pay_again_link'],
817
+			'$show_try_pay_again_link'
818
+		);
819
+		EEH_Template_Validator::verify_isnt_null(
820
+			$template_args['SPCO_payment_options_url'],
821
+			'$SPCO_payment_options_url'
822
+		);
823
+		return EEH_Template::locate_template(
824
+			THANK_YOU_TEMPLATES_PATH . 'thank-you-page-transaction-details.template.php',
825
+			$template_args,
826
+			true,
827
+			true
828
+		);
829
+	}
830
+
831
+
832
+	/**
833
+	 * get_payment_row_html
834
+	 *
835
+	 * @param EE_Payment $payment
836
+	 * @return string
837
+	 * @throws \EE_Error
838
+	 */
839
+	public function get_payment_row_html($payment = null)
840
+	{
841
+		$html = '';
842
+		if ($payment instanceof EE_Payment) {
843
+			if ($payment->payment_method() instanceof EE_Payment_Method
844
+				&& $payment->status() === EEM_Payment::status_id_failed
845
+				&& $payment->payment_method()->is_off_site()
846
+			) {
847
+				// considering the registrant has made it to the Thank You page,
848
+				// any failed payments may actually be pending and the IPN is just slow
849
+				// so let's
850
+				$payment->set_status(EEM_Payment::status_id_pending);
851
+			}
852
+			$payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined
853
+				? '<br /><span class="small-text">' . $payment->gateway_response() . '</span>'
854
+				: '';
855
+			$html .= '
856 856
 				<tr>
857 857
 					<td>
858 858
 						' . $payment->timestamp() . '
859 859
 					</td>
860 860
 					<td>
861 861
 						' . (
862
-                $payment->payment_method() instanceof EE_Payment_Method
863
-                    ? $payment->payment_method()->name()
864
-                    : __('Unknown', 'event_espresso')
865
-                ) . '
862
+				$payment->payment_method() instanceof EE_Payment_Method
863
+					? $payment->payment_method()->name()
864
+					: __('Unknown', 'event_espresso')
865
+				) . '
866 866
 					</td>
867 867
 					<td class="jst-rght">
868 868
 						' . EEH_Template::format_currency($payment->amount()) . '
@@ -871,83 +871,83 @@  discard block
 block discarded – undo
871 871
 						' . $payment->pretty_status(true) . $payment_declined_msg . '
872 872
 					</td>
873 873
 				</tr>';
874
-            do_action('AHEE__thank_you_page_payment_details_template__after_each_payment', $payment);
875
-        }
876
-        return $html;
877
-    }
878
-
879
-
880
-    /**
881
-     * get_payment_details
882
-     *
883
-     * @param array $payments
884
-     * @return string
885
-     * @throws \EE_Error
886
-     */
887
-    public function get_payment_details($payments = array())
888
-    {
889
-        // prepare variables for displaying
890
-        $template_args = array();
891
-        $template_args['transaction'] = $this->_current_txn;
892
-        $template_args['reg_url_link'] = $this->_reg_url_link;
893
-        $template_args['payments'] = array();
894
-        foreach ($payments as $payment) {
895
-            $template_args['payments'][] = $this->get_payment_row_html($payment);
896
-        }
897
-        // create a hacky payment object, but dont save it
898
-        $payment = EE_Payment::new_instance(
899
-            array(
900
-                'TXN_ID'        => $this->_current_txn->ID(),
901
-                'STS_ID'        => EEM_Payment::status_id_pending,
902
-                'PAY_timestamp' => time(),
903
-                'PAY_amount'    => $this->_current_txn->total(),
904
-                'PMD_ID'        => $this->_current_txn->payment_method_ID(),
905
-            )
906
-        );
907
-        $payment_method = $this->_current_txn->payment_method();
908
-        if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base) {
909
-            $template_args['gateway_content'] = $payment_method->type_obj()->payment_overview_content($payment);
910
-        } else {
911
-            $template_args['gateway_content'] = '';
912
-        }
913
-        // link to SPCO payment_options
914
-        $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link;
915
-        $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url;
916
-        // verify template arguments
917
-        EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction');
918
-        EEH_Template_Validator::verify_isnt_null($template_args['payments'], '$payments');
919
-        EEH_Template_Validator::verify_isnt_null(
920
-            $template_args['show_try_pay_again_link'],
921
-            '$show_try_pay_again_link'
922
-        );
923
-        EEH_Template_Validator::verify_isnt_null($template_args['gateway_content'], '$gateway_content');
924
-        EEH_Template_Validator::verify_isnt_null(
925
-            $template_args['SPCO_payment_options_url'],
926
-            '$SPCO_payment_options_url'
927
-        );
928
-        return EEH_Template::locate_template(
929
-            THANK_YOU_TEMPLATES_PATH . 'thank-you-page-payment-details.template.php',
930
-            $template_args,
931
-            true,
932
-            true
933
-        );
934
-    }
935
-
936
-
937
-    /**
938
-     * get_payment_details
939
-     *
940
-     * @param array $payments
941
-     * @return string
942
-     * @throws \EE_Error
943
-     */
944
-    public function get_new_payments($payments = array())
945
-    {
946
-        $payments_html = '';
947
-        // prepare variables for displaying
948
-        foreach ($payments as $payment) {
949
-            $payments_html .= $this->get_payment_row_html($payment);
950
-        }
951
-        return $payments_html;
952
-    }
874
+			do_action('AHEE__thank_you_page_payment_details_template__after_each_payment', $payment);
875
+		}
876
+		return $html;
877
+	}
878
+
879
+
880
+	/**
881
+	 * get_payment_details
882
+	 *
883
+	 * @param array $payments
884
+	 * @return string
885
+	 * @throws \EE_Error
886
+	 */
887
+	public function get_payment_details($payments = array())
888
+	{
889
+		// prepare variables for displaying
890
+		$template_args = array();
891
+		$template_args['transaction'] = $this->_current_txn;
892
+		$template_args['reg_url_link'] = $this->_reg_url_link;
893
+		$template_args['payments'] = array();
894
+		foreach ($payments as $payment) {
895
+			$template_args['payments'][] = $this->get_payment_row_html($payment);
896
+		}
897
+		// create a hacky payment object, but dont save it
898
+		$payment = EE_Payment::new_instance(
899
+			array(
900
+				'TXN_ID'        => $this->_current_txn->ID(),
901
+				'STS_ID'        => EEM_Payment::status_id_pending,
902
+				'PAY_timestamp' => time(),
903
+				'PAY_amount'    => $this->_current_txn->total(),
904
+				'PMD_ID'        => $this->_current_txn->payment_method_ID(),
905
+			)
906
+		);
907
+		$payment_method = $this->_current_txn->payment_method();
908
+		if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base) {
909
+			$template_args['gateway_content'] = $payment_method->type_obj()->payment_overview_content($payment);
910
+		} else {
911
+			$template_args['gateway_content'] = '';
912
+		}
913
+		// link to SPCO payment_options
914
+		$template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link;
915
+		$template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url;
916
+		// verify template arguments
917
+		EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction');
918
+		EEH_Template_Validator::verify_isnt_null($template_args['payments'], '$payments');
919
+		EEH_Template_Validator::verify_isnt_null(
920
+			$template_args['show_try_pay_again_link'],
921
+			'$show_try_pay_again_link'
922
+		);
923
+		EEH_Template_Validator::verify_isnt_null($template_args['gateway_content'], '$gateway_content');
924
+		EEH_Template_Validator::verify_isnt_null(
925
+			$template_args['SPCO_payment_options_url'],
926
+			'$SPCO_payment_options_url'
927
+		);
928
+		return EEH_Template::locate_template(
929
+			THANK_YOU_TEMPLATES_PATH . 'thank-you-page-payment-details.template.php',
930
+			$template_args,
931
+			true,
932
+			true
933
+		);
934
+	}
935
+
936
+
937
+	/**
938
+	 * get_payment_details
939
+	 *
940
+	 * @param array $payments
941
+	 * @return string
942
+	 * @throws \EE_Error
943
+	 */
944
+	public function get_new_payments($payments = array())
945
+	{
946
+		$payments_html = '';
947
+		// prepare variables for displaying
948
+		foreach ($payments as $payment) {
949
+			$payments_html .= $this->get_payment_row_html($payment);
950
+		}
951
+		return $payments_html;
952
+	}
953 953
 }
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
      */
135 135
     public static function set_definitions()
136 136
     {
137
-        define('THANK_YOU_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS);
138
-        define('THANK_YOU_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)) . 'templates' . DS);
137
+        define('THANK_YOU_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
138
+        define('THANK_YOU_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
139 139
     }
140 140
 
141 141
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             return $this->_current_txn;
151 151
         }
152 152
         $TXN_model = EE_Registry::instance()->load_model('Transaction');
153
-        if (! $TXN_model instanceof EEM_Transaction) {
153
+        if ( ! $TXN_model instanceof EEM_Transaction) {
154 154
             EE_Error::add_error(
155 155
                 __('The transaction model could not be established.', 'event_espresso'),
156 156
                 __FILE__,
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
      */
188 188
     public function get_txn_payments($since = 0)
189 189
     {
190
-        if (! $this->get_txn()) {
190
+        if ( ! $this->get_txn()) {
191 191
             return false;
192 192
         }
193 193
         $args = array('order_by' => array('PAY_timestamp' => 'ASC'));
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
      */
207 207
     private function _get_reg_url_link()
208 208
     {
209
-        if (! empty($this->_reg_url_link)) {
209
+        if ( ! empty($this->_reg_url_link)) {
210 210
             return;
211 211
         }
212 212
         // only do thank you page stuff if we have a REG_url_link in the url
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
     {
319 319
         wp_register_script(
320 320
             'thank_you_page',
321
-            THANK_YOU_ASSETS_URL . 'thank_you_page.js',
321
+            THANK_YOU_ASSETS_URL.'thank_you_page.js',
322 322
             array('espresso_core', 'heartbeat'),
323 323
             EVENT_ESPRESSO_VERSION,
324 324
             true
@@ -337,9 +337,9 @@  discard block
 block discarded – undo
337 337
     public function init()
338 338
     {
339 339
         $this->_get_reg_url_link();
340
-        if (! $this->get_txn()) {
340
+        if ( ! $this->get_txn()) {
341 341
             echo EEH_HTML::div(
342
-                EEH_HTML::h4(__('We\'re sorry...', 'event_espresso'), '', '') .
342
+                EEH_HTML::h4(__('We\'re sorry...', 'event_espresso'), '', '').
343 343
                 sprintf(
344 344
                     __(
345 345
                         'This is a system page for displaying transaction information after a purchase.%1$sYou are most likely seeing this notice because you have navigated to this page%1$sthrough some means other than completing a transaction.%1$sSorry for the disappointment, but you will most likely find nothing of interest here.%1$s%1$s',
@@ -429,12 +429,12 @@  discard block
 block discarded – undo
429 429
     public function thank_you_page_results()
430 430
     {
431 431
         $this->init();
432
-        if (! $this->_current_txn instanceof EE_Transaction) {
432
+        if ( ! $this->_current_txn instanceof EE_Transaction) {
433 433
             return EE_Error::get_notices();
434 434
         }
435 435
         // link to receipt
436 436
         $template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url('html');
437
-        if (! empty($template_args['TXN_receipt_url'])) {
437
+        if ( ! empty($template_args['TXN_receipt_url'])) {
438 438
             $template_args['order_conf_desc'] = __(
439 439
                 '%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation or click the button below to view / download / print a full description of your purchases and registration information.',
440 440
                 'event_espresso'
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
             add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_ajax_content'));
453 453
         }
454 454
         return EEH_Template::locate_template(
455
-            THANK_YOU_TEMPLATES_PATH . 'thank-you-page-overview.template.php',
455
+            THANK_YOU_TEMPLATES_PATH.'thank-you-page-overview.template.php',
456 456
             $template_args,
457 457
             true,
458 458
             true
@@ -474,11 +474,11 @@  discard block
 block discarded – undo
474 474
     public static function thank_you_page_IPN_monitor($response = array(), $data = array())
475 475
     {
476 476
         // does this heartbeat contain our data ?
477
-        if (! isset($data['espresso_thank_you_page'])) {
477
+        if ( ! isset($data['espresso_thank_you_page'])) {
478 478
             return $response;
479 479
         }
480 480
         // check for reg_url_link in the incoming heartbeat data
481
-        if (! isset($data['espresso_thank_you_page']['e_reg_url_link'])) {
481
+        if ( ! isset($data['espresso_thank_you_page']['e_reg_url_link'])) {
482 482
             $response['espresso_thank_you_page'] = array(
483 483
                 'errors' => ! empty($notices['errors'])
484 484
                     ? $notices['errors']
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
         // get TXN
501 501
         $TXN = $espresso_thank_you_page->get_txn();
502 502
         // no TXN? then get out
503
-        if (! $TXN instanceof EE_Transaction) {
503
+        if ( ! $TXN instanceof EE_Transaction) {
504 504
             $notices = EE_Error::get_notices();
505 505
             $response['espresso_thank_you_page'] = array(
506 506
                 'errors' => ! empty($notices['errors'])
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
         // then check for payments
553 553
         $payments = $espresso_thank_you_page->get_txn_payments($since);
554 554
         // has a payment been processed ?
555
-        if (! empty($payments) || $espresso_thank_you_page->_is_offline_payment_method) {
555
+        if ( ! empty($payments) || $espresso_thank_you_page->_is_offline_payment_method) {
556 556
             if ($since) {
557 557
                 $response['espresso_thank_you_page'] = array(
558 558
                     'new_payments'        => $espresso_thank_you_page->get_new_payments($payments),
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
             '$SPCO_attendee_information_url'
617 617
         );
618 618
         echo EEH_Template::locate_template(
619
-            THANK_YOU_TEMPLATES_PATH . 'thank-you-page-registration-details.template.php',
619
+            THANK_YOU_TEMPLATES_PATH.'thank-you-page-registration-details.template.php',
620 620
             $template_args,
621 621
             true,
622 622
             true
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
      */
690 690
     public function get_ajax_content()
691 691
     {
692
-        if (! $this->get_txn()) {
692
+        if ( ! $this->get_txn()) {
693 693
             return;
694 694
         }
695 695
         // first determine which event(s) require pre-approval or not
@@ -700,9 +700,9 @@  discard block
 block discarded – undo
700 700
                 $event = $registration->event();
701 701
                 if ($event instanceof EE_Event) {
702 702
                     if ($registration->is_not_approved() && $registration->event() instanceof EE_Event) {
703
-                        $events_requiring_pre_approval[ $event->ID() ] = $event;
703
+                        $events_requiring_pre_approval[$event->ID()] = $event;
704 704
                     } else {
705
-                        $events[ $event->ID() ] = $event;
705
+                        $events[$event->ID()] = $event;
706 706
                     }
707 707
                 }
708 708
             }
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
      */
721 721
     public function display_details_for_events($events = array())
722 722
     {
723
-        if (! empty($events)) {
723
+        if ( ! empty($events)) {
724 724
             ?>
725 725
             <div id="espresso-thank-you-page-ajax-content-dv">
726 726
                 <div id="espresso-thank-you-page-ajax-transaction-dv"></div>
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
                                 'event_espresso'
734 734
                             ); ?></span>
735 735
                     </div>
736
-                    <?php if (! $this->_is_offline_payment_method && ! $this->_payments_closed) : ?>
736
+                    <?php if ( ! $this->_is_offline_payment_method && ! $this->_payments_closed) : ?>
737 737
                         <p id="ee-ajax-loading-pg" class="highlight-bg small-text clear">
738 738
                             <?php echo apply_filters(
739 739
                                 'EED_Thank_You_Page__get_ajax_content__waiting_for_IPN_msg',
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
      */
765 765
     public function display_details_for_events_requiring_pre_approval($events = array())
766 766
     {
767
-        if (! empty($events)) {
767
+        if ( ! empty($events)) {
768 768
             ?>
769 769
             <div id="espresso-thank-you-page-not-approved-message-dv">
770 770
                 <h4 class="orange-text"><?php _e('Important Notice:', 'event_espresso'); ?></h4>
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
             '$SPCO_payment_options_url'
822 822
         );
823 823
         return EEH_Template::locate_template(
824
-            THANK_YOU_TEMPLATES_PATH . 'thank-you-page-transaction-details.template.php',
824
+            THANK_YOU_TEMPLATES_PATH.'thank-you-page-transaction-details.template.php',
825 825
             $template_args,
826 826
             true,
827 827
             true
@@ -850,25 +850,25 @@  discard block
 block discarded – undo
850 850
                 $payment->set_status(EEM_Payment::status_id_pending);
851 851
             }
852 852
             $payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined
853
-                ? '<br /><span class="small-text">' . $payment->gateway_response() . '</span>'
853
+                ? '<br /><span class="small-text">'.$payment->gateway_response().'</span>'
854 854
                 : '';
855 855
             $html .= '
856 856
 				<tr>
857 857
 					<td>
858
-						' . $payment->timestamp() . '
858
+						' . $payment->timestamp().'
859 859
 					</td>
860 860
 					<td>
861 861
 						' . (
862 862
                 $payment->payment_method() instanceof EE_Payment_Method
863 863
                     ? $payment->payment_method()->name()
864 864
                     : __('Unknown', 'event_espresso')
865
-                ) . '
865
+                ).'
866 866
 					</td>
867 867
 					<td class="jst-rght">
868
-						' . EEH_Template::format_currency($payment->amount()) . '
868
+						' . EEH_Template::format_currency($payment->amount()).'
869 869
 					</td>
870 870
 					<td class="jst-rght" style="line-height:1;">
871
-						' . $payment->pretty_status(true) . $payment_declined_msg . '
871
+						' . $payment->pretty_status(true).$payment_declined_msg.'
872 872
 					</td>
873 873
 				</tr>';
874 874
             do_action('AHEE__thank_you_page_payment_details_template__after_each_payment', $payment);
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
             '$SPCO_payment_options_url'
927 927
         );
928 928
         return EEH_Template::locate_template(
929
-            THANK_YOU_TEMPLATES_PATH . 'thank-you-page-payment-details.template.php',
929
+            THANK_YOU_TEMPLATES_PATH.'thank-you-page-payment-details.template.php',
930 930
             $template_args,
931 931
             true,
932 932
             true
Please login to merge, or discard this patch.
thank_you_page/templates/thank-you-page-transaction-details.template.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
                 <label><?php _e('Amount Owing: ', 'event_espresso'); ?></label>
18 18
             </td>
19 19
             <td class="<?php echo ($transaction->paid() == $transaction->total()) ? 'ee-transaction-paid'
20
-                : 'ee-transaction-unpaid' ?>">
20
+				: 'ee-transaction-unpaid' ?>">
21 21
                 <?php echo EEH_Template::format_currency($transaction->remaining()); ?>
22 22
             </td>
23 23
         </tr>
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
             </td>
28 28
             <td>
29 29
                 <?php $transaction->e_pretty_status(true);
30
-                if ($show_try_pay_again_link && ! $transaction->is_completed()) { ?>
30
+				if ($show_try_pay_again_link && ! $transaction->is_completed()) { ?>
31 31
                     &nbsp; <span class="small-text"><a href='<?php echo $SPCO_payment_options_url ?>'>
32 32
                             <?php _e(
33
-                                'View Payment Options',
34
-                                'event_espresso'
35
-                            ); ?></a></span>
33
+								'View Payment Options',
34
+								'event_espresso'
35
+							); ?></a></span>
36 36
                 <?php } ?>
37 37
             </td>
38 38
         </tr>
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
             </td>
46 46
         </tr>
47 47
         <?php do_action(
48
-            'AHEE__thank_you_page_transaction_details_template__after_transaction_table_row',
49
-            $transaction
50
-        ); ?>
48
+			'AHEE__thank_you_page_transaction_details_template__after_transaction_table_row',
49
+			$transaction
50
+		); ?>
51 51
         </tbody>
52 52
     </table>
53 53
 
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
         <p class="small-text jst-rght">
56 56
             <a href='<?php echo $SPCO_payment_options_url ?>'>
57 57
                 <?php _e(
58
-                    "Click here to view Payment Options",
59
-                    'event_espresso'
60
-                ); ?></a>
58
+					"Click here to view Payment Options",
59
+					'event_espresso'
60
+				); ?></a>
61 61
         </p>
62 62
         <br/>
63 63
 
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
                     <div class="jst-rght">
27 27
                         <a class="ee-button ee-roundish indented-text big-text"
28 28
                            href="<?php echo $TXN_receipt_url; ?>"><span
29 29
                                 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
-                                __('View Full Order Confirmation Receipt', 'event_espresso')
33
-                            ); ?></a>
31
+								'FHEE__thank_you_page_overview_template__order_conf_button_text',
32
+								__('View Full Order Confirmation Receipt', 'event_espresso')
33
+							); ?></a>
34 34
                     </div>
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
                     <div class="jst-rght">
27 27
                         <a class="ee-button ee-roundish indented-text big-text"
Please login to merge, or discard this patch.
thank_you_page/templates/thank-you-page-registration-details.template.php 2 patches
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -9,22 +9,22 @@  discard block
 block discarded – undo
9 9
 
10 10
 <div class="ee-registration-details-dv">
11 11
     <?php
12
-    $registrations = $transaction->registrations();
13
-    $registrations = is_array($registrations) ? $registrations : array();
14
-    $reg_count = count($registrations);
15
-    $reg_cntr = 0;
16
-    $event_name = '';
17
-    $wait_list = false;
18
-    foreach ($registrations as $registration) {
19
-        if ($registration instanceof EE_Registration) {
20
-            if ($event_name != $registration->event_name() && ! empty($event_name)) { ?>
12
+	$registrations = $transaction->registrations();
13
+	$registrations = is_array($registrations) ? $registrations : array();
14
+	$reg_count = count($registrations);
15
+	$reg_cntr = 0;
16
+	$event_name = '';
17
+	$wait_list = false;
18
+	foreach ($registrations as $registration) {
19
+		if ($registration instanceof EE_Registration) {
20
+			if ($event_name != $registration->event_name() && ! empty($event_name)) { ?>
21 21
                 </tbody>
22 22
                 </table>
23 23
                 <?php
24
-            }
25
-            $reg_cntr++;
26
-            if ($event_name != $registration->event_name()) {
27
-                ?>
24
+			}
25
+			$reg_cntr++;
26
+			if ($event_name != $registration->event_name()) {
27
+				?>
28 28
                 <h5>
29 29
                     <span class="smaller-text grey-text"><?php _e('for', 'event_espresso'); ?>
30 30
                         : </span> <?php echo htmlentities($registration->event_name(), ENT_QUOTES, 'UTF-8'); ?>
@@ -45,46 +45,46 @@  discard block
 block discarded – undo
45 45
                 </thead>
46 46
                 <tbody>
47 47
                 <?php
48
-            }
49
-            if ($is_primary || (! $is_primary && $reg_url_link == $registration->reg_url_link())) { ?>
48
+			}
49
+			if ($is_primary || (! $is_primary && $reg_url_link == $registration->reg_url_link())) { ?>
50 50
                 <tr>
51 51
                     <td width="40%">
52 52
                         <?php
53
-                        if ($registration->attendee() instanceof EE_Attendee) {
54
-                            echo $registration->attendee()->full_name(true);
55
-                        }
56
-                        ?>
53
+						if ($registration->attendee() instanceof EE_Attendee) {
54
+							echo $registration->attendee()->full_name(true);
55
+						}
56
+						?>
57 57
                         <p class="tiny-text" style="margin: .75em 0 0;">
58 58
                             <?php
59
-                            if ($registration->count_question_groups()) {
60
-                                ?>
59
+							if ($registration->count_question_groups()) {
60
+								?>
61 61
                                 <a class="ee-icon-only-lnk"
62 62
                                    href="<?php echo $registration->edit_attendee_information_url(); ?>"
63 63
                                    title="<?php
64
-                                               esc_attr_e(
65
-                                                   'Click here to edit Attendee Information',
66
-                                                   'event_espresso'
67
-                                               ); ?>"><span class="ee-icon ee-icon-user-edit"></span>
64
+											   esc_attr_e(
65
+												   'Click here to edit Attendee Information',
66
+												   'event_espresso'
67
+											   ); ?>"><span class="ee-icon ee-icon-user-edit"></span>
68 68
                                     <?php _e(
69
-                                        'edit info',
70
-                                        'event_espresso'
71
-                                    ); ?></a>
69
+										'edit info',
70
+										'event_espresso'
71
+									); ?></a>
72 72
                             <?php } ?>
73 73
                             <a class="ee-resend-reg-confirmation-email ee-icon-only-lnk"
74 74
                                href="<?php
75
-                                        echo add_query_arg(
76
-                                            array('token' => $registration->reg_url_link(), 'resend_reg_confirmation' => 'true'),
77
-                                            EE_Registry::instance()->CFG->core->thank_you_page_url()
78
-                                        ); ?>" title="<?php
79
-                                                        esc_attr_e(
80
-                                                            'Click here to resend the Registration Confirmation email',
81
-                                                            'event_espresso'
82
-                                                        ); ?>" rel="<?php echo $registration->reg_url_link(); ?>"><span
75
+										echo add_query_arg(
76
+											array('token' => $registration->reg_url_link(), 'resend_reg_confirmation' => 'true'),
77
+											EE_Registry::instance()->CFG->core->thank_you_page_url()
78
+										); ?>" title="<?php
79
+														esc_attr_e(
80
+															'Click here to resend the Registration Confirmation email',
81
+															'event_espresso'
82
+														); ?>" rel="<?php echo $registration->reg_url_link(); ?>"><span
83 83
                                                                 class="dashicons dashicons-email-alt"></span>
84 84
                                 <?php _e(
85
-                                    'resend email',
86
-                                    'event_espresso'
87
-                                ); ?></a>
85
+									'resend email',
86
+									'event_espresso'
87
+								); ?></a>
88 88
                         </p>
89 89
                     </td>
90 90
                     <td width="25%" class="jst-left">
@@ -93,53 +93,53 @@  discard block
 block discarded – undo
93 93
                     <td width="35%" class="jst-left">
94 94
                         <?php $registration->e_pretty_status(true) ?>
95 95
                         <?php
96
-                        if ($registration->status_ID() === EEM_Registration::status_id_wait_list) {
97
-                            $wait_list = true;
98
-                        }
99
-                        ?>
96
+						if ($registration->status_ID() === EEM_Registration::status_id_wait_list) {
97
+							$wait_list = true;
98
+						}
99
+						?>
100 100
                     </td>
101 101
                 </tr>
102 102
                 <?php do_action(
103
-                    'AHEE__thank_you_page_registration_details_template__after_registration_table_row',
104
-                    $registration
105
-                ); ?>
103
+					'AHEE__thank_you_page_registration_details_template__after_registration_table_row',
104
+					$registration
105
+				); ?>
106 106
                 <?php
107
-                $event_name = $registration->event_name();
108
-            }
109
-            if ($reg_cntr >= $reg_count) {
110
-                ?>
107
+				$event_name = $registration->event_name();
108
+			}
109
+			if ($reg_cntr >= $reg_count) {
110
+				?>
111 111
                 </tbody>
112 112
                 </table>
113 113
                 <?php
114
-            }
115
-        }
116
-    }
117
-    ?>
114
+			}
115
+		}
116
+	}
117
+	?>
118 118
     <?php if ($is_primary && $SPCO_attendee_information_url) { ?>
119 119
         <p class="small-text jst-rght">
120 120
             <a href='<?php echo $SPCO_attendee_information_url ?>'>
121 121
                 <?php _e(
122
-                    "Click here to edit All Attendee Information",
123
-                    'event_espresso'
124
-                ); ?></a>
122
+					"Click here to edit All Attendee Information",
123
+					'event_espresso'
124
+				); ?></a>
125 125
         </p>
126 126
     <?php } ?>
127 127
     <?php
128
-    if ($wait_list) { ?>
128
+	if ($wait_list) { ?>
129 129
         <?php
130
-        echo apply_filters(
131
-            'AFEE__thank_you_page_registration_details_template__wait_list_notice',
132
-            sprintf(
133
-                __(
134
-                    '%1$sre: Wait List Registrations%2$sPlease note that the total cost listed below in the Transaction Details is for ALL registrations, including those that are on the wait list, even though they can not be currently paid for. If any spaces become available however, you may be notified by the Event admin and have the opportunity to secure the remaining tickets by making a payment for them.%3$s',
135
-                    'event_espresso'
136
-                ),
137
-                '<h6 class="" style="margin-bottom:.25em;"><span class="dashicons dashicons-clipboard ee-icon-size-16 purple-text"></span>',
138
-                '</h6 ><p class="ee-wait-list-notice">',
139
-                '</p ><br />'
140
-            )
141
-        );
142
-        ?>
130
+		echo apply_filters(
131
+			'AFEE__thank_you_page_registration_details_template__wait_list_notice',
132
+			sprintf(
133
+				__(
134
+					'%1$sre: Wait List Registrations%2$sPlease note that the total cost listed below in the Transaction Details is for ALL registrations, including those that are on the wait list, even though they can not be currently paid for. If any spaces become available however, you may be notified by the Event admin and have the opportunity to secure the remaining tickets by making a payment for them.%3$s',
135
+					'event_espresso'
136
+				),
137
+				'<h6 class="" style="margin-bottom:.25em;"><span class="dashicons dashicons-clipboard ee-icon-size-16 purple-text"></span>',
138
+				'</h6 ><p class="ee-wait-list-notice">',
139
+				'</p ><br />'
140
+			)
141
+		);
142
+		?>
143 143
 
144 144
     <?php } ?>
145 145
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
                 <tbody>
47 47
                 <?php
48 48
             }
49
-            if ($is_primary || (! $is_primary && $reg_url_link == $registration->reg_url_link())) { ?>
49
+            if ($is_primary || ( ! $is_primary && $reg_url_link == $registration->reg_url_link())) { ?>
50 50
                 <tr>
51 51
                     <td width="40%">
52 52
                         <?php
Please login to merge, or discard this patch.
thank_you_page/templates/thank-you-page-payment-details.template.php 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 
6 6
 <div id="espresso-thank-you-page-payment-details-dv">
7 7
     <?php
8
-    if (! empty($payments)) { ?>
8
+	if (! empty($payments)) { ?>
9 9
         <table class="ee-table">
10 10
             <thead>
11 11
             <tr>
@@ -25,40 +25,40 @@  discard block
 block discarded – undo
25 25
             </thead>
26 26
             <tbody>
27 27
             <?php
28
-            foreach ($payments as $payment) {
29
-                echo $payment;
30
-            }
31
-            ?>
28
+			foreach ($payments as $payment) {
29
+				echo $payment;
30
+			}
31
+			?>
32 32
             </tbody>
33 33
         </table>
34 34
         <?php
35
-    } else {
36
-        if ($transaction->total()) {
37
-            echo apply_filters(
38
-                'FHEE__payment_overview_template__no_payments_made',
39
-                sprintf(
40
-                    __('%sNo payments towards this transaction have been received.%s', 'event_espresso'),
41
-                    '<p class="important-notice">',
42
-                    '</p>'
43
-                )
44
-            );
45
-            do_action('AHEE__thank_you_page_payment_details_template__no_payments_made', $transaction);
46
-        } else {
47
-            echo apply_filters(
48
-                'FHEE__payment_overview_template__no_payment_required',
49
-                sprintf(
50
-                    __('%sNo payment is required for this transaction.%s', 'event_espresso'),
51
-                    '<p>',
52
-                    '</p>'
53
-                )
54
-            );
55
-            do_action('AHEE__thank_you_page_payment_details_template__no_payment_required');
56
-        }
57
-    }
58
-    echo $gateway_content;
59
-    do_action('AHEE__thank_you_page_payment_details_template__after_gateway_content', $gateway_content);
35
+	} else {
36
+		if ($transaction->total()) {
37
+			echo apply_filters(
38
+				'FHEE__payment_overview_template__no_payments_made',
39
+				sprintf(
40
+					__('%sNo payments towards this transaction have been received.%s', 'event_espresso'),
41
+					'<p class="important-notice">',
42
+					'</p>'
43
+				)
44
+			);
45
+			do_action('AHEE__thank_you_page_payment_details_template__no_payments_made', $transaction);
46
+		} else {
47
+			echo apply_filters(
48
+				'FHEE__payment_overview_template__no_payment_required',
49
+				sprintf(
50
+					__('%sNo payment is required for this transaction.%s', 'event_espresso'),
51
+					'<p>',
52
+					'</p>'
53
+				)
54
+			);
55
+			do_action('AHEE__thank_you_page_payment_details_template__no_payment_required');
56
+		}
57
+	}
58
+	echo $gateway_content;
59
+	do_action('AHEE__thank_you_page_payment_details_template__after_gateway_content', $gateway_content);
60 60
 
61
-    ?>
61
+	?>
62 62
 
63 63
     <br/>
64 64
     <?php do_action('AHEE__thank_you_page_payment_details_template__after_payment_details');
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 
6 6
 <div id="espresso-thank-you-page-payment-details-dv">
7 7
     <?php
8
-    if (! empty($payments)) { ?>
8
+    if ( ! empty($payments)) { ?>
9 9
         <table class="ee-table">
10 10
             <thead>
11 11
             <tr>
Please login to merge, or discard this patch.
reg_steps/payment_options/no_payment_required.template.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -2,36 +2,36 @@
 block discarded – undo
2 2
 /** @type array $registrations_for_free_events */
3 3
 
4 4
 if (is_array($registrations_for_free_events) && ! empty($registrations_for_free_events)) {
5
-    echo apply_filters(
6
-        'FHEE__registration_page_payment_options__no_payment_required_hdr',
7
-        sprintf(
8
-            __('%1$sNo Payment Required%2$s', 'event_espresso'),
9
-            '<h6>',
10
-            '</h6>'
11
-        )
12
-    );
13
-    foreach ($registrations_for_free_events as $registration_for_free_event) {
14
-        if ($registration_for_free_event instanceof EE_Registration
15
-            && $registration_for_free_event->ticket()->is_free()
16
-        ) {
17
-            if ($registration_for_free_event->event() instanceof EE_Event) {
18
-                ?>
5
+	echo apply_filters(
6
+		'FHEE__registration_page_payment_options__no_payment_required_hdr',
7
+		sprintf(
8
+			__('%1$sNo Payment Required%2$s', 'event_espresso'),
9
+			'<h6>',
10
+			'</h6>'
11
+		)
12
+	);
13
+	foreach ($registrations_for_free_events as $registration_for_free_event) {
14
+		if ($registration_for_free_event instanceof EE_Registration
15
+			&& $registration_for_free_event->ticket()->is_free()
16
+		) {
17
+			if ($registration_for_free_event->event() instanceof EE_Event) {
18
+				?>
19 19
                 <p>
20 20
                     <?php echo apply_filters(
21
-                        'FHEE__registration_page_payment_options__no_payment_required_pg',
22
-                        sprintf(
23
-                            __(
24
-                                '"%1$s" for "%2$s" is free, so no payment is required and no billing will occur.',
25
-                                'event_espresso'
26
-                            ),
27
-                            $registration_for_free_event->ticket()->name(),
28
-                            $registration_for_free_event->event()->name()
29
-                        )
30
-                    ); ?>
21
+						'FHEE__registration_page_payment_options__no_payment_required_pg',
22
+						sprintf(
23
+							__(
24
+								'"%1$s" for "%2$s" is free, so no payment is required and no billing will occur.',
25
+								'event_espresso'
26
+							),
27
+							$registration_for_free_event->ticket()->name(),
28
+							$registration_for_free_event->event()->name()
29
+						)
30
+					); ?>
31 31
                 </p>
32 32
                 <?php
33
-            }
34
-        }
35
-    }
33
+			}
34
+		}
35
+	}
36 36
 }
37 37
 ?>
Please login to merge, or discard this patch.
reg_steps/attendee_information/copy_attendee_info.template.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@  discard block
 block discarded – undo
3 3
     <p class="spco-copy-all-attendee-pg">
4 4
         <label class="ee-checkbox-label-before ee-checkbox-label-wide">
5 5
             <?php _e(
6
-                'Use Attendee #1\'s information for ALL attendees',
7
-                'event_espresso'
8
-            ); ?>
6
+				'Use Attendee #1\'s information for ALL attendees',
7
+				'event_espresso'
8
+			); ?>
9 9
             <input id="spco-copy-all-attendee-chk" class="spco-copy-all-attendee-chk ee-do-not-validate" type="checkbox"
10 10
                    value="copy-all">
11 11
         </label>
@@ -13,23 +13,23 @@  discard block
 block discarded – undo
13 13
 
14 14
     <p class="spco-copy-attendee-pg">
15 15
         <?php echo apply_filters(
16
-            'FHEE__registration_page_attendee_information__copy_attendee_pg',
17
-            sprintf(
18
-                __(
19
-                    'This option allows you to use the above information for all additional attendee question fields. %sPlease note:%s some events may have additional questions that you may still be required to answer in order to complete your registration.',
20
-                    'event_espresso'
21
-                ),
22
-                '<strong>',
23
-                '</strong>'
24
-            )
25
-        ); ?></p>
16
+			'FHEE__registration_page_attendee_information__copy_attendee_pg',
17
+			sprintf(
18
+				__(
19
+					'This option allows you to use the above information for all additional attendee question fields. %sPlease note:%s some events may have additional questions that you may still be required to answer in order to complete your registration.',
20
+					'event_espresso'
21
+				),
22
+				'<strong>',
23
+				'</strong>'
24
+			)
25
+		); ?></p>
26 26
 
27 27
     <a id="display-more-attendee-copy-options" class="display-the-hidden smaller-text float-right"
28 28
        rel="more-attendee-copy-options"><span class="dashicons dashicons-arrow-right"></span>
29 29
         <?php _e(
30
-            'advanced copy options',
31
-            'event_espresso'
32
-        ); ?></a>
30
+			'advanced copy options',
31
+			'event_espresso'
32
+		); ?></a>
33 33
     <a id="hide-more-attendee-copy-options" class="hide-the-displayed smaller-text float-right"
34 34
        rel="more-attendee-copy-options" style="display: none;"><span
35 35
             class="dashicons dashicons-arrow-down"></span><?php _e('basic copy options', 'event_espresso'); ?></a>
@@ -38,15 +38,15 @@  discard block
 block discarded – undo
38 38
 
39 39
         <p class="spco-copy-attendee-pg">
40 40
             <?php _e(
41
-                'Only copy the above information to the following selected additional attendees.',
42
-                'event_espresso'
43
-            ); ?>
41
+				'Only copy the above information to the following selected additional attendees.',
42
+				'event_espresso'
43
+			); ?>
44 44
         </p>
45 45
 
46 46
         <?php
47
-        foreach ($spco_copy_attendee_chk as $spco_copy_chk) {
48
-            echo $spco_copy_chk;
49
-        } ?>
47
+		foreach ($spco_copy_attendee_chk as $spco_copy_chk) {
48
+			echo $spco_copy_chk;
49
+		} ?>
50 50
 
51 51
     </div>
52 52
     <div class="clear-float"></div>
Please login to merge, or discard this patch.
reg_steps/attendee_information/auto_copy_attendee_info.template.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <p id="spco-auto-copy-attendee-pg" class="smaller-text lt-grey-text">
2 2
     <?php echo apply_filters(
3
-        'FHEE__registration_page_attendee_information__auto_copy_attendee_pg',
4
-        __(
5
-            'The above information will be used for any additional tickets/attendees.',
6
-            'event_espresso'
7
-        )
8
-    ); ?>
3
+		'FHEE__registration_page_attendee_information__auto_copy_attendee_pg',
4
+		__(
5
+			'The above information will be used for any additional tickets/attendees.',
6
+			'event_espresso'
7
+		)
8
+	); ?>
9 9
 </p>
10 10
\ No newline at end of file
Please login to merge, or discard this patch.
reg_steps/attendee_information/attendee_info_main.template.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -5,16 +5,16 @@  discard block
 block discarded – undo
5 5
 ?>
6 6
 <p id="spco-attendee_information-pg" class="spco-steps-pg small-text drk-grey-text">
7 7
     <?php echo apply_filters(
8
-        'FHEE__registration_page_attendee_information__attendee_information_pg',
9
-        sprintf(
10
-            __(
11
-                'In order to process your registration, we ask you to provide the following information.%1$sPlease note that all fields marked with an asterisk (%2$s) are required.',
12
-                'event_espresso'
13
-            ),
14
-            '<br />',
15
-            '<span class="asterisk">*</span>'
16
-        )
17
-    ); ?>
8
+		'FHEE__registration_page_attendee_information__attendee_information_pg',
9
+		sprintf(
10
+			__(
11
+				'In order to process your registration, we ask you to provide the following information.%1$sPlease note that all fields marked with an asterisk (%2$s) are required.',
12
+				'event_espresso'
13
+			),
14
+			'<br />',
15
+			'<span class="asterisk">*</span>'
16
+		)
17
+	); ?>
18 18
 </p>
19 19
 
20 20
 <?php
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 $prev_ticket = 0;
24 24
 
25 25
 if (count($registrations) > 0) {
26
-    foreach ($registrations as $registration) {
27
-        if ($registration instanceof EE_Registration) {
28
-            $att_nmbr++;
29
-            ?>
26
+	foreach ($registrations as $registration) {
27
+		if ($registration instanceof EE_Registration) {
28
+			$att_nmbr++;
29
+			?>
30 30
 
31 31
             <div id="spco-attendee-panel-dv-<?php echo $registration->reg_url_link(); ?>"
32 32
                  class="spco-attendee-panel-dv spco-attendee-ticket-<?php echo $registration->ticket()->ID(); ?>">
@@ -46,19 +46,19 @@  discard block
 block discarded – undo
46 46
                                     <th scope="col" width=""><?php _e('Name and Description', 'event_espresso'); ?></th>
47 47
                                     <th scope="col" width="7.5%" class="jst-rght">
48 48
                                         <?php _e(
49
-                                            'Qty',
50
-                                            'event_espresso'
51
-                                        ); ?></th>
49
+											'Qty',
50
+											'event_espresso'
51
+										); ?></th>
52 52
                                     <th scope="col" width="17.5%" class="jst-rght">
53 53
                                         <?php _e(
54
-                                            'Price',
55
-                                            'event_espresso'
56
-                                        ); ?></th>
54
+											'Price',
55
+											'event_espresso'
56
+										); ?></th>
57 57
                                     <th scope="col" width="17.5%" class="jst-rght">
58 58
                                         <?php _e(
59
-                                            'Total',
60
-                                            'event_espresso'
61
-                                        ); ?></th>
59
+											'Total',
60
+											'event_espresso'
61
+										); ?></th>
62 62
                                 </tr>
63 63
                                 </thead>
64 64
                                 <tbody>
@@ -70,19 +70,19 @@  discard block
 block discarded – undo
70 70
                 <?php } ?>
71 71
 
72 72
                 <?php
73
-                // ATTENDEE QUESTIONS
74
-                $reg_form = EE_Template_Layout::get_subform_name($registration->reg_url_link());
75
-                echo ${$reg_form};
76
-                ?>
73
+				// ATTENDEE QUESTIONS
74
+				$reg_form = EE_Template_Layout::get_subform_name($registration->reg_url_link());
75
+				echo ${$reg_form};
76
+				?>
77 77
 
78 78
             </div>
79 79
             <?php
80
-            $prev_event = $registration->event()->ID();
81
-            $prev_ticket = $registration->ticket()->ID();
82
-        } // if ( $registration instanceof EE_Registration )
83
-    } // end foreach ( $registrations as $registration )
80
+			$prev_event = $registration->event()->ID();
81
+			$prev_ticket = $registration->ticket()->ID();
82
+		} // if ( $registration instanceof EE_Registration )
83
+	} // end foreach ( $registrations as $registration )
84 84
 
85
-    echo $default_hidden_inputs;
85
+	echo $default_hidden_inputs;
86 86
 } // end if ( count( $registrations ) > 0 )
87 87
 
88 88
 ?>
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
                     </h4>
38 38
                 <?php } ?>
39 39
                 <?php if ($registration->ticket()->ID() !== $prev_ticket) { ?>
40
-                    <?php if (! $revisit) { ?>
40
+                    <?php if ( ! $revisit) { ?>
41 41
                         <div class="spco-ticket-info-dv small-text">
42 42
                             <h5><?php _e('Details', 'event_espresso'); ?></h5>
43 43
                             <table>
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
                                 </tr>
63 63
                                 </thead>
64 64
                                 <tbody>
65
-                                <?php echo $ticket_line_item[ $registration->ticket()->ID() ]; ?>
65
+                                <?php echo $ticket_line_item[$registration->ticket()->ID()]; ?>
66 66
                                 </tbody>
67 67
                             </table>
68 68
                         </div>
Please login to merge, or discard this patch.