Completed
Branch rest-authorization (c7240a)
by
unknown
02:23
created
single_page_checkout/templates/registration_page_wrapper.template.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 <div id="ee-single-page-checkout-dv" class="">
16 16
     <?php
17
-    if (! $empty_cart) {
17
+    if ( ! $empty_cart) {
18 18
         if (apply_filters('FHEE__registration_page_wrapper_template__display_time_limit', false)) { ?>
19 19
             <p id="spco-registration-time-limit-pg" class="spco-steps-pg ee-attention important-notice"
20 20
                style="display: none;">
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
                 <span id="spco-registration-expiration-spn" class="" style="display:none;"></span>
32 32
             </p>
33 33
         <?php }
34
-        if (! $revisit && apply_filters('FHEE__registration_page_wrapper_template__steps_display', true)) {
34
+        if ( ! $revisit && apply_filters('FHEE__registration_page_wrapper_template__steps_display', true)) {
35 35
             ?>
36 36
             <h2 id="spco-steps-big-hdr" class="spco-steps-big-hdr">
37 37
                 <?php esc_html_e(' Steps', 'event_espresso'); ?>
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         foreach ($reg_steps as $reg_step) {
78 78
             if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') {
79 79
                 $slug = $reg_step->slug();
80
-                do_action('AHEE__' . $slug . '__reg_step_start', $reg_step);
80
+                do_action('AHEE__'.$slug.'__reg_step_start', $reg_step);
81 81
                 // todo: deprecate hook AHEE__registration_page_attendee_information__start
82 82
                 ?>
83 83
                 <div id="spco-<?php echo esc_attr($slug); ?>-dv"
Please login to merge, or discard this patch.
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -16,38 +16,38 @@  discard block
 block discarded – undo
16 16
 
17 17
 <div id="ee-single-page-checkout-dv" class="">
18 18
     <?php
19
-    if (! $empty_cart) {
20
-        if (apply_filters('FHEE__registration_page_wrapper_template__display_time_limit', false)) { ?>
19
+	if (! $empty_cart) {
20
+		if (apply_filters('FHEE__registration_page_wrapper_template__display_time_limit', false)) { ?>
21 21
             <p id="spco-registration-time-limit-pg" class="spco-steps-pg ee-attention important-notice"
22 22
                style="display: none;">
23 23
                 <?php echo sprintf(
24
-                    apply_filters(
25
-                        'FHEE__registration_page_wrapper_template___time_limit',
26
-                        esc_html__('You have %1$s to complete your registration.', 'event_espresso')
27
-                    ),
28
-                    '<span id="spco-registration-time-limit-spn" class="spco-registration-time-limit-spn">'
29
-                    . $registration_time_limit
30
-                    . '</span>'
31
-                );
32
-                ?>
24
+					apply_filters(
25
+						'FHEE__registration_page_wrapper_template___time_limit',
26
+						esc_html__('You have %1$s to complete your registration.', 'event_espresso')
27
+					),
28
+					'<span id="spco-registration-time-limit-spn" class="spco-registration-time-limit-spn">'
29
+					. $registration_time_limit
30
+					. '</span>'
31
+				);
32
+				?>
33 33
                 <span id="spco-registration-expiration-spn" class="" style="display:none;"></span>
34 34
             </p>
35 35
         <?php }
36
-        if (! $revisit && apply_filters('FHEE__registration_page_wrapper_template__steps_display', true)) {
37
-            ?>
36
+		if (! $revisit && apply_filters('FHEE__registration_page_wrapper_template__steps_display', true)) {
37
+			?>
38 38
             <h2 id="spco-steps-big-hdr" class="spco-steps-big-hdr">
39 39
                 <?php esc_html_e(' Steps', 'event_espresso'); ?>
40 40
             </h2>
41 41
 
42 42
             <div id="spco-steps-display-dv">
43 43
                 <?php
44
-                $step_nmbr = 1;
45
-                $total_steps = count($reg_steps) - 1;
46
-                foreach ($reg_steps as $reg_step) {
47
-                    if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') {
48
-                        $slug = $reg_step->slug();
49
-                        $step_display_dv_class = $reg_step->is_current_step() ? 'active-step' : 'inactive-step';
50
-                        ?>
44
+				$step_nmbr = 1;
45
+				$total_steps = count($reg_steps) - 1;
46
+				foreach ($reg_steps as $reg_step) {
47
+					if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') {
48
+						$slug = $reg_step->slug();
49
+						$step_display_dv_class = $reg_step->is_current_step() ? 'active-step' : 'inactive-step';
50
+						?>
51 51
                         <div id="spco-step-<?php echo esc_attr($slug); ?>-display-dv"
52 52
                              class="spco-step-display-dv <?php echo esc_attr($step_display_dv_class); ?> steps-<?php echo esc_attr($total_steps); ?>"
53 53
                         >
@@ -60,28 +60,28 @@  discard block
 block discarded – undo
60 60
                         </div>
61 61
 
62 62
                         <?php
63
-                        if ($step_nmbr < $total_steps) { ?>
63
+						if ($step_nmbr < $total_steps) { ?>
64 64
                             <div class="spco-step-arrow-dv">&raquo;</div>
65 65
                             <?php
66
-                        }
67
-                        $step_nmbr++;
68
-                    }
69
-                }
70
-                ?>
66
+						}
67
+						$step_nmbr++;
68
+					}
69
+				}
70
+				?>
71 71
                 <div class="clear-float"></div>
72 72
             </div>
73 73
 
74 74
             <?php
75
-        }
75
+		}
76 76
 
77
-        do_action('AHEE__SPCO__before_registration_steps');
78
-        $step_nmbr = 1;
79
-        foreach ($reg_steps as $reg_step) {
80
-            if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') {
81
-                $slug = $reg_step->slug();
82
-                do_action('AHEE__' . $slug . '__reg_step_start', $reg_step);
83
-                // todo: deprecate hook AHEE__registration_page_attendee_information__start
84
-                ?>
77
+		do_action('AHEE__SPCO__before_registration_steps');
78
+		$step_nmbr = 1;
79
+		foreach ($reg_steps as $reg_step) {
80
+			if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') {
81
+				$slug = $reg_step->slug();
82
+				do_action('AHEE__' . $slug . '__reg_step_start', $reg_step);
83
+				// todo: deprecate hook AHEE__registration_page_attendee_information__start
84
+				?>
85 85
                 <div id="spco-<?php echo esc_attr($slug); ?>-dv"
86 86
                      class="spco-step-dv <?php echo esc_attr($reg_step->div_class()); ?>"
87 87
                 >
@@ -89,20 +89,20 @@  discard block
 block discarded – undo
89 89
                     <?php do_action('AHEE__SPCO_after_reg_step_form', $slug, $next_step); ?>
90 90
                 </div>
91 91
                 <?php $step_nmbr++;
92
-            }
93
-        }
94
-        do_action('AHEE__SPCO__after_registration_steps');
95
-    } else {
96
-        ?>
92
+			}
93
+		}
94
+		do_action('AHEE__SPCO__after_registration_steps');
95
+	} else {
96
+		?>
97 97
         <h3 id="spco-empty-cart-hdr" class="spco-step-title-hdr">
98 98
             <?php esc_html_e('Nothing in your Event Queue', 'event_espresso'); ?>
99 99
         </h3>
100 100
         <p><?php echo wp_kses($empty_msg, AllowedTags::getWithFormTags()); ?></p>
101 101
         <?php echo wp_kses($cookies_not_set_msg, AllowedTags::getWithFormTags()); ?>
102 102
         <?php
103
-    }
104
-    do_action('AHEE__SPCO__reg_form_footer');
105
-    ?>
103
+	}
104
+	do_action('AHEE__SPCO__reg_form_footer');
105
+	?>
106 106
 
107 107
 </div>
108 108
 
Please login to merge, or discard this patch.
attendee_information/EE_SPCO_Reg_Step_Attendee_Information.class.php 2 patches
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 
66 66
     public function translate_js_strings()
67 67
     {
68
-        EE_Registry::$i18n_js_strings['required_field']            = esc_html__(
68
+        EE_Registry::$i18n_js_strings['required_field'] = esc_html__(
69 69
             ' is a required question.',
70 70
             'event_espresso'
71 71
         );
72
-        EE_Registry::$i18n_js_strings['required_multi_field']      = esc_html__(
72
+        EE_Registry::$i18n_js_strings['required_multi_field'] = esc_html__(
73 73
             ' is a required question. Please enter a value for at least one of the options.',
74 74
             'event_espresso'
75 75
         );
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
             'Please answer all required questions correctly before proceeding.',
78 78
             'event_espresso'
79 79
         );
80
-        EE_Registry::$i18n_js_strings['attendee_info_copied']      = sprintf(
80
+        EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf(
81 81
             esc_html_x(
82 82
                 'The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.',
83 83
                 'The attendee information was successfully copied.(line break)Please ensure the rest of the registration form is completed before proceeding.',
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
             ),
86 86
             '<br/>'
87 87
         );
88
-        EE_Registry::$i18n_js_strings['attendee_info_copy_error']  = esc_html__(
88
+        EE_Registry::$i18n_js_strings['attendee_info_copy_error'] = esc_html__(
89 89
             'An unknown error occurred on the server while attempting to copy the attendee information. Please refresh the page and try again.',
90 90
             'event_espresso'
91 91
         );
92
-        EE_Registry::$i18n_js_strings['enter_valid_email']         = esc_html__(
92
+        EE_Registry::$i18n_js_strings['enter_valid_email'] = esc_html__(
93 93
             'You must enter a valid email address.',
94 94
             'event_espresso'
95 95
         );
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         ];
153 153
 
154 154
         // if this isn't a revisit, and they have the privacy consent box enabled, add it
155
-        if (! $this->checkout->revisit && $reg_config->isConsentCheckboxEnabled()) {
155
+        if ( ! $this->checkout->revisit && $reg_config->isConsentCheckboxEnabled()) {
156 156
             $extra_inputs_section->add_subsections(
157 157
                 [
158 158
                     'consent_box' => new EE_Form_Section_Proper(
@@ -201,15 +201,15 @@  discard block
 block discarded – undo
201 201
                     $registration instanceof EE_Registration
202 202
                     && $this->checkout->visit_allows_processing_of_this_registration($registration)
203 203
                 ) {
204
-                    $subsections[ $registration->reg_url_link() ]                       =
204
+                    $subsections[$registration->reg_url_link()]                       =
205 205
                         $this->_registrations_reg_form($registration);
206
-                    $template_args['registrations'][ $registration->reg_url_link() ]    = $registration;
207
-                    $template_args['ticket_count'][ $registration->ticket()->ID() ]     = isset(
208
-                        $template_args['ticket_count'][ $registration->ticket()->ID() ]
206
+                    $template_args['registrations'][$registration->reg_url_link()]    = $registration;
207
+                    $template_args['ticket_count'][$registration->ticket()->ID()]     = isset(
208
+                        $template_args['ticket_count'][$registration->ticket()->ID()]
209 209
                     )
210
-                        ? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1
210
+                        ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1
211 211
                         : 1;
212
-                    $ticket_line_item                                                   =
212
+                    $ticket_line_item =
213 213
                         EEH_Line_Item::get_line_items_by_object_type_and_IDs(
214 214
                             $this->checkout->cart->get_grand_total(),
215 215
                             'Ticket',
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
                     $ticket_line_item                                                   = is_array($ticket_line_item)
219 219
                         ? reset($ticket_line_item)
220 220
                         : $ticket_line_item;
221
-                    $template_args['ticket_line_item'][ $registration->ticket()->ID() ] =
221
+                    $template_args['ticket_line_item'][$registration->ticket()->ID()] =
222 222
                         $Line_Item_Display->display_line_item($ticket_line_item);
223 223
                     if ($registration->is_primary_registrant()) {
224 224
                         $primary_registrant = $registration->reg_url_link();
@@ -232,10 +232,10 @@  discard block
 block discarded – undo
232 232
                     : $this->_auto_copy_attendee_info();
233 233
                 // generate hidden input
234 234
                 if (
235
-                    isset($subsections[ $primary_registrant ])
236
-                    && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper
235
+                    isset($subsections[$primary_registrant])
236
+                    && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper
237 237
                 ) {
238
-                    $subsections[ $primary_registrant ]->add_subsections(
238
+                    $subsections[$primary_registrant]->add_subsections(
239 239
                         $copy_options,
240 240
                         'primary_registrant',
241 241
                         false
@@ -247,8 +247,8 @@  discard block
 block discarded – undo
247 247
         // Set the registration form template (default: one form per ticket details table).
248 248
         // We decide the template to used based on the number of forms.
249 249
         $this->_template = $this->reg_form_count > 1
250
-            ? SPCO_REG_STEPS_PATH . $this->_slug . '/attendee_info_main.template.php'
251
-            : SPCO_REG_STEPS_PATH . $this->_slug . '/attendee_info_single.template.php';
250
+            ? SPCO_REG_STEPS_PATH . $this->_slug.'/attendee_info_main.template.php'
251
+            : SPCO_REG_STEPS_PATH.$this->_slug.'/attendee_info_single.template.php';
252 252
 
253 253
         return new EE_Form_Section_Proper(
254 254
             [
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
         $form_args = [];
283 283
         // verify that registration has valid event
284 284
         if ($registration->event() instanceof EE_Event) {
285
-            $field_name      = 'Event_Question_Group.'
285
+            $field_name = 'Event_Question_Group.'
286 286
                                . EEM_Event_Question_Group::instance()->fieldNameForContext(
287 287
                                    $registration->is_primary_registrant()
288 288
                                );
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
             if ($question_groups) {
306 306
                 // array of params to pass to parent constructor
307 307
                 $form_args = [
308
-                    'html_id'         => 'ee-registration-' . $registration->reg_url_link(),
308
+                    'html_id'         => 'ee-registration-'.$registration->reg_url_link(),
309 309
                     'html_class'      => 'ee-reg-form-attendee-dv',
310 310
                     'html_style'      => $this->checkout->admin_request
311 311
                         ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;'
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
                 ];
328 328
                 foreach ($question_groups as $question_group) {
329 329
                     if ($question_group instanceof EE_Question_Group) {
330
-                        $form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form(
330
+                        $form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form(
331 331
                             $registration,
332 332
                             $question_group
333 333
                         );
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
         $attendee_nmbr++;
362 362
 
363 363
         // Increment the reg forms number if form is valid.
364
-        if (! empty($form_args)) {
364
+        if ( ! empty($form_args)) {
365 365
             $this->reg_form_count++;
366 366
         }
367 367
 
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
         // generate hidden input
385 385
         return new EE_Hidden_Input(
386 386
             [
387
-                'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(),
387
+                'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(),
388 388
                 'default' => $additional_attendee_reg_info,
389 389
             ]
390 390
         );
@@ -405,12 +405,12 @@  discard block
 block discarded – undo
405 405
     {
406 406
         // array of params to pass to parent constructor
407 407
         $form_args = [
408
-            'html_id'         => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-' . $registration->ID(),
408
+            'html_id'         => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-'.$registration->ID(),
409 409
             'html_class'      => $this->checkout->admin_request
410 410
                 ? 'form-table ee-reg-form-qstn-grp-dv'
411 411
                 : 'ee-reg-form-qstn-grp-dv',
412
-            'html_label_id'   => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-'
413
-                                 . $registration->ID() . '-lbl',
412
+            'html_label_id'   => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-'
413
+                                 . $registration->ID().'-lbl',
414 414
             'subsections'     => [
415 415
                 'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group),
416 416
             ],
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
         // where params
422 422
         $query_params = ['QST_deleted' => 0];
423 423
         // don't load admin only questions on the frontend
424
-        if (! $this->checkout->admin_request) {
424
+        if ( ! $this->checkout->admin_request) {
425 425
             $query_params['QST_admin_only'] = ['!=', true];
426 426
         }
427 427
         $questions = $question_group->get_many_related(
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
                 $identifier                              = $question->is_system_question()
456 456
                     ? $question->system_ID()
457 457
                     : $question->ID();
458
-                $form_args['subsections'][ $identifier ] = $this->reg_form_question($registration, $question);
458
+                $form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question);
459 459
             }
460 460
         }
461 461
         $form_args['subsections'] = apply_filters(
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
     {
568 568
         return new EE_Form_Section_HTML(
569 569
             EEH_Template::locate_template(
570
-                SPCO_REG_STEPS_PATH . $this->_slug . '/_auto_copy_attendee_info.template.php',
570
+                SPCO_REG_STEPS_PATH.$this->_slug.'/_auto_copy_attendee_info.template.php',
571 571
                 apply_filters(
572 572
                     'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args',
573 573
                     []
@@ -596,20 +596,20 @@  discard block
 block discarded – undo
596 596
             if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) {
597 597
                 // if this is a new ticket OR if this is the very first additional attendee after the primary attendee
598 598
                 if ($registration->ticket()->ID() !== $prev_ticket) {
599
-                    $item_name                          = $registration->ticket()->name();
600
-                    $item_name                          .= $registration->ticket()->description() !== ''
601
-                        ? ' - ' . $registration->ticket()->description()
599
+                    $item_name = $registration->ticket()->name();
600
+                    $item_name .= $registration->ticket()->description() !== ''
601
+                        ? ' - '.$registration->ticket()->description()
602 602
                         : '';
603
-                    $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-'
603
+                    $copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'
604 604
                                                 . $registration->ticket()->ID()
605
-                                                . ']' ] =
605
+                                                . ']'] =
606 606
                         new EE_Form_Section_HTML(
607
-                            '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>'
607
+                            '<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>'
608 608
                         );
609
-                    $prev_ticket                        = $registration->ticket()->ID();
609
+                    $prev_ticket = $registration->ticket()->ID();
610 610
                 }
611 611
 
612
-                $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] =
612
+                $copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] =
613 613
                     new EE_Checkbox_Multi_Input(
614 614
                         [
615 615
                             $registration->ID() => sprintf(
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
                             ),
619 619
                         ],
620 620
                         [
621
-                            'html_id'                 => 'spco-copy-attendee-chk-' . $registration->reg_url_link(),
621
+                            'html_id'                 => 'spco-copy-attendee-chk-'.$registration->reg_url_link(),
622 622
                             'html_class'              => 'spco-copy-attendee-chk ee-do-not-validate',
623 623
                             'display_html_label_text' => false,
624 624
                         ]
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
             $registration,
665 665
             $question->system_ID()
666 666
         );
667
-        $answer       = $answer_value === null
667
+        $answer = $answer_value === null
668 668
             ? EEM_Answer::instance()->get_one(
669 669
                 [['QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()]]
670 670
             )
@@ -683,14 +683,14 @@  discard block
 block discarded – undo
683 683
         }
684 684
         // verify instance
685 685
         if ($answer instanceof EE_Answer) {
686
-            if (! empty($answer_value)) {
686
+            if ( ! empty($answer_value)) {
687 687
                 $answer->set('ANS_value', $answer_value);
688 688
             }
689 689
             $answer->cache('Question', $question);
690 690
             // remember system ID had a bug where sometimes it could be null
691 691
             $answer_cache_id = $question->is_system_question()
692
-                ? $question->system_ID() . '-' . $registration->reg_url_link()
693
-                : $question->ID() . '-' . $registration->reg_url_link();
692
+                ? $question->system_ID().'-'.$registration->reg_url_link()
693
+                : $question->ID().'-'.$registration->reg_url_link();
694 694
             $registration->cache('Answer', $answer, $answer_cache_id);
695 695
         }
696 696
         return $this->_generate_question_input($registration, $question, $answer);
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
         $identifier                               = $question->is_system_question()
714 714
             ? $question->system_ID()
715 715
             : $question->ID();
716
-        $this->_required_questions[ $identifier ] = $question->required();
716
+        $this->_required_questions[$identifier] = $question->required();
717 717
         add_filter(
718 718
             'FHEE__EE_Question__generate_form_input__country_options',
719 719
             [$this, 'use_cached_countries_for_form_input'],
@@ -726,18 +726,18 @@  discard block
 block discarded – undo
726 726
             10,
727 727
             4
728 728
         );
729
-        $input_constructor_args                  = [
730
-            'html_name'        => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']',
731
-            'html_id'          => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
732
-            'html_class'       => 'ee-reg-qstn ee-reg-qstn-' . $identifier,
733
-            'html_label_id'    => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
729
+        $input_constructor_args = [
730
+            'html_name'        => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']',
731
+            'html_id'          => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
732
+            'html_class'       => 'ee-reg-qstn ee-reg-qstn-'.$identifier,
733
+            'html_label_id'    => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
734 734
             'html_label_class' => 'ee-reg-qstn',
735 735
         ];
736 736
         $input_constructor_args['html_label_id'] .= '-lbl';
737 737
         if ($answer instanceof EE_Answer && $answer->ID()) {
738
-            $input_constructor_args['html_name']     .= '[' . $answer->ID() . ']';
739
-            $input_constructor_args['html_id']       .= '-' . $answer->ID();
740
-            $input_constructor_args['html_label_id'] .= '-' . $answer->ID();
738
+            $input_constructor_args['html_name']     .= '['.$answer->ID().']';
739
+            $input_constructor_args['html_id']       .= '-'.$answer->ID();
740
+            $input_constructor_args['html_label_id'] .= '-'.$answer->ID();
741 741
         }
742 742
         $form_input = $question->generate_form_input(
743 743
             $registration,
@@ -781,10 +781,10 @@  discard block
 block discarded – undo
781 781
         $countries = $this->checkout->action === 'process_reg_step'
782 782
             ? EEM_Country::instance()->get_all_countries()
783 783
             : EEM_Country::instance()->get_all_active_countries();
784
-        if (! empty($countries)) {
784
+        if ( ! empty($countries)) {
785 785
             foreach ($countries as $country) {
786 786
                 if ($country instanceof EE_Country) {
787
-                    $country_options[ $country->ID() ] = $country->name();
787
+                    $country_options[$country->ID()] = $country->name();
788 788
                 }
789 789
             }
790 790
         }
@@ -830,10 +830,10 @@  discard block
 block discarded – undo
830 830
         $states        = $this->checkout->action === 'process_reg_step'
831 831
             ? EEM_State::instance()->get_all_states()
832 832
             : EEM_State::instance()->get_all_active_states();
833
-        if (! empty($states)) {
833
+        if ( ! empty($states)) {
834 834
             foreach ($states as $state) {
835 835
                 if ($state instanceof EE_State) {
836
-                    $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name();
836
+                    $state_options[$state->country()->name()][$state->ID()] = $state->name();
837 837
                 }
838 838
             }
839 839
         }
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
877 877
             );
878 878
             return false;
879 879
         }
880
-        if (! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) {
880
+        if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) {
881 881
             EE_Error::add_error(
882 882
                 esc_html__(
883 883
                     'A valid transaction could not be initiated for processing your registrations.',
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
                     '(line break)This can sometimes happen if too much time has been taken to complete the registration process.(line break)Please return to the (link)Event List(end link) and reselect your tickets. If the problem continues, please contact the site administrator.',
905 905
                     'event_espresso'
906 906
                 ),
907
-                '<a href="' . get_post_type_archive_link('espresso_events') . '" >',
907
+                '<a href="'.get_post_type_archive_link('espresso_events').'" >',
908 908
                 '</a>',
909 909
                 '<br />'
910 910
             );
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
             // but return immediately if the previous step exited early due to errors
925 925
             return false;
926 926
         }
927
-        if (! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) {
927
+        if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) {
928 928
             // generate a correctly translated string for all possible singular/plural combinations
929 929
             if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) {
930 930
                 $error_msg = sprintf(
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
         // grab the saved registrations from the transaction
1008 1008
         foreach ($registrations as $registration) {
1009 1009
             // verify EE_Registration object
1010
-            if (! $registration instanceof EE_Registration) {
1010
+            if ( ! $registration instanceof EE_Registration) {
1011 1011
                 EE_Error::add_error(
1012 1012
                     esc_html__(
1013 1013
                         'An invalid Registration object was discovered when attempting to process your registration information.',
@@ -1021,12 +1021,12 @@  discard block
 block discarded – undo
1021 1021
             }
1022 1022
             $reg_url_link = $registration->reg_url_link();
1023 1023
             // reg_url_link exists ?
1024
-            if (! empty($reg_url_link)) {
1024
+            if ( ! empty($reg_url_link)) {
1025 1025
                 // should this registration be processed during this visit ?
1026 1026
                 if ($this->checkout->visit_allows_processing_of_this_registration($registration)) {
1027 1027
                     // if NOT revisiting, then let's save the registration now,
1028 1028
                     // so that we have a REG_ID to use when generating other objects
1029
-                    if (! $this->checkout->revisit) {
1029
+                    if ( ! $this->checkout->revisit) {
1030 1030
                         $registration->save();
1031 1031
                     }
1032 1032
                     /**
@@ -1052,18 +1052,18 @@  discard block
 block discarded – undo
1052 1052
 
1053 1053
                     // Houston, we have a registration!
1054 1054
                     $att_nmbr++;
1055
-                    $this->_attendee_data[ $reg_url_link ] = [];
1055
+                    $this->_attendee_data[$reg_url_link] = [];
1056 1056
                     // grab any existing related answer objects
1057 1057
                     $this->_registration_answers = $registration->answers();
1058 1058
                     // unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] );
1059
-                    if (isset($valid_data[ $reg_url_link ])) {
1059
+                    if (isset($valid_data[$reg_url_link])) {
1060 1060
                         // do we need to copy basic info from primary attendee ?
1061
-                        $copy_primary = isset($valid_data[ $reg_url_link ]['additional_attendee_reg_info'])
1062
-                                        && absint($valid_data[ $reg_url_link ]['additional_attendee_reg_info']) === 0;
1061
+                        $copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info'])
1062
+                                        && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0;
1063 1063
                         // filter form input data for this registration
1064
-                        $valid_data[ $reg_url_link ] = (array) apply_filters(
1064
+                        $valid_data[$reg_url_link] = (array) apply_filters(
1065 1065
                             'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item',
1066
-                            $valid_data[ $reg_url_link ]
1066
+                            $valid_data[$reg_url_link]
1067 1067
                         );
1068 1068
                         if (isset($valid_data['primary_attendee'])) {
1069 1069
                             $primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee'])
@@ -1072,8 +1072,8 @@  discard block
 block discarded – undo
1072 1072
                             unset($valid_data['primary_attendee']);
1073 1073
                         }
1074 1074
                         // now loop through our array of valid post data && process attendee reg forms
1075
-                        foreach ($valid_data[ $reg_url_link ] as $form_section => $form_inputs) {
1076
-                            if (! in_array($form_section, $non_input_form_sections, true)) {
1075
+                        foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) {
1076
+                            if ( ! in_array($form_section, $non_input_form_sections, true)) {
1077 1077
                                 foreach ($form_inputs as $form_input => $input_value) {
1078 1078
                                     // check for critical inputs
1079 1079
                                     if (
@@ -1090,13 +1090,13 @@  discard block
 block discarded – undo
1090 1090
                                         && ! empty($input_value)
1091 1091
                                         && $reg_url_link === $primary_registrant['line_item_id']
1092 1092
                                     ) {
1093
-                                        $primary_registrant[ $form_input ] = $input_value;
1093
+                                        $primary_registrant[$form_input] = $input_value;
1094 1094
                                     } elseif (
1095 1095
                                         $copy_primary
1096 1096
                                               && $input_value === null
1097
-                                              && isset($primary_registrant[ $form_input ])
1097
+                                              && isset($primary_registrant[$form_input])
1098 1098
                                     ) {
1099
-                                        $input_value = $primary_registrant[ $form_input ];
1099
+                                        $input_value = $primary_registrant[$form_input];
1100 1100
                                     }
1101 1101
                                     // now attempt to save the input data
1102 1102
                                     if (
@@ -1136,15 +1136,15 @@  discard block
 block discarded – undo
1136 1136
                         $attendee = $this->checkout->primary_attendee_obj;
1137 1137
                     } else {
1138 1138
                         // ensure critical details are set for additional attendees
1139
-                        $this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1
1139
+                        $this->_attendee_data[$reg_url_link] = $att_nmbr > 1
1140 1140
                             ? $this->_copy_critical_attendee_details_from_primary_registrant(
1141
-                                $this->_attendee_data[ $reg_url_link ]
1141
+                                $this->_attendee_data[$reg_url_link]
1142 1142
                             )
1143
-                            : $this->_attendee_data[ $reg_url_link ];
1143
+                            : $this->_attendee_data[$reg_url_link];
1144 1144
                         // execute create attendee command (which may return an existing attendee)
1145 1145
                         $attendee = EE_Registry::instance()->BUS->execute(
1146 1146
                             new CreateAttendeeCommand(
1147
-                                $this->_attendee_data[ $reg_url_link ],
1147
+                                $this->_attendee_data[$reg_url_link],
1148 1148
                                 $registration
1149 1149
                             )
1150 1150
                         );
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
                     }
1156 1156
                     // add relation to registration, set attendee ID, and cache attendee
1157 1157
                     $this->_associate_attendee_with_registration($registration, $attendee);
1158
-                    if (! $registration->attendee() instanceof EE_Attendee) {
1158
+                    if ( ! $registration->attendee() instanceof EE_Attendee) {
1159 1159
                         EE_Error::add_error(
1160 1160
                             sprintf(
1161 1161
                                 esc_html_x(
@@ -1205,7 +1205,7 @@  discard block
 block discarded – undo
1205 1205
                     __LINE__
1206 1206
                 );
1207 1207
                 // remove malformed data
1208
-                unset($valid_data[ $reg_url_link ]);
1208
+                unset($valid_data[$reg_url_link]);
1209 1209
                 return false;
1210 1210
             }
1211 1211
         } // end of foreach ( $this->checkout->transaction->registrations()  as $registration )
@@ -1255,10 +1255,10 @@  discard block
 block discarded – undo
1255 1255
          * @see https://events.codebasehq.com/projects/event-espresso/tickets/10477
1256 1256
          */
1257 1257
         $answer_cache_id = $this->checkout->reg_url_link
1258
-            ? $form_input . '-' . $registration->reg_url_link()
1258
+            ? $form_input.'-'.$registration->reg_url_link()
1259 1259
             : (string) $form_input;
1260
-        $answer_is_obj   = isset($this->_registration_answers[ $answer_cache_id ])
1261
-                           && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer;
1260
+        $answer_is_obj   = isset($this->_registration_answers[$answer_cache_id])
1261
+                           && $this->_registration_answers[$answer_cache_id] instanceof EE_Answer;
1262 1262
         // rename form_inputs if they are EE_Attendee properties
1263 1263
         switch ((string) $form_input) {
1264 1264
             case 'state':
@@ -1274,24 +1274,24 @@  discard block
 block discarded – undo
1274 1274
                 break;
1275 1275
 
1276 1276
             default:
1277
-                $ATT_input = 'ATT_' . $form_input;
1277
+                $ATT_input = 'ATT_'.$form_input;
1278 1278
                 $attendee_property = EEM_Attendee::instance()->has_field($ATT_input);
1279
-                $form_input        = $attendee_property ? 'ATT_' . $form_input : $form_input;
1279
+                $form_input        = $attendee_property ? 'ATT_'.$form_input : $form_input;
1280 1280
         }
1281 1281
         // if this form input has a corresponding attendee property
1282 1282
         if ($attendee_property) {
1283
-            $this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value;
1283
+            $this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value;
1284 1284
             if ($answer_is_obj) {
1285 1285
                 // and delete the corresponding answer since we won't be storing this data in that object
1286
-                $registration->_remove_relation_to($this->_registration_answers[ $answer_cache_id ], 'Answer');
1287
-                $this->_registration_answers[ $answer_cache_id ]->delete_permanently();
1286
+                $registration->_remove_relation_to($this->_registration_answers[$answer_cache_id], 'Answer');
1287
+                $this->_registration_answers[$answer_cache_id]->delete_permanently();
1288 1288
             }
1289 1289
             return true;
1290 1290
         }
1291 1291
         if ($answer_is_obj) {
1292 1292
             // save this data to the answer object
1293
-            $this->_registration_answers[ $answer_cache_id ]->set_value($input_value);
1294
-            $result = $this->_registration_answers[ $answer_cache_id ]->save();
1293
+            $this->_registration_answers[$answer_cache_id]->set_value($input_value);
1294
+            $result = $this->_registration_answers[$answer_cache_id]->save();
1295 1295
             return $result !== false;
1296 1296
         }
1297 1297
         foreach ($this->_registration_answers as $answer) {
@@ -1318,7 +1318,7 @@  discard block
 block discarded – undo
1318 1318
     ) {
1319 1319
         if (empty($input_value)) {
1320 1320
             // if the form input isn't marked as being required, then just return
1321
-            if (! isset($this->_required_questions[ $form_input ]) || ! $this->_required_questions[ $form_input ]) {
1321
+            if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) {
1322 1322
                 return true;
1323 1323
             }
1324 1324
             switch ($form_input) {
@@ -1416,7 +1416,7 @@  discard block
 block discarded – undo
1416 1416
                 false
1417 1417
             )
1418 1418
         ) {
1419
-            $address_details           = [
1419
+            $address_details = [
1420 1420
                 'ATT_address',
1421 1421
                 'ATT_address2',
1422 1422
                 'ATT_city',
@@ -1429,10 +1429,10 @@  discard block
 block discarded – undo
1429 1429
         }
1430 1430
         foreach ($critical_attendee_details as $critical_attendee_detail) {
1431 1431
             if (
1432
-                ! isset($attendee_data[ $critical_attendee_detail ])
1433
-                || empty($attendee_data[ $critical_attendee_detail ])
1432
+                ! isset($attendee_data[$critical_attendee_detail])
1433
+                || empty($attendee_data[$critical_attendee_detail])
1434 1434
             ) {
1435
-                $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get(
1435
+                $attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get(
1436 1436
                     $critical_attendee_detail
1437 1437
                 );
1438 1438
             }
Please login to merge, or discard this patch.
Indentation   +1451 added lines, -1451 removed lines patch added patch discarded remove patch
@@ -17,1458 +17,1458 @@
 block discarded – undo
17 17
  */
18 18
 class EE_SPCO_Reg_Step_Attendee_Information extends EE_SPCO_Reg_Step
19 19
 {
20
-    /**
21
-     * @type bool $_print_copy_info
22
-     */
23
-    private $_print_copy_info = false;
24
-
25
-    /**
26
-     * @type array $_attendee_data
27
-     */
28
-    private $_attendee_data = [];
29
-
30
-    /**
31
-     * @type array $_required_questions
32
-     */
33
-    private $_required_questions = [];
34
-
35
-    /**
36
-     * @type array $_registration_answers
37
-     */
38
-    private $_registration_answers = [];
39
-
40
-    /**
41
-     * @type int $reg_form_count
42
-     */
43
-    protected $reg_form_count = 0;
44
-
45
-
46
-    /**
47
-     *    class constructor
48
-     *
49
-     * @access    public
50
-     * @param EE_Checkout $checkout
51
-     */
52
-    public function __construct(EE_Checkout $checkout)
53
-    {
54
-        $this->request  = EED_Single_Page_Checkout::getRequest();
55
-        $this->_slug    = 'attendee_information';
56
-        $this->_name    = esc_html__('Attendee Information', 'event_espresso');
57
-        $this->checkout = $checkout;
58
-        $this->_reset_success_message();
59
-        $this->set_instructions(
60
-            esc_html__('Please answer the following registration questions before proceeding.', 'event_espresso')
61
-        );
62
-    }
63
-
64
-
65
-    public function translate_js_strings()
66
-    {
67
-        EE_Registry::$i18n_js_strings['required_field']            = esc_html__(
68
-            ' is a required question.',
69
-            'event_espresso'
70
-        );
71
-        EE_Registry::$i18n_js_strings['required_multi_field']      = esc_html__(
72
-            ' is a required question. Please enter a value for at least one of the options.',
73
-            'event_espresso'
74
-        );
75
-        EE_Registry::$i18n_js_strings['answer_required_questions'] = esc_html__(
76
-            'Please answer all required questions correctly before proceeding.',
77
-            'event_espresso'
78
-        );
79
-        EE_Registry::$i18n_js_strings['attendee_info_copied']      = sprintf(
80
-            esc_html_x(
81
-                'The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.',
82
-                'The attendee information was successfully copied.(line break)Please ensure the rest of the registration form is completed before proceeding.',
83
-                'event_espresso'
84
-            ),
85
-            '<br/>'
86
-        );
87
-        EE_Registry::$i18n_js_strings['attendee_info_copy_error']  = esc_html__(
88
-            'An unknown error occurred on the server while attempting to copy the attendee information. Please refresh the page and try again.',
89
-            'event_espresso'
90
-        );
91
-        EE_Registry::$i18n_js_strings['enter_valid_email']         = esc_html__(
92
-            'You must enter a valid email address.',
93
-            'event_espresso'
94
-        );
95
-        EE_Registry::$i18n_js_strings['valid_email_and_questions'] = esc_html__(
96
-            'You must enter a valid email address and answer all other required questions before you can proceed.',
97
-            'event_espresso'
98
-        );
99
-    }
100
-
101
-
102
-    public function enqueue_styles_and_scripts()
103
-    {
104
-    }
105
-
106
-
107
-    /**
108
-     * @return boolean
109
-     */
110
-    public function initialize_reg_step()
111
-    {
112
-        return true;
113
-    }
114
-
115
-
116
-    /**
117
-     * @return EE_Form_Section_Proper
118
-     * @throws DomainException
119
-     * @throws EE_Error
120
-     * @throws InvalidArgumentException
121
-     * @throws ReflectionException
122
-     * @throws EntityNotFoundException
123
-     * @throws InvalidDataTypeException
124
-     * @throws InvalidInterfaceException
125
-     */
126
-    public function generate_reg_form()
127
-    {
128
-        /**
129
-         * @var $reg_config EE_Registration_Config
130
-         */
131
-        $reg_config = LoaderFactory::getLoader()->getShared('EE_Registration_Config');
132
-
133
-        $this->_print_copy_info = $reg_config->copyAttendeeInfo();
134
-
135
-        // Init reg forms count.
136
-        $this->reg_form_count = 0;
137
-
138
-        $primary_registrant = null;
139
-        // autoload Line_Item_Display classes
140
-        EEH_Autoloader::register_line_item_display_autoloaders();
141
-        $Line_Item_Display = new EE_Line_Item_Display();
142
-        // calculate taxes
143
-        $Line_Item_Display->display_line_item(
144
-            $this->checkout->cart->get_grand_total(),
145
-            ['set_tax_rate' => true]
146
-        );
147
-        /** @var $subsections EE_Form_Section_Proper[] */
148
-        $extra_inputs_section = $this->reg_step_hidden_inputs();
149
-        $subsections          = [
150
-            'default_hidden_inputs' => $extra_inputs_section,
151
-        ];
152
-
153
-        // if this isn't a revisit, and they have the privacy consent box enabled, add it
154
-        if (! $this->checkout->revisit && $reg_config->isConsentCheckboxEnabled()) {
155
-            $extra_inputs_section->add_subsections(
156
-                [
157
-                    'consent_box' => new EE_Form_Section_Proper(
158
-                        [
159
-                            'layout_strategy' =>
160
-                                new EE_Template_Layout(
161
-                                    [
162
-                                        'input_template_file' => SPCO_REG_STEPS_PATH
163
-                                                                 . $this->_slug
164
-                                                                 . '/privacy_consent.template.php',
165
-                                    ]
166
-                                ),
167
-                            'subsections'     => [
168
-                                'consent' => new EE_Checkbox_Multi_Input(
169
-                                    [
170
-                                        'consent' => $reg_config->getConsentCheckboxLabelText(),
171
-                                    ],
172
-                                    [
173
-                                        'required'                          => true,
174
-                                        'required_validation_error_message' => esc_html__(
175
-                                            'You must consent to these terms in order to register.',
176
-                                            'event_espresso'
177
-                                        ),
178
-                                        'html_label_text'                   => '',
179
-                                    ]
180
-                                ),
181
-                            ],
182
-                        ]
183
-                    ),
184
-                ],
185
-                null,
186
-                false
187
-            );
188
-        }
189
-        $template_args = [
190
-            'revisit'       => $this->checkout->revisit,
191
-            'registrations' => [],
192
-            'ticket_count'  => [],
193
-        ];
194
-        // grab the saved registrations from the transaction
195
-        $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
196
-        if ($registrations) {
197
-            foreach ($registrations as $registration) {
198
-                // can this registration be processed during this visit ?
199
-                if (
200
-                    $registration instanceof EE_Registration
201
-                    && $this->checkout->visit_allows_processing_of_this_registration($registration)
202
-                ) {
203
-                    $subsections[ $registration->reg_url_link() ]                       =
204
-                        $this->_registrations_reg_form($registration);
205
-                    $template_args['registrations'][ $registration->reg_url_link() ]    = $registration;
206
-                    $template_args['ticket_count'][ $registration->ticket()->ID() ]     = isset(
207
-                        $template_args['ticket_count'][ $registration->ticket()->ID() ]
208
-                    )
209
-                        ? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1
210
-                        : 1;
211
-                    $ticket_line_item                                                   =
212
-                        EEH_Line_Item::get_line_items_by_object_type_and_IDs(
213
-                            $this->checkout->cart->get_grand_total(),
214
-                            'Ticket',
215
-                            [$registration->ticket()->ID()]
216
-                        );
217
-                    $ticket_line_item                                                   = is_array($ticket_line_item)
218
-                        ? reset($ticket_line_item)
219
-                        : $ticket_line_item;
220
-                    $template_args['ticket_line_item'][ $registration->ticket()->ID() ] =
221
-                        $Line_Item_Display->display_line_item($ticket_line_item);
222
-                    if ($registration->is_primary_registrant()) {
223
-                        $primary_registrant = $registration->reg_url_link();
224
-                    }
225
-                }
226
-            }
227
-
228
-            if ($primary_registrant && count($registrations) > 1) {
229
-                $copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info
230
-                    ? $this->_copy_attendee_info_form()
231
-                    : $this->_auto_copy_attendee_info();
232
-                // generate hidden input
233
-                if (
234
-                    isset($subsections[ $primary_registrant ])
235
-                    && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper
236
-                ) {
237
-                    $subsections[ $primary_registrant ]->add_subsections(
238
-                        $copy_options,
239
-                        'primary_registrant',
240
-                        false
241
-                    );
242
-                }
243
-            }
244
-        }
245
-
246
-        // Set the registration form template (default: one form per ticket details table).
247
-        // We decide the template to used based on the number of forms.
248
-        $this->_template = $this->reg_form_count > 1
249
-            ? SPCO_REG_STEPS_PATH . $this->_slug . '/attendee_info_main.template.php'
250
-            : SPCO_REG_STEPS_PATH . $this->_slug . '/attendee_info_single.template.php';
251
-
252
-        return new EE_Form_Section_Proper(
253
-            [
254
-                'name'            => $this->reg_form_name(),
255
-                'html_id'         => $this->reg_form_name(),
256
-                'subsections'     => $subsections,
257
-                'layout_strategy' => new EE_Template_Layout(
258
-                    [
259
-                        'layout_template_file' => $this->_template, // layout_template
260
-                        'template_args'        => $template_args,
261
-                    ]
262
-                ),
263
-            ]
264
-        );
265
-    }
266
-
267
-
268
-    /**
269
-     * @param EE_Registration $registration
270
-     * @return EE_Form_Section_Base
271
-     * @throws EE_Error
272
-     * @throws InvalidArgumentException
273
-     * @throws EntityNotFoundException
274
-     * @throws InvalidDataTypeException
275
-     * @throws InvalidInterfaceException
276
-     * @throws ReflectionException
277
-     */
278
-    private function _registrations_reg_form(EE_Registration $registration)
279
-    {
280
-        static $attendee_nmbr = 1;
281
-        $form_args = [];
282
-        // verify that registration has valid event
283
-        if ($registration->event() instanceof EE_Event) {
284
-            $field_name      = 'Event_Question_Group.'
285
-                               . EEM_Event_Question_Group::instance()->fieldNameForContext(
286
-                                   $registration->is_primary_registrant()
287
-                               );
288
-            $question_groups = $registration->event()->question_groups(
289
-                apply_filters(
290
-                // @codingStandardsIgnoreStart
291
-                    'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__question_groups_query_parameters',
292
-                    // @codingStandardsIgnoreEnd
293
-                    [
294
-                        [
295
-                            'Event.EVT_ID' => $registration->event()->ID(),
296
-                            $field_name    => true,
297
-                            'QSG_deleted'  => false
298
-                        ],
299
-                        'order_by' => ['QSG_order' => 'ASC'],
300
-                    ],
301
-                    $registration,
302
-                    $this
303
-                )
304
-            );
305
-            if ($question_groups) {
306
-                // array of params to pass to parent constructor
307
-                $form_args = [
308
-                    'html_id'         => 'ee-registration-' . $registration->reg_url_link(),
309
-                    'html_class'      => 'ee-reg-form-attendee-dv',
310
-                    'html_style'      => $this->checkout->admin_request
311
-                        ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;'
312
-                        : '',
313
-                    'subsections'     => [],
314
-                    'layout_strategy' => new EE_Fieldset_Section_Layout(
315
-                        [
316
-                            'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text',
317
-                            'legend_text'  => sprintf(
318
-                                esc_html_x(
319
-                                    'Attendee %d',
320
-                                    'Attendee 123',
321
-                                    'event_espresso'
322
-                                ),
323
-                                $attendee_nmbr
324
-                            ),
325
-                        ]
326
-                    ),
327
-                ];
328
-                foreach ($question_groups as $question_group) {
329
-                    if ($question_group instanceof EE_Question_Group) {
330
-                        $form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form(
331
-                            $registration,
332
-                            $question_group
333
-                        );
334
-                    }
335
-                }
336
-                // add hidden input
337
-                $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input(
338
-                    $registration
339
-                );
340
-
341
-                /**
342
-                 * @var $reg_config EE_Registration_Config
343
-                 */
344
-                $reg_config = LoaderFactory::getLoader()->getShared('EE_Registration_Config');
345
-
346
-                // If we have question groups for additional attendees, then display the copy options
347
-                $this->_print_copy_info = apply_filters(
348
-                    'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form___printCopyInfo',
349
-                    $attendee_nmbr > 1 && $reg_config->copyAttendeeInfo(),
350
-                    $attendee_nmbr
351
-                );
352
-
353
-                if ($registration->is_primary_registrant()) {
354
-                    // generate hidden input
355
-                    $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs(
356
-                        $registration
357
-                    );
358
-                }
359
-            }
360
-        }
361
-        $attendee_nmbr++;
362
-
363
-        // Increment the reg forms number if form is valid.
364
-        if (! empty($form_args)) {
365
-            $this->reg_form_count++;
366
-        }
367
-
368
-        return ! empty($form_args)
369
-            ? new EE_Form_Section_Proper($form_args)
370
-            : new EE_Form_Section_HTML();
371
-    }
372
-
373
-
374
-    /**
375
-     * @param EE_Registration $registration
376
-     * @param bool            $additional_attendee_reg_info
377
-     * @return EE_Form_Input_Base
378
-     * @throws EE_Error
379
-     */
380
-    private function _additional_attendee_reg_info_input(
381
-        EE_Registration $registration,
382
-        $additional_attendee_reg_info = true
383
-    ) {
384
-        // generate hidden input
385
-        return new EE_Hidden_Input(
386
-            [
387
-                'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(),
388
-                'default' => $additional_attendee_reg_info,
389
-            ]
390
-        );
391
-    }
392
-
393
-
394
-    /**
395
-     * @param EE_Registration   $registration
396
-     * @param EE_Question_Group $question_group
397
-     * @return EE_Form_Section_Proper
398
-     * @throws EE_Error
399
-     * @throws InvalidArgumentException
400
-     * @throws InvalidDataTypeException
401
-     * @throws InvalidInterfaceException
402
-     * @throws ReflectionException
403
-     */
404
-    private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group)
405
-    {
406
-        // array of params to pass to parent constructor
407
-        $form_args = [
408
-            'html_id'         => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-' . $registration->ID(),
409
-            'html_class'      => $this->checkout->admin_request
410
-                ? 'form-table ee-reg-form-qstn-grp-dv'
411
-                : 'ee-reg-form-qstn-grp-dv',
412
-            'html_label_id'   => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-'
413
-                                 . $registration->ID() . '-lbl',
414
-            'subsections'     => [
415
-                'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group),
416
-            ],
417
-            'layout_strategy' => $this->checkout->admin_request
418
-                ? new EE_Admin_Two_Column_Layout()
419
-                : new EE_Div_Per_Section_Layout(),
420
-        ];
421
-        // where params
422
-        $query_params = ['QST_deleted' => 0];
423
-        // don't load admin only questions on the frontend
424
-        if (! $this->checkout->admin_request) {
425
-            $query_params['QST_admin_only'] = ['!=', true];
426
-        }
427
-        $questions = $question_group->get_many_related(
428
-            'Question',
429
-            apply_filters(
430
-                'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__related_questions_query_params',
431
-                [
432
-                    $query_params,
433
-                    'order_by' => [
434
-                        'Question_Group_Question.QGQ_order' => 'ASC',
435
-                    ],
436
-                ],
437
-                $question_group,
438
-                $registration,
439
-                $this
440
-            )
441
-        );
442
-        // filter for additional content before questions
443
-        $form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML(
444
-            apply_filters(
445
-                'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions',
446
-                '',
447
-                $registration,
448
-                $question_group,
449
-                $this
450
-            )
451
-        );
452
-        // loop thru questions
453
-        foreach ($questions as $question) {
454
-            if ($question instanceof EE_Question) {
455
-                $identifier                              = $question->is_system_question()
456
-                    ? $question->system_ID()
457
-                    : $question->ID();
458
-                $form_args['subsections'][ $identifier ] = $this->reg_form_question($registration, $question);
459
-            }
460
-        }
461
-        $form_args['subsections'] = apply_filters(
462
-            'FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array',
463
-            $form_args['subsections'],
464
-            $registration,
465
-            $question_group,
466
-            $this
467
-        );
468
-        // filter for additional content after questions
469
-        $form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML(
470
-            apply_filters(
471
-                'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions',
472
-                '',
473
-                $registration,
474
-                $question_group,
475
-                $this
476
-            )
477
-        );
478
-        // d($form_args);
479
-        $question_group_reg_form = new EE_Form_Section_Proper($form_args);
480
-        return apply_filters(
481
-            'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form',
482
-            $question_group_reg_form,
483
-            $registration,
484
-            $question_group,
485
-            $this
486
-        );
487
-    }
488
-
489
-
490
-    /**
491
-     * @param EE_Question_Group $question_group
492
-     * @return    EE_Form_Section_HTML
493
-     */
494
-    private function _question_group_header(EE_Question_Group $question_group)
495
-    {
496
-        $html = '';
497
-        // group_name
498
-        if ($question_group->show_group_name() && $question_group->name() !== '') {
499
-            if ($this->checkout->admin_request) {
500
-                $html .= EEH_HTML::br();
501
-                $html .= EEH_HTML::h3(
502
-                    $question_group->name(),
503
-                    '',
504
-                    'ee-reg-form-qstn-grp-title title',
505
-                    'font-size: 1.3em; padding-left:0;'
506
-                );
507
-            } else {
508
-                $html .= EEH_HTML::h4(
509
-                    $question_group->name(),
510
-                    '',
511
-                    'ee-reg-form-qstn-grp-title section-title'
512
-                );
513
-            }
514
-        }
515
-        // group_desc
516
-        if ($question_group->show_group_desc() && $question_group->desc() !== '') {
517
-            $html .= EEH_HTML::p(
518
-                $question_group->desc(),
519
-                '',
520
-                $this->checkout->admin_request
521
-                    ? 'ee-reg-form-qstn-grp-desc-pg'
522
-                    : 'ee-reg-form-qstn-grp-desc-pg small-text lt-grey-text'
523
-            );
524
-        }
525
-        return new EE_Form_Section_HTML($html);
526
-    }
527
-
528
-
529
-    /**
530
-     * @return    EE_Form_Section_Proper
531
-     * @throws EE_Error
532
-     * @throws InvalidArgumentException
533
-     * @throws ReflectionException
534
-     * @throws InvalidDataTypeException
535
-     * @throws InvalidInterfaceException
536
-     */
537
-    private function _copy_attendee_info_form()
538
-    {
539
-        // array of params to pass to parent constructor
540
-        return new EE_Form_Section_Proper(
541
-            [
542
-                'subsections'     => $this->_copy_attendee_info_inputs(),
543
-                'layout_strategy' => new EE_Template_Layout(
544
-                    [
545
-                        'layout_template_file'     => SPCO_REG_STEPS_PATH
546
-                                                      . $this->_slug
547
-                                                      . '/copy_attendee_info.template.php',
548
-                        'begin_template_file'      => null,
549
-                        'input_template_file'      => null,
550
-                        'subsection_template_file' => null,
551
-                        'end_template_file'        => null,
552
-                    ]
553
-                ),
554
-            ]
555
-        );
556
-    }
557
-
558
-
559
-    /**
560
-     * @return EE_Form_Section_HTML
561
-     * @throws DomainException
562
-     * @throws InvalidArgumentException
563
-     * @throws InvalidDataTypeException
564
-     * @throws InvalidInterfaceException
565
-     */
566
-    private function _auto_copy_attendee_info()
567
-    {
568
-        return new EE_Form_Section_HTML(
569
-            EEH_Template::locate_template(
570
-                SPCO_REG_STEPS_PATH . $this->_slug . '/_auto_copy_attendee_info.template.php',
571
-                apply_filters(
572
-                    'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args',
573
-                    []
574
-                )
575
-            )
576
-        );
577
-    }
578
-
579
-
580
-    /**
581
-     * @return array
582
-     * @throws EE_Error
583
-     * @throws InvalidArgumentException
584
-     * @throws ReflectionException
585
-     * @throws InvalidDataTypeException
586
-     * @throws InvalidInterfaceException
587
-     */
588
-    private function _copy_attendee_info_inputs()
589
-    {
590
-        $copy_attendee_info_inputs = [];
591
-        $prev_ticket               = null;
592
-        // grab the saved registrations from the transaction
593
-        $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
594
-        foreach ($registrations as $registration) {
595
-            // for all  attendees other than the primary attendee
596
-            if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) {
597
-                // if this is a new ticket OR if this is the very first additional attendee after the primary attendee
598
-                if ($registration->ticket()->ID() !== $prev_ticket) {
599
-                    $item_name                          = $registration->ticket()->name();
600
-                    $item_name                          .= $registration->ticket()->description() !== ''
601
-                        ? ' - ' . $registration->ticket()->description()
602
-                        : '';
603
-                    $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-'
604
-                                                . $registration->ticket()->ID()
605
-                                                . ']' ] =
606
-                        new EE_Form_Section_HTML(
607
-                            '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>'
608
-                        );
609
-                    $prev_ticket                        = $registration->ticket()->ID();
610
-                }
611
-
612
-                $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] =
613
-                    new EE_Checkbox_Multi_Input(
614
-                        [
615
-                            $registration->ID() => sprintf(
616
-                                esc_html_x('Attendee #%s', 'Attendee #123', 'event_espresso'),
617
-                                $registration->count()
618
-                            ),
619
-                        ],
620
-                        [
621
-                            'html_id'                 => 'spco-copy-attendee-chk-' . $registration->reg_url_link(),
622
-                            'html_class'              => 'spco-copy-attendee-chk ee-do-not-validate',
623
-                            'display_html_label_text' => false,
624
-                        ]
625
-                    );
626
-            }
627
-        }
628
-        return $copy_attendee_info_inputs;
629
-    }
630
-
631
-
632
-    /**
633
-     * @param EE_Registration $registration
634
-     * @return    EE_Form_Input_Base
635
-     * @throws EE_Error
636
-     */
637
-    private function _additional_primary_registrant_inputs(EE_Registration $registration)
638
-    {
639
-        // generate hidden input
640
-        return new EE_Hidden_Input(
641
-            [
642
-                'html_id' => 'primary_registrant',
643
-                'default' => $registration->reg_url_link(),
644
-            ]
645
-        );
646
-    }
647
-
648
-
649
-    /**
650
-     * @param EE_Registration $registration
651
-     * @param EE_Question     $question
652
-     * @return EE_Form_Input_Base
653
-     * @throws EE_Error
654
-     * @throws InvalidArgumentException
655
-     * @throws InvalidDataTypeException
656
-     * @throws InvalidInterfaceException
657
-     * @throws ReflectionException
658
-     */
659
-    public function reg_form_question(EE_Registration $registration, EE_Question $question)
660
-    {
661
-
662
-        // if this question was for an attendee detail, then check for that answer
663
-        $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value(
664
-            $registration,
665
-            $question->system_ID()
666
-        );
667
-        $answer       = $answer_value === null
668
-            ? EEM_Answer::instance()->get_one(
669
-                [['QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()]]
670
-            )
671
-            : null;
672
-        // if NOT returning to edit an existing registration
673
-        // OR if this question is for an attendee property
674
-        // OR we still don't have an EE_Answer object
675
-        if ($answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link()) {
676
-            // create an EE_Answer object for storing everything in
677
-            $answer = EE_Answer::new_instance(
678
-                [
679
-                    'QST_ID' => $question->ID(),
680
-                    'REG_ID' => $registration->ID(),
681
-                ]
682
-            );
683
-        }
684
-        // verify instance
685
-        if ($answer instanceof EE_Answer) {
686
-            if (! empty($answer_value)) {
687
-                $answer->set('ANS_value', $answer_value);
688
-            }
689
-            $answer->cache('Question', $question);
690
-            // remember system ID had a bug where sometimes it could be null
691
-            $answer_cache_id = $question->is_system_question()
692
-                ? $question->system_ID() . '-' . $registration->reg_url_link()
693
-                : $question->ID() . '-' . $registration->reg_url_link();
694
-            $registration->cache('Answer', $answer, $answer_cache_id);
695
-        }
696
-        return $this->_generate_question_input($registration, $question, $answer);
697
-    }
698
-
699
-
700
-    /**
701
-     * @param EE_Registration $registration
702
-     * @param EE_Question     $question
703
-     * @param                 $answer
704
-     * @return EE_Form_Input_Base
705
-     * @throws EE_Error
706
-     * @throws InvalidArgumentException
707
-     * @throws ReflectionException
708
-     * @throws InvalidDataTypeException
709
-     * @throws InvalidInterfaceException
710
-     */
711
-    private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer)
712
-    {
713
-        $identifier                               = $question->is_system_question()
714
-            ? $question->system_ID()
715
-            : $question->ID();
716
-        $this->_required_questions[ $identifier ] = $question->required();
717
-        add_filter(
718
-            'FHEE__EE_Question__generate_form_input__country_options',
719
-            [$this, 'use_cached_countries_for_form_input'],
720
-            10,
721
-            4
722
-        );
723
-        add_filter(
724
-            'FHEE__EE_Question__generate_form_input__state_options',
725
-            [$this, 'use_cached_states_for_form_input'],
726
-            10,
727
-            4
728
-        );
729
-        $input_constructor_args                  = [
730
-            'html_name'        => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']',
731
-            'html_id'          => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
732
-            'html_class'       => 'ee-reg-qstn ee-reg-qstn-' . $identifier,
733
-            'html_label_id'    => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
734
-            'html_label_class' => 'ee-reg-qstn',
735
-        ];
736
-        $input_constructor_args['html_label_id'] .= '-lbl';
737
-        if ($answer instanceof EE_Answer && $answer->ID()) {
738
-            $input_constructor_args['html_name']     .= '[' . $answer->ID() . ']';
739
-            $input_constructor_args['html_id']       .= '-' . $answer->ID();
740
-            $input_constructor_args['html_label_id'] .= '-' . $answer->ID();
741
-        }
742
-        $form_input = $question->generate_form_input(
743
-            $registration,
744
-            $answer,
745
-            $input_constructor_args
746
-        );
747
-        remove_filter(
748
-            'FHEE__EE_Question__generate_form_input__country_options',
749
-            [$this, 'use_cached_countries_for_form_input']
750
-        );
751
-        remove_filter(
752
-            'FHEE__EE_Question__generate_form_input__state_options',
753
-            [$this, 'use_cached_states_for_form_input']
754
-        );
755
-        return $form_input;
756
-    }
757
-
758
-
759
-    /**
760
-     * Gets the list of countries for the form input
761
-     *
762
-     * @param array|null      $countries_list
763
-     * @param EE_Question     $question
764
-     * @param EE_Registration $registration
765
-     * @param EE_Answer       $answer
766
-     * @return array 2d keys are country IDs, values are their names
767
-     * @throws EE_Error
768
-     * @throws InvalidArgumentException
769
-     * @throws InvalidDataTypeException
770
-     * @throws InvalidInterfaceException
771
-     * @throws ReflectionException
772
-     */
773
-    public function use_cached_countries_for_form_input(
774
-        $countries_list,
775
-        EE_Question $question = null,
776
-        EE_Registration $registration = null,
777
-        EE_Answer $answer = null
778
-    ) {
779
-        $country_options = ['' => ''];
780
-        // get possibly cached list of countries
781
-        $countries = $this->checkout->action === 'process_reg_step'
782
-            ? EEM_Country::instance()->get_all_countries()
783
-            : EEM_Country::instance()->get_all_active_countries();
784
-        if (! empty($countries)) {
785
-            foreach ($countries as $country) {
786
-                if ($country instanceof EE_Country) {
787
-                    $country_options[ $country->ID() ] = $country->name();
788
-                }
789
-            }
790
-        }
791
-        if ($question instanceof EE_Question && $registration instanceof EE_Registration) {
792
-            $answer = EEM_Answer::instance()->get_one(
793
-                [['QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()]]
794
-            );
795
-        } else {
796
-            $answer = EE_Answer::new_instance();
797
-        }
798
-        return apply_filters(
799
-            'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options',
800
-            $country_options,
801
-            $this,
802
-            $registration,
803
-            $question,
804
-            $answer
805
-        );
806
-    }
807
-
808
-
809
-    /**
810
-     * Gets the list of states for the form input
811
-     *
812
-     * @param array|null      $states_list
813
-     * @param EE_Question     $question
814
-     * @param EE_Registration $registration
815
-     * @param EE_Answer       $answer
816
-     * @return array 2d keys are state IDs, values are their names
817
-     * @throws EE_Error
818
-     * @throws InvalidArgumentException
819
-     * @throws InvalidDataTypeException
820
-     * @throws InvalidInterfaceException
821
-     * @throws ReflectionException
822
-     */
823
-    public function use_cached_states_for_form_input(
824
-        $states_list,
825
-        EE_Question $question = null,
826
-        EE_Registration $registration = null,
827
-        EE_Answer $answer = null
828
-    ) {
829
-        $state_options = ['' => ['' => '']];
830
-        $states        = $this->checkout->action === 'process_reg_step'
831
-            ? EEM_State::instance()->get_all_states()
832
-            : EEM_State::instance()->get_all_active_states();
833
-        if (! empty($states)) {
834
-            foreach ($states as $state) {
835
-                if ($state instanceof EE_State) {
836
-                    $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name();
837
-                }
838
-            }
839
-        }
840
-        return apply_filters(
841
-            'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options',
842
-            $state_options,
843
-            $this,
844
-            $registration,
845
-            $question,
846
-            $answer
847
-        );
848
-    }
849
-
850
-
851
-    /********************************************************************************************************/
852
-    /****************************************  PROCESS REG STEP  ****************************************/
853
-    /********************************************************************************************************/
854
-
855
-
856
-    /**
857
-     * @return bool
858
-     * @throws EE_Error
859
-     * @throws InvalidArgumentException
860
-     * @throws ReflectionException
861
-     * @throws RuntimeException
862
-     * @throws InvalidDataTypeException
863
-     * @throws InvalidInterfaceException
864
-     */
865
-    public function process_reg_step()
866
-    {
867
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
868
-        // grab validated data from form
869
-        $valid_data = $this->checkout->current_step->valid_data();
870
-        // if we don't have any $valid_data then something went TERRIBLY WRONG !!!
871
-        if (empty($valid_data)) {
872
-            EE_Error::add_error(
873
-                esc_html__('No valid question responses were received.', 'event_espresso'),
874
-                __FILE__,
875
-                __FUNCTION__,
876
-                __LINE__
877
-            );
878
-            return false;
879
-        }
880
-        if (! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) {
881
-            EE_Error::add_error(
882
-                esc_html__(
883
-                    'A valid transaction could not be initiated for processing your registrations.',
884
-                    'event_espresso'
885
-                ),
886
-                __FILE__,
887
-                __FUNCTION__,
888
-                __LINE__
889
-            );
890
-            return false;
891
-        }
892
-        // get cached registrations
893
-        $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
894
-        // verify we got the goods
895
-        if (empty($registrations)) {
896
-            // combine the old translated string with a new one, in order to not break translations
897
-            $error_message = esc_html__(
898
-                'Your form data could not be applied to any valid registrations.',
899
-                'event_espresso'
900
-            )
901
-            . sprintf(
902
-                esc_html_x(
903
-                    '%3$sThis can sometimes happen if too much time has been taken to complete the registration process.%3$sPlease return to the %1$sEvent List%2$s and reselect your tickets. If the problem continues, please contact the site administrator.',
904
-                    '(line break)This can sometimes happen if too much time has been taken to complete the registration process.(line break)Please return to the (link)Event List(end link) and reselect your tickets. If the problem continues, please contact the site administrator.',
905
-                    'event_espresso'
906
-                ),
907
-                '<a href="' . get_post_type_archive_link('espresso_events') . '" >',
908
-                '</a>',
909
-                '<br />'
910
-            );
911
-            EE_Error::add_error(
912
-                $error_message,
913
-                __FILE__,
914
-                __FUNCTION__,
915
-                __LINE__
916
-            );
917
-            return false;
918
-        }
919
-        // extract attendee info from form data and save to model objects
920
-        $registrations_processed = $this->_process_registrations($registrations, $valid_data);
921
-        // if first pass thru SPCO,
922
-        // then let's check processed registrations against the total number of tickets in the cart
923
-        if ($registrations_processed === false) {
924
-            // but return immediately if the previous step exited early due to errors
925
-            return false;
926
-        }
927
-        if (! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) {
928
-            // generate a correctly translated string for all possible singular/plural combinations
929
-            if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) {
930
-                $error_msg = sprintf(
931
-                    esc_html_x(
932
-                        'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed',
933
-                        'There was 1 ticket in the Event Queue, but 2 registrations were processed',
934
-                        'event_espresso'
935
-                    ),
936
-                    $this->checkout->total_ticket_count,
937
-                    $registrations_processed
938
-                );
939
-            } elseif ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) {
940
-                $error_msg = sprintf(
941
-                    esc_html_x(
942
-                        'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed',
943
-                        'There was a total of 2 tickets in the Event Queue, but only 1 registration was processed',
944
-                        'event_espresso'
945
-                    ),
946
-                    $this->checkout->total_ticket_count,
947
-                    $registrations_processed
948
-                );
949
-            } else {
950
-                $error_msg = sprintf(
951
-                    esc_html__(
952
-                        'There was a total of 2 tickets in the Event Queue, but 2 registrations were processed',
953
-                        'event_espresso'
954
-                    ),
955
-                    $this->checkout->total_ticket_count,
956
-                    $registrations_processed
957
-                );
958
-            }
959
-            EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
960
-            return false;
961
-        }
962
-        // mark this reg step as completed
963
-        $this->set_completed();
964
-        $this->_set_success_message(
965
-            esc_html__('The Attendee Information Step has been successfully completed.', 'event_espresso')
966
-        );
967
-        // do action in case a plugin wants to do something with the data submitted in step 1.
968
-        // passes EE_Single_Page_Checkout, and it's posted data
969
-        do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data);
970
-        return true;
971
-    }
972
-
973
-
974
-    /**
975
-     *    _process_registrations
976
-     *
977
-     * @param EE_Registration[] $registrations
978
-     * @param array[][]         $valid_data
979
-     * @return bool|int
980
-     * @throws EntityNotFoundException
981
-     * @throws EE_Error
982
-     * @throws InvalidArgumentException
983
-     * @throws ReflectionException
984
-     * @throws RuntimeException
985
-     * @throws InvalidDataTypeException
986
-     * @throws InvalidInterfaceException
987
-     */
988
-    private function _process_registrations($registrations = [], $valid_data = [])
989
-    {
990
-        // load resources and set some defaults
991
-        EE_Registry::instance()->load_model('Attendee');
992
-        // holder for primary registrant attendee object
993
-        $this->checkout->primary_attendee_obj = null;
994
-        // array for tracking reg form data for the primary registrant
995
-        $primary_registrant = [
996
-            'line_item_id' => null,
997
-        ];
998
-        $copy_primary       = false;
999
-        // reg form sections that do not contain inputs
1000
-        $non_input_form_sections = [
1001
-            'primary_registrant',
1002
-            'additional_attendee_reg_info',
1003
-            'spco_copy_attendee_chk',
1004
-        ];
1005
-        // attendee counter
1006
-        $att_nmbr = 0;
1007
-        // grab the saved registrations from the transaction
1008
-        foreach ($registrations as $registration) {
1009
-            // verify EE_Registration object
1010
-            if (! $registration instanceof EE_Registration) {
1011
-                EE_Error::add_error(
1012
-                    esc_html__(
1013
-                        'An invalid Registration object was discovered when attempting to process your registration information.',
1014
-                        'event_espresso'
1015
-                    ),
1016
-                    __FILE__,
1017
-                    __FUNCTION__,
1018
-                    __LINE__
1019
-                );
1020
-                return false;
1021
-            }
1022
-            $reg_url_link = $registration->reg_url_link();
1023
-            // reg_url_link exists ?
1024
-            if (! empty($reg_url_link)) {
1025
-                // should this registration be processed during this visit ?
1026
-                if ($this->checkout->visit_allows_processing_of_this_registration($registration)) {
1027
-                    // if NOT revisiting, then let's save the registration now,
1028
-                    // so that we have a REG_ID to use when generating other objects
1029
-                    if (! $this->checkout->revisit) {
1030
-                        $registration->save();
1031
-                    }
1032
-                    /**
1033
-                     * This allows plugins to trigger a fail on processing of a
1034
-                     * registration for any conditions they may have for it to pass.
1035
-                     *
1036
-                     * @var bool   if true is returned by the plugin then the
1037
-                     *            registration processing is halted.
1038
-                     */
1039
-                    if (
1040
-                        apply_filters(
1041
-                            'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process',
1042
-                            false,
1043
-                            $att_nmbr,
1044
-                            $registration,
1045
-                            $registrations,
1046
-                            $valid_data,
1047
-                            $this
1048
-                        )
1049
-                    ) {
1050
-                        return false;
1051
-                    }
1052
-
1053
-                    // Houston, we have a registration!
1054
-                    $att_nmbr++;
1055
-                    $this->_attendee_data[ $reg_url_link ] = [];
1056
-                    // grab any existing related answer objects
1057
-                    $this->_registration_answers = $registration->answers();
1058
-                    // unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] );
1059
-                    if (isset($valid_data[ $reg_url_link ])) {
1060
-                        // do we need to copy basic info from primary attendee ?
1061
-                        $copy_primary = isset($valid_data[ $reg_url_link ]['additional_attendee_reg_info'])
1062
-                                        && absint($valid_data[ $reg_url_link ]['additional_attendee_reg_info']) === 0;
1063
-                        // filter form input data for this registration
1064
-                        $valid_data[ $reg_url_link ] = (array) apply_filters(
1065
-                            'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item',
1066
-                            $valid_data[ $reg_url_link ]
1067
-                        );
1068
-                        if (isset($valid_data['primary_attendee'])) {
1069
-                            $primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee'])
1070
-                                ? $valid_data['primary_attendee']
1071
-                                : false;
1072
-                            unset($valid_data['primary_attendee']);
1073
-                        }
1074
-                        // now loop through our array of valid post data && process attendee reg forms
1075
-                        foreach ($valid_data[ $reg_url_link ] as $form_section => $form_inputs) {
1076
-                            if (! in_array($form_section, $non_input_form_sections, true)) {
1077
-                                foreach ($form_inputs as $form_input => $input_value) {
1078
-                                    // check for critical inputs
1079
-                                    if (
1080
-                                        ! $this->_verify_critical_attendee_details_are_set_and_validate_email(
1081
-                                            $form_input,
1082
-                                            $input_value
1083
-                                        )
1084
-                                    ) {
1085
-                                        return false;
1086
-                                    }
1087
-                                    // store a bit of data about the primary attendee
1088
-                                    if (
1089
-                                        $att_nmbr === 1
1090
-                                        && ! empty($input_value)
1091
-                                        && $reg_url_link === $primary_registrant['line_item_id']
1092
-                                    ) {
1093
-                                        $primary_registrant[ $form_input ] = $input_value;
1094
-                                    } elseif (
1095
-                                        $copy_primary
1096
-                                              && $input_value === null
1097
-                                              && isset($primary_registrant[ $form_input ])
1098
-                                    ) {
1099
-                                        $input_value = $primary_registrant[ $form_input ];
1100
-                                    }
1101
-                                    // now attempt to save the input data
1102
-                                    if (
1103
-                                        ! $this->_save_registration_form_input(
1104
-                                            $registration,
1105
-                                            $form_input,
1106
-                                            $input_value
1107
-                                        )
1108
-                                    ) {
1109
-                                        EE_Error::add_error(
1110
-                                            sprintf(
1111
-                                                esc_html_x(
1112
-                                                    'Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"',
1113
-                                                    'Unable to save registration form data for the form input: "form input name" with the submitted value: "form input value"',
1114
-                                                    'event_espresso'
1115
-                                                ),
1116
-                                                $form_input,
1117
-                                                $input_value
1118
-                                            ),
1119
-                                            __FILE__,
1120
-                                            __FUNCTION__,
1121
-                                            __LINE__
1122
-                                        );
1123
-                                        return false;
1124
-                                    }
1125
-                                }
1126
-                            }
1127
-                        }  // end of foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs )
1128
-                    }
1129
-                    // this registration does not require additional attendee information ?
1130
-                    if (
1131
-                        $copy_primary
1132
-                        && $att_nmbr > 1
1133
-                        && $this->checkout->primary_attendee_obj instanceof EE_Attendee
1134
-                    ) {
1135
-                        // just copy the primary registrant
1136
-                        $attendee = $this->checkout->primary_attendee_obj;
1137
-                    } else {
1138
-                        // ensure critical details are set for additional attendees
1139
-                        $this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1
1140
-                            ? $this->_copy_critical_attendee_details_from_primary_registrant(
1141
-                                $this->_attendee_data[ $reg_url_link ]
1142
-                            )
1143
-                            : $this->_attendee_data[ $reg_url_link ];
1144
-                        // execute create attendee command (which may return an existing attendee)
1145
-                        $attendee = EE_Registry::instance()->BUS->execute(
1146
-                            new CreateAttendeeCommand(
1147
-                                $this->_attendee_data[ $reg_url_link ],
1148
-                                $registration
1149
-                            )
1150
-                        );
1151
-                        // who's #1 ?
1152
-                        if ($att_nmbr === 1) {
1153
-                            $this->checkout->primary_attendee_obj = $attendee;
1154
-                        }
1155
-                    }
1156
-                    // add relation to registration, set attendee ID, and cache attendee
1157
-                    $this->_associate_attendee_with_registration($registration, $attendee);
1158
-                    if (! $registration->attendee() instanceof EE_Attendee) {
1159
-                        EE_Error::add_error(
1160
-                            sprintf(
1161
-                                esc_html_x(
1162
-                                    'Registration %s has an invalid or missing Attendee object.',
1163
-                                    'Registration 123-456-789 has an invalid or missing Attendee object.',
1164
-                                    'event_espresso'
1165
-                                ),
1166
-                                $reg_url_link
1167
-                            ),
1168
-                            __FILE__,
1169
-                            __FUNCTION__,
1170
-                            __LINE__
1171
-                        );
1172
-                        return false;
1173
-                    }
1174
-                    /** @type EE_Registration_Processor $registration_processor */
1175
-                    $registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1176
-                    // at this point, we should have enough details about the registrant to consider the registration
1177
-                    // NOT incomplete
1178
-                    $registration_processor->toggle_incomplete_registration_status_to_default(
1179
-                        $registration,
1180
-                        false,
1181
-                        new Context(
1182
-                            'spco_reg_step_attendee_information_process_registrations',
1183
-                            esc_html__(
1184
-                                'Finished populating registration with details from the registration form after submitting the Attendee Information Reg Step.',
1185
-                                'event_espresso'
1186
-                            )
1187
-                        )
1188
-                    );
1189
-                    // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to
1190
-                    // abandoned
1191
-                    $this->checkout->transaction->toggle_failed_transaction_status();
1192
-                    // if we've gotten this far, then let's save what we have
1193
-                    $registration->save();
1194
-                    // add relation between TXN and registration
1195
-                    $this->_associate_registration_with_transaction($registration);
1196
-                }
1197
-            } else {
1198
-                EE_Error::add_error(
1199
-                    esc_html__(
1200
-                        'An invalid or missing line item ID was encountered while attempting to process the registration form.',
1201
-                        'event_espresso'
1202
-                    ),
1203
-                    __FILE__,
1204
-                    __FUNCTION__,
1205
-                    __LINE__
1206
-                );
1207
-                // remove malformed data
1208
-                unset($valid_data[ $reg_url_link ]);
1209
-                return false;
1210
-            }
1211
-        } // end of foreach ( $this->checkout->transaction->registrations()  as $registration )
1212
-        return $att_nmbr;
1213
-    }
1214
-
1215
-
1216
-    /**
1217
-     *    _save_registration_form_input
1218
-     *
1219
-     * @param EE_Registration $registration
1220
-     * @param string          $form_input
1221
-     * @param string          $input_value
1222
-     * @return bool
1223
-     * @throws EE_Error
1224
-     * @throws InvalidArgumentException
1225
-     * @throws InvalidDataTypeException
1226
-     * @throws InvalidInterfaceException
1227
-     * @throws ReflectionException
1228
-     */
1229
-    private function _save_registration_form_input(
1230
-        EE_Registration $registration,
1231
-        $form_input = '',
1232
-        $input_value = ''
1233
-    ) {
1234
-        // If email_confirm is sent it's not saved
1235
-        if ((string) $form_input === 'email_confirm') {
1236
-            return true;
1237
-        }
1238
-
1239
-        // allow for plugins to hook in and do their own processing of the form input.
1240
-        // For plugins to bypass normal processing here, they just need to return a boolean value.
1241
-        if (
1242
-            apply_filters(
1243
-                'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input',
1244
-                false,
1245
-                $registration,
1246
-                $form_input,
1247
-                $input_value,
1248
-                $this
1249
-            )
1250
-        ) {
1251
-            return true;
1252
-        }
1253
-        /*
20
+	/**
21
+	 * @type bool $_print_copy_info
22
+	 */
23
+	private $_print_copy_info = false;
24
+
25
+	/**
26
+	 * @type array $_attendee_data
27
+	 */
28
+	private $_attendee_data = [];
29
+
30
+	/**
31
+	 * @type array $_required_questions
32
+	 */
33
+	private $_required_questions = [];
34
+
35
+	/**
36
+	 * @type array $_registration_answers
37
+	 */
38
+	private $_registration_answers = [];
39
+
40
+	/**
41
+	 * @type int $reg_form_count
42
+	 */
43
+	protected $reg_form_count = 0;
44
+
45
+
46
+	/**
47
+	 *    class constructor
48
+	 *
49
+	 * @access    public
50
+	 * @param EE_Checkout $checkout
51
+	 */
52
+	public function __construct(EE_Checkout $checkout)
53
+	{
54
+		$this->request  = EED_Single_Page_Checkout::getRequest();
55
+		$this->_slug    = 'attendee_information';
56
+		$this->_name    = esc_html__('Attendee Information', 'event_espresso');
57
+		$this->checkout = $checkout;
58
+		$this->_reset_success_message();
59
+		$this->set_instructions(
60
+			esc_html__('Please answer the following registration questions before proceeding.', 'event_espresso')
61
+		);
62
+	}
63
+
64
+
65
+	public function translate_js_strings()
66
+	{
67
+		EE_Registry::$i18n_js_strings['required_field']            = esc_html__(
68
+			' is a required question.',
69
+			'event_espresso'
70
+		);
71
+		EE_Registry::$i18n_js_strings['required_multi_field']      = esc_html__(
72
+			' is a required question. Please enter a value for at least one of the options.',
73
+			'event_espresso'
74
+		);
75
+		EE_Registry::$i18n_js_strings['answer_required_questions'] = esc_html__(
76
+			'Please answer all required questions correctly before proceeding.',
77
+			'event_espresso'
78
+		);
79
+		EE_Registry::$i18n_js_strings['attendee_info_copied']      = sprintf(
80
+			esc_html_x(
81
+				'The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.',
82
+				'The attendee information was successfully copied.(line break)Please ensure the rest of the registration form is completed before proceeding.',
83
+				'event_espresso'
84
+			),
85
+			'<br/>'
86
+		);
87
+		EE_Registry::$i18n_js_strings['attendee_info_copy_error']  = esc_html__(
88
+			'An unknown error occurred on the server while attempting to copy the attendee information. Please refresh the page and try again.',
89
+			'event_espresso'
90
+		);
91
+		EE_Registry::$i18n_js_strings['enter_valid_email']         = esc_html__(
92
+			'You must enter a valid email address.',
93
+			'event_espresso'
94
+		);
95
+		EE_Registry::$i18n_js_strings['valid_email_and_questions'] = esc_html__(
96
+			'You must enter a valid email address and answer all other required questions before you can proceed.',
97
+			'event_espresso'
98
+		);
99
+	}
100
+
101
+
102
+	public function enqueue_styles_and_scripts()
103
+	{
104
+	}
105
+
106
+
107
+	/**
108
+	 * @return boolean
109
+	 */
110
+	public function initialize_reg_step()
111
+	{
112
+		return true;
113
+	}
114
+
115
+
116
+	/**
117
+	 * @return EE_Form_Section_Proper
118
+	 * @throws DomainException
119
+	 * @throws EE_Error
120
+	 * @throws InvalidArgumentException
121
+	 * @throws ReflectionException
122
+	 * @throws EntityNotFoundException
123
+	 * @throws InvalidDataTypeException
124
+	 * @throws InvalidInterfaceException
125
+	 */
126
+	public function generate_reg_form()
127
+	{
128
+		/**
129
+		 * @var $reg_config EE_Registration_Config
130
+		 */
131
+		$reg_config = LoaderFactory::getLoader()->getShared('EE_Registration_Config');
132
+
133
+		$this->_print_copy_info = $reg_config->copyAttendeeInfo();
134
+
135
+		// Init reg forms count.
136
+		$this->reg_form_count = 0;
137
+
138
+		$primary_registrant = null;
139
+		// autoload Line_Item_Display classes
140
+		EEH_Autoloader::register_line_item_display_autoloaders();
141
+		$Line_Item_Display = new EE_Line_Item_Display();
142
+		// calculate taxes
143
+		$Line_Item_Display->display_line_item(
144
+			$this->checkout->cart->get_grand_total(),
145
+			['set_tax_rate' => true]
146
+		);
147
+		/** @var $subsections EE_Form_Section_Proper[] */
148
+		$extra_inputs_section = $this->reg_step_hidden_inputs();
149
+		$subsections          = [
150
+			'default_hidden_inputs' => $extra_inputs_section,
151
+		];
152
+
153
+		// if this isn't a revisit, and they have the privacy consent box enabled, add it
154
+		if (! $this->checkout->revisit && $reg_config->isConsentCheckboxEnabled()) {
155
+			$extra_inputs_section->add_subsections(
156
+				[
157
+					'consent_box' => new EE_Form_Section_Proper(
158
+						[
159
+							'layout_strategy' =>
160
+								new EE_Template_Layout(
161
+									[
162
+										'input_template_file' => SPCO_REG_STEPS_PATH
163
+																 . $this->_slug
164
+																 . '/privacy_consent.template.php',
165
+									]
166
+								),
167
+							'subsections'     => [
168
+								'consent' => new EE_Checkbox_Multi_Input(
169
+									[
170
+										'consent' => $reg_config->getConsentCheckboxLabelText(),
171
+									],
172
+									[
173
+										'required'                          => true,
174
+										'required_validation_error_message' => esc_html__(
175
+											'You must consent to these terms in order to register.',
176
+											'event_espresso'
177
+										),
178
+										'html_label_text'                   => '',
179
+									]
180
+								),
181
+							],
182
+						]
183
+					),
184
+				],
185
+				null,
186
+				false
187
+			);
188
+		}
189
+		$template_args = [
190
+			'revisit'       => $this->checkout->revisit,
191
+			'registrations' => [],
192
+			'ticket_count'  => [],
193
+		];
194
+		// grab the saved registrations from the transaction
195
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
196
+		if ($registrations) {
197
+			foreach ($registrations as $registration) {
198
+				// can this registration be processed during this visit ?
199
+				if (
200
+					$registration instanceof EE_Registration
201
+					&& $this->checkout->visit_allows_processing_of_this_registration($registration)
202
+				) {
203
+					$subsections[ $registration->reg_url_link() ]                       =
204
+						$this->_registrations_reg_form($registration);
205
+					$template_args['registrations'][ $registration->reg_url_link() ]    = $registration;
206
+					$template_args['ticket_count'][ $registration->ticket()->ID() ]     = isset(
207
+						$template_args['ticket_count'][ $registration->ticket()->ID() ]
208
+					)
209
+						? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1
210
+						: 1;
211
+					$ticket_line_item                                                   =
212
+						EEH_Line_Item::get_line_items_by_object_type_and_IDs(
213
+							$this->checkout->cart->get_grand_total(),
214
+							'Ticket',
215
+							[$registration->ticket()->ID()]
216
+						);
217
+					$ticket_line_item                                                   = is_array($ticket_line_item)
218
+						? reset($ticket_line_item)
219
+						: $ticket_line_item;
220
+					$template_args['ticket_line_item'][ $registration->ticket()->ID() ] =
221
+						$Line_Item_Display->display_line_item($ticket_line_item);
222
+					if ($registration->is_primary_registrant()) {
223
+						$primary_registrant = $registration->reg_url_link();
224
+					}
225
+				}
226
+			}
227
+
228
+			if ($primary_registrant && count($registrations) > 1) {
229
+				$copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info
230
+					? $this->_copy_attendee_info_form()
231
+					: $this->_auto_copy_attendee_info();
232
+				// generate hidden input
233
+				if (
234
+					isset($subsections[ $primary_registrant ])
235
+					&& $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper
236
+				) {
237
+					$subsections[ $primary_registrant ]->add_subsections(
238
+						$copy_options,
239
+						'primary_registrant',
240
+						false
241
+					);
242
+				}
243
+			}
244
+		}
245
+
246
+		// Set the registration form template (default: one form per ticket details table).
247
+		// We decide the template to used based on the number of forms.
248
+		$this->_template = $this->reg_form_count > 1
249
+			? SPCO_REG_STEPS_PATH . $this->_slug . '/attendee_info_main.template.php'
250
+			: SPCO_REG_STEPS_PATH . $this->_slug . '/attendee_info_single.template.php';
251
+
252
+		return new EE_Form_Section_Proper(
253
+			[
254
+				'name'            => $this->reg_form_name(),
255
+				'html_id'         => $this->reg_form_name(),
256
+				'subsections'     => $subsections,
257
+				'layout_strategy' => new EE_Template_Layout(
258
+					[
259
+						'layout_template_file' => $this->_template, // layout_template
260
+						'template_args'        => $template_args,
261
+					]
262
+				),
263
+			]
264
+		);
265
+	}
266
+
267
+
268
+	/**
269
+	 * @param EE_Registration $registration
270
+	 * @return EE_Form_Section_Base
271
+	 * @throws EE_Error
272
+	 * @throws InvalidArgumentException
273
+	 * @throws EntityNotFoundException
274
+	 * @throws InvalidDataTypeException
275
+	 * @throws InvalidInterfaceException
276
+	 * @throws ReflectionException
277
+	 */
278
+	private function _registrations_reg_form(EE_Registration $registration)
279
+	{
280
+		static $attendee_nmbr = 1;
281
+		$form_args = [];
282
+		// verify that registration has valid event
283
+		if ($registration->event() instanceof EE_Event) {
284
+			$field_name      = 'Event_Question_Group.'
285
+							   . EEM_Event_Question_Group::instance()->fieldNameForContext(
286
+								   $registration->is_primary_registrant()
287
+							   );
288
+			$question_groups = $registration->event()->question_groups(
289
+				apply_filters(
290
+				// @codingStandardsIgnoreStart
291
+					'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__question_groups_query_parameters',
292
+					// @codingStandardsIgnoreEnd
293
+					[
294
+						[
295
+							'Event.EVT_ID' => $registration->event()->ID(),
296
+							$field_name    => true,
297
+							'QSG_deleted'  => false
298
+						],
299
+						'order_by' => ['QSG_order' => 'ASC'],
300
+					],
301
+					$registration,
302
+					$this
303
+				)
304
+			);
305
+			if ($question_groups) {
306
+				// array of params to pass to parent constructor
307
+				$form_args = [
308
+					'html_id'         => 'ee-registration-' . $registration->reg_url_link(),
309
+					'html_class'      => 'ee-reg-form-attendee-dv',
310
+					'html_style'      => $this->checkout->admin_request
311
+						? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;'
312
+						: '',
313
+					'subsections'     => [],
314
+					'layout_strategy' => new EE_Fieldset_Section_Layout(
315
+						[
316
+							'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text',
317
+							'legend_text'  => sprintf(
318
+								esc_html_x(
319
+									'Attendee %d',
320
+									'Attendee 123',
321
+									'event_espresso'
322
+								),
323
+								$attendee_nmbr
324
+							),
325
+						]
326
+					),
327
+				];
328
+				foreach ($question_groups as $question_group) {
329
+					if ($question_group instanceof EE_Question_Group) {
330
+						$form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form(
331
+							$registration,
332
+							$question_group
333
+						);
334
+					}
335
+				}
336
+				// add hidden input
337
+				$form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input(
338
+					$registration
339
+				);
340
+
341
+				/**
342
+				 * @var $reg_config EE_Registration_Config
343
+				 */
344
+				$reg_config = LoaderFactory::getLoader()->getShared('EE_Registration_Config');
345
+
346
+				// If we have question groups for additional attendees, then display the copy options
347
+				$this->_print_copy_info = apply_filters(
348
+					'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form___printCopyInfo',
349
+					$attendee_nmbr > 1 && $reg_config->copyAttendeeInfo(),
350
+					$attendee_nmbr
351
+				);
352
+
353
+				if ($registration->is_primary_registrant()) {
354
+					// generate hidden input
355
+					$form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs(
356
+						$registration
357
+					);
358
+				}
359
+			}
360
+		}
361
+		$attendee_nmbr++;
362
+
363
+		// Increment the reg forms number if form is valid.
364
+		if (! empty($form_args)) {
365
+			$this->reg_form_count++;
366
+		}
367
+
368
+		return ! empty($form_args)
369
+			? new EE_Form_Section_Proper($form_args)
370
+			: new EE_Form_Section_HTML();
371
+	}
372
+
373
+
374
+	/**
375
+	 * @param EE_Registration $registration
376
+	 * @param bool            $additional_attendee_reg_info
377
+	 * @return EE_Form_Input_Base
378
+	 * @throws EE_Error
379
+	 */
380
+	private function _additional_attendee_reg_info_input(
381
+		EE_Registration $registration,
382
+		$additional_attendee_reg_info = true
383
+	) {
384
+		// generate hidden input
385
+		return new EE_Hidden_Input(
386
+			[
387
+				'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(),
388
+				'default' => $additional_attendee_reg_info,
389
+			]
390
+		);
391
+	}
392
+
393
+
394
+	/**
395
+	 * @param EE_Registration   $registration
396
+	 * @param EE_Question_Group $question_group
397
+	 * @return EE_Form_Section_Proper
398
+	 * @throws EE_Error
399
+	 * @throws InvalidArgumentException
400
+	 * @throws InvalidDataTypeException
401
+	 * @throws InvalidInterfaceException
402
+	 * @throws ReflectionException
403
+	 */
404
+	private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group)
405
+	{
406
+		// array of params to pass to parent constructor
407
+		$form_args = [
408
+			'html_id'         => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-' . $registration->ID(),
409
+			'html_class'      => $this->checkout->admin_request
410
+				? 'form-table ee-reg-form-qstn-grp-dv'
411
+				: 'ee-reg-form-qstn-grp-dv',
412
+			'html_label_id'   => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-'
413
+								 . $registration->ID() . '-lbl',
414
+			'subsections'     => [
415
+				'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group),
416
+			],
417
+			'layout_strategy' => $this->checkout->admin_request
418
+				? new EE_Admin_Two_Column_Layout()
419
+				: new EE_Div_Per_Section_Layout(),
420
+		];
421
+		// where params
422
+		$query_params = ['QST_deleted' => 0];
423
+		// don't load admin only questions on the frontend
424
+		if (! $this->checkout->admin_request) {
425
+			$query_params['QST_admin_only'] = ['!=', true];
426
+		}
427
+		$questions = $question_group->get_many_related(
428
+			'Question',
429
+			apply_filters(
430
+				'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__related_questions_query_params',
431
+				[
432
+					$query_params,
433
+					'order_by' => [
434
+						'Question_Group_Question.QGQ_order' => 'ASC',
435
+					],
436
+				],
437
+				$question_group,
438
+				$registration,
439
+				$this
440
+			)
441
+		);
442
+		// filter for additional content before questions
443
+		$form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML(
444
+			apply_filters(
445
+				'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions',
446
+				'',
447
+				$registration,
448
+				$question_group,
449
+				$this
450
+			)
451
+		);
452
+		// loop thru questions
453
+		foreach ($questions as $question) {
454
+			if ($question instanceof EE_Question) {
455
+				$identifier                              = $question->is_system_question()
456
+					? $question->system_ID()
457
+					: $question->ID();
458
+				$form_args['subsections'][ $identifier ] = $this->reg_form_question($registration, $question);
459
+			}
460
+		}
461
+		$form_args['subsections'] = apply_filters(
462
+			'FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array',
463
+			$form_args['subsections'],
464
+			$registration,
465
+			$question_group,
466
+			$this
467
+		);
468
+		// filter for additional content after questions
469
+		$form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML(
470
+			apply_filters(
471
+				'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions',
472
+				'',
473
+				$registration,
474
+				$question_group,
475
+				$this
476
+			)
477
+		);
478
+		// d($form_args);
479
+		$question_group_reg_form = new EE_Form_Section_Proper($form_args);
480
+		return apply_filters(
481
+			'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form',
482
+			$question_group_reg_form,
483
+			$registration,
484
+			$question_group,
485
+			$this
486
+		);
487
+	}
488
+
489
+
490
+	/**
491
+	 * @param EE_Question_Group $question_group
492
+	 * @return    EE_Form_Section_HTML
493
+	 */
494
+	private function _question_group_header(EE_Question_Group $question_group)
495
+	{
496
+		$html = '';
497
+		// group_name
498
+		if ($question_group->show_group_name() && $question_group->name() !== '') {
499
+			if ($this->checkout->admin_request) {
500
+				$html .= EEH_HTML::br();
501
+				$html .= EEH_HTML::h3(
502
+					$question_group->name(),
503
+					'',
504
+					'ee-reg-form-qstn-grp-title title',
505
+					'font-size: 1.3em; padding-left:0;'
506
+				);
507
+			} else {
508
+				$html .= EEH_HTML::h4(
509
+					$question_group->name(),
510
+					'',
511
+					'ee-reg-form-qstn-grp-title section-title'
512
+				);
513
+			}
514
+		}
515
+		// group_desc
516
+		if ($question_group->show_group_desc() && $question_group->desc() !== '') {
517
+			$html .= EEH_HTML::p(
518
+				$question_group->desc(),
519
+				'',
520
+				$this->checkout->admin_request
521
+					? 'ee-reg-form-qstn-grp-desc-pg'
522
+					: 'ee-reg-form-qstn-grp-desc-pg small-text lt-grey-text'
523
+			);
524
+		}
525
+		return new EE_Form_Section_HTML($html);
526
+	}
527
+
528
+
529
+	/**
530
+	 * @return    EE_Form_Section_Proper
531
+	 * @throws EE_Error
532
+	 * @throws InvalidArgumentException
533
+	 * @throws ReflectionException
534
+	 * @throws InvalidDataTypeException
535
+	 * @throws InvalidInterfaceException
536
+	 */
537
+	private function _copy_attendee_info_form()
538
+	{
539
+		// array of params to pass to parent constructor
540
+		return new EE_Form_Section_Proper(
541
+			[
542
+				'subsections'     => $this->_copy_attendee_info_inputs(),
543
+				'layout_strategy' => new EE_Template_Layout(
544
+					[
545
+						'layout_template_file'     => SPCO_REG_STEPS_PATH
546
+													  . $this->_slug
547
+													  . '/copy_attendee_info.template.php',
548
+						'begin_template_file'      => null,
549
+						'input_template_file'      => null,
550
+						'subsection_template_file' => null,
551
+						'end_template_file'        => null,
552
+					]
553
+				),
554
+			]
555
+		);
556
+	}
557
+
558
+
559
+	/**
560
+	 * @return EE_Form_Section_HTML
561
+	 * @throws DomainException
562
+	 * @throws InvalidArgumentException
563
+	 * @throws InvalidDataTypeException
564
+	 * @throws InvalidInterfaceException
565
+	 */
566
+	private function _auto_copy_attendee_info()
567
+	{
568
+		return new EE_Form_Section_HTML(
569
+			EEH_Template::locate_template(
570
+				SPCO_REG_STEPS_PATH . $this->_slug . '/_auto_copy_attendee_info.template.php',
571
+				apply_filters(
572
+					'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args',
573
+					[]
574
+				)
575
+			)
576
+		);
577
+	}
578
+
579
+
580
+	/**
581
+	 * @return array
582
+	 * @throws EE_Error
583
+	 * @throws InvalidArgumentException
584
+	 * @throws ReflectionException
585
+	 * @throws InvalidDataTypeException
586
+	 * @throws InvalidInterfaceException
587
+	 */
588
+	private function _copy_attendee_info_inputs()
589
+	{
590
+		$copy_attendee_info_inputs = [];
591
+		$prev_ticket               = null;
592
+		// grab the saved registrations from the transaction
593
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
594
+		foreach ($registrations as $registration) {
595
+			// for all  attendees other than the primary attendee
596
+			if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) {
597
+				// if this is a new ticket OR if this is the very first additional attendee after the primary attendee
598
+				if ($registration->ticket()->ID() !== $prev_ticket) {
599
+					$item_name                          = $registration->ticket()->name();
600
+					$item_name                          .= $registration->ticket()->description() !== ''
601
+						? ' - ' . $registration->ticket()->description()
602
+						: '';
603
+					$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-'
604
+												. $registration->ticket()->ID()
605
+												. ']' ] =
606
+						new EE_Form_Section_HTML(
607
+							'<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>'
608
+						);
609
+					$prev_ticket                        = $registration->ticket()->ID();
610
+				}
611
+
612
+				$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] =
613
+					new EE_Checkbox_Multi_Input(
614
+						[
615
+							$registration->ID() => sprintf(
616
+								esc_html_x('Attendee #%s', 'Attendee #123', 'event_espresso'),
617
+								$registration->count()
618
+							),
619
+						],
620
+						[
621
+							'html_id'                 => 'spco-copy-attendee-chk-' . $registration->reg_url_link(),
622
+							'html_class'              => 'spco-copy-attendee-chk ee-do-not-validate',
623
+							'display_html_label_text' => false,
624
+						]
625
+					);
626
+			}
627
+		}
628
+		return $copy_attendee_info_inputs;
629
+	}
630
+
631
+
632
+	/**
633
+	 * @param EE_Registration $registration
634
+	 * @return    EE_Form_Input_Base
635
+	 * @throws EE_Error
636
+	 */
637
+	private function _additional_primary_registrant_inputs(EE_Registration $registration)
638
+	{
639
+		// generate hidden input
640
+		return new EE_Hidden_Input(
641
+			[
642
+				'html_id' => 'primary_registrant',
643
+				'default' => $registration->reg_url_link(),
644
+			]
645
+		);
646
+	}
647
+
648
+
649
+	/**
650
+	 * @param EE_Registration $registration
651
+	 * @param EE_Question     $question
652
+	 * @return EE_Form_Input_Base
653
+	 * @throws EE_Error
654
+	 * @throws InvalidArgumentException
655
+	 * @throws InvalidDataTypeException
656
+	 * @throws InvalidInterfaceException
657
+	 * @throws ReflectionException
658
+	 */
659
+	public function reg_form_question(EE_Registration $registration, EE_Question $question)
660
+	{
661
+
662
+		// if this question was for an attendee detail, then check for that answer
663
+		$answer_value = EEM_Answer::instance()->get_attendee_property_answer_value(
664
+			$registration,
665
+			$question->system_ID()
666
+		);
667
+		$answer       = $answer_value === null
668
+			? EEM_Answer::instance()->get_one(
669
+				[['QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()]]
670
+			)
671
+			: null;
672
+		// if NOT returning to edit an existing registration
673
+		// OR if this question is for an attendee property
674
+		// OR we still don't have an EE_Answer object
675
+		if ($answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link()) {
676
+			// create an EE_Answer object for storing everything in
677
+			$answer = EE_Answer::new_instance(
678
+				[
679
+					'QST_ID' => $question->ID(),
680
+					'REG_ID' => $registration->ID(),
681
+				]
682
+			);
683
+		}
684
+		// verify instance
685
+		if ($answer instanceof EE_Answer) {
686
+			if (! empty($answer_value)) {
687
+				$answer->set('ANS_value', $answer_value);
688
+			}
689
+			$answer->cache('Question', $question);
690
+			// remember system ID had a bug where sometimes it could be null
691
+			$answer_cache_id = $question->is_system_question()
692
+				? $question->system_ID() . '-' . $registration->reg_url_link()
693
+				: $question->ID() . '-' . $registration->reg_url_link();
694
+			$registration->cache('Answer', $answer, $answer_cache_id);
695
+		}
696
+		return $this->_generate_question_input($registration, $question, $answer);
697
+	}
698
+
699
+
700
+	/**
701
+	 * @param EE_Registration $registration
702
+	 * @param EE_Question     $question
703
+	 * @param                 $answer
704
+	 * @return EE_Form_Input_Base
705
+	 * @throws EE_Error
706
+	 * @throws InvalidArgumentException
707
+	 * @throws ReflectionException
708
+	 * @throws InvalidDataTypeException
709
+	 * @throws InvalidInterfaceException
710
+	 */
711
+	private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer)
712
+	{
713
+		$identifier                               = $question->is_system_question()
714
+			? $question->system_ID()
715
+			: $question->ID();
716
+		$this->_required_questions[ $identifier ] = $question->required();
717
+		add_filter(
718
+			'FHEE__EE_Question__generate_form_input__country_options',
719
+			[$this, 'use_cached_countries_for_form_input'],
720
+			10,
721
+			4
722
+		);
723
+		add_filter(
724
+			'FHEE__EE_Question__generate_form_input__state_options',
725
+			[$this, 'use_cached_states_for_form_input'],
726
+			10,
727
+			4
728
+		);
729
+		$input_constructor_args                  = [
730
+			'html_name'        => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']',
731
+			'html_id'          => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
732
+			'html_class'       => 'ee-reg-qstn ee-reg-qstn-' . $identifier,
733
+			'html_label_id'    => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
734
+			'html_label_class' => 'ee-reg-qstn',
735
+		];
736
+		$input_constructor_args['html_label_id'] .= '-lbl';
737
+		if ($answer instanceof EE_Answer && $answer->ID()) {
738
+			$input_constructor_args['html_name']     .= '[' . $answer->ID() . ']';
739
+			$input_constructor_args['html_id']       .= '-' . $answer->ID();
740
+			$input_constructor_args['html_label_id'] .= '-' . $answer->ID();
741
+		}
742
+		$form_input = $question->generate_form_input(
743
+			$registration,
744
+			$answer,
745
+			$input_constructor_args
746
+		);
747
+		remove_filter(
748
+			'FHEE__EE_Question__generate_form_input__country_options',
749
+			[$this, 'use_cached_countries_for_form_input']
750
+		);
751
+		remove_filter(
752
+			'FHEE__EE_Question__generate_form_input__state_options',
753
+			[$this, 'use_cached_states_for_form_input']
754
+		);
755
+		return $form_input;
756
+	}
757
+
758
+
759
+	/**
760
+	 * Gets the list of countries for the form input
761
+	 *
762
+	 * @param array|null      $countries_list
763
+	 * @param EE_Question     $question
764
+	 * @param EE_Registration $registration
765
+	 * @param EE_Answer       $answer
766
+	 * @return array 2d keys are country IDs, values are their names
767
+	 * @throws EE_Error
768
+	 * @throws InvalidArgumentException
769
+	 * @throws InvalidDataTypeException
770
+	 * @throws InvalidInterfaceException
771
+	 * @throws ReflectionException
772
+	 */
773
+	public function use_cached_countries_for_form_input(
774
+		$countries_list,
775
+		EE_Question $question = null,
776
+		EE_Registration $registration = null,
777
+		EE_Answer $answer = null
778
+	) {
779
+		$country_options = ['' => ''];
780
+		// get possibly cached list of countries
781
+		$countries = $this->checkout->action === 'process_reg_step'
782
+			? EEM_Country::instance()->get_all_countries()
783
+			: EEM_Country::instance()->get_all_active_countries();
784
+		if (! empty($countries)) {
785
+			foreach ($countries as $country) {
786
+				if ($country instanceof EE_Country) {
787
+					$country_options[ $country->ID() ] = $country->name();
788
+				}
789
+			}
790
+		}
791
+		if ($question instanceof EE_Question && $registration instanceof EE_Registration) {
792
+			$answer = EEM_Answer::instance()->get_one(
793
+				[['QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()]]
794
+			);
795
+		} else {
796
+			$answer = EE_Answer::new_instance();
797
+		}
798
+		return apply_filters(
799
+			'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options',
800
+			$country_options,
801
+			$this,
802
+			$registration,
803
+			$question,
804
+			$answer
805
+		);
806
+	}
807
+
808
+
809
+	/**
810
+	 * Gets the list of states for the form input
811
+	 *
812
+	 * @param array|null      $states_list
813
+	 * @param EE_Question     $question
814
+	 * @param EE_Registration $registration
815
+	 * @param EE_Answer       $answer
816
+	 * @return array 2d keys are state IDs, values are their names
817
+	 * @throws EE_Error
818
+	 * @throws InvalidArgumentException
819
+	 * @throws InvalidDataTypeException
820
+	 * @throws InvalidInterfaceException
821
+	 * @throws ReflectionException
822
+	 */
823
+	public function use_cached_states_for_form_input(
824
+		$states_list,
825
+		EE_Question $question = null,
826
+		EE_Registration $registration = null,
827
+		EE_Answer $answer = null
828
+	) {
829
+		$state_options = ['' => ['' => '']];
830
+		$states        = $this->checkout->action === 'process_reg_step'
831
+			? EEM_State::instance()->get_all_states()
832
+			: EEM_State::instance()->get_all_active_states();
833
+		if (! empty($states)) {
834
+			foreach ($states as $state) {
835
+				if ($state instanceof EE_State) {
836
+					$state_options[ $state->country()->name() ][ $state->ID() ] = $state->name();
837
+				}
838
+			}
839
+		}
840
+		return apply_filters(
841
+			'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options',
842
+			$state_options,
843
+			$this,
844
+			$registration,
845
+			$question,
846
+			$answer
847
+		);
848
+	}
849
+
850
+
851
+	/********************************************************************************************************/
852
+	/****************************************  PROCESS REG STEP  ****************************************/
853
+	/********************************************************************************************************/
854
+
855
+
856
+	/**
857
+	 * @return bool
858
+	 * @throws EE_Error
859
+	 * @throws InvalidArgumentException
860
+	 * @throws ReflectionException
861
+	 * @throws RuntimeException
862
+	 * @throws InvalidDataTypeException
863
+	 * @throws InvalidInterfaceException
864
+	 */
865
+	public function process_reg_step()
866
+	{
867
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
868
+		// grab validated data from form
869
+		$valid_data = $this->checkout->current_step->valid_data();
870
+		// if we don't have any $valid_data then something went TERRIBLY WRONG !!!
871
+		if (empty($valid_data)) {
872
+			EE_Error::add_error(
873
+				esc_html__('No valid question responses were received.', 'event_espresso'),
874
+				__FILE__,
875
+				__FUNCTION__,
876
+				__LINE__
877
+			);
878
+			return false;
879
+		}
880
+		if (! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) {
881
+			EE_Error::add_error(
882
+				esc_html__(
883
+					'A valid transaction could not be initiated for processing your registrations.',
884
+					'event_espresso'
885
+				),
886
+				__FILE__,
887
+				__FUNCTION__,
888
+				__LINE__
889
+			);
890
+			return false;
891
+		}
892
+		// get cached registrations
893
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
894
+		// verify we got the goods
895
+		if (empty($registrations)) {
896
+			// combine the old translated string with a new one, in order to not break translations
897
+			$error_message = esc_html__(
898
+				'Your form data could not be applied to any valid registrations.',
899
+				'event_espresso'
900
+			)
901
+			. sprintf(
902
+				esc_html_x(
903
+					'%3$sThis can sometimes happen if too much time has been taken to complete the registration process.%3$sPlease return to the %1$sEvent List%2$s and reselect your tickets. If the problem continues, please contact the site administrator.',
904
+					'(line break)This can sometimes happen if too much time has been taken to complete the registration process.(line break)Please return to the (link)Event List(end link) and reselect your tickets. If the problem continues, please contact the site administrator.',
905
+					'event_espresso'
906
+				),
907
+				'<a href="' . get_post_type_archive_link('espresso_events') . '" >',
908
+				'</a>',
909
+				'<br />'
910
+			);
911
+			EE_Error::add_error(
912
+				$error_message,
913
+				__FILE__,
914
+				__FUNCTION__,
915
+				__LINE__
916
+			);
917
+			return false;
918
+		}
919
+		// extract attendee info from form data and save to model objects
920
+		$registrations_processed = $this->_process_registrations($registrations, $valid_data);
921
+		// if first pass thru SPCO,
922
+		// then let's check processed registrations against the total number of tickets in the cart
923
+		if ($registrations_processed === false) {
924
+			// but return immediately if the previous step exited early due to errors
925
+			return false;
926
+		}
927
+		if (! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) {
928
+			// generate a correctly translated string for all possible singular/plural combinations
929
+			if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) {
930
+				$error_msg = sprintf(
931
+					esc_html_x(
932
+						'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed',
933
+						'There was 1 ticket in the Event Queue, but 2 registrations were processed',
934
+						'event_espresso'
935
+					),
936
+					$this->checkout->total_ticket_count,
937
+					$registrations_processed
938
+				);
939
+			} elseif ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) {
940
+				$error_msg = sprintf(
941
+					esc_html_x(
942
+						'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed',
943
+						'There was a total of 2 tickets in the Event Queue, but only 1 registration was processed',
944
+						'event_espresso'
945
+					),
946
+					$this->checkout->total_ticket_count,
947
+					$registrations_processed
948
+				);
949
+			} else {
950
+				$error_msg = sprintf(
951
+					esc_html__(
952
+						'There was a total of 2 tickets in the Event Queue, but 2 registrations were processed',
953
+						'event_espresso'
954
+					),
955
+					$this->checkout->total_ticket_count,
956
+					$registrations_processed
957
+				);
958
+			}
959
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
960
+			return false;
961
+		}
962
+		// mark this reg step as completed
963
+		$this->set_completed();
964
+		$this->_set_success_message(
965
+			esc_html__('The Attendee Information Step has been successfully completed.', 'event_espresso')
966
+		);
967
+		// do action in case a plugin wants to do something with the data submitted in step 1.
968
+		// passes EE_Single_Page_Checkout, and it's posted data
969
+		do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data);
970
+		return true;
971
+	}
972
+
973
+
974
+	/**
975
+	 *    _process_registrations
976
+	 *
977
+	 * @param EE_Registration[] $registrations
978
+	 * @param array[][]         $valid_data
979
+	 * @return bool|int
980
+	 * @throws EntityNotFoundException
981
+	 * @throws EE_Error
982
+	 * @throws InvalidArgumentException
983
+	 * @throws ReflectionException
984
+	 * @throws RuntimeException
985
+	 * @throws InvalidDataTypeException
986
+	 * @throws InvalidInterfaceException
987
+	 */
988
+	private function _process_registrations($registrations = [], $valid_data = [])
989
+	{
990
+		// load resources and set some defaults
991
+		EE_Registry::instance()->load_model('Attendee');
992
+		// holder for primary registrant attendee object
993
+		$this->checkout->primary_attendee_obj = null;
994
+		// array for tracking reg form data for the primary registrant
995
+		$primary_registrant = [
996
+			'line_item_id' => null,
997
+		];
998
+		$copy_primary       = false;
999
+		// reg form sections that do not contain inputs
1000
+		$non_input_form_sections = [
1001
+			'primary_registrant',
1002
+			'additional_attendee_reg_info',
1003
+			'spco_copy_attendee_chk',
1004
+		];
1005
+		// attendee counter
1006
+		$att_nmbr = 0;
1007
+		// grab the saved registrations from the transaction
1008
+		foreach ($registrations as $registration) {
1009
+			// verify EE_Registration object
1010
+			if (! $registration instanceof EE_Registration) {
1011
+				EE_Error::add_error(
1012
+					esc_html__(
1013
+						'An invalid Registration object was discovered when attempting to process your registration information.',
1014
+						'event_espresso'
1015
+					),
1016
+					__FILE__,
1017
+					__FUNCTION__,
1018
+					__LINE__
1019
+				);
1020
+				return false;
1021
+			}
1022
+			$reg_url_link = $registration->reg_url_link();
1023
+			// reg_url_link exists ?
1024
+			if (! empty($reg_url_link)) {
1025
+				// should this registration be processed during this visit ?
1026
+				if ($this->checkout->visit_allows_processing_of_this_registration($registration)) {
1027
+					// if NOT revisiting, then let's save the registration now,
1028
+					// so that we have a REG_ID to use when generating other objects
1029
+					if (! $this->checkout->revisit) {
1030
+						$registration->save();
1031
+					}
1032
+					/**
1033
+					 * This allows plugins to trigger a fail on processing of a
1034
+					 * registration for any conditions they may have for it to pass.
1035
+					 *
1036
+					 * @var bool   if true is returned by the plugin then the
1037
+					 *            registration processing is halted.
1038
+					 */
1039
+					if (
1040
+						apply_filters(
1041
+							'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process',
1042
+							false,
1043
+							$att_nmbr,
1044
+							$registration,
1045
+							$registrations,
1046
+							$valid_data,
1047
+							$this
1048
+						)
1049
+					) {
1050
+						return false;
1051
+					}
1052
+
1053
+					// Houston, we have a registration!
1054
+					$att_nmbr++;
1055
+					$this->_attendee_data[ $reg_url_link ] = [];
1056
+					// grab any existing related answer objects
1057
+					$this->_registration_answers = $registration->answers();
1058
+					// unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] );
1059
+					if (isset($valid_data[ $reg_url_link ])) {
1060
+						// do we need to copy basic info from primary attendee ?
1061
+						$copy_primary = isset($valid_data[ $reg_url_link ]['additional_attendee_reg_info'])
1062
+										&& absint($valid_data[ $reg_url_link ]['additional_attendee_reg_info']) === 0;
1063
+						// filter form input data for this registration
1064
+						$valid_data[ $reg_url_link ] = (array) apply_filters(
1065
+							'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item',
1066
+							$valid_data[ $reg_url_link ]
1067
+						);
1068
+						if (isset($valid_data['primary_attendee'])) {
1069
+							$primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee'])
1070
+								? $valid_data['primary_attendee']
1071
+								: false;
1072
+							unset($valid_data['primary_attendee']);
1073
+						}
1074
+						// now loop through our array of valid post data && process attendee reg forms
1075
+						foreach ($valid_data[ $reg_url_link ] as $form_section => $form_inputs) {
1076
+							if (! in_array($form_section, $non_input_form_sections, true)) {
1077
+								foreach ($form_inputs as $form_input => $input_value) {
1078
+									// check for critical inputs
1079
+									if (
1080
+										! $this->_verify_critical_attendee_details_are_set_and_validate_email(
1081
+											$form_input,
1082
+											$input_value
1083
+										)
1084
+									) {
1085
+										return false;
1086
+									}
1087
+									// store a bit of data about the primary attendee
1088
+									if (
1089
+										$att_nmbr === 1
1090
+										&& ! empty($input_value)
1091
+										&& $reg_url_link === $primary_registrant['line_item_id']
1092
+									) {
1093
+										$primary_registrant[ $form_input ] = $input_value;
1094
+									} elseif (
1095
+										$copy_primary
1096
+											  && $input_value === null
1097
+											  && isset($primary_registrant[ $form_input ])
1098
+									) {
1099
+										$input_value = $primary_registrant[ $form_input ];
1100
+									}
1101
+									// now attempt to save the input data
1102
+									if (
1103
+										! $this->_save_registration_form_input(
1104
+											$registration,
1105
+											$form_input,
1106
+											$input_value
1107
+										)
1108
+									) {
1109
+										EE_Error::add_error(
1110
+											sprintf(
1111
+												esc_html_x(
1112
+													'Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"',
1113
+													'Unable to save registration form data for the form input: "form input name" with the submitted value: "form input value"',
1114
+													'event_espresso'
1115
+												),
1116
+												$form_input,
1117
+												$input_value
1118
+											),
1119
+											__FILE__,
1120
+											__FUNCTION__,
1121
+											__LINE__
1122
+										);
1123
+										return false;
1124
+									}
1125
+								}
1126
+							}
1127
+						}  // end of foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs )
1128
+					}
1129
+					// this registration does not require additional attendee information ?
1130
+					if (
1131
+						$copy_primary
1132
+						&& $att_nmbr > 1
1133
+						&& $this->checkout->primary_attendee_obj instanceof EE_Attendee
1134
+					) {
1135
+						// just copy the primary registrant
1136
+						$attendee = $this->checkout->primary_attendee_obj;
1137
+					} else {
1138
+						// ensure critical details are set for additional attendees
1139
+						$this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1
1140
+							? $this->_copy_critical_attendee_details_from_primary_registrant(
1141
+								$this->_attendee_data[ $reg_url_link ]
1142
+							)
1143
+							: $this->_attendee_data[ $reg_url_link ];
1144
+						// execute create attendee command (which may return an existing attendee)
1145
+						$attendee = EE_Registry::instance()->BUS->execute(
1146
+							new CreateAttendeeCommand(
1147
+								$this->_attendee_data[ $reg_url_link ],
1148
+								$registration
1149
+							)
1150
+						);
1151
+						// who's #1 ?
1152
+						if ($att_nmbr === 1) {
1153
+							$this->checkout->primary_attendee_obj = $attendee;
1154
+						}
1155
+					}
1156
+					// add relation to registration, set attendee ID, and cache attendee
1157
+					$this->_associate_attendee_with_registration($registration, $attendee);
1158
+					if (! $registration->attendee() instanceof EE_Attendee) {
1159
+						EE_Error::add_error(
1160
+							sprintf(
1161
+								esc_html_x(
1162
+									'Registration %s has an invalid or missing Attendee object.',
1163
+									'Registration 123-456-789 has an invalid or missing Attendee object.',
1164
+									'event_espresso'
1165
+								),
1166
+								$reg_url_link
1167
+							),
1168
+							__FILE__,
1169
+							__FUNCTION__,
1170
+							__LINE__
1171
+						);
1172
+						return false;
1173
+					}
1174
+					/** @type EE_Registration_Processor $registration_processor */
1175
+					$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1176
+					// at this point, we should have enough details about the registrant to consider the registration
1177
+					// NOT incomplete
1178
+					$registration_processor->toggle_incomplete_registration_status_to_default(
1179
+						$registration,
1180
+						false,
1181
+						new Context(
1182
+							'spco_reg_step_attendee_information_process_registrations',
1183
+							esc_html__(
1184
+								'Finished populating registration with details from the registration form after submitting the Attendee Information Reg Step.',
1185
+								'event_espresso'
1186
+							)
1187
+						)
1188
+					);
1189
+					// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to
1190
+					// abandoned
1191
+					$this->checkout->transaction->toggle_failed_transaction_status();
1192
+					// if we've gotten this far, then let's save what we have
1193
+					$registration->save();
1194
+					// add relation between TXN and registration
1195
+					$this->_associate_registration_with_transaction($registration);
1196
+				}
1197
+			} else {
1198
+				EE_Error::add_error(
1199
+					esc_html__(
1200
+						'An invalid or missing line item ID was encountered while attempting to process the registration form.',
1201
+						'event_espresso'
1202
+					),
1203
+					__FILE__,
1204
+					__FUNCTION__,
1205
+					__LINE__
1206
+				);
1207
+				// remove malformed data
1208
+				unset($valid_data[ $reg_url_link ]);
1209
+				return false;
1210
+			}
1211
+		} // end of foreach ( $this->checkout->transaction->registrations()  as $registration )
1212
+		return $att_nmbr;
1213
+	}
1214
+
1215
+
1216
+	/**
1217
+	 *    _save_registration_form_input
1218
+	 *
1219
+	 * @param EE_Registration $registration
1220
+	 * @param string          $form_input
1221
+	 * @param string          $input_value
1222
+	 * @return bool
1223
+	 * @throws EE_Error
1224
+	 * @throws InvalidArgumentException
1225
+	 * @throws InvalidDataTypeException
1226
+	 * @throws InvalidInterfaceException
1227
+	 * @throws ReflectionException
1228
+	 */
1229
+	private function _save_registration_form_input(
1230
+		EE_Registration $registration,
1231
+		$form_input = '',
1232
+		$input_value = ''
1233
+	) {
1234
+		// If email_confirm is sent it's not saved
1235
+		if ((string) $form_input === 'email_confirm') {
1236
+			return true;
1237
+		}
1238
+
1239
+		// allow for plugins to hook in and do their own processing of the form input.
1240
+		// For plugins to bypass normal processing here, they just need to return a boolean value.
1241
+		if (
1242
+			apply_filters(
1243
+				'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input',
1244
+				false,
1245
+				$registration,
1246
+				$form_input,
1247
+				$input_value,
1248
+				$this
1249
+			)
1250
+		) {
1251
+			return true;
1252
+		}
1253
+		/*
1254 1254
          * $answer_cache_id is the key used to find the EE_Answer we want
1255 1255
          * @see https://events.codebasehq.com/projects/event-espresso/tickets/10477
1256 1256
          */
1257
-        $answer_cache_id = $this->checkout->reg_url_link
1258
-            ? $form_input . '-' . $registration->reg_url_link()
1259
-            : (string) $form_input;
1260
-        $answer_is_obj   = isset($this->_registration_answers[ $answer_cache_id ])
1261
-                           && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer;
1262
-        // rename form_inputs if they are EE_Attendee properties
1263
-        switch ((string) $form_input) {
1264
-            case 'state':
1265
-            case 'STA_ID':
1266
-                $attendee_property = true;
1267
-                $form_input        = 'STA_ID';
1268
-                break;
1269
-
1270
-            case 'country':
1271
-            case 'CNT_ISO':
1272
-                $attendee_property = true;
1273
-                $form_input        = 'CNT_ISO';
1274
-                break;
1275
-
1276
-            default:
1277
-                $ATT_input = 'ATT_' . $form_input;
1278
-                $attendee_property = EEM_Attendee::instance()->has_field($ATT_input);
1279
-                $form_input        = $attendee_property ? 'ATT_' . $form_input : $form_input;
1280
-        }
1281
-        // if this form input has a corresponding attendee property
1282
-        if ($attendee_property) {
1283
-            $this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value;
1284
-            if ($answer_is_obj) {
1285
-                // and delete the corresponding answer since we won't be storing this data in that object
1286
-                $registration->_remove_relation_to($this->_registration_answers[ $answer_cache_id ], 'Answer');
1287
-                $this->_registration_answers[ $answer_cache_id ]->delete_permanently();
1288
-            }
1289
-            return true;
1290
-        }
1291
-        if ($answer_is_obj) {
1292
-            // save this data to the answer object
1293
-            $this->_registration_answers[ $answer_cache_id ]->set_value($input_value);
1294
-            $result = $this->_registration_answers[ $answer_cache_id ]->save();
1295
-            return $result !== false;
1296
-        }
1297
-        foreach ($this->_registration_answers as $answer) {
1298
-            if ($answer instanceof EE_Answer && (string) $answer->question_ID() === $answer_cache_id) {
1299
-                $answer->set_value($input_value);
1300
-                $result = $answer->save();
1301
-                return $result !== false;
1302
-            }
1303
-        }
1304
-        return false;
1305
-    }
1306
-
1307
-
1308
-    /**
1309
-     *    _verify_critical_attendee_details_are_set
1310
-     *
1311
-     * @param string $form_input
1312
-     * @param string $input_value
1313
-     * @return boolean
1314
-     */
1315
-    private function _verify_critical_attendee_details_are_set_and_validate_email(
1316
-        $form_input = '',
1317
-        $input_value = ''
1318
-    ) {
1319
-        if (empty($input_value)) {
1320
-            // if the form input isn't marked as being required, then just return
1321
-            if (! isset($this->_required_questions[ $form_input ]) || ! $this->_required_questions[ $form_input ]) {
1322
-                return true;
1323
-            }
1324
-            switch ($form_input) {
1325
-                case 'fname':
1326
-                    EE_Error::add_error(
1327
-                        esc_html__('First Name is a required value.', 'event_espresso'),
1328
-                        __FILE__,
1329
-                        __FUNCTION__,
1330
-                        __LINE__
1331
-                    );
1332
-                    return false;
1333
-                case 'lname':
1334
-                    EE_Error::add_error(
1335
-                        esc_html__('Last Name is a required value.', 'event_espresso'),
1336
-                        __FILE__,
1337
-                        __FUNCTION__,
1338
-                        __LINE__
1339
-                    );
1340
-                    return false;
1341
-                case 'email':
1342
-                    EE_Error::add_error(
1343
-                        esc_html__('Please enter a valid email address.', 'event_espresso'),
1344
-                        __FILE__,
1345
-                        __FUNCTION__,
1346
-                        __LINE__
1347
-                    );
1348
-                    return false;
1349
-            }
1350
-        }
1351
-        return true;
1352
-    }
1353
-
1354
-
1355
-    /**
1356
-     *    _associate_attendee_with_registration
1357
-     *
1358
-     * @param EE_Registration $registration
1359
-     * @param EE_Attendee     $attendee
1360
-     * @return void
1361
-     * @throws EE_Error
1362
-     * @throws InvalidArgumentException
1363
-     * @throws ReflectionException
1364
-     * @throws RuntimeException
1365
-     * @throws InvalidDataTypeException
1366
-     * @throws InvalidInterfaceException
1367
-     */
1368
-    private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee)
1369
-    {
1370
-        // add relation to attendee
1371
-        $registration->_add_relation_to($attendee, 'Attendee');
1372
-        $registration->set_attendee_id($attendee->ID());
1373
-        $registration->update_cache_after_object_save('Attendee', $attendee);
1374
-    }
1375
-
1376
-
1377
-    /**
1378
-     *    _associate_registration_with_transaction
1379
-     *
1380
-     * @param EE_Registration $registration
1381
-     * @return void
1382
-     * @throws EE_Error
1383
-     * @throws InvalidArgumentException
1384
-     * @throws ReflectionException
1385
-     * @throws InvalidDataTypeException
1386
-     * @throws InvalidInterfaceException
1387
-     */
1388
-    private function _associate_registration_with_transaction(EE_Registration $registration)
1389
-    {
1390
-        // add relation to registration
1391
-        $this->checkout->transaction->_add_relation_to($registration, 'Registration');
1392
-        $this->checkout->transaction->update_cache_after_object_save('Registration', $registration);
1393
-    }
1394
-
1395
-
1396
-    /**
1397
-     *    _copy_critical_attendee_details_from_primary_registrant
1398
-     *    ensures that all attendees at least have data for first name, last name, and email address
1399
-     *
1400
-     * @param array $attendee_data
1401
-     * @return array
1402
-     * @throws EE_Error
1403
-     * @throws InvalidArgumentException
1404
-     * @throws ReflectionException
1405
-     * @throws InvalidDataTypeException
1406
-     * @throws InvalidInterfaceException
1407
-     */
1408
-    private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = [])
1409
-    {
1410
-        // bare minimum critical details include first name, last name, email address
1411
-        $critical_attendee_details = ['ATT_fname', 'ATT_lname', 'ATT_email'];
1412
-        // add address info to critical details?
1413
-        if (
1414
-            apply_filters(
1415
-                'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details',
1416
-                false
1417
-            )
1418
-        ) {
1419
-            $address_details           = [
1420
-                'ATT_address',
1421
-                'ATT_address2',
1422
-                'ATT_city',
1423
-                'STA_ID',
1424
-                'CNT_ISO',
1425
-                'ATT_zip',
1426
-                'ATT_phone',
1427
-            ];
1428
-            $critical_attendee_details = array_merge($critical_attendee_details, $address_details);
1429
-        }
1430
-        foreach ($critical_attendee_details as $critical_attendee_detail) {
1431
-            if (
1432
-                ! isset($attendee_data[ $critical_attendee_detail ])
1433
-                || empty($attendee_data[ $critical_attendee_detail ])
1434
-            ) {
1435
-                $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get(
1436
-                    $critical_attendee_detail
1437
-                );
1438
-            }
1439
-        }
1440
-        return $attendee_data;
1441
-    }
1442
-
1443
-
1444
-    /**
1445
-     *    update_reg_step
1446
-     *    this is the final step after a user  revisits the site to edit their attendee information
1447
-     *    this gets called AFTER the process_reg_step() method above
1448
-     *
1449
-     * @return bool
1450
-     * @throws EE_Error
1451
-     * @throws InvalidArgumentException
1452
-     * @throws ReflectionException
1453
-     * @throws RuntimeException
1454
-     * @throws InvalidDataTypeException
1455
-     * @throws InvalidInterfaceException
1456
-     */
1457
-    public function update_reg_step()
1458
-    {
1459
-        // save everything
1460
-        if ($this->process_reg_step()) {
1461
-            $this->checkout->redirect     = true;
1462
-            $this->checkout->redirect_url = add_query_arg(
1463
-                [
1464
-                    'e_reg_url_link' => $this->checkout->reg_url_link,
1465
-                    'revisit'        => true,
1466
-                ],
1467
-                $this->checkout->thank_you_page_url
1468
-            );
1469
-            $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1470
-            return true;
1471
-        }
1472
-        return false;
1473
-    }
1257
+		$answer_cache_id = $this->checkout->reg_url_link
1258
+			? $form_input . '-' . $registration->reg_url_link()
1259
+			: (string) $form_input;
1260
+		$answer_is_obj   = isset($this->_registration_answers[ $answer_cache_id ])
1261
+						   && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer;
1262
+		// rename form_inputs if they are EE_Attendee properties
1263
+		switch ((string) $form_input) {
1264
+			case 'state':
1265
+			case 'STA_ID':
1266
+				$attendee_property = true;
1267
+				$form_input        = 'STA_ID';
1268
+				break;
1269
+
1270
+			case 'country':
1271
+			case 'CNT_ISO':
1272
+				$attendee_property = true;
1273
+				$form_input        = 'CNT_ISO';
1274
+				break;
1275
+
1276
+			default:
1277
+				$ATT_input = 'ATT_' . $form_input;
1278
+				$attendee_property = EEM_Attendee::instance()->has_field($ATT_input);
1279
+				$form_input        = $attendee_property ? 'ATT_' . $form_input : $form_input;
1280
+		}
1281
+		// if this form input has a corresponding attendee property
1282
+		if ($attendee_property) {
1283
+			$this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value;
1284
+			if ($answer_is_obj) {
1285
+				// and delete the corresponding answer since we won't be storing this data in that object
1286
+				$registration->_remove_relation_to($this->_registration_answers[ $answer_cache_id ], 'Answer');
1287
+				$this->_registration_answers[ $answer_cache_id ]->delete_permanently();
1288
+			}
1289
+			return true;
1290
+		}
1291
+		if ($answer_is_obj) {
1292
+			// save this data to the answer object
1293
+			$this->_registration_answers[ $answer_cache_id ]->set_value($input_value);
1294
+			$result = $this->_registration_answers[ $answer_cache_id ]->save();
1295
+			return $result !== false;
1296
+		}
1297
+		foreach ($this->_registration_answers as $answer) {
1298
+			if ($answer instanceof EE_Answer && (string) $answer->question_ID() === $answer_cache_id) {
1299
+				$answer->set_value($input_value);
1300
+				$result = $answer->save();
1301
+				return $result !== false;
1302
+			}
1303
+		}
1304
+		return false;
1305
+	}
1306
+
1307
+
1308
+	/**
1309
+	 *    _verify_critical_attendee_details_are_set
1310
+	 *
1311
+	 * @param string $form_input
1312
+	 * @param string $input_value
1313
+	 * @return boolean
1314
+	 */
1315
+	private function _verify_critical_attendee_details_are_set_and_validate_email(
1316
+		$form_input = '',
1317
+		$input_value = ''
1318
+	) {
1319
+		if (empty($input_value)) {
1320
+			// if the form input isn't marked as being required, then just return
1321
+			if (! isset($this->_required_questions[ $form_input ]) || ! $this->_required_questions[ $form_input ]) {
1322
+				return true;
1323
+			}
1324
+			switch ($form_input) {
1325
+				case 'fname':
1326
+					EE_Error::add_error(
1327
+						esc_html__('First Name is a required value.', 'event_espresso'),
1328
+						__FILE__,
1329
+						__FUNCTION__,
1330
+						__LINE__
1331
+					);
1332
+					return false;
1333
+				case 'lname':
1334
+					EE_Error::add_error(
1335
+						esc_html__('Last Name is a required value.', 'event_espresso'),
1336
+						__FILE__,
1337
+						__FUNCTION__,
1338
+						__LINE__
1339
+					);
1340
+					return false;
1341
+				case 'email':
1342
+					EE_Error::add_error(
1343
+						esc_html__('Please enter a valid email address.', 'event_espresso'),
1344
+						__FILE__,
1345
+						__FUNCTION__,
1346
+						__LINE__
1347
+					);
1348
+					return false;
1349
+			}
1350
+		}
1351
+		return true;
1352
+	}
1353
+
1354
+
1355
+	/**
1356
+	 *    _associate_attendee_with_registration
1357
+	 *
1358
+	 * @param EE_Registration $registration
1359
+	 * @param EE_Attendee     $attendee
1360
+	 * @return void
1361
+	 * @throws EE_Error
1362
+	 * @throws InvalidArgumentException
1363
+	 * @throws ReflectionException
1364
+	 * @throws RuntimeException
1365
+	 * @throws InvalidDataTypeException
1366
+	 * @throws InvalidInterfaceException
1367
+	 */
1368
+	private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee)
1369
+	{
1370
+		// add relation to attendee
1371
+		$registration->_add_relation_to($attendee, 'Attendee');
1372
+		$registration->set_attendee_id($attendee->ID());
1373
+		$registration->update_cache_after_object_save('Attendee', $attendee);
1374
+	}
1375
+
1376
+
1377
+	/**
1378
+	 *    _associate_registration_with_transaction
1379
+	 *
1380
+	 * @param EE_Registration $registration
1381
+	 * @return void
1382
+	 * @throws EE_Error
1383
+	 * @throws InvalidArgumentException
1384
+	 * @throws ReflectionException
1385
+	 * @throws InvalidDataTypeException
1386
+	 * @throws InvalidInterfaceException
1387
+	 */
1388
+	private function _associate_registration_with_transaction(EE_Registration $registration)
1389
+	{
1390
+		// add relation to registration
1391
+		$this->checkout->transaction->_add_relation_to($registration, 'Registration');
1392
+		$this->checkout->transaction->update_cache_after_object_save('Registration', $registration);
1393
+	}
1394
+
1395
+
1396
+	/**
1397
+	 *    _copy_critical_attendee_details_from_primary_registrant
1398
+	 *    ensures that all attendees at least have data for first name, last name, and email address
1399
+	 *
1400
+	 * @param array $attendee_data
1401
+	 * @return array
1402
+	 * @throws EE_Error
1403
+	 * @throws InvalidArgumentException
1404
+	 * @throws ReflectionException
1405
+	 * @throws InvalidDataTypeException
1406
+	 * @throws InvalidInterfaceException
1407
+	 */
1408
+	private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = [])
1409
+	{
1410
+		// bare minimum critical details include first name, last name, email address
1411
+		$critical_attendee_details = ['ATT_fname', 'ATT_lname', 'ATT_email'];
1412
+		// add address info to critical details?
1413
+		if (
1414
+			apply_filters(
1415
+				'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details',
1416
+				false
1417
+			)
1418
+		) {
1419
+			$address_details           = [
1420
+				'ATT_address',
1421
+				'ATT_address2',
1422
+				'ATT_city',
1423
+				'STA_ID',
1424
+				'CNT_ISO',
1425
+				'ATT_zip',
1426
+				'ATT_phone',
1427
+			];
1428
+			$critical_attendee_details = array_merge($critical_attendee_details, $address_details);
1429
+		}
1430
+		foreach ($critical_attendee_details as $critical_attendee_detail) {
1431
+			if (
1432
+				! isset($attendee_data[ $critical_attendee_detail ])
1433
+				|| empty($attendee_data[ $critical_attendee_detail ])
1434
+			) {
1435
+				$attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get(
1436
+					$critical_attendee_detail
1437
+				);
1438
+			}
1439
+		}
1440
+		return $attendee_data;
1441
+	}
1442
+
1443
+
1444
+	/**
1445
+	 *    update_reg_step
1446
+	 *    this is the final step after a user  revisits the site to edit their attendee information
1447
+	 *    this gets called AFTER the process_reg_step() method above
1448
+	 *
1449
+	 * @return bool
1450
+	 * @throws EE_Error
1451
+	 * @throws InvalidArgumentException
1452
+	 * @throws ReflectionException
1453
+	 * @throws RuntimeException
1454
+	 * @throws InvalidDataTypeException
1455
+	 * @throws InvalidInterfaceException
1456
+	 */
1457
+	public function update_reg_step()
1458
+	{
1459
+		// save everything
1460
+		if ($this->process_reg_step()) {
1461
+			$this->checkout->redirect     = true;
1462
+			$this->checkout->redirect_url = add_query_arg(
1463
+				[
1464
+					'e_reg_url_link' => $this->checkout->reg_url_link,
1465
+					'revisit'        => true,
1466
+				],
1467
+				$this->checkout->thank_you_page_url
1468
+			);
1469
+			$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1470
+			return true;
1471
+		}
1472
+		return false;
1473
+	}
1474 1474
 }
Please login to merge, or discard this patch.
reg_steps/payment_options/no_payment_required.template.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -3,36 +3,36 @@
 block discarded – undo
3 3
 /** @type array $registrations_for_free_events */
4 4
 
5 5
 if (is_array($registrations_for_free_events) && ! empty($registrations_for_free_events)) {
6
-    echo apply_filters(
7
-        'FHEE__registration_page_payment_options__no_payment_required_hdr',
8
-        sprintf(
9
-            esc_html__('%1$sNo Payment Required%2$s', 'event_espresso'),
10
-            '<h6>',
11
-            '</h6>'
12
-        )
13
-    );
14
-    foreach ($registrations_for_free_events as $registration_for_free_event) {
15
-        if (
16
-            $registration_for_free_event instanceof EE_Registration
17
-            && $registration_for_free_event->ticket()->is_free()
18
-        ) {
19
-            if ($registration_for_free_event->event() instanceof EE_Event) {
20
-                ?>
6
+	echo apply_filters(
7
+		'FHEE__registration_page_payment_options__no_payment_required_hdr',
8
+		sprintf(
9
+			esc_html__('%1$sNo Payment Required%2$s', 'event_espresso'),
10
+			'<h6>',
11
+			'</h6>'
12
+		)
13
+	);
14
+	foreach ($registrations_for_free_events as $registration_for_free_event) {
15
+		if (
16
+			$registration_for_free_event instanceof EE_Registration
17
+			&& $registration_for_free_event->ticket()->is_free()
18
+		) {
19
+			if ($registration_for_free_event->event() instanceof EE_Event) {
20
+				?>
21 21
                 <p>
22 22
                     <?php echo apply_filters(
23
-                        'FHEE__registration_page_payment_options__no_payment_required_pg',
24
-                        sprintf(
25
-                            esc_html__(
26
-                                '"%1$s" for "%2$s" is free, so no payment is required and no billing will occur.',
27
-                                'event_espresso'
28
-                            ),
29
-                            $registration_for_free_event->ticket()->name(),
30
-                            $registration_for_free_event->event()->name()
31
-                        )
32
-                    ); ?>
23
+						'FHEE__registration_page_payment_options__no_payment_required_pg',
24
+						sprintf(
25
+							esc_html__(
26
+								'"%1$s" for "%2$s" is free, so no payment is required and no billing will occur.',
27
+								'event_espresso'
28
+							),
29
+							$registration_for_free_event->ticket()->name(),
30
+							$registration_for_free_event->event()->name()
31
+						)
32
+					); ?>
33 33
                 </p>
34 34
                 <?php
35
-            }
36
-        }
37
-    }
35
+			}
36
+		}
37
+	}
38 38
 }
Please login to merge, or discard this patch.
modules/ticket_selector/templates/standard_ticket_selector.template.php 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -34,48 +34,48 @@  discard block
 block discarded – undo
34 34
         <tr>
35 35
             <th id="details-<?php echo esc_attr($EVT_ID); ?>" scope="col" class="ee-ticket-selector-ticket-details-th">
36 36
                 <?php
37
-                echo apply_filters(
38
-                    'FHEE__ticket_selector_chart_template__table_header_available_tickets',
39
-                    esc_html__('Details', 'event_espresso'),
40
-                    $EVT_ID
41
-                );
42
-                ?>
37
+				echo apply_filters(
38
+					'FHEE__ticket_selector_chart_template__table_header_available_tickets',
39
+					esc_html__('Details', 'event_espresso'),
40
+					$EVT_ID
41
+				);
42
+				?>
43 43
             </th>
44 44
             <?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) { ?>
45 45
                 <th id="price-<?php echo esc_attr($EVT_ID); ?>" scope="col" class="ee-ticket-selector-ticket-price-th cntr">
46 46
                     <?php
47
-                    /**
48
-                     * Filters the text printed for the header of the price column in the ticket selector table
49
-                     *
50
-                     * @since 4.7.2
51
-                     *
52
-                     * @param string 'Price' The translatable text to display in the table header for price
53
-                     * @param int $EVT_ID The Event ID
54
-                     */
55
-                    echo apply_filters(
56
-                        'FHEE__ticket_selector_chart_template__table_header_price',
57
-                        esc_html__('Price', 'event_espresso'),
58
-                        $EVT_ID
59
-                    );
60
-                    ?>
47
+					/**
48
+					 * Filters the text printed for the header of the price column in the ticket selector table
49
+					 *
50
+					 * @since 4.7.2
51
+					 *
52
+					 * @param string 'Price' The translatable text to display in the table header for price
53
+					 * @param int $EVT_ID The Event ID
54
+					 */
55
+					echo apply_filters(
56
+						'FHEE__ticket_selector_chart_template__table_header_price',
57
+						esc_html__('Price', 'event_espresso'),
58
+						$EVT_ID
59
+					);
60
+					?>
61 61
                 </th>
62 62
             <?php } ?>
63 63
             <th id="quantity-<?php echo esc_attr($EVT_ID); ?>" scope="col" class="ee-ticket-selector-ticket-qty-th cntr">
64 64
                 <?php
65
-                /**
66
-                 * Filters the text printed for the header of the quantity column in the ticket selector table
67
-                 *
68
-                 * @since 4.7.2
69
-                 *
70
-                 * @param string 'Qty' The translatable text to display in the table header for the Quantity of tickets
71
-                 * @param int $EVT_ID The Event ID
72
-                 */
73
-                echo apply_filters(
74
-                    'FHEE__ticket_selector_chart_template__table_header_qty',
75
-                    esc_html__('Qty', 'event_espresso'),
76
-                    $EVT_ID
77
-                );
78
-                ?>
65
+				/**
66
+				 * Filters the text printed for the header of the quantity column in the ticket selector table
67
+				 *
68
+				 * @since 4.7.2
69
+				 *
70
+				 * @param string 'Qty' The translatable text to display in the table header for the Quantity of tickets
71
+				 * @param int $EVT_ID The Event ID
72
+				 */
73
+				echo apply_filters(
74
+					'FHEE__ticket_selector_chart_template__table_header_qty',
75
+					esc_html__('Qty', 'event_espresso'),
76
+					$EVT_ID
77
+				);
78
+				?>
79 79
             </th>
80 80
         </tr>
81 81
         </thead>
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
     </table>
86 86
 <?php
87 87
 if ($taxable_tickets && apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) {
88
-    if ($prices_displayed_including_taxes) {
89
-        $ticket_price_includes_taxes = esc_html__('* price includes taxes', 'event_espresso');
90
-    } else {
91
-        $ticket_price_includes_taxes = esc_html__('* price does not include taxes', 'event_espresso');
92
-    }
93
-    echo '<p class="small-text lt-grey-text" style="text-align:right; margin: -1em 0 1em;">
88
+	if ($prices_displayed_including_taxes) {
89
+		$ticket_price_includes_taxes = esc_html__('* price includes taxes', 'event_espresso');
90
+	} else {
91
+		$ticket_price_includes_taxes = esc_html__('* price does not include taxes', 'event_espresso');
92
+	}
93
+	echo '<p class="small-text lt-grey-text" style="text-align:right; margin: -1em 0 1em;">
94 94
         ' . $ticket_price_includes_taxes . '
95 95
         </p>';
96 96
 }
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
 
101 101
 <?php
102 102
 if ($max_atndz > 0) {
103
-    echo apply_filters(
104
-        'FHEE__ticket_selector_chart_template__maximum_tickets_purchased_footnote',
105
-        esc_html('')
106
-    );
103
+	echo apply_filters(
104
+		'FHEE__ticket_selector_chart_template__maximum_tickets_purchased_footnote',
105
+		esc_html('')
106
+	);
107 107
 }
108 108
 if (! apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) {
109
-    add_filter('FHEE__EE_Ticket_Selector__no_ticket_selector_submit', '__return_true');
109
+	add_filter('FHEE__EE_Ticket_Selector__no_ticket_selector_submit', '__return_true');
110 110
 }
111 111
 do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event);
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         $ticket_price_includes_taxes = esc_html__('* price does not include taxes', 'event_espresso');
92 92
     }
93 93
     echo '<p class="small-text lt-grey-text" style="text-align:right; margin: -1em 0 1em;">
94
-        ' . $ticket_price_includes_taxes . '
94
+        ' . $ticket_price_includes_taxes.'
95 95
         </p>';
96 96
 }
97 97
 ?>
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         esc_html('')
106 106
     );
107 107
 }
108
-if (! apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) {
108
+if ( ! apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) {
109 109
     add_filter('FHEE__EE_Ticket_Selector__no_ticket_selector_submit', '__return_true');
110 110
 }
111 111
 do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event);
Please login to merge, or discard this patch.
modules/ticket_selector/templates/simple_ticket_selector.template.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
     />
19 19
 <?php
20 20
 if ($ticket instanceof EE_Ticket) {
21
-    do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event);
22
-    $ticket_description .= ! empty($ticket_description)
23
-        ? '<br />' . $ticket_status_display
24
-        : $ticket_status_display;
25
-    if (strpos($ticket_description, '<div') === false) {
26
-        $ticket_description = "<p>{$ticket_description}</p>";
27
-    }
28
-    ?>
21
+	do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event);
22
+	$ticket_description .= ! empty($ticket_description)
23
+		? '<br />' . $ticket_status_display
24
+		: $ticket_status_display;
25
+	if (strpos($ticket_description, '<div') === false) {
26
+		$ticket_description = "<p>{$ticket_description}</p>";
27
+	}
28
+	?>
29 29
 <div id="no-tkt-slctr-ticket-dv-<?php echo esc_attr($EVT_ID); ?>" class="no-tkt-slctr-ticket-dv">
30 30
     <div class="no-tkt-slctr-ticket-content-dv">
31 31
         <h5><?php echo esc_html($ticket->name()); ?></h5>
@@ -34,5 +34,5 @@  discard block
 block discarded – undo
34 34
         <?php } ?>
35 35
     </div><!-- .no-tkt-slctr-ticket-content-dv -->
36 36
     <?php
37
-    do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event);
37
+	do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event);
38 38
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 if ($ticket instanceof EE_Ticket) {
28 28
     do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event);
29 29
     $ticket_description .= ! empty($ticket_description)
30
-        ? '<br />' . $ticket_status_display
30
+        ? '<br />'.$ticket_status_display
31 31
         : $ticket_status_display;
32 32
     if (strpos($ticket_description, '<div') === false) {
33 33
         $ticket_description = "<p>{$ticket_description}</p>";
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 <div id="no-tkt-slctr-ticket-dv-<?php echo esc_attr($EVT_ID); ?>" class="no-tkt-slctr-ticket-dv">
37 37
     <div class="no-tkt-slctr-ticket-content-dv">
38 38
         <h5><?php echo esc_html($ticket->name()); ?></h5>
39
-        <?php if (! empty($ticket_description)) { ?>
39
+        <?php if ( ! empty($ticket_description)) { ?>
40 40
             <?php echo wp_kses($ticket_description, AllowedTags::getAllowedTags()); ?>
41 41
         <?php } ?>
42 42
     </div><!-- .no-tkt-slctr-ticket-content-dv -->
Please login to merge, or discard this patch.
libraries/messages/defaults/default/html_receipt_attendee_list.template.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@
 block discarded – undo
8 8
 <li class="ticket-registration">
9 9
     <table class="registration-details">
10 10
         <tr class="odd">
11
-            <th><?php	_e('Attendee', 'event_espresso');?></th>
11
+            <th><?php	_e('Attendee', 'event_espresso'); ?></th>
12 12
             <td>[FNAME] [LNAME] ([ATTENDEE_EMAIL])</td>
13 13
         </tr>
14 14
         <tr>
15
-            <th><?php esc_html_e("Registration Code:", "event_espresso");?></th>
15
+            <th><?php esc_html_e("Registration Code:", "event_espresso"); ?></th>
16 16
             <td>[REGISTRATION_CODE] - <span class="[REGISTRATION_STATUS_ID]">[REGISTRATION_STATUS_LABEL]</span></td>
17 17
         </tr>
18 18
         <tr>
Please login to merge, or discard this patch.
payment_methods/Paypal_Pro/templates/paypal_pro_debug_info.template.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -17,39 +17,39 @@  discard block
 block discarded – undo
17 17
     <div class="sandbox-panel">
18 18
     <h2 class="section-title"><?php esc_html_e('PayPal Sandbox Mode', 'event_espresso'); ?></h2>
19 19
     <h3 style="color:#ff0000;"><?php
20
-        esc_html_e(
21
-            'Debug Mode Is Turned On. Payments will not be processed',
22
-            'event_espresso'
23
-        ); ?></h3>
20
+		esc_html_e(
21
+			'Debug Mode Is Turned On. Payments will not be processed',
22
+			'event_espresso'
23
+		); ?></h3>
24 24
 
25 25
     <p class="test-credit-cards-info-pg" style="margin-bottom:0;">
26 26
         <strong><?php esc_html_e('Testing Guidelines', 'event_espresso'); ?></strong>
27 27
     </p>
28 28
     <ul style="margin:1em 2em 1.5em; line-height:1.2em;">
29 29
         <li><?php
30
-            esc_html_e(
31
-                'While testing, use the credit card number associated with your sandbox account.',
32
-                'event_espresso'
33
-            ); ?></li>
30
+			esc_html_e(
31
+				'While testing, use the credit card number associated with your sandbox account.',
32
+				'event_espresso'
33
+			); ?></li>
34 34
         <li><?php
35
-            printf(
36
-                esc_html__(
37
-                    'To find the sandbox account\'s credit card, go to %1$s, then "Dashboard", then under Sandbox click "Accounts", then click your account and click "Profile", then in the popup that appears click on the "Funding" tab. Your testing card is listed there.',
38
-                    'event_espresso'
39
-                ),
40
-                '<a href="http://developer.paypal.com">developer.paypal.com</a>'
41
-            ); ?></li>
35
+			printf(
36
+				esc_html__(
37
+					'To find the sandbox account\'s credit card, go to %1$s, then "Dashboard", then under Sandbox click "Accounts", then click your account and click "Profile", then in the popup that appears click on the "Funding" tab. Your testing card is listed there.',
38
+					'event_espresso'
39
+				),
40
+				'<a href="http://developer.paypal.com">developer.paypal.com</a>'
41
+			); ?></li>
42 42
         <li><?php
43
-            esc_html_e('CVV2 should be 115', 'event_espresso'); ?></li>
43
+			esc_html_e('CVV2 should be 115', 'event_espresso'); ?></li>
44 44
     </ul>
45 45
 
46 46
     <p class="test-credit-cards-info-pg">
47 47
         <strong><?php esc_html_e('Credit Card Numbers Used for Testing', 'event_espresso'); ?></strong><br/>
48 48
         <span class="small-text"><?php
49
-            esc_html_e(
50
-                'Use the following credit card numbers for testing. Any other card number produces a general failure.',
51
-                'event_espresso'
52
-            ); ?></span>
49
+			esc_html_e(
50
+				'Use the following credit card numbers for testing. Any other card number produces a general failure.',
51
+				'event_espresso'
52
+			); ?></span>
53 53
     </p>
54 54
 
55 55
     <div class="tbl-wrap">
@@ -73,18 +73,18 @@  discard block
 block discarded – undo
73 73
     <p class="test-credit-cards-info-pg">
74 74
         <strong><?php esc_html_e('Testing Result Code Responses', 'event_espresso'); ?></strong><br/>
75 75
         <span class="small-text"><?php
76
-            printf(
77
-                esc_html__(
78
-                    'You can use the amount of the transaction to generate a particular result code (see %s PayPal\'s documentation%s). The table below lists the general guidelines for specifying amounts. IMPORTANT: before you attempt any of these, ensure your sandbox PayPal account has %s "Negative Testing" set to on%s. Also be aware that you can generate AVS errors by using certain strings in your address field, and CVV errors using certain CVV values. See %s this PayPal doc %s',
79
-                    'event_espresso'
80
-                ),
81
-                "<a href='https://developer.paypal.com/docs/classic/api/errorcodes/#id09C3GA00GR1' target='_blank'>",
82
-                "</a>",
83
-                "<a href='https://docs.google.com/a/eventespresso.com/file/d/0B5P8GXTvZgfMNXNkZ2s5VUlHTUk/edit?usp=drivesdk' target='_blank'>",
84
-                "</a>",
85
-                "<a href='https://cms.paypal.com/ca/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_testing_SBTestErrorConditions' target='_blank'>",
86
-                "</a>"
87
-            ); ?></span>
76
+			printf(
77
+				esc_html__(
78
+					'You can use the amount of the transaction to generate a particular result code (see %s PayPal\'s documentation%s). The table below lists the general guidelines for specifying amounts. IMPORTANT: before you attempt any of these, ensure your sandbox PayPal account has %s "Negative Testing" set to on%s. Also be aware that you can generate AVS errors by using certain strings in your address field, and CVV errors using certain CVV values. See %s this PayPal doc %s',
79
+					'event_espresso'
80
+				),
81
+				"<a href='https://developer.paypal.com/docs/classic/api/errorcodes/#id09C3GA00GR1' target='_blank'>",
82
+				"</a>",
83
+				"<a href='https://docs.google.com/a/eventespresso.com/file/d/0B5P8GXTvZgfMNXNkZ2s5VUlHTUk/edit?usp=drivesdk' target='_blank'>",
84
+				"</a>",
85
+				"<a href='https://cms.paypal.com/ca/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_testing_SBTestErrorConditions' target='_blank'>",
86
+				"</a>"
87
+			); ?></span>
88 88
     </p>
89 89
 
90 90
     <div class="tbl-wrap">
Please login to merge, or discard this patch.
payment_methods/Aim/templates/authorize_net_aim_debug_info.template.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@
 block discarded – undo
18 18
 
19 19
         <p>
20 20
             <?php esc_html_e(
21
-                'Test Mode allows you to submit test transactions to the payment gateway. Transactions that are submitted while Test Mode is ON are NOT actually processed. The result of a transaction depends on the card number submitted, and the invoice amount. If you want a transaction to be approved, use one of the following card numbers.',
22
-                'event_espresso'
23
-            ); ?>
21
+				'Test Mode allows you to submit test transactions to the payment gateway. Transactions that are submitted while Test Mode is ON are NOT actually processed. The result of a transaction depends on the card number submitted, and the invoice amount. If you want a transaction to be approved, use one of the following card numbers.',
22
+				'event_espresso'
23
+			); ?>
24 24
         </p>
25 25
 
26 26
         <p>
Please login to merge, or discard this patch.
admin/new/pricing/templates/pricing_details_main_meta_box.template.php 2 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,8 +20,11 @@
 block discarded – undo
20 20
                         );
21 21
                         ?>
22 22
                     </p>
23
-                <?php else : ?>
24
-                    <?php echo EEH_Form_Fields::select_input('PRT_ID', $price_types, $price->type(), 'id="PRT_ID"'); ?>
23
+                <?php else {
24
+	: ?>
25
+                    <?php echo EEH_Form_Fields::select_input('PRT_ID', $price_types, $price->type(), 'id="PRT_ID"');
26
+}
27
+?>
25 28
                     <p class="description">
26 29
                         <?php
27 30
                             esc_html_e(
Please login to merge, or discard this patch.
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -4,40 +4,40 @@  discard block
 block discarded – undo
4 4
         <tbody>
5 5
         <tr valign="top">
6 6
             <th><label for="PRT_ID"><?php
7
-                    esc_html_e(
8
-                        'Type',
9
-                        'event_espresso'
10
-                    ); ?></label> <?php echo EEH_Template::get_help_tab_link('type_field_info'); ?></th>
7
+					esc_html_e(
8
+						'Type',
9
+						'event_espresso'
10
+					); ?></label> <?php echo EEH_Template::get_help_tab_link('type_field_info'); ?></th>
11 11
             <td>
12 12
                 <?php if ($price->type_obj() && $price->type_obj()->base_type() === 1) : ?>
13 13
                     <input type="hidden" name="PRT_ID" id="PRT_ID" value="<?php echo esc_attr($price->type()); ?>"/>
14 14
                     <p><strong><?php esc_html_e('Price', 'event_espresso'); ?></strong></p>
15 15
                     <p class="description">
16 16
                         <?php
17
-                        esc_html_e(
18
-                            'This is the default base price. Every new ticket created will start off with this base price.',
19
-                            'event_espresso'
20
-                        );
21
-                        ?>
17
+						esc_html_e(
18
+							'This is the default base price. Every new ticket created will start off with this base price.',
19
+							'event_espresso'
20
+						);
21
+						?>
22 22
                     </p>
23 23
                 <?php else : ?>
24 24
                     <?php echo EEH_Form_Fields::select_input('PRT_ID', $price_types, $price->type(), 'id="PRT_ID"'); ?>
25 25
                     <p class="description">
26 26
                         <?php
27
-                            esc_html_e(
28
-                                'Price Modifier. Default items will apply to ALL new events you create.',
29
-                                'event_espresso'
30
-                            );
31
-                        ?></p>
27
+							esc_html_e(
28
+								'Price Modifier. Default items will apply to ALL new events you create.',
29
+								'event_espresso'
30
+							);
31
+						?></p>
32 32
                 <?php endif; ?>
33 33
             </td>
34 34
         </tr>
35 35
         <tr valign="top">
36 36
             <th><label for="PRC_name"><?php
37
-                    esc_html_e(
38
-                        'Name',
39
-                        'event_espresso'
40
-                    ); ?></label> <?php echo EEH_Template::get_help_tab_link('name_field_info'); ?></th>
37
+					esc_html_e(
38
+						'Name',
39
+						'event_espresso'
40
+					); ?></label> <?php echo EEH_Template::get_help_tab_link('name_field_info'); ?></th>
41 41
             <td>
42 42
                 <input class="regular-text" type="text" id="PRC_name" name="PRC_name"
43 43
                        value="<?php $price->f('PRC_name'); ?>"/>
@@ -45,22 +45,22 @@  discard block
 block discarded – undo
45 45
         </tr>
46 46
         <tr valign="top">
47 47
             <th><label for="PRC_desc"><?php
48
-                    esc_html_e(
49
-                        'Description',
50
-                        'event_espresso'
51
-                    ); ?></label> <?php echo EEH_Template::get_help_tab_link('description_field_info'); ?></th>
48
+					esc_html_e(
49
+						'Description',
50
+						'event_espresso'
51
+					); ?></label> <?php echo EEH_Template::get_help_tab_link('description_field_info'); ?></th>
52 52
             <td>
53 53
                     <textarea class="regular-text" id="PRC_desc" name="PRC_desc" rows="5"><?php
54
-                        echo esc_textarea($price->get_f('PRC_desc'));
55
-                    ?></textarea><br/>
54
+						echo esc_textarea($price->get_f('PRC_desc'));
55
+					?></textarea><br/>
56 56
             </td>
57 57
         </tr>
58 58
         <tr valign="top">
59 59
             <th><label for="PRC_amount"><?php
60
-                    esc_html_e(
61
-                        'Amount',
62
-                        'event_espresso'
63
-                    ); ?><?php echo EEH_Template::get_help_tab_link('amount_field_info'); ?></label></th>
60
+					esc_html_e(
61
+						'Amount',
62
+						'event_espresso'
63
+					); ?><?php echo EEH_Template::get_help_tab_link('amount_field_info'); ?></label></th>
64 64
             <td>
65 65
                 <input class="small-text ee-numeric" type="text" id="PRC_amount" name="PRC_amount"
66 66
                        value="<?php echo esc_attr($price->amount()); ?>"/>
Please login to merge, or discard this patch.